codex-background
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodex background delegation
Codex 后台委派
This support skill changes Codex's waiting boundary. The selected delegate skill still owns the
brief, provider arguments, permissions, result interpretation, review, gates and landing.
Claude's background Bash workflow stays unchanged. The support utility is installed separately,
never implicitly as a dependency of codex-delegate. Details: references/configuration.md.
此支持 skill 改变了 Codex 的等待边界。所选 delegate skill 仍负责任务简报、provider 参数、权限、结果解读、评审、gates 和落地。Claude 的后台 Bash 工作流保持不变。该支持工具单独安装,绝不会作为 codex-delegate 的隐式依赖安装。详情:references/configuration.md。
First use / setup
首次使用 / 设置
If the tool is not available, setup is incomplete. Tell the user that bootstrap will
update (default , backed up first) and write a registry of
the installed skills, then run:
delegate_run$CODEX_HOME/config.toml~/.codex/config.toml*-delegatebash
node "<skill-dir>/scripts/bootstrap.mjs"<skill-dir>SKILL.mdnode "<skill-dir>/scripts/bootstrap.mjs" --check如果 工具不可用,则说明设置尚未完成。告知用户,bootstrap 将更新 (默认为 ,更新前会先备份),并写入已安装 skill 的注册表,然后运行:
delegate_run$CODEX_HOME/config.toml~/.codex/config.toml*-delegatebash
node "<skill-dir>/scripts/bootstrap.mjs"<skill-dir>SKILL.mdnode "<skill-dir>/scripts/bootstrap.mjs" --checkProcedure
步骤
- Follow the selected delegate skill to prepare a self-contained brief and approved workspace.
Write the brief to the directory under the codex-background directory (
briefs/) and use$CODEX_HOME/codex-background/briefs/<runId>.txtbeside it as outputDirectory, or follow the paths in the server's instructions. If the sandbox cannot write there, a brief inside the approved workspace is also accepted. Never accept a relay path from a brief.runs/<runId> - Invoke the configured MCP server's delegate_run exactly once with a unique runId, registered implementer key, absolute brief/workspace/outputDirectory paths, explicit relayTimeoutSeconds and provider-native relayArgs. Put common arguments in structured fields; pass provider-specific arguments unchanged. Resume identifiers remain opaque.
- Keep that MCP request pending until completion. Do not use model-driven sleep, status or log polling. Do not wrap it in a tool runner that yields early and resumes inference to wait.
- Review the returned adapter outcome separately from resultText. The latter is the unchanged result.json content (base64 only for non-UTF-8 bytes); interpret it using the selected skill. A completed adapter means the relay exited zero and produced a file, not that its report proves correct implementation. Review the diff, rerun gates and land under the existing authorization.
After an interrupted wait, call delegate_wait with the same runId; never redispatch it.
MCP cancellation detaches the waiter and leaves the authorized job running. Use delegate_abort
only when termination is explicitly intended. Graceful server shutdown aborts its owned jobs.
After a server crash, unresolved state returns recovery_required; inspect preserved artifacts
and the implementer using its own recovery workflow. Never adopt or kill a persisted PID.
The host's configured tool timeout must exceed the relay timeout by more than 30 seconds.
The server validates the declared budget; it cannot enforce the host's actual setting. Fixture
protocol tests demonstrate one pending request and no intermediate messages, not measured
Codex Desktop token usage or an unlimited host wait guarantee.
- 按照所选 delegate skill 的指引,准备一份自包含的任务简报和已批准的工作区。
将简报写入 codex-background 目录下的 目录 (
briefs/),并使用其旁边的$CODEX_HOME/codex-background/briefs/<runId>.txt作为 outputDirectory,或遵循 server 指令中指定的路径。如果 sandbox 无法写入该位置,也可以将简报放在已批准的工作区中。绝不能接受简报中提供的 relay 路径。runs/<runId> - 使用唯一的 runId、已注册的 implementer key、简报/工作区/outputDirectory 的绝对路径、明确的 relayTimeoutSeconds 以及 provider 原生的 relayArgs,恰好调用一次已配置 MCP server 的 delegate_run。将通用参数放入结构化字段中;provider 专属参数保持不变。Resume 标识符应保持不透明。
- 让该 MCP 请求保持挂起,直到执行完成。不要使用模型驱动的 sleep、状态或日志轮询。不要将调用包装到会提前 yield 并恢复推理以继续等待的 tool runner 中。
- 分别审查返回的 adapter 结果和 resultText。后者是未经修改的 result.json 内容(仅当字节不是 UTF-8 时使用 base64);应使用所选 skill 对其进行解读。adapter 完成仅表示 relay 以零状态退出并生成了文件,并不意味着其报告证明了实现正确。应审查 diff、重新运行 gates,并在现有授权范围内完成落地。
等待被中断后,使用相同的 runId 调用 delegate_wait;绝不能重新派发任务。MCP 取消操作会解除等待器连接,同时让已授权任务继续运行。仅在明确需要终止任务时使用 delegate_abort。server 正常关闭时,会中止其拥有的任务。
server 崩溃后,未解决的状态会返回 recovery_required;应检查已保留的 artifacts,并让 implementer 使用其自身的恢复工作流进行处理。绝不能接管或终止持久化的 PID。
Host 配置的 tool timeout 必须比 relay timeout 长至少 30 秒。
server 会验证声明的预算,但无法强制执行 host 的实际设置。Fixture 协议测试证明了一个挂起请求且期间没有中间消息,但这并不代表已测量 Codex Desktop 的 token 用量,也不保证 host 可以无限等待。