codex_fork_session
Fork an existing Codex session by session ID or the latest session, but this MCP tool requires an interactive terminal and fails headlessly; use codex_request to resume a session instead.
Instructions
UNAVAILABLE from the gateway: codex fork is an interactive subcommand requiring a controlling terminal, which an MCP server cannot provide, so every call fails fast with an explanation instead of spawning a child that cannot succeed. To continue an existing Codex conversation use codex_request with a real Codex session UUID or resumeLatest: true, which run codex exec resume and work headlessly. Retained because Codex exposes no non-interactive fork today; this prompt remains argv-bound and still rejects oversized UTF-8 input as non-retryable input_too_large before the unavailability check, so the argv builder stays ready if a headless fork appears.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model name or alias (e.g. gpt-5.5, latest) | |
| prompt | Yes | Prompt text for the forked Codex session. This codex fork path remains argv-bound and rejects oversized UTF-8 input. | |
| forkLast | No | Fork from the most recent Codex session. Mutually exclusive with `sessionId`. | |
| sessionId | No | Codex session UUID to fork from. Mutually exclusive with `forkLast`. | |
| workspace | No | Registered workspace alias for remote HTTP/OAuth provider calls. Do not use this field, workspace_list, or workspace_register_existing_repo as a fallback for stdio/local provider path access; pass workingDir/addDir/includeDirs directly instead. | |
| sandboxMode | No | Codex --sandbox. NEW SESSIONS ONLY: the gateway filters --sandbox out of a resume argv, so this field has no effect on a resumed request. That is NOT a guarantee that the resumed session keeps its original posture: configOverrides still passes through and can set sandbox_mode, and Codex re-resolves configuration on a cold resume. Establish the posture on the first request and verify it when it matters. On a new session, omitting it does NOT guarantee read-only: the gateway emits no --sandbox flag and Codex resolves the policy from configuration, project trust, and its own fallback, so a trusted project can resolve to workspace-write. Pass read-only explicitly for inspection. Pass workspace-write to let Codex edit files in the working dir, or danger-full-access for unrestricted access. | |
| correlationId | No | Request trace ID (auto if omitted) | |
| idleTimeoutMs | No | Idle timeout in ms (min 30s, max 1h, omit=CLI default) | |
| approvalPolicy | No | approvalPolicy is unavailable for this provider. It has no effect with legacy, and mcp_managed is rejected before launch because ambient MCP configuration cannot be isolated. | |
| askForApproval | No | DEPRECATED compatibility input: accepted but ignored because current Codex no longer accepts --ask-for-approval. | |
| approvalStrategy | No | Approval strategy: legacy is supported. mcp_managed is rejected before launch because this adapter cannot isolate ambient MCP configuration. | legacy |