examples-auto-run
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseexamples-auto-run
示例自动运行工具
What it does
功能说明
- Runs first
pnpm build && pnpm -r build-check - Runs in auto-input mode (interactive prompts are auto-answered, HITL/MCP/apply-patch are auto-approved).
pnpm examples:start-all - Executes starts in parallel (default concurrency 4) and pipes each start’s stdout/stderr into its own log file under .
.tmp/examples-start-logs/ - Provides start/stop/status/logs/tail helpers via .
run.sh - If the Codex session ends (no disown/nohup), the child processes receive SIGHUP and exit; is also available to clean up manually.
stop
- 首先执行
pnpm build && pnpm -r build-check - 以自动输入模式运行(交互式提示将自动应答,HITL/MCP/apply-patch将自动批准)
pnpm examples:start-all - 并行启动实例(默认并发数为4),并将每个启动进程的stdout/stderr输出到目录下的独立日志文件中
.tmp/examples-start-logs/ - 通过提供启动/停止/状态查看/日志查看/日志追踪等辅助功能
run.sh - 如果Codex会话结束(未使用disown/nohup),子进程将收到SIGHUP信号并退出;也可使用命令手动清理
stop
Usage
使用方法
bash
undefinedbash
undefinedStart (auto mode, concurrency=4 by default)
启动(自动模式,默认并发数为4)
.agents/skills/examples-auto-run/scripts/run.sh start [extra args to examples:start-all]
.agents/skills/examples-auto-run/scripts/run.sh start [传递给examples:start-all的额外参数]
If you invoke the skill name alone ($examples-auto-run):
如果直接调用技能名称($examples-auto-run
):
$examples-auto-run- when .tmp/examples-rerun.txt
exists and is non-empty, it will run rerun
automatically
.tmp/examples-rerun.txtrerun- 当.tmp/examples-rerun.txt
文件存在且非空时,将自动执行rerun
命令
.tmp/examples-rerun.txtrerun- otherwise it runs the default start
command.
start- 否则将执行默认的start
命令
startExamples:
示例:
.agents/skills/examples-auto-run/scripts/run.sh start --filter basic
.agents/skills/examples-auto-run/scripts/run.sh start --include-server --include-audio
.agents/skills/examples-auto-run/scripts/run.sh start --filter basic
.agents/skills/examples-auto-run/scripts/run.sh start --include-server --include-audio
Check status
查看状态
.agents/skills/examples-auto-run/scripts/run.sh status
.agents/skills/examples-auto-run/scripts/run.sh status
Stop running job (kills pid from .tmp/examples-auto-run.pid)
停止运行中的任务(终止.tmp/examples-auto-run.pid
中记录的进程)
.tmp/examples-auto-run.pid.agents/skills/examples-auto-run/scripts/run.sh stop
.agents/skills/examples-auto-run/scripts/run.sh stop
List logs (per start script)
列出所有日志(按启动脚本分类)
.agents/skills/examples-auto-run/scripts/run.sh logs
.agents/skills/examples-auto-run/scripts/run.sh logs
Tail latest log
追踪最新日志
.agents/skills/examples-auto-run/scripts/run.sh tail
.agents/skills/examples-auto-run/scripts/run.sh tail basic__start_hello-world.log
.agents/skills/examples-auto-run/scripts/run.sh tail
.agents/skills/examples-auto-run/scripts/run.sh tail basic__start_hello-world.log
After a run, build a rerun list from the latest main log (auto-skip list is imported from scripts/run-example-starts.mjs
and server/audio/external skips are honored)
scripts/run-example-starts.mjs运行完成后,从最新的主日志中生成重跑列表(自动跳过列表将从scripts/run-example-starts.mjs
导入,同时会遵循server/audio/external的跳过规则)
scripts/run-example-starts.mjs.agents/skills/examples-auto-run/scripts/run.sh collect
.agents/skills/examples-auto-run/scripts/run.sh collect
Rerun only the entries in .tmp/examples-rerun.txt
仅重跑.tmp/examples-rerun.txt
中记录的条目
.tmp/examples-rerun.txt.agents/skills/examples-auto-run/scripts/run.sh rerun
.agents/skills/examples-auto-run/scripts/run.sh rerun
Show the current auto-skip list (env or defaults)
显示当前的自动跳过列表(来自环境变量或默认值)
.agents/skills/examples-auto-run/scripts/run.sh start --print-auto-skip --dry-run
undefined.agents/skills/examples-auto-run/scripts/run.sh start --print-auto-skip --dry-run
undefinedDefaults (overridable via env)
默认配置(可通过环境变量覆盖)
EXAMPLES_INTERACTIVE_MODE=auto- ,
AUTO_APPROVE_MCP=1,APPLY_PATCH_AUTO_APPROVE=1(set in runner)AUTO_APPROVE_HITL=1 EXAMPLES_CONCURRENCY=4- (5m)
EXAMPLES_EXECA_TIMEOUT_MS=300000
andfinancial-research-agentuse 10m inside the script.computer-use - Includes interactive; excludes server/audio/external by default:
EXAMPLES_INCLUDE_INTERACTIVE=1EXAMPLES_INCLUDE_SERVER=0EXAMPLES_INCLUDE_AUDIO=0
EXAMPLES_INCLUDE_EXTERNAL=0- This means /
realtime-*(tagged as server/audio) are skipped unless you opt in withnextjs/--include-serveror the corresponding env flags.--include-audio
- This means
- Auto-skip list: (comma/space separated) overrides the built-in defaults used by both
EXAMPLES_AUTO_SKIPandrun.sh. Defaults includerun-example-starts.mjs,agent-patterns:start:llm-as-a-judge,agent-patterns:start:routing,customer-service:start,connectors:start,mcp:start:hosted-mcp-on-approval.mcp:start:hosted-mcp-human-in-the-loop
EXAMPLES_INTERACTIVE_MODE=auto- ,
AUTO_APPROVE_MCP=1,APPLY_PATCH_AUTO_APPROVE=1(由运行器设置)AUTO_APPROVE_HITL=1 EXAMPLES_CONCURRENCY=4- (5分钟)
EXAMPLES_EXECA_TIMEOUT_MS=300000
和financial-research-agent在脚本内设置为10分钟computer-use - 默认包含交互式示例;排除server/audio/external类型的示例:
EXAMPLES_INCLUDE_INTERACTIVE=1EXAMPLES_INCLUDE_SERVER=0EXAMPLES_INCLUDE_AUDIO=0
EXAMPLES_INCLUDE_EXTERNAL=0- 这意味着/
realtime-*(标记为server/audio)将被跳过,除非通过nextjs/--include-server或对应的环境变量手动开启--include-audio
- 这意味着
- 自动跳过列表:(逗号/空格分隔)将覆盖
EXAMPLES_AUTO_SKIP和run.sh使用的内置默认值。默认包含run-example-starts.mjs,agent-patterns:start:llm-as-a-judge,agent-patterns:start:routing,customer-service:start,connectors:start,mcp:start:hosted-mcp-on-approvalmcp:start:hosted-mcp-human-in-the-loop
Cancellation / cleanup
取消/清理
- Jobs are backgrounded but not disowned; if Codex suspends/ends the shell, the process group gets SIGHUP and stops.
- Manual cleanup: (removes stale pid if already exited).
run.sh stop
- 任务将在后台运行但未脱离会话;如果Codex暂停/结束shell,进程组将收到SIGHUP信号并停止
- 手动清理:(如果进程已退出,将移除无效的pid文件)
run.sh stop
Log locations
日志位置
- (per start)
.tmp/examples-start-logs/<package>__<script>.log - Main runner log path is printed when is invoked.
start - Rerun list (generated by ):
collect(one.tmp/examples-rerun.txtper line).package:script
- (每个启动脚本对应独立日志)
.tmp/examples-start-logs/<package>__<script>.log - 主运行器日志路径将在执行命令时打印
start - 重跑列表(由生成):
collect(每行一个.tmp/examples-rerun.txt条目)package:script
Notes
注意事项
- Auto-skip is centralized (same defaults as above) and can be overridden via . Auto-skip entries are excluded from rerun collection and will be removed from rerun execution automatically.
EXAMPLES_AUTO_SKIP - Auto-input map covers common interactive prompts; HITL/MCP/apply-patch auto-approve via env is enabled by the runner.
- Shell tool approvals are auto-approved in auto mode ().
SHELL_AUTO_APPROVE=1 - runs entries sequentially, continues after failures, and rewrites
rerunwith only the remaining failures. Auto-skip entries are not re-added..tmp/examples-rerun.txt - Behavioral validation is not done in the runner, so Codex must immediately perform it after every or
startinvocation without waiting for the user to ask. Required steps:rerun- Read the example source to infer intended flow from code/comments (tools invoked, expected outputs, guards, approvals).
- Read the matching log under .
.tmp/examples-start-logs/ - Compare intent vs. log: confirm key actions/results happened; flag omissions or divergences.
- Do this for all exit-0 entries, not just samples.
- Summarize findings right after the run completes; when “OK”, note what was checked (e.g., “tools called + final message emitted”).
- When reporting, do not omit or ellipsize outputs that justify the validation; include the full relevant lines (keep it concise but untruncated).
- The runner prints a full table after the summary: one row per start script with ,
status,package:script(reason/exit/skipped), and the log path. If the run stops before the table appears, point the analyzer at the latestinfoto reconstruct a table and validations.main_*.log
- 自动跳过列表是集中管理的(默认值如上),可通过覆盖。自动跳过的条目将被排除在重跑列表收集之外,且在重跑时会自动被忽略
EXAMPLES_AUTO_SKIP - 自动输入映射覆盖常见的交互式提示;运行器会通过环境变量开启HITL/MCP/apply-patch的自动批准
- 在自动模式下,Shell工具的批准将自动通过()
SHELL_AUTO_APPROVE=1 - 命令将按顺序执行条目,失败后会继续执行,并将
rerun重写为仅包含未成功的条目。自动跳过的条目不会被重新添加.tmp/examples-rerun.txt - 运行器不会执行行为验证,因此Codex必须在每次或
start调用完成后立即执行验证,无需等待用户请求。验证步骤如下:rerun- 读取示例源码,从代码/注释中推断预期流程(调用的工具、预期输出、防护机制、批准操作)
- 读取目录下对应的日志文件
.tmp/examples-start-logs/ - 对比预期与实际日志:确认关键操作/结果已执行;标记遗漏或偏离的情况
- 对所有退出码为0的条目执行此验证,而非仅抽样
- 运行完成后立即总结验证结果;如果“验证通过”,需注明检查的内容(例如:“已确认工具调用+最终消息输出”)
- 报告时请勿省略或截断用于验证的输出内容;需包含完整的相关行(保持简洁但不截断)
- 运行器在总结后会打印完整的表格:每行对应一个启动脚本,包含、
状态、package:script(原因/退出码/已跳过)以及日志路径。如果运行在表格打印前停止,需引导分析人员查看最新的信息以重建表格并完成验证main_*.log