Files
Agent-System-Dev/tests/fixtures/agent-exec
weichen dee06368ea Add real execution agent probe harness
Why: verify configured Agent CLIs one profile at a time before declaring them usable

Evidence: 53 focused tests, agent-exec validation, 397-test governance regression, and diff check

Impact: adds opt-in source-external probes, acceptance checks, and current task records

Refs: U5; docs/superpowers/plans/2026-10-15-project-agent-execution.md
2026-10-15 05:22:00 +00:00
..

U5 真实 Agent CLI 探针

本夹具描述 host 稍后执行的 opt-in 探针。七个 profile 的真实结果都还是 NOT_RUN。这里不记录探针 PASS。

门禁

默认测试不设置下面两个变量,因此不会启动真实 CLI,也不会联系 provider。

  • RUN_REAL_AGENT_EXEC=1:显式打开真实探针。其他值(包括 true)保持关闭。
  • AGENT_EXEC_REAL_PROFILE:每次恰好一个 profile。允许的名字是 cursor、antigravity、claude、codex、pi、kimi、opencode。空值、空白、逗号或空格列表都会拒绝,并且不会启动 CLI。

一次只跑一个 profile,不要对同一个目标并行开多个探针。

RUN_REAL_AGENT_EXEC=1 AGENT_EXEC_REAL_PROFILE=cursor \
  PYTHONDONTWRITEBYTECODE=1 python3 -m unittest \
  tests.test_agent_exec.RealAgentCliProbeTests.test_opt_in_real_profile_probe -v

把 cursor 换成要测的那一个 profile。建议顺序:cursor,然后 antigravity(可执行文件 agy),claude,pi,codex,kimi。opencode 单独跑。

夹具

探针在临时 Git 仓库里进行,不使用本仓的规范工作区。

  • 分支是非默认分支 feature/u5-real-probe。
  • 配置里只启用被选中的那一个 profile,model 为 auto(省略模型参数,不把字符串 auto 传给 CLI)。
  • 单元只允许一个文件:src/u5-marker.txt。
  • 文件字节必须是 ASCII U5-REAL-PROBE-MARKER 再加一个换行 0x0A。

核对

Host 只在机械检查全部成立时把能力结论记为 PASS:

  • transport 树和工作区里的标记内容与上面的字节完全一致。
  • transport 提交只有一个父提交,且该父提交就是夹具基线 HEAD。
  • changed_paths 只有 src/u5-marker.txt。
  • 成功时保留隔离工作区,transport_created 为真,exact_restore 为假。
  • 模型收据只记录实际看得到的状态。原始输出里没有 model_receipt_status 时记 not-observable,不得编造成 verified。观察到 mismatch 时结论不是 PASS。
  • 规范检出的 HEAD、分支、状态和索引保持不变,标记文件不得出现在规范检出里。

不可用与回退

缺失或不兼容的 OpenCode 必须记 unavailable,不得记 PASS。不兼容指本地 help 缺少 adapter 要求的能力标志;这种情况下不得把 CLI 当成已经跑通。

唯一候选耗尽时,控制器的运行级终态可以是 host-fallback-authorized。那是回退授权,不是探针通过。夹具不会代替 CLI 去写标记文件。

Provider 配额、认证失败,或进程启动后没有留下标记且规范检出仍然完好,同样记 unavailable,不得记 PASS。范围外改动、规范检出被改写、标记内容不符,记 failed。

源码外收据

真实 opt-in 运行会保留临时仓库,并把收据复制到 /tmp/agent-exec-<uid>/u5-probes/。原始 CLI 日志留在控制器的私有 run 目录。这些文件不进入 Git。

默认单元测试使用隔离 PATH 上的假 CLI,只验证上述核对逻辑。

仍为 NOT_RUN

profile 探针 模型收据 transport 变更路径 清理/保留 规范检出 能力结论
cursor NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN
antigravity NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN
claude NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN
codex NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN
pi NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN
kimi NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN
opencode NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN NOT_RUN

Host 回退演练、完整治理回归、独立 Review、精确 HEAD CI 与合入也不在本夹具的已执行范围内。