diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index a87546dff9..6f058e3b02 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -2959,7 +2959,7 @@ "description": "Override the reasoning effort for this turn and subsequent turns." }, "ephemeralContext": { - "description": "Additional model-visible context for this turn, such as editor or IDE state. This context is not re-injected automatically after compaction, so clients should send a fresh snapshot on each turn instead of expecting it to carry forward automatically.", + "description": "Additional model-visible context for this turn, such as editor or IDE state. If compaction happens while this turn is still in progress, the current turn's ephemeral context is preserved so the turn can continue. Ephemeral context from older turns is stripped during compaction, so clients should send a fresh snapshot on each turn instead of expecting it to persist automatically.", "items": { "$ref": "#/definitions/EphemeralContext" }, diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 73721b199f..aad617df03 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -13224,7 +13224,7 @@ "description": "Override the reasoning effort for this turn and subsequent turns." }, "ephemeralContext": { - "description": "Additional model-visible context for this turn, such as editor or IDE state. This context is not re-injected automatically after compaction, so clients should send a fresh snapshot on each turn instead of expecting it to carry forward automatically.", + "description": "Additional model-visible context for this turn, such as editor or IDE state. If compaction happens while this turn is still in progress, the current turn's ephemeral context is preserved so the turn can continue. Ephemeral context from older turns is stripped during compaction, so clients should send a fresh snapshot on each turn instead of expecting it to persist automatically.", "items": { "$ref": "#/definitions/v2/EphemeralContext" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json index 3839311334..407f6a29cf 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json @@ -538,7 +538,7 @@ "description": "Override the reasoning effort for this turn and subsequent turns." }, "ephemeralContext": { - "description": "Additional model-visible context for this turn, such as editor or IDE state. This context is not re-injected automatically after compaction, so clients should send a fresh snapshot on each turn instead of expecting it to carry forward automatically.", + "description": "Additional model-visible context for this turn, such as editor or IDE state. If compaction happens while this turn is still in progress, the current turn's ephemeral context is preserved so the turn can continue. Ephemeral context from older turns is stripped during compaction, so clients should send a fresh snapshot on each turn instead of expecting it to persist automatically.", "items": { "$ref": "#/definitions/EphemeralContext" }, diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/TurnStartParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/TurnStartParams.ts index 0cb24ba953..11a06074ef 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/TurnStartParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/TurnStartParams.ts @@ -12,45 +12,58 @@ import type { EphemeralContext } from "./EphemeralContext"; import type { SandboxPolicy } from "./SandboxPolicy"; import type { UserInput } from "./UserInput"; -export type TurnStartParams = {threadId: string, input: Array, /** +export type TurnStartParams = { threadId: string, input: Array, +/** * Additional model-visible context for this turn, such as editor or IDE state. - * This context is not re-injected automatically after compaction, so + * If compaction happens while this turn is still in progress, the current + * turn's ephemeral context is preserved so the turn can continue. + * Ephemeral context from older turns is stripped during compaction, so * clients should send a fresh snapshot on each turn instead of expecting - * it to carry forward automatically. + * it to persist automatically. */ -ephemeralContext?: Array | null, /** +ephemeralContext?: Array | null, +/** * Override the working directory for this turn and subsequent turns. */ -cwd?: string | null, /** +cwd?: string | null, +/** * Override the approval policy for this turn and subsequent turns. */ -approvalPolicy?: AskForApproval | null, /** +approvalPolicy?: AskForApproval | null, +/** * Override the sandbox policy for this turn and subsequent turns. */ -sandboxPolicy?: SandboxPolicy | null, /** +sandboxPolicy?: SandboxPolicy | null, +/** * Override the model for this turn and subsequent turns. */ -model?: string | null, /** +model?: string | null, +/** * Override the service tier for this turn and subsequent turns. */ -serviceTier?: ServiceTier | null | null, /** +serviceTier?: ServiceTier | null | null, +/** * Override the reasoning effort for this turn and subsequent turns. */ -effort?: ReasoningEffort | null, /** +effort?: ReasoningEffort | null, +/** * Override the reasoning summary for this turn and subsequent turns. */ -summary?: ReasoningSummary | null, /** +summary?: ReasoningSummary | null, +/** * Override the personality for this turn and subsequent turns. */ -personality?: Personality | null, /** +personality?: Personality | null, +/** * Optional JSON Schema used to constrain the final assistant message for * this turn. */ -outputSchema?: JsonValue | null, /** +outputSchema?: JsonValue | null, +/** * EXPERIMENTAL - Set a pre-set collaboration mode. * Takes precedence over model, reasoning_effort, and developer instructions if set. * * For `collaboration_mode.settings.developer_instructions`, `null` means * "use the built-in instructions for the selected mode". */ -collaborationMode?: CollaborationMode | null}; +collaborationMode?: CollaborationMode | null, }; diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index a4f960e469..1e6e5745db 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -3633,9 +3633,11 @@ pub struct TurnStartParams { pub thread_id: String, pub input: Vec, /// Additional model-visible context for this turn, such as editor or IDE state. - /// This context is not re-injected automatically after compaction, so + /// If compaction happens while this turn is still in progress, the current + /// turn's ephemeral context is preserved so the turn can continue. + /// Ephemeral context from older turns is stripped during compaction, so /// clients should send a fresh snapshot on each turn instead of expecting - /// it to carry forward automatically. + /// it to persist automatically. #[ts(optional = nullable)] pub ephemeral_context: Option>, /// Override the working directory for this turn and subsequent turns. diff --git a/codex-rs/app-server/README.md b/codex-rs/app-server/README.md index fc71f5b3d8..e4c4803daa 100644 --- a/codex-rs/app-server/README.md +++ b/codex-rs/app-server/README.md @@ -414,7 +414,7 @@ Turns attach user input (text or images) to a thread and trigger Codex generatio You can optionally specify config overrides on the new turn. If specified, these settings become the default for subsequent turns on the same thread. `outputSchema` applies only to the current turn. -`ephemeralContext` is separate from `input`. Use it for additional model-visible context for this turn, such as IDE/editor state. This context is not re-injected automatically after compaction, so clients should send a fresh snapshot on each turn instead of expecting it to carry forward automatically. +`ephemeralContext` is separate from `input`. Use it for additional model-visible context for this turn, such as IDE/editor state. If compaction happens while this turn is still in progress, the current turn's ephemeral context is preserved so the turn can continue. Ephemeral context from older turns is stripped during compaction, so clients should send a fresh snapshot on each turn instead of expecting it to persist automatically. ```json { "method": "turn/start", "id": 30, "params": {