codex

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codex

Codex

Options and boundaries

选项与边界

Default:
codex exec -C <abs-dir> "<prompt>"
; sandbox and model omitted; parent wait 15m. Bare
codex
is an asked-for TUI. "Use <model>" adds
-m
. A named sandbox adds
--sandbox <mode>
. "Worktree" adds boolean
--worktree
, never a name or invented path. "Review" selects
codex review
. Missing values or conflicts are
BLOCKED
.
Sandbox read-only constrains model-generated shell, not the whole process. Workspace-write is not auto-approve.
--full-auto
is rejected.
--search
and
--ask-for-approval
are global, before
exec
. Skip-git-repo-check needs an explicit request; do not initialize a repo to evade the check. Named waivers are required for bypass-approvals-and-sandbox, bypass-hook-trust, danger-full-access, approve-for-me, approval never, yolo, and ignore-rules. Before a waiver or on sandbox failure, apply
references/sandbox.md
; failure does not authorize a bypass.
默认命令:
codex exec -C <abs-dir> "<prompt>"
;省略sandbox与model参数;父进程等待15分钟。仅执行
codex
裸命令会启动TUI(需用户主动调用)。 “使用<model>”会添加
-m
参数。指定名称的sandbox会添加
--sandbox <mode>
参数。 “Worktree”相关请求会添加布尔型参数
--worktree
,绝不传入名称或虚构路径。 “Review”相关请求会调用
codex review
。参数缺失或冲突时返回
BLOCKED
。
sandbox只读模式限制的是模型生成的shell命令,而非整个进程。工作区写入不等于自动批准。
--full-auto
参数会被拒绝。
--search
和
--ask-for-approval
是全局参数,需放在
exec
之前。 跳过git仓库检查需要用户明确请求;不得通过初始化仓库来规避检查。 以下操作需要使用命名waiver:bypass-approvals-and-sandbox、bypass-hook-trust、danger-full-access、approve-for-me、approval never、yolo、ignore-rules。 在申请waiver或sandbox运行失败时,需遵循
references/sandbox.md
的规定;失败不代表可以绕过限制。

1. Resolve

1. 解析

Fix workspace, prompt, mode, session, worktree, sandbox, and wait. Check binary and
codex login status
without exposing secrets. Missing binary → follow
references/install.md
; missing auth →
BLOCKED
unless login was requested. Omit sandbox unless the user named it. Record
cmd | workspace | mode | session | worktree | waiver | wait | evidence | terminal
. Done when target, binary, auth, and authorized options are fixed.
确定workspace、prompt、mode、session、worktree、sandbox和wait参数。 检查二进制文件与
codex login status
命令输出,不得泄露密钥。 二进制文件缺失 → 遵循
references/install.md
操作;认证信息缺失 → 返回
BLOCKED
,除非用户明确请求登录。 除非用户指定sandbox,否则省略该参数。 记录以下字段:
cmd | workspace | mode | session | worktree | waiver | wait | evidence | terminal
。 当目标目录、二进制文件、认证信息和授权选项全部确定后,本步骤完成。

2. Run

2. 运行

Build argv, quote the prompt literally, and use
-C
for the target. Default text is quiet until exit; silence is not a hang. Wait until exit or the recorded deadline; kill only this run's PID at that deadline. Nonzero exit: capture stderr, inspect the tree, report
BLOCKED
.
For JSONL/last-message output, follow
references/streaming.md
. For resume/fork, follow
references/sessions.md
. For worktrees/parallel runs, follow
references/worktrees.md
. For review, TUI, login, MCP, or plugins, follow
references/management.md
. On a rejected flag, use scoped
codex --help
or
codex exec --help
. Done when the process exits or a named failure/authorization gate is reported.
构建argv参数数组,原样转义prompt内容,使用
-C
参数指定目标目录。 默认模式下进程退出前无额外输出;无输出不代表进程挂起。等待进程退出或达到记录的截止时间;截止时间到后仅终止本次运行的PID。 非零退出码:捕获stderr输出,检查目录树,报告
BLOCKED
。
如需JSONL/last-message格式输出,遵循
references/streaming.md
的规定。 如需恢复/分叉会话,遵循
references/sessions.md
的规定。 如需worktree/并行运行,遵循
references/worktrees.md
的规定。 如需review、TUI、登录、MCP或插件管理,遵循
references/management.md
的规定。 遇到被拒绝的参数时,使用对应范围的
codex --help
或
codex exec --help
查看帮助。 当进程退出,或报告指定的失败/授权门禁触发时,本步骤完成。

3. Verify and report

3. 验证与报告

Inspect status and diff; CLI text is unverified. Run the narrowest covering tests for edited executable code. Check every child worktree; read-only sandbox is not a tree-unchanged guarantee. Remove only clean worktrees this run created and the user did not ask to keep; preserve login, MCP, plugins. Report command, mode, session/worktree, waiver, wait, and outcome evidence. Done when every requested outcome is observed or a blocker is evidenced.
Terminals:
SUCCESS
,
NO_CHANGES
,
BLOCKED
,
AWAITING_USER
.
检查状态和diff;CLI输出文本不做验证。针对编辑过的可执行代码,运行覆盖范围最小的测试用例。检查每个子worktree;只读sandbox不保证目录树未被修改。仅删除本次运行创建的、用户未要求保留的干净worktree;保留登录信息、MCP配置和插件。 报告命令、mode、session/worktree、waiver、wait和结果证据。 当所有请求的结果都已观测到,或已证实存在阻塞项时,本步骤完成。
终止状态:
SUCCESS
、
NO_CHANGES
、
BLOCKED
、
AWAITING_USER
。