codex_delegate
Delegate a coding task to Codex in an isolated git worktree, returning a reviewable diff that is not applied to your tree.
Instructions
Delegate a coding task to Codex (a different model) in an isolated git worktree, and get back a reviewable diff that is NOT applied to your tree.
Codex edits files with workspace-write, but only inside a throwaway worktree
seeded from your current tracked state. The returned diff is Codex's changes;
review it, then apply it yourself if you want it. Requires a git repo with at
least one commit. Pass workspace_root (absolute).
NO NETWORK: workspace-write blocks network egress for commands Codex RUNS in the
sandbox, so the task must be self-contained — it cannot git push/fetch, gh
anything, curl, publish, or install dependencies (those fail inside the sandbox
with a DNS/host-resolution error). Ask only for local code changes; do any network
step yourself afterward. This does NOT mean nothing leaves the machine: the Codex
model call still sends your task to OpenAI and lets Codex read tracked files in
the worktree and send their content. The tracked AGENTS.md and .agents/skills/
skills seeded into the worktree auto-load there too — their content can be sent even
if your task never mentions them (the plugin's isolation flags do not suppress
this). Your task is sent raw — secret redaction is best-effort and does not cover
it or files Codex reads itself.
Progress & recovery: blocks until Codex finishes (timeout clamped 10-600s via
timeout_seconds), streaming coarse notifications/progress when your client requests
it; the detached run (meta.job_id) is recoverable via codex_job_list→codex_job_result
if the connection drops, and codex_delegate_async runs the same work fire-and-forget
(poll codex_job_status).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | The coding task for Codex to implement inside a throwaway git worktree; the resulting diff is returned for review, not applied to your tree. | |
| model | No | Override the Codex model slug for this call; defaults to the server/Codex default when unset. | |
| detail | No | Response verbosity: 'summary' (default) omits the raw model text; 'full' includes it. | summary |
| isolation | No | Codex config isolation: 'inherit', 'ignore-config', or 'ignore-rules'. Defaults to the server's configured isolation (built-in default 'inherit'; `codex_status` reports the resolved value). | |
| workspace_root | No | Absolute path to the target repository root. Pass it (or rely on an MCP root) so the call targets the intended repo; otherwise it falls back to the server's own cwd and meta.workspace_warning is set. | |
| idempotency_key | No | Optional client-supplied dedup key, scoped to THIS concrete tool on the same workspace. Reusing it on the same tool with the same arguments replays the existing run instead of starting — and paying for — a duplicate Codex call (a sync call reattaches to the in-flight run and returns its result; an _async call returns the same job_id). The sync and _async variants are DIFFERENT tools and never share a key's run. Reuse with different arguments — including a different timeout_seconds — is refused (idempotency_conflict); a key whose prior result was already consumed/evicted is idempotency_result_unavailable; a still-publishing reservation is idempotency_in_progress (retry). Omit it for the prior no-dedup behavior. A completed result stays replayable while its job record lives (its TTL), subject to consumption or count-eviction; the fail-closed conflict/in-progress window can last longer — up to the job's max runtime + termination grace + TTL. meta.idempotency_replayed=true marks a replayed (unpaid) response. | |
| timeout_seconds | No | Per-call wall-clock timeout in seconds, clamped to 10..600 (out-of-range values are coerced, not rejected). Defaults to the server's configured timeout. | |
| reasoning_effort | No | Override the Codex reasoning effort for this call (sent as a `model_reasoning_effort` config override); omit (or pass null) for the server default (CODEX_IN_CLAUDE_REASONING_EFFORT) or Codex's own resolution. An open per-model string the Codex backend validates at run time — commonly minimal|low|medium|high|xhigh; codex_models lists each model's advertised set (advisory). A backend-rejected value fails as invalid_reasoning_effort; an explicit empty string is sent as-is (and rejected by the backend), never treated as unset. Control characters, surrogates, and values over 128 chars are rejected as invalid_arguments. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes |