Implement environment-bound exec plumbing

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-03-20 18:52:02 -07:00
co-authored by Codex
parent fc135afd78
commit 2de2b1bfbd
77 changed files with 1775 additions and 53 deletions
@@ -201,6 +201,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for this command.",
"type": [
"string",
"null"
]
},
"outputBytesCap": {
"description": "Optional per-stream stdout/stderr capture cap in bytes.\n\nWhen omitted, the server default applies. Cannot be combined with `disableOutputCap`.",
"format": "uint",
@@ -2492,6 +2499,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for the forked thread.",
"type": [
"string",
"null"
]
},
"ephemeral": {
"type": "boolean"
},
@@ -2789,6 +2803,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for the resumed thread.",
"type": [
"string",
"null"
]
},
"model": {
"description": "Configuration overrides for the resumed thread, if any.",
"type": [
@@ -2967,6 +2988,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for this thread.",
"type": [
"string",
"null"
]
},
"ephemeral": {
"type": [
"boolean",
@@ -5924,6 +5924,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for this command.",
"type": [
"string",
"null"
]
},
"outputBytesCap": {
"description": "Optional per-stream stdout/stderr capture cap in bytes.\n\nWhen omitted, the server default applies. Cannot be combined with `disableOutputCap`.",
"format": "uint",
@@ -11822,6 +11829,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for the forked thread.",
"type": [
"string",
"null"
]
},
"ephemeral": {
"type": "boolean"
},
@@ -11892,6 +11906,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -11929,6 +11946,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -13016,6 +13034,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for the resumed thread.",
"type": [
"string",
"null"
]
},
"model": {
"description": "Configuration overrides for the resumed thread, if any.",
"type": [
@@ -13093,6 +13118,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -13130,6 +13158,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -13292,6 +13321,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for this thread.",
"type": [
"string",
"null"
]
},
"ephemeral": {
"type": [
"boolean",
@@ -13374,6 +13410,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -13411,6 +13450,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -2557,6 +2557,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for this command.",
"type": [
"string",
"null"
]
},
"outputBytesCap": {
"description": "Optional per-stream stdout/stderr capture cap in bytes.\n\nWhen omitted, the server default applies. Cannot be combined with `disableOutputCap`.",
"format": "uint",
@@ -9582,6 +9589,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for the forked thread.",
"type": [
"string",
"null"
]
},
"ephemeral": {
"type": "boolean"
},
@@ -9652,6 +9666,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -9689,6 +9706,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -10776,6 +10794,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for the resumed thread.",
"type": [
"string",
"null"
]
},
"model": {
"description": "Configuration overrides for the resumed thread, if any.",
"type": [
@@ -10853,6 +10878,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -10890,6 +10918,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -11052,6 +11081,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for this thread.",
"type": [
"string",
"null"
]
},
"ephemeral": {
"type": [
"boolean",
@@ -11134,6 +11170,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -11171,6 +11210,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -238,6 +238,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for this command.",
"type": [
"string",
"null"
]
},
"outputBytesCap": {
"description": "Optional per-stream stdout/stderr capture cap in bytes.\n\nWhen omitted, the server default applies. Cannot be combined with `disableOutputCap`.",
"format": "uint",
@@ -123,6 +123,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for the forked thread.",
"type": [
"string",
"null"
]
},
"ephemeral": {
"type": "boolean"
},
@@ -2106,6 +2106,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -2143,6 +2146,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -1029,6 +1029,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for the resumed thread.",
"type": [
"string",
"null"
]
},
"model": {
"description": "Configuration overrides for the resumed thread, if any.",
"type": [
@@ -2106,6 +2106,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -2143,6 +2146,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -150,6 +150,13 @@
"null"
]
},
"environmentId": {
"description": "Optional executor environment binding for this thread.",
"type": [
"string",
"null"
]
},
"ephemeral": {
"type": [
"boolean",
@@ -2106,6 +2106,9 @@
"cwd": {
"type": "string"
},
"environmentId": {
"type": "string"
},
"model": {
"type": "string"
},
@@ -2143,6 +2146,7 @@
"approvalPolicy",
"approvalsReviewer",
"cwd",
"environmentId",
"model",
"modelProvider",
"sandbox",
@@ -12,11 +12,15 @@ import type { SandboxPolicy } from "./SandboxPolicy";
* sent only after all `command/exec/outputDelta` notifications for that
* connection have been emitted.
*/
export type CommandExecParams = {
export type CommandExecParams = {
/**
* Command argv vector. Empty arrays are rejected.
*/
command: Array<string>,
command: Array<string>,
/**
* Optional executor environment binding for this command.
*/
environmentId?: string | null,
/**
* Optional client-supplied, connection-scoped process id.
*
@@ -25,56 +29,56 @@ command: Array<string>,
* `command/exec/terminate` calls. When omitted, buffered execution gets an
* internal id that is not exposed to the client.
*/
processId?: string | null,
processId?: string | null,
/**
* Enable PTY mode.
*
* This implies `streamStdin` and `streamStdoutStderr`.
*/
tty?: boolean,
tty?: boolean,
/**
* Allow follow-up `command/exec/write` requests to write stdin bytes.
*
* Requires a client-supplied `processId`.
*/
streamStdin?: boolean,
streamStdin?: boolean,
/**
* Stream stdout/stderr via `command/exec/outputDelta` notifications.
*
* Streamed bytes are not duplicated into the final response and require a
* client-supplied `processId`.
*/
streamStdoutStderr?: boolean,
streamStdoutStderr?: boolean,
/**
* Optional per-stream stdout/stderr capture cap in bytes.
*
* When omitted, the server default applies. Cannot be combined with
* `disableOutputCap`.
*/
outputBytesCap?: number | null,
outputBytesCap?: number | null,
/**
* Disable stdout/stderr capture truncation for this request.
*
* Cannot be combined with `outputBytesCap`.
*/
disableOutputCap?: boolean,
disableOutputCap?: boolean,
/**
* Disable the timeout entirely for this request.
*
* Cannot be combined with `timeoutMs`.
*/
disableTimeout?: boolean,
disableTimeout?: boolean,
/**
* Optional timeout in milliseconds.
*
* When omitted, the server default applies. Cannot be combined with
* `disableTimeout`.
*/
timeoutMs?: number | null,
timeoutMs?: number | null,
/**
* Optional working directory. Defaults to the server cwd.
*/
cwd?: string | null,
cwd?: string | null,
/**
* Optional environment overrides merged into the server-computed
* environment.
@@ -82,12 +86,12 @@ cwd?: string | null,
* Matching names override inherited values. Set a key to `null` to unset
* an inherited variable.
*/
env?: { [key in string]?: string | null } | null,
env?: { [key in string]?: string | null } | null,
/**
* Optional initial PTY size in character cells. Only valid when `tty` is
* true.
*/
size?: CommandExecTerminalSize | null,
size?: CommandExecTerminalSize | null,
/**
* Optional sandbox policy for this command.
*
@@ -17,6 +17,9 @@ import type { SandboxMode } from "./SandboxMode";
* Prefer using thread_id whenever possible.
*/
export type ThreadForkParams = {threadId: string, /**
* Optional executor environment binding for the forked thread.
*/
environmentId?: string | null, /**
* [UNSTABLE] Specify the rollout path to fork from.
* If specified, the thread_id param will be ignored.
*/
@@ -8,7 +8,7 @@ import type { AskForApproval } from "./AskForApproval";
import type { SandboxPolicy } from "./SandboxPolicy";
import type { Thread } from "./Thread";
export type ThreadForkResponse = { thread: Thread, model: string, modelProvider: string, serviceTier: ServiceTier | null, cwd: string, approvalPolicy: AskForApproval,
export type ThreadForkResponse = { thread: Thread, environmentId: string, model: string, modelProvider: string, serviceTier: ServiceTier | null, cwd: string, approvalPolicy: AskForApproval,
/**
* Reviewer currently used for approval requests on this thread.
*/
@@ -21,6 +21,9 @@ import type { SandboxMode } from "./SandboxMode";
* Prefer using thread_id whenever possible.
*/
export type ThreadResumeParams = {threadId: string, /**
* Optional executor environment binding for the resumed thread.
*/
environmentId?: string | null, /**
* [UNSTABLE] FOR CODEX CLOUD - DO NOT USE.
* If specified, the thread will be resumed with the provided history
* instead of loaded from disk.
@@ -8,7 +8,7 @@ import type { AskForApproval } from "./AskForApproval";
import type { SandboxPolicy } from "./SandboxPolicy";
import type { Thread } from "./Thread";
export type ThreadResumeResponse = { thread: Thread, model: string, modelProvider: string, serviceTier: ServiceTier | null, cwd: string, approvalPolicy: AskForApproval,
export type ThreadResumeResponse = { thread: Thread, environmentId: string, model: string, modelProvider: string, serviceTier: ServiceTier | null, cwd: string, approvalPolicy: AskForApproval,
/**
* Reviewer currently used for approval requests on this thread.
*/
@@ -8,7 +8,10 @@ import type { ApprovalsReviewer } from "./ApprovalsReviewer";
import type { AskForApproval } from "./AskForApproval";
import type { SandboxMode } from "./SandboxMode";
export type ThreadStartParams = {model?: string | null, modelProvider?: string | null, serviceTier?: ServiceTier | null | null, cwd?: string | null, approvalPolicy?: AskForApproval | null, /**
export type ThreadStartParams = {model?: string | null, modelProvider?: string | null, /**
* Optional executor environment binding for this thread.
*/
environmentId?: string | null, serviceTier?: ServiceTier | null | null, cwd?: string | null, approvalPolicy?: AskForApproval | null, /**
* Override where approval requests are routed for review on this thread
* and subsequent turns.
*/
@@ -8,7 +8,7 @@ import type { AskForApproval } from "./AskForApproval";
import type { SandboxPolicy } from "./SandboxPolicy";
import type { Thread } from "./Thread";
export type ThreadStartResponse = { thread: Thread, model: string, modelProvider: string, serviceTier: ServiceTier | null, cwd: string, approvalPolicy: AskForApproval,
export type ThreadStartResponse = { thread: Thread, environmentId: string, model: string, modelProvider: string, serviceTier: ServiceTier | null, cwd: string, approvalPolicy: AskForApproval,
/**
* Reviewer currently used for approval requests on this thread.
*/