Merge authoritative main into the task branch

Why: include the current integration baseline before verification.

Evidence: fetched origin/main=17f8bc06c110014b9101e7a33729d9f5445bd123.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
This commit is contained in:
2026-10-20 09:20:11 +00:00
9 changed files with 882 additions and 48 deletions
@@ -0,0 +1,410 @@
# feature/cli-agent-fallback-chain 任务卡
任务主记录:PR #648 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/648;状态:已完成(合入前闭合);owner:weichen
## 基线与授权
- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= d2035c76dc1cb15e01d2c184af5155d9d773cd9f
- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain(worktree);分支:feature/cli-agent-fallback-chain
- 分支类型:standalone;root_target:main;immediate_target:main;accepting_requirements:false
- 需求分流:verdict=NEW;selected_initiative=无;requirement_sha256=8817d4906061c95f5116cecb7e6b185dc6882b638ea71d2dde2db6e437903610;triage_receipt=/tmp/cli-fallback-chain-triage.json;receipt_sha256=555d302ea9cc489bc4b9ef51c0c5857332df08494cd57267646f93c1eabfaf7b
- 授权与交付终点:用户 2026-10-20 要求修改执行规范:CLI Agent 安全失败后不询问用户、自动换下一候选;候选为 cursor(auto)、agy(Gemini 3.8 Flash)、pi(GLM-5.3-flash)、pi(MiniMax-M3),前三类顺序不限,Codex(GPT-6.1-Sol) 必须最后;每候选 3 次,全部失败后暂停询问是否重试。授权范围内实施、验证、Review、PR 合入 Dev main 与安全收口。不改 DM 控制器、不部署、不发布版本、不改分支保护。
- 交付模式:goal-first(目标、范围和交付终点一次确认;范围内连续推进)
- 实施执行:agent-per-unit(配置:AGENT-EXECUTION.md)
- 合入执行:agent(已授权交付范围内,Review 通过、冲突解决且当前 HEAD 的 CI 通过后合入)
- 人工决策点:仅限目标/范围/验收变更、重大取舍、高后果操作或无法自动判定的业务验收
- 当前阶段:实施与自检;当前增量:I1(AGENT-EXECUTION.md 候选链 + 规范文字)
- 流程依据:仓库根目录 policy/delivery.md(归档后仍按仓库根目录定位)
## 目标与非目标
目标:`AGENT-EXECUTION.md` 的四个角色候选均为 cursor(`auto`)、antigravity(`gemini-3.8-flash-high`)、pi-glm(`zai-coding-cn/glm-5.3-flash`)、pi(`minimax-cn/MiniMax-M3`),codex(`gpt-6.1-sol`) 固定为最后候选;去掉 `emergency_profile`,`max_attempts_per_profile: 3` 对含 Codex 在内的每个候选生效。`policy/delivery.md`、`policy/governance.md`、`policy/tool-adaptation-matrix.md` 同步:安全可恢复失败自动换候选、不询问用户;Codex 之外的候选顺序可按角色调整但 Codex 必须最后;全部安全耗尽后 host 暂停并询问用户是否重试,仍不代写。
验收:`make agent-exec-validate` 通过;文档与机器块一致;PR HEAD 完整 CI 通过。
非目标:不改 DM 控制器(不实现运行时随机顺序;“顺序不限”由声明顺序满足);fail-stop 终态(`failed-unknown` 等)语义不变;不改 `deps/development-guidelines`。
## Agent 实施收据
路由与 fail-stop 规则见根目录 AGENT-EXECUTION.md 与 policy/delivery.md;每次尝试一行,原始日志留在源码外收据路径。
| 单元 ID | 预期范围 | 配置摘要 | 角色 | 候选顺序 | attempt | CLI/模型 | 终态 | transport | fallback | 源码外收据路径 |
|---|---|---|---|---|---|---|---|---|---|---|
| dev-cli-agent-fallback-chain | `AGENT-EXECUTION.md`、`policy/{delivery,governance,tool-adaptation-matrix}.md` | config_digest=d2e3574ebf5a…(run 时 AGENT-EXECUTION.md 为 R0 版本) | implementation | [cursor, antigravity, pi] | 1 | cursor-agent-stable / auto | completed (success) | refs/agent-exec/68343647…/536ff962e681 → 8e21b66db4606c20a1d7de4f1293fbcd61780658 | 否 | /tmp/cli-fallback-chain-receipt.json(单元包 /tmp/cli-fallback-chain-unit.json) |
## 关联方向与规划
- 适用状态:不适用(用户直接提出的执行路由调整,无对应规划条目)
- 主记录路径/版本:不适用
- 对应里程碑:不适用
## 需求分析
| ID | 描述 | 项目符合度及依据 | 优先级 | 验收条件 | 依赖 | 结论 |
|---|---|---|---|---|---|---|
| R1 | 五个候选(含第二个 PI 档与 Codex)各 3 次、Codex 最后、全部失败暂停询问 | 符合:控制器已按声明顺序对 `unavailable`/`failed-clean` 自动续跑;模型 ID 经本机冒烟(agy `gemini-3.8-flash-high`、pi `zai-coding-cn/glm-5.3-flash`、codex `gpt-6.1-sol` 均回 OK,SELF) | P2 | validate 通过;文档一致;CI 通过 | 无 | 接受 |
## 方案与计划
- 方案引用:纯配置:Codex 从应急档改为各角色最后一个正常候选(校验器禁止应急档进入普通角色列表,且应急档只跑 1 次,故不保留 `emergency_profile`);新增 `pi-glm` 档
- 实施计划引用:I1 / R1:单一 Agent 单元改 `AGENT-EXECUTION.md` 与三份 policy 文本
- 测试计划引用:R1:`make agent-exec-validate`;PR HEAD 完整 CI
## 阶段记录
| 阶段 | 对象版本 | 状态 | 决策/执行者 | 时间 | 依据 |
|---|---|---|---|---|---|
| 需求拆解 | d2035c7 | 已完成 | host | 2026-10-20 | 用户直接请求 |
| 需求评估 | d2035c7 | 已完成 | host | 2026-10-20 | R1 接受 |
| 需求表确认 | d2035c7 | 跳过 | — | 2026-10-20 | 用户请求已明确目标与验收,无取舍 |
| 方案设计 | 890313e | 已完成 | host | 2026-10-20 | 本卡方案与计划段 |
| 实施计划 | 890313e | 已完成 | host | 2026-10-20 | 本卡方案与计划段 |
| 实施与自检 | 8e21b66 | 已完成 | cursor-agent-stable | 2026-10-20 | Agent 实施收据表 |
| 正式测试与验收 | 8e21b66 | 已完成(SELF;GATE 待 CI) | host | 2026-10-20 | 证据表 |
| 代码 Review | 8e21b66 | PASS | host 主模型 | 2026-10-20 | 合入与清理段 |
| 合入 | 待定 | 待执行 | — | — | — |
| 合入核验与收口 | 待定 | 待执行 | — | — | — |
## 探索试验与迭代
| 增量/试验 | 假设 | 范围 | 判断和停止条件 | 授权/决策依据 | 结果 | 变更影响 | 需重审补测 |
|---|---|---|---|---|---|---|---|
| I1 | 纯配置即可实现五候选链、Codex 最后、每候选 3 次 | AGENT-EXECUTION.md + 3 份 policy | validate 与 CI 通过即停 | 用户直接请求 | 三个新模型 ID 冒烟回 OK(SELF);validate PASS | 全部角色路由 | 否 |
## 同步记录
| 节点 | sync_base_sha | tested_head_sha | checked_at |
|---|---|---|---|
| 启动 | d2035c76dc1cb15e01d2c184af5155d9d773cd9f | d2035c76dc1cb15e01d2c184af5155d9d773cd9f | 2026-10-20T05:56:50Z |
## 证据(Evidence)
<!-- CMD="<命令>" make evidence 写入;手抄/转写输出视为无效证据(AGENTS.md 证据与验证门禁)。 -->
| 时间(UTC) | 命令 | 被测HEAD | exit | 来源 | sha256(16) |
|---|---|---|---|---|---|
## 交付调度
- 调度状态:窗口已领取;调度记录:#518 comment 8226(mq-dev-20261020-cli-agent-fallback-chain-01)
- entry_id:无;attempt_id:无;窗口执行者:无
- 固定候选:无(base/head、组件与相关配置引用实际尝试)
- 调度依据:policy/delivery.md#合入调度
- 固定后证据:源码外 RECEIPT;实际结果后按授权原样导入和闭合
## 结果与验证
- 结果:四个角色候选链为 cursor(auto) → antigravity(`gemini-3.8-flash-high`) → pi-glm(`zai-coding-cn/glm-5.3-flash`) → pi(`minimax-cn/MiniMax-M3`) → codex(`gpt-6.1-sol`)(test/review 前四项顺序不同,Codex 均最后),每候选最多 3 次;去掉 `emergency_profile`;policy 三份文本同步“自动换候选不询问、全部耗尽暂停询问是否重试”。
- 验证:`make agent-exec-validate` PASS;`make test-governance` PASS(513 tests,skipped=18);`make task-sync` PASS;三个新模型 ID 冒烟 PASS(SELF,未入证据表);PR HEAD 完整 CI 待 GATE。
- 影响与剩余项:仅影响 Agent 执行路由。运行时随机顺序未实现(非目标,声明顺序满足“顺序不限、Codex 最后”);`failed-unknown` 等 fail-stop 仍立即停止、不换候选。
## 规划进展与下一步
- 本次推进/剩余:R1 完成,无剩余
- 首选下一任务:无(独立小改动)
- 推荐依据:不适用
- 前置条件/待确认:无
- 预期产物/验收条件:不适用
- 重复任务核对:远端分流 NEW(唯一候选 rdm-two-trees-followup 无关)
- 启动授权:未授权(建议不自动启动新任务,仍须明确授权)
## 合入与清理
- Review 记录:host 主模型(未撰写实施单元;平台账号 weichen)审阅 890313e..8e21b66 实际 diff(AGENT-EXECUTION.md 机器块与说明、delivery/governance/tool-adaptation-matrix 指定段落),重放 `make agent-exec-validate`;结论 PASS,无阻塞项(非阻塞:AGENT-EXECUTION.md 一行超过 78 列)。
- 冲突记录:窗口内 `make task-sync` 合入 main f1866dc(changed=1),无冲突;main 侧对 AGENT-EXECUTION.md 仅在 cursor 档加注释,与本改动正交;合并后重跑 `make agent-exec-validate` PASS。
- CI 记录:NOT_RUN(当前 HEAD 完整 SHA、全部必需检查、运行链接、执行身份及 GATE 结果)
- 合入记录:NOT_RUN(交付授权范围、PR、被核验 HEAD、合入 SHA、目标分支及内容核验)
- 清理记录:NOT_RUN(授权依据、写者退出确认、worktree/分支/任务卡处置)
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T05:55:50.540864+00:00",
"command": "make precheck",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev",
"before_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"after_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"branch": "main",
"target_branch": "main",
"target_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"make[1]: Entering directory '/home/weichen/projects/Agent-System-Dev'",
"[repo] branch=main head=d2035c76dc",
"[remote] origin/main=d2035c76dc ahead=0 behind=0",
"[tree] clean submodules_drift=0 uninit=0",
"[worktrees] linked=7",
"[initiatives] local cards (not authoritative): none",
"[hooks] core.hooksPath=scripts/hooks(pre-commit/post-merge 实际接线)",
"[facts] policy/facts.md 6 条事实均在有效期内",
"[required-reading] core/baseline.md, workflows/delivery.md §1, policy/delivery.md",
"[R0] d2035c76dc(完整:d2035c76dc1cb15e01d2c184af5155d9d773cd9f)",
"[worktree] before-sync: recursive component checks passed",
"[verdict] READY — 保留本次 precheck receipt 后建任务工作区:PRECHECK_RECEIPT=/tmp/task-precheck.json make task-start NAME=feature/your-branch",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev'"
],
"output_sha256": "ecc7f16b6bcabae29ac639e9d5d31ab0bc39f85e0fe0b51449d7b69412ba2d08",
"receipt_sha256": "a8789614c5e3adf44db1e46a6fee98cfabea7b7e79708756d63c4aa756359b79",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/a8789614c5e3adf44db1e46a6fee98cfabea7b7e79708756d63c4aa756359b79.json"
}
```
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T06:00:53.614147+00:00",
"command": "make agent-exec-validate",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain",
"before_head": "8e21b66db4606c20a1d7de4f1293fbcd61780658",
"after_head": "8e21b66db4606c20a1d7de4f1293fbcd61780658",
"branch": "feature/cli-agent-fallback-chain",
"target_branch": "main",
"target_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"make[1]: Entering directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'",
"scripts/agent-exec validate --repo .",
"validate: ok",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'"
],
"output_sha256": "74357235852380ff3b7cbcb532b030dc924e8d11a6b2e39dfcb729717e460660",
"receipt_sha256": "1f3ed60af7d5c96fd19ba0b2f89142237b61597e30e7c9578ec20b8c6bfb60f5",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/1f3ed60af7d5c96fd19ba0b2f89142237b61597e30e7c9578ec20b8c6bfb60f5.json"
}
```
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T06:01:05.726907+00:00",
"command": "make task-sync",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain",
"before_head": "95aba5d68d68f1e3f35887a93aec41b464638a95",
"after_head": "95aba5d68d68f1e3f35887a93aec41b464638a95",
"branch": "feature/cli-agent-fallback-chain",
"target_branch": "main",
"target_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"make[1]: Entering directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'",
"[worktree] before-sync: recursive component checks passed",
"[worktree] before-update: recursive component checks passed",
"[worktree] materialize: recursive component checks passed",
"[worktree] after-sync: recursive component checks passed",
"[evidence] WARN JSON receipt line 120: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[synced] sync_base=d2035c76dc1cb15e01d2c184af5155d9d773cd9f tested_head=95aba5d68d68f1e3f35887a93aec41b464638a95 checked_at=2026-10-20T06:01:57Z changed=0 sync_target=main",
"[next] 跑正式验收(make test 等),证据写入任务卡",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'"
],
"output_sha256": "e797ab5e6a3e9bd075c44fdfe89f72e36a3e2f2fa892e6194501f7c88f46ceb1",
"receipt_sha256": "d05e26eda35110298bb7721e35872f95cdc6c62964c0bf8a84e6db0f06e07775",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/d05e26eda35110298bb7721e35872f95cdc6c62964c0bf8a84e6db0f06e07775.json"
}
```
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T06:04:41.162206+00:00",
"command": "make task-sync",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain",
"before_head": "c41e773d1e11a052ff53b32d493a3fa3e025ea99",
"after_head": "c41e773d1e11a052ff53b32d493a3fa3e025ea99",
"branch": "feature/cli-agent-fallback-chain",
"target_branch": "main",
"target_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"make[1]: Entering directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'",
"[worktree] before-sync: recursive component checks passed",
"[worktree] before-update: recursive component checks passed",
"[worktree] materialize: recursive component checks passed",
"[worktree] after-sync: recursive component checks passed",
"[evidence] WARN JSON receipt line 120: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[synced] sync_base=d2035c76dc1cb15e01d2c184af5155d9d773cd9f tested_head=c41e773d1e11a052ff53b32d493a3fa3e025ea99 checked_at=2026-10-20T06:05:34Z changed=0 sync_target=main",
"[next] 跑正式验收(make test 等),证据写入任务卡",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'"
],
"output_sha256": "40878f3432df9e7aa449f4304ca79a36a9f2c9d3253e229481283dd119efc992",
"receipt_sha256": "cf538efd2a1d13e0f740447675779b37e3ae0db15fa78cc6553856ac2dbb6cc1",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/cf538efd2a1d13e0f740447675779b37e3ae0db15fa78cc6553856ac2dbb6cc1.json"
}
```
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T06:06:03.531305+00:00",
"command": "make task-sync",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain",
"before_head": "3a6ffb97ad0cab5c215f684f27108dbd92f23129",
"after_head": "3a6ffb97ad0cab5c215f684f27108dbd92f23129",
"branch": "feature/cli-agent-fallback-chain",
"target_branch": "main",
"target_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"make[1]: Entering directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'",
"[worktree] before-sync: recursive component checks passed",
"[worktree] before-update: recursive component checks passed",
"[worktree] materialize: recursive component checks passed",
"[worktree] after-sync: recursive component checks passed",
"[evidence] WARN JSON receipt line 120: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[synced] sync_base=d2035c76dc1cb15e01d2c184af5155d9d773cd9f tested_head=3a6ffb97ad0cab5c215f684f27108dbd92f23129 checked_at=2026-10-20T06:06:49Z changed=0 sync_target=main",
"[next] 跑正式验收(make test 等),证据写入任务卡",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'"
],
"output_sha256": "1be7bf73418483205369a97f0b90f7ff7a2709effd5ca44875e59f6ff1b2d955",
"receipt_sha256": "2756940470feebd40744bd42504690f19dfeebd9d76cca06369b57e36fe7caa3",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/2756940470feebd40744bd42504690f19dfeebd9d76cca06369b57e36fe7caa3.json"
}
```
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T06:08:38.659173+00:00",
"command": "make test-governance",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain",
"before_head": "286c3ab0c16fff6ead69a62f470977de4cec656e",
"after_head": "286c3ab0c16fff6ead69a62f470977de4cec656e",
"branch": "feature/cli-agent-fallback-chain",
"target_branch": "main",
"target_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"test_feature_missing_parent_is_allowed (test_write_guard.WriteGuardTests.test_feature_missing_parent_is_allowed) ... ok",
"test_invalid_json_is_denied (test_write_guard.WriteGuardTests.test_invalid_json_is_denied) ... ok",
"test_missing_parent_on_main_is_denied (test_write_guard.WriteGuardTests.test_missing_parent_on_main_is_denied) ... ok",
"test_missing_unknown_and_malformed_write_input_are_denied (test_write_guard.WriteGuardTests.test_missing_unknown_and_malformed_write_input_are_denied) ... ok",
"test_non_git_destination_is_explicitly_outside_scope (test_write_guard.WriteGuardTests.test_non_git_destination_is_explicitly_outside_scope) ... ok",
"test_nonwrite_tools_are_outside_scope (test_write_guard.WriteGuardTests.test_nonwrite_tools_are_outside_scope) ... ok",
"test_relative_path_uses_hook_cwd_not_process_cwd (test_write_guard.WriteGuardTests.test_relative_path_uses_hook_cwd_not_process_cwd) ... ok",
"test_symlink_into_main_with_missing_parents_is_denied (test_write_guard.WriteGuardTests.test_symlink_into_main_with_missing_parents_is_denied) ... ok",
"test_valid_multi_file_patch_on_feature_is_allowed (test_write_guard.WriteGuardTests.test_valid_multi_file_patch_on_feature_is_allowed) ... ok",
"",
"----------------------------------------------------------------------",
"Ran 513 tests in 365.638s",
"",
"OK (skipped=18)",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'"
],
"output_sha256": "750f575e91446dc8480ec53ac70d500852145ae12a75d19ef96390baaf6d55a2",
"receipt_sha256": "14ba55cc1c8585e2a24ef81e0f4edaf74277b83fb47d76fa7bd95dda815cceec",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/14ba55cc1c8585e2a24ef81e0f4edaf74277b83fb47d76fa7bd95dda815cceec.json"
}
```
| 同步(记录前对象) | f1866dc3bb4537ac6446fdd26e696cb636b543ef | 16913620d8cbf214bf81792c5ff03eaee94752cd | 2026-10-20T07:48:20Z |
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T07:47:26.429534+00:00",
"command": "make task-sync",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain",
"before_head": "6bf1000547cc533b914dcb79ad37573b7d33cf61",
"after_head": "f60effc6326ae8847cb1a39bef469c83d812c385",
"branch": "feature/cli-agent-fallback-chain",
"target_branch": "main",
"target_head": "f1866dc3bb4537ac6446fdd26e696cb636b543ef",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
" create mode 100644 docker/verify-env.sh",
" create mode 100644 docs/superpowers/specs/2026-10-20-fast-slow-o2-i1-review.md",
"[worktree] before-update: recursive component checks passed",
"[worktree] materialize: recursive component checks passed",
"[worktree] after-sync: recursive component checks passed",
"admit: ok",
"[evidence] WARN JSON receipt line 120: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[evidence] WARN JSON receipt line 159: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[evidence] WARN JSON receipt line 189: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[evidence] WARN JSON receipt line 224: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[evidence] WARN JSON receipt line 259: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[evidence] WARN JSON receipt line 294: recorded HEAD predates non-card changes ——关键检查须重跑并以 make evidence 重新写入",
"[synced] sync_base=f1866dc3bb4537ac6446fdd26e696cb636b543ef tested_head=f60effc6326ae8847cb1a39bef469c83d812c385 checked_at=2026-10-20T07:48:20Z changed=1 sync_target=main",
"[next] 跑正式验收(make test 等),证据写入任务卡",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'"
],
"output_sha256": "9671a18a5835bfbad2bade03cd21602d59eb40b92f070c258b186ecea7ae9a58",
"receipt_sha256": "c4547470f11d63491ea2f2c4b23c6a46425e5362f37dd23d13f1770165e32057",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/c4547470f11d63491ea2f2c4b23c6a46425e5362f37dd23d13f1770165e32057.json"
}
```
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T07:48:38.505764+00:00",
"command": "make agent-exec-validate",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain",
"before_head": "b90d3aaee9550271cb7c2acd200267f3605d6fca",
"after_head": "b90d3aaee9550271cb7c2acd200267f3605d6fca",
"branch": "feature/cli-agent-fallback-chain",
"target_branch": "main",
"target_head": "f1866dc3bb4537ac6446fdd26e696cb636b543ef",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"make[1]: Entering directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'",
"scripts/agent-exec validate --repo .",
"validate: ok",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-cli-agent-fallback-chain'"
],
"output_sha256": "74357235852380ff3b7cbcb532b030dc924e8d11a6b2e39dfcb729717e460660",
"receipt_sha256": "8a2946c846a8e64c76222cefd05e91161131d1fae4d8b8412dd4e8d90c562fd7",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/8a2946c846a8e64c76222cefd05e91161131d1fae4d8b8412dd4e8d90c562fd7.json"
}
```
## 闭合记录(合入前折叠)
- 本卡在 PR #648(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/648)合入前闭合并归档,随该 PR 一同合入。
- 该 PR 的合并提交即本任务的落地记录。
- 合入后无需回填,也无需单独的闭合 PR。
@@ -0,0 +1,166 @@
# feature/fast-slow-o2-i1-agent-native 任务卡
任务主记录:PR #647 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/647;Dev 草稿 PR [#647](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/647);状态:已完成(合入前闭合);owner:weichen
## 基线与授权
- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= ac594c90e536cfb670e94680f045a6c8247a2513
- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-fast-slow-o2-i1-agent-native(worktree);分支:feature/fast-slow-o2-i1-agent-native
- 分支类型:standalone;root_target:main;immediate_target:main;accepting_requirements:false
- 需求分流:verdict=NEW;selected_initiative=无;requirement_sha256=24717af8dcc91e7b1fbe4ceb92919ea31e43da66f46e51371e9ea2102d8b8cc5;triage_receipt=/tmp/o2i1-20261020/triage.json;receipt_sha256=7854667c4867dabc655b1ce4d1b8f026da6de0e2929fb26b4374353089474fa7
- 授权与交付终点:用户 2026-10-20 阶段 4/5 人审“通过”([方案](docs/superpowers/specs/2026-10-19-fast-slow-o2-route-contract-eof-design.md) §6.1 选 C2 同时接受 `http2_stream` 与 `known_length`+`match`;§6.2 配置仅系统层、默认关闭),并要求启动 I1。终点:Agent-Native I1 草稿 PR 经独立 Review 与 CI 通过 + 阶段 6 评审包,待用户阶段 6 人审后再合入。未授权:I2/I3 启动前另行确认、P1 付费探针(另提资源方案)、部署、真实模型/付费请求。
- 交付模式:goal-first(目标、范围和交付终点一次确认;范围内连续推进)
- 实施执行:agent-per-unit(配置:AGENT-EXECUTION.md)
- 合入执行:agent(已授权交付范围内,Review 通过、冲突解决且当前 HEAD 的 CI 通过后合入)
- 人工决策点:仅限目标/范围/验收变更、重大取舍、高后果操作或无法自动判定的业务验收
- 当前阶段:实施与自检;当前增量:I1(Agent-Native 分支 feature/fast-slow-o2-i1-route-contract,base origin/main 9c24e22)
- 流程依据:仓库根目录 policy/delivery.md(归档后仍按仓库根目录定位)
## 目标与非目标
- 目标:对一条精确绑定的 OpenAI 兼容路由(模型 + 规范化基址 + 摘要),在流缺字面 `[DONE]` 但 C1–C9 全部成立时放行工具调用,终态标 `CompletionBasis=route_contract_eof`;合同为零值时行为逐字节等同现状。
- 受影响:Agent-Native `runtime/llm`(`Client.RouteContract`、解析器延后判定、`Event`/`TerminalObservation` 新增 `completionBasis`/`contractCheck`)、新包 `runtime/argschema`、`runtime/tools/registry.go` 委托校验。
- 非目标:不改 `StreamComplete` 语义;不泛化到其他路由/协议;Backend 配置与透传(I2)、Dev 改钉(I3)、付费探针(P1)不在本卡。
## Agent 实施收据
路由与 fail-stop 规则见根目录 AGENT-EXECUTION.md 与 policy/delivery.md;每次尝试一行,原始日志留在源码外收据路径。
| 单元 ID | 预期范围 | 配置摘要 | 角色 | 候选顺序 | attempt | CLI/模型 | 终态 | transport | fallback | 源码外收据路径 |
|---|---|---|---|---|---|---|---|---|---|---|
| o2-i1-agent-native-route-contract | runtime/llm、runtime/argschema、registry.go(+test) | AGENT-EXECUTION.md | implementation | cursor→antigravity→pi | 1 | cursor / auto | scope-expansion(单元包 `allowed_paths` 误用 `**` 通配,执行器按前缀匹配,7 个范围内文件被判越界;fail-stop) | 未集成 | never | /tmp/o2i1-20261020/o2-i1-receipt.attempt1-scope-expansion.json |
| o2-i1-agent-native-route-contract | 同上(改为前缀写法 `runtime/llm/`、`runtime/argschema/`,范围不变) | AGENT-EXECUTION.md | implementation | cursor→antigravity→pi | 2(用户 2026-10-20 授权全新重跑) | cursor / auto | success | `899fd70`(ref refs/agent-exec/e38bcf1c…/445c377b,parent 9c24e22),`agent-exec apply` 快进集成 | never | /tmp/o2i1-20261020/o2-i1-receipt.json |
## 关联方向与规划
- 适用状态:待核对(无适用规划时说明原因)
- 主记录路径/版本:待核对(路径按仓库根目录定位,归档后不变;只引用唯一正文)
- 对应里程碑:待核对
## 需求分析
| ID | 描述 | 项目符合度及依据 | 优先级 | 验收条件 | 依赖 | 结论 |
|---|---|---|---|---|---|---|
| R1 | I1:Agent-Native `route_contract_eof` 限路由等价终态 | 符合:用户 2026-10-19 选定 O2,2026-10-20 阶段 4/5 通过 | P1 | 计划 §2 测试矩阵全部用例通过;拒绝时终态事件除 `contractCheck` 外与合同关闭 deep-equal;零值合同行为不变;现有断言不删减 | 无 | 实施中 |
## 方案与计划
- 方案引用:docs/superpowers/specs/2026-10-19-fast-slow-o2-route-contract-eof-design.md(Dev main,PR #639 合入)
- 实施计划引用:docs/superpowers/plans/2026-10-19-fast-slow-o2-route-contract-eof-plan.md §2(I1)
- 测试计划引用:同上 §2 测试表与验证命令
## 阶段记录
| 阶段 | 对象版本 | 状态 | 决策/执行者 | 时间 | 依据 |
|---|---|---|---|---|---|
| 需求拆解 | 待定 | 待执行 | — | — | — |
| 需求评估 | 待定 | 待执行 | — | — | — |
| 需求表确认 | 待定 | 待执行 | — | — | — |
| 方案设计 | Dev 5a7a0da | 通过(C2 接受 known_length+match) | 用户 | 2026-10-20 | 阶段 4 人审 |
| 实施计划 | Dev 5a7a0da | 通过 | 用户 | 2026-10-20 | 阶段 5 人审 |
| 实施与自检 | Agent-Native 899fd70 | 完成(SELF) | cursor worker 实施;host 范围审阅与验证 | 2026-10-20 | 收据 o2-i1-receipt.json |
| 正式测试与验收 | Agent-Native 899fd70 | 阶段 6 通过(接受 C2 编号) | 用户 | 2026-10-20 | PR #48 CI GATE success;评审包 2026-10-20-fast-slow-o2-i1-review.md |
| 代码 Review | Agent-Native 899fd70 | PASS | 全新会话 code-reviewer | 2026-10-20 | 见合入与清理节 |
| 合入 | Agent-Native 2fc66be | 已合入 Agent-Native main | host | 2026-10-20 | 用户阶段 6 授权 |
| 合入核验与收口 | 待定 | 待执行 | — | — | — |
## 探索试验与迭代
| 增量/试验 | 假设 | 范围 | 判断和停止条件 | 授权/决策依据 | 结果 | 变更影响 | 需重审补测 |
|---|---|---|---|---|---|---|---|
| 待定义 | — | — | — | 待核对 | NOT_RUN | 待评估 | 待评估 |
## 同步记录
| 节点 | sync_base_sha | tested_head_sha | checked_at |
|---|---|---|---|
| 启动 | ac594c90e536cfb670e94680f045a6c8247a2513 | ac594c90e536cfb670e94680f045a6c8247a2513 | 2026-10-20T03:22:13Z |
## 证据(Evidence)
<!-- CMD="<命令>" make evidence 写入;手抄/转写输出视为无效证据(AGENTS.md 证据与验证门禁)。 -->
| 时间(UTC) | 命令 | 被测HEAD | exit | 来源 | sha256(16) |
|---|---|---|---|---|---|
## 交付调度
- 调度状态:未入队;调度记录:无
- entry_id:无;attempt_id:无;窗口执行者:无
- 固定候选:无(base/head、组件与相关配置引用实际尝试)
- 调度依据:policy/delivery.md#合入调度
- 固定后证据:源码外 RECEIPT;实际结果后按授权原样导入和闭合
## 结果与验证
- 结果:I1 在 Agent-Native 分支 `feature/fast-slow-o2-i1-route-contract`(`899fd70`,草稿 PR #48)交付;阶段 6 评审包 docs/superpowers/specs/2026-10-20-fast-slow-o2-i1-review.md。
- 验证:host(SELF)@899fd70 vet、定向测试(含 -race)、`go test ./...` PASS;CI(GATE)PR #48 三项 success;独立 Review PASS。
- 影响与剩余项:仅 Agent-Native `runtime/llm`、`runtime/argschema`、registry 委托;合同默认关闭。剩余:用户阶段 6;I2、I3、P1;评审包第 3 节非阻塞项。
## 规划进展与下一步
- 本次推进/剩余:待核对(依据实际成果更新适用方案/规划)
- 首选下一任务:待核对(无适用规划、已完成或受阻时如实说明,不虚构任务)
- 推荐依据:待填写
- 前置条件/待确认:待核对
- 预期产物/验收条件:待定义
- 重复任务核对:待核对(已有/在途任务、PR 与规划记录)
- 启动授权:未授权(建议不自动启动新任务,仍须明确授权)
## 合入与清理
- Review 记录:Cursor Task 子代理 code-reviewer(fresh_session=true,session=531ce711-73e7-44d8-8b9e-ed90d93856f7;只接收需求、方案/计划、base 9c24e22/head 899fd70 与 diff,未转交实施会话);结论 PASS,0 阻塞,3 条非阻塞记入评审包第 3 节;评审者自跑 vet 与 -race 定向测试通过(SELF)。
- CI 记录(Agent-Native):PR #48 head `899fd70d27dd25bb88088a677546a71e54a86d9e` commit status success:`ci / vet-and-test`(runs/4350/jobs/7018)、`ci / docker-checkout-hostgateway`(runs/4350/jobs/7019)、`governance / governance`(runs/4351/jobs/7020)(GATE)。
- 冲突记录:NOT_RUN(最新目标同步、冲突处置、组合兼容核验及复审/补测)
- CI 记录:NOT_RUN(当前 HEAD 完整 SHA、全部必需检查、运行链接、执行身份及 GATE 结果)
- 合入记录(Agent-Native):用户 2026-10-20 阶段 6 通过;PR #48 核验 head `899fd70`、commit status success(3 项,GATE)后合入 Agent-Native main,合入提交 `2fc66be65201232ea38ba64d457efad5565d869d`;合入后 tree `720ec93` 与合入前 `git merge-tree` 预期一致。Dev 改钉在 I3 组合验证。
- 合入记录(本 PR):NOT_RUN(交付授权范围、PR、被核验 HEAD、合入 SHA、目标分支及内容核验)
- 清理记录:Agent-Native worktree `Agent-Native-wt-feature-fast-slow-o2-i1` 核验无写者、干净后移除,本地分支已删;Dev worktree 待本 PR 合入后回收。
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T03:21:23.593016+00:00",
"command": "make precheck",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev",
"before_head": "ac594c90e536cfb670e94680f045a6c8247a2513",
"after_head": "ac594c90e536cfb670e94680f045a6c8247a2513",
"branch": "main",
"target_branch": "main",
"target_head": "ac594c90e536cfb670e94680f045a6c8247a2513",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"make[1]: Entering directory '/home/weichen/projects/Agent-System-Dev'",
"[repo] branch=main head=ac594c90e5",
"[remote] origin/main=ac594c90e5 ahead=0 behind=0",
"[tree] clean submodules_drift=0 uninit=0",
"[worktrees] linked=7",
"[cards] 已合入未闭合任务卡:feature-iam-role-permission-linked-capabilities.md——make task-close 回填归档(主检出运行)",
"[initiatives] local cards (not authoritative): none",
"[hooks] core.hooksPath=scripts/hooks(pre-commit/post-merge 实际接线)",
"[facts] policy/facts.md 6 条事实均在有效期内",
"[required-reading] core/baseline.md, workflows/delivery.md §1, policy/delivery.md",
"[R0] ac594c90e5(完整:ac594c90e536cfb670e94680f045a6c8247a2513)",
"[worktree] before-sync: recursive component checks passed",
"[verdict] READY — 保留本次 precheck receipt 后建任务工作区:PRECHECK_RECEIPT=/tmp/task-precheck.json make task-start NAME=feature/your-branch",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev'"
],
"output_sha256": "8354ba7addbd3c5505eb65459b25cc49dc9c6513d9a4e8f6b38dc9f448b3f478",
"receipt_sha256": "a0e06fafe3a01436440290d8fe41abd0581c817dde2ad3481497f95cae50a473",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/a0e06fafe3a01436440290d8fe41abd0581c817dde2ad3481497f95cae50a473.json"
}
```
## 闭合记录(合入前折叠)
- 本卡在 PR #647(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/647)合入前闭合并归档,随该 PR 一同合入。
- 该 PR 的合并提交即本任务的落地记录。
- 合入后无需回填,也无需单独的闭合 PR。
| 同步(记录前对象) | d2035c76dc1cb15e01d2c184af5155d9d773cd9f | 014655339962c1057970ddc9ce9e2025fe31f902 | 2026-10-20T05:56:34Z |
| 同步(记录前对象) | f97917032d143188bc7faf665aff612d9814af4e | a577c9e11bae5655fc63a9ca313c84e70ad24aed | 2026-10-20T06:55:48Z |
@@ -0,0 +1,164 @@
# feature/fast-slow-o2-i2-backend 任务卡
任务主记录:PR #652 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/652;状态:已完成(合入前闭合);owner:weichen
## 基线与授权
- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= d2035c76dc1cb15e01d2c184af5155d9d773cd9f
- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-fast-slow-o2-i2-backend(worktree);分支:feature/fast-slow-o2-i2-backend
- 分支类型:standalone;root_target:main;immediate_target:main;accepting_requirements:false
- 需求分流:verdict=NEW;selected_initiative=无;requirement_sha256=95d3a2ee34b8bdcabd1222b2ffbad0031a98717338fa400b8d7367d9d7d91610;triage_receipt=/tmp/o2i2-20261020/triage.json;receipt_sha256=88c443107094b249c62de6b88b0d3503d8caa4e420b802ebc4002dc58bb9250e
- 授权与交付终点:用户 2026-10-20 在 O2 I1 阶段 6 结论中选择“通过并启动 I2”(方案/计划阶段 4/5 已于同日通过)。终点:Backend I2 草稿 PR 经独立 Review 与 CI 通过 + 阶段 6 评审包,待用户阶段 6 人审后再合入。未授权:I3 Dev 改钉(I2 通过后启动)、P1 付费探针、写入任何实例的系统层配置、部署、真实模型/付费请求。
- 交付模式:goal-first(目标、范围和交付终点一次确认;范围内连续推进)
- 实施执行:agent-per-unit(配置:AGENT-EXECUTION.md)
- 合入执行:agent(已授权交付范围内,Review 通过、冲突解决且当前 HEAD 的 CI 通过后合入)
- 人工决策点:仅限目标/范围/验收变更、重大取舍、高后果操作或无法自动判定的业务验收
- 当前阶段:实施与自检;当前增量:I2(Backend 分支 feature/fast-slow-o2-i2-route-contract,base origin/main b5eb89c)
- 流程依据:仓库根目录 policy/delivery.md(归档后仍按仓库根目录定位)
## 目标与非目标
- 目标:Backend 以系统层三键 `models.routeContractEOF.model/.baseUrl/.identitySha256`(默认空 = 关闭)声明 O2 路由合同;5 个 `openLLMClient` 调用点统一按各自解析出的 (model, base) 精确判定是否挂 `RouteContractEOF`;`deps/agent-native` 改钉到 I1 合入提交 `2fc66be`。
- 受影响:Backend `internal/runtime`(`openRouteClient`/`routeContractFor`)、`internal/settings/settings.go`、`deps/agent-native` gitlink。
- 非目标:不改 Agent-Native;不写入任何实例配置;`runmgr` 无需改动(Backend 生产代码不记录终态字段,快慢通道收据由测试侧评估工具记录整个 `terminalObservation`,改钉后自动包含 `completionBasis`);Dev 改钉(I3)、付费探针(P1)不在本卡。
## Agent 实施收据
路由与 fail-stop 规则见根目录 AGENT-EXECUTION.md 与 policy/delivery.md;每次尝试一行,原始日志留在源码外收据路径。
| 单元 ID | 预期范围 | 配置摘要 | 角色 | 候选顺序 | attempt | CLI/模型 | 终态 | transport | fallback | 源码外收据路径 |
|---|---|---|---|---|---|---|---|---|---|---|
| o2-i2-backend-route-contract-config | deps/agent-native、internal/runtime/、internal/settings/ | AGENT-EXECUTION.md | implementation | cursor→antigravity→pi | 1 | — | invalid-config(host 把写单元包与派发并行执行,执行器读包时文件尚不存在;attempts 为空,无任何改动;fail-stop) | 未集成 | never | /tmp/o2i2-20261020/o2-i2-receipt.attempt1-invalid-config.json |
| o2-i2-backend-route-contract-config | 同上 | AGENT-EXECUTION.md | implementation | cursor→antigravity→pi | 2(用户 2026-10-20 授权全新重跑) | cursor / auto | success | `e1a90a5`(ref refs/agent-exec/8eed31d0…/d97e9636,parent b5eb89c),`agent-exec apply` 快进集成 | never | /tmp/o2i2-20261020/o2-i2-receipt.json |
| o2-i2b-eval-receipt-route-contract | internal/runtime/llm.go、internal/server/work_checkpoint_eval_test.go、internal/server/work_checkpoint_eval_route_contract_test.go | AGENT-EXECUTION.md | implementation | cursor→antigravity→pi | 1 | cursor / auto | failed-unknown(worker exit 1,原始日志末尾 `RetriableError: [internal] HTTP/2 keepalive ping timed out after 5000ms`;变更仅在允许路径内但未完成,执行器无法机械对账外部副作用;fail-stop,未换候选) | 未集成 | never | /tmp/o2i2-20261020/o2-i2b-receipt.attempt1-failed-unknown.json |
| o2-i2b-eval-receipt-route-contract | 同上 | AGENT-EXECUTION.md | implementation | cursor→antigravity→pi | 2(用户 2026-10-20 07:54 对“授权全新重跑(推荐)”回复“继续”) | cursor / auto | success(219s) | `16f98b8`(ref refs/agent-exec/4792e791…/c578cdde,parent e1a90a5),`agent-exec apply` 快进集成 | never | /tmp/o2i2-20261020/o2-i2b-receipt.json |
## 关联方向与规划
- 适用状态:待核对(无适用规划时说明原因)
- 主记录路径/版本:待核对(路径按仓库根目录定位,归档后不变;只引用唯一正文)
- 对应里程碑:待核对
## 需求分析
| ID | 描述 | 项目符合度及依据 | 优先级 | 验收条件 | 依赖 | 结论 |
|---|---|---|---|---|---|---|
| R1 | I2:Backend 系统层合同配置与按身份挂合同 | 符合:O2 阶段 4/5 通过;I1 阶段 6 通过(Agent-Native #48 合入 2fc66be) | P1 | 计划 §3 测试全部通过:缺省关闭;用户层写入被忽略;模型/基址/摘要任一不符不挂;视觉改模/轻量档独立判定;挂合同后假流放行一次工具并记 `route_contract_eof`;删除配置恢复拒绝;现有断言不删减 | I1 | 实施中 |
## 方案与计划
- 方案引用:docs/superpowers/specs/2026-10-19-fast-slow-o2-route-contract-eof-design.md §4.5(Dev main,PR #639)
- 实施计划引用:docs/superpowers/plans/2026-10-19-fast-slow-o2-route-contract-eof-plan.md §3(I2)
- 测试计划引用:同上 §3 测试与验证命令
## 阶段记录
| 阶段 | 对象版本 | 状态 | 决策/执行者 | 时间 | 依据 |
|---|---|---|---|---|---|
| 需求拆解 | 待定 | 待执行 | — | — | — |
| 需求评估 | 待定 | 待执行 | — | — | — |
| 需求表确认 | 待定 | 待执行 | — | — | — |
| 方案设计 | 待定 | 待执行 | — | — | — |
| 实施计划 | 待定 | 待执行 | — | — | — |
| 实施与自检 | Backend `16f98b8` | 完成 | Cursor worker ×2 单元 + host 验证 | 2026-10-20 | 收据表;host SELF 验证见评审包 §2 |
| 正式测试与验收 | Backend `16f98b8` | 用户阶段 6 通过 | 用户 | 2026-10-20 08:06 | 用户对“通过:合入 #224 和 #652,并启动 I3(推荐)”回复“继续”;评审包 docs/superpowers/specs/2026-10-20-fast-slow-o2-i2-review.md |
| 代码 Review | `e1a90a5` / `16f98b8` | PASS | 独立子智能体 8b8edce1(第 1 轮 PASS-with-fixes)、b0f773ba(第 2 轮 PASS) | 2026-10-20 | 见合入与清理节 Review 记录 |
| 合入 | Backend #224 | 已合入 `c164950` | host(agent) | 2026-10-20 | 见合入记录 |
| 合入核验与收口 | 待定 | 待执行 | — | — | — |
## 探索试验与迭代
| 增量/试验 | 假设 | 范围 | 判断和停止条件 | 授权/决策依据 | 结果 | 变更影响 | 需重审补测 |
|---|---|---|---|---|---|---|---|
| 待定义 | — | — | — | 待核对 | NOT_RUN | 待评估 | 待评估 |
## 同步记录
| 节点 | sync_base_sha | tested_head_sha | checked_at |
|---|---|---|---|
| 启动 | d2035c76dc1cb15e01d2c184af5155d9d773cd9f | d2035c76dc1cb15e01d2c184af5155d9d773cd9f | 2026-10-20T06:05:02Z |
## 证据(Evidence)
<!-- CMD="<命令>" make evidence 写入;手抄/转写输出视为无效证据(AGENTS.md 证据与验证门禁)。 -->
| 时间(UTC) | 命令 | 被测HEAD | exit | 来源 | sha256(16) |
|---|---|---|---|---|---|
## 交付调度
- 调度状态:未入队;调度记录:无
- entry_id:无;attempt_id:无;窗口执行者:无
- 固定候选:无(base/head、组件与相关配置引用实际尝试)
- 调度依据:policy/delivery.md#合入调度
- 固定后证据:源码外 RECEIPT;实际结果后按授权原样导入和闭合
## 结果与验证
- 结果:
- 验证:<结论摘要 PASS/FAIL/SKIP/NOT_RUN 逐项;逐条证据由 make evidence 写入上方证据表>
- 影响与剩余项:
## 规划进展与下一步
- 本次推进/剩余:待核对(依据实际成果更新适用方案/规划)
- 首选下一任务:待核对(无适用规划、已完成或受阻时如实说明,不虚构任务)
- 推荐依据:待填写
- 前置条件/待确认:待核对
- 预期产物/验收条件:待定义
- 重复任务核对:待核对(已有/在途任务、PR 与规划记录)
- 启动授权:未授权(建议不自动启动新任务,仍须明确授权)
## 合入与清理
- Review 记录:第 1 轮——全新独立 Cursor 子智能体(agent 8b8edce1,fresh_session=true,只接收目标/计划/base b5eb89c..head e1a90a5 diff/CI),结论 PASS-with-fixes:5 条单元验收均满足(本地 SELF 重放 vet、`go test -race ./internal/runtime ./internal/settings`、gofmt、diff --check 通过)。阻塞(相对已批准计划 §3 I2“运行记录与快慢通道收据透传 completionBasis”,host 写单元包时漏列):`internal/server/work_checkpoint_eval_test.go` 的 `evalProviderStream` 直接构造 Client 不挂合同,`evalTerminalObservation`/`evalCallRecord` 白名单丢 `CompletionBasis`/`ContractCheck`。处置:属已批准 I2 范围,补派单元 `o2-i2b-eval-receipt-route-contract`。非阻塞(只记录):`internal/app/app.go:350` 小队内核直接构造 Client(不在批准的 5 个调用点内,维持失败关闭);`app.go:519` 意图生成器无合同无影响;5 个调用点与 `Execute` 的 nil-stream 分支靠审读确认;`settings.go` baseUrl 说明未提 fragment/userinfo。第 2 轮——全新独立 code-reviewer 子智能体(agent b0f773ba,fresh_session=true,只接收需求与 e1a90a5..16f98b8 diff),结论 **PASS,无阻塞项**:生产代码零行为变化(仅导出薄封装);评测判定经真实 settings 服务 `SetSystemOverride`+`Effective` 与生产同源;白名单无泄漏路径(含 PRIVATE_/C10/大小写反例);不匹配失败关闭;既有断言未删减。评审者重放(REPLAY):`go vet -tags live ./internal/server`、`go test -tags live ./internal/server -run 'TestEval|TestEvaluation|TestExtraA01|TestFollowupA01|TestMechanism'`、`go test ./internal/runtime` 均通过。非阻塞:配置了 `routeContractEOF` 却未挂上时评测静默按无合同运行(建议 P1 前改为 t.Fatal,避免浪费付费请求);合同对象未知键被静默丢弃。
- 冲突记录:Backend #224 合入前 origin/main(b5eb89c)是 head 的祖先,无冲突;Dev 侧见同步记录。
- CI 记录(Backend #224,GATE):head `16f98b8e4fbc413d65e2d76b761ffe19afc65a67` 全部 success——`ci / vet-and-test`(/weichen/Agent-System-Backend/actions/runs/4409/jobs/7158)、`governance / governance`(runs/4410/jobs/7159);前一 head `e1a90a5` 亦 success(runs/4382/jobs/7104、runs/4383/jobs/7105)。注意:CI 跑 `go vet ./... && go test ./...`,不含 `live` tag,评测文件 `internal/server/work_checkpoint_eval*_test.go` 的测试只有 host SELF(`go test -tags live ./internal/server` 24 项通过)与评审重放。
- 合入记录:Backend PR #224(授权:用户 2026-10-20 08:06 阶段 6 通过)被核验 HEAD `16f98b8e4fbc413d65e2d76b761ffe19afc65a67`(CI success),合入 Agent-System-Backend main,merge commit `c16495006dbf1cf6ee581b48d99bba1e7f9a377c`,main tree `43129de` 与被核验 HEAD tree 一致。Dev 侧 gitlink 改钉由 I3 负责。
- 清理记录:NOT_RUN(授权依据、写者退出确认、worktree/分支/任务卡处置)
<!-- Local receipt: SELF. Digests detect corruption; they do not authenticate a reviewer or CI. -->
```json
{
"summary_schema": 1,
"source": "SELF",
"timestamp": "2026-10-20T06:04:02.239270+00:00",
"command": "make precheck",
"exit_code": 0,
"cwd": "/home/weichen/projects/Agent-System-Dev",
"before_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"after_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"branch": "main",
"target_branch": "main",
"target_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f",
"root_target": "main",
"immediate_target": "main",
"before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"output_tail": [
"make[1]: Entering directory '/home/weichen/projects/Agent-System-Dev'",
"[repo] branch=main head=d2035c76dc",
"[remote] origin/main=d2035c76dc ahead=0 behind=0",
"[tree] clean submodules_drift=0 uninit=0",
"[worktrees] linked=8",
"[initiatives] local cards (not authoritative): none",
"[hooks] core.hooksPath=scripts/hooks(pre-commit/post-merge 实际接线)",
"[facts] policy/facts.md 6 条事实均在有效期内",
"[required-reading] core/baseline.md, workflows/delivery.md §1, policy/delivery.md",
"[R0] d2035c76dc(完整:d2035c76dc1cb15e01d2c184af5155d9d773cd9f)",
"[worktree] before-sync: recursive component checks passed",
"[verdict] READY — 保留本次 precheck receipt 后建任务工作区:PRECHECK_RECEIPT=/tmp/task-precheck.json make task-start NAME=feature/your-branch",
"make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev'"
],
"output_sha256": "32e2a7ee7d89e931af5b2d76a480bf3ccfb9367bff3bc01a91df24649e3a09d8",
"receipt_sha256": "c2a4c48509432276fcb5c41d14a8e62e01dda2248d6e49da03b8438114e3650d",
"receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/c2a4c48509432276fcb5c41d14a8e62e01dda2248d6e49da03b8438114e3650d.json"
}
```
## 闭合记录(合入前折叠)
- 本卡在 PR #652(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/652)合入前闭合并归档,随该 PR 一同合入。
- 该 PR 的合并提交即本任务的落地记录。
- 合入后无需回填,也无需单独的闭合 PR。
| 同步(记录前对象) | adbef2f49c6c252a09449496afbdb6685201993b | c70ebf53bfac50b460707d7eb6f482f20e697701 | 2026-10-20T08:08:33Z |
+43 -34
View File
@@ -7,20 +7,22 @@ parser accepts exactly one `agent-execution` fenced block.
U3's execution controller and U4's project wiring are integrated. This file is
the execution-routing authority for implementation, repair, test, and review.
Normal implementation, repair, and test routes stay Cursor, Antigravity
(`agy`), and PI. Each of those profiles may be attempted up to
`max_attempts_per_profile`, which is exactly 3 whenever `emergency_profile`
is configured. Only after those candidates safely exhaust their attempts does
the enabled emergency `codex` profile run once. Codex remains out of the three
normal role lists and may also appear in review. `fallback_to_host` is
`never`: the controller does not emit `host-fallback-authorized` and does not
increment host fallback authorizations. Safe exhaustion without an emergency
candidate ends `unavailable` or `blocked`, and that result does not authorize
the host to write the unit. The legacy value `all-unavailable` remains
parseable and likewise grants no host write authority. Cursor uses
`cursor-agent-stable`. `model: auto` makes Cursor receive an explicit
`--model auto`; the other CLIs omit the model flag and use their configured
default. Any other value is passed to that CLI as its model selector. The
Implementation, repair, test, and review all use the candidates Cursor,
Antigravity (`agy`), PI with GLM (`pi-glm`), PI with MiniMax (`pi`), and
Codex. Each candidate may be attempted up to `max_attempts_per_profile` (3)
times on safe recoverable failures (`unavailable`, `failed-clean`); after that
the controller moves to the next candidate automatically, and the host does
not ask the user. The order of the non-Codex candidates may differ per role,
but Codex must stay the last candidate in every role list. There is no
`emergency_profile`. `fallback_to_host` is `never`: the controller does not
emit `host-fallback-authorized` and does not increment host fallback
authorizations. When every candidate is safely exhausted the run ends
`unavailable` or `blocked`; the host pauses that unit and asks the user
whether to retry, and does not write the unit. The legacy value
`all-unavailable` remains parseable and likewise grants no host write
authority. Cursor uses `cursor-agent-stable`. `model: auto` makes Cursor
receive an explicit `--model auto`; the other CLIs omit the model flag and use
their configured default. Any other value is passed to that CLI as its model selector. The
`integration` block declares the host-exempt paths and the transport, admission,
and cleanup entry points.
@@ -37,13 +39,12 @@ execution:
summary_bytes: 16384
raw_output_bytes: 10485760
max_attempts_per_profile: 3
emergency_profile: codex
roles:
implementation: [cursor, antigravity, pi]
repair: [cursor, antigravity, pi]
test: [pi, antigravity, cursor]
review: [pi, antigravity, cursor, codex]
implementation: [cursor, antigravity, pi-glm, pi, codex]
repair: [cursor, antigravity, pi-glm, pi, codex]
test: [pi-glm, pi, antigravity, cursor, codex]
review: [pi-glm, pi, antigravity, cursor, codex]
profiles:
cursor:
@@ -59,7 +60,13 @@ profiles:
antigravity:
adapter: antigravity
executable: agy
model: auto
model: gemini-3.8-flash-high
enabled: true
pi-glm:
adapter: pi
executable: pi
model: zai-coding-cn/glm-5.3-flash
enabled: true
pi:
@@ -71,7 +78,7 @@ profiles:
codex:
adapter: codex
executable: codex
model: auto
model: gpt-6.1-sol
enabled: true
integration:
@@ -96,23 +103,25 @@ section records only this project's choices.
- Planning, design and implementation plans: Codex or Claude when available,
in the host or a fresh CLI session. This is a preference, not a routing role.
- Bounded implementation, repair and test units: the existing normal
candidates in the configured role order above. Requested models:
- PI: `minimax-cn/MiniMax-M3`, passed as `--model provider/id`. PI
actual events have reported `minimax-cn` / `MiniMax-M3` and the local
offline catalog lists that profile; each run still records the effective
model from that run's events.
- Bounded implementation, repair, test and review units: the candidates in
the configured role order above, with Codex last. Requested models:
- Cursor: `auto`, passed explicitly as `--model auto` (Cursor Auto).
- agy: Gemini 3.8 Flash is requested, but its exact selectable model ID and
effective identity are `NOT_VERIFIED` (the `agy` models query needs a
login that was not available). The profile therefore stays `model: auto`
until an observed model ID exists; do not claim Gemini 3.8 Flash is active.
- agy: `gemini-3.8-flash-high`. `agy models` listed it on 2026-10-20 and a
one-line smoke run answered; the effective identity is still taken from
each run's events.
- PI GLM profile (`pi-glm`): `zai-coding-cn/glm-5.3-flash`, passed as
`--model provider/id`.
- PI MiniMax profile (`pi`): `minimax-cn/MiniMax-M3`, passed as
`--model provider/id`. PI actual events have reported `minimax-cn` /
`MiniMax-M3` and the local offline catalog lists that profile; each run
still records the effective model from that run's events.
- Codex: `gpt-6.1-sol`, always the last candidate.
- Assigning a different candidate or model to a unit needs a concrete,
task-specific reason recorded in the task record, and stays within the
existing roles and candidate lists. It is not a silent permission or routing
change. Role lists, attempt limits, timeouts, output limits, the single
Codex emergency attempt, stage isolation and `fallback_to_host: never` are
unchanged by these preferences.
change. Role lists, attempt limits, timeouts, output limits, Codex as the
last candidate, stage isolation and `fallback_to_host: never` are unchanged
by these preferences.
- A requested model is prompt/config intent. Only the model reported in a
run's actual event envelope counts as effective; when the CLI does not report
it, record `not-observable`. Unknown context capacity, a missing agy login
@@ -0,0 +1,36 @@
# 快慢通道 O2 I1(Agent-Native `route_contract_eof`):阶段 6 评审包
- 状态:**用户阶段 6 通过(2026-10-20)**,接受第 3 节第 1 条的 C2 编号,并要求启动 I2。Agent-Native #48 已合入 main(`2fc66be`)。I3(Dev 改钉)待 I2 后启动,P1 付费探针另提资源方案。
- 日期:2026-10-20;作者:host;Dev 任务:`feature/fast-slow-o2-i1-agent-native`。
- 依据:[阶段 4 方案](2026-10-19-fast-slow-o2-route-contract-eof-design.md)与[阶段 5 计划 §2](../plans/2026-10-19-fast-slow-o2-route-contract-eof-plan.md)(用户 2026-10-20 通过;C2 同时接受 `http2_stream` 与 `known_length`+`match`)。
- 交付对象:Agent-Native 草稿 PR [#48](https://git-home.u1680832.nyat.app:30319/weichen/Agent-Native/pulls/48),base `9c24e22`(origin/main),head `899fd70`。
## 1. 交付内容
| 方案条目 | 实现 | 位置 |
|---|---|---|
| 路由合同与身份绑定(§4.1) | `RouteContractEOF{Model, BaseURL, IdentitySHA256}`、`RouteContractIdentity`、`NormalizeRouteBaseURL`(仅 https,含 userinfo/query/fragment 一律不匹配);`Client.RouteContract` 为 nil/零值即关闭;重定向逐项比较 scheme、host、port、path | `runtime/llm/route_contract.go`、`client.go` |
| 解析器延后判定(计划 §2.2) | 公开 `ParseSSE` 签名与零值行为不变;内部 `parseSSE(…, sseHooks)` 只在“有工具且缺 `[DONE]`”时把成功候选与今天的失败事件一起交给传输层;新增 `finishChunks`、`multiChoice`、`fragmentAfterFinish` 统计 | `runtime/llm/sse.go` |
| 放行条件 C1–C9(§4.2) | 按顺序判定,记录第一个不满足的编号;放行时 `StreamComplete=false`、`CompletionBasis=route_contract_eof` | `route_contract.go` `check` |
| 参数 schema 子集(§4.3) | 新包 `runtime/argschema.Validate`,由 `validateArgs`/`matchesType` 逐字迁移;registry 改为委托 | `runtime/argschema/`、`runtime/tools/registry.go` |
| 可观测性(§4.4) | `Event.CompletionBasis`;`TerminalObservation.completionBasis`/`contractCheck`(仅枚举值);`[DONE]` 成功路径记 `done_marker` | `types.go`、`client.go` |
## 2. 验证
- 实施:Cursor worker(`agent-exec`,attempt 2 success;attempt 1 因单元包 `allowed_paths` 误用 `**` 被判 scope-expansion,修正写法后经用户授权全新重跑),`agent-exec apply` 快进集成。
- host 验证(SELF)@`899fd70`:改动文件 `gofmt` 合格;`git diff --check`;`go vet ./runtime/...`;`go test ./runtime/llm/... ./runtime/argschema/... ./runtime/tools/... -count=1`(另跑 `-race`)与 `go test ./... -count=1` 全部通过。
- CI(GATE):PR #48 head `899fd70` 三项检查 success(`ci / vet-and-test`、`ci / docker-checkout-hostgateway`、`governance / governance`)。
- 独立 Review(全新会话 code-reviewer,只接收需求、base/head 与 diff;评审者自跑为 SELF):**PASS,无阻塞项**。确认零值合同行为不变;拒绝事件与合同关闭事件除 `contractCheck` 外 `reflect.DeepEqual`;`argschema` 与旧实现逐行一致;无数据竞争;计划 §2 测试矩阵每一行都有带断言的用例,并同时断言 Usage 保留与放行次数。
## 3. 需人审确认与非阻塞项
1. **C3 行的编号差异**:计划写的是 HTTP/2 `RST_STREAM`/中途断连期望 C3,实现返回 **C2**。原因是 C2(传输边界)先于 C3 判定,断流时没有见到 EOF,先在 C2 失败。结论同样是拒绝,`contractCheck` 记录的是“第一个不满足的条件”,不一定是根因。请确认接受。
2. **无工具的错误终态也会带 `contractCheck`**(非阻塞):合同开启时,纯文本流遇到供应商错误这类终态也会补一次判定(如记为 `C2`),这类流本来就不可能放行。不影响验收条件 3,也不泄漏内容;可在后续把补判限定为含工具调用的终态。
3. **重复 `finish_reason` 会被 C4 拒绝**(非阻塞,失败关闭):若供应商在 usage 块里重复 `finish_reason`,一律拒绝。MiniMax 真实流是否这样,列为 P1 付费探针的观察点。
4. **测试可加强**(非阻塞):`release/http2` 与 `close-delimited` 用例可直接断言 `BodyBoundary.FramingClass`;补一个“合同开启时纯文本流不变”的回归用例(评审者已用临时探针确认行为不变)。
## 4. 下一步(通过后)
1. 合入 Agent-Native #48(组件仓,无需 #518 窗口)。
2. 启动 I2(Backend:系统层配置键、`openLLMClient` 按身份挂合同、透传 `completionBasis`;启动前核对 Backend 是否有读 `StreamComplete` 的工具门控)。
3. I3 Dev 改钉组合验证;P1 另提资源方案。
@@ -0,0 +1,48 @@
# 快慢通道 O2 I2(Backend `route_contract_eof` 配置与挂载):阶段 6 评审包
- 状态:**用户阶段 6 通过(2026-10-20)**,并要求启动 I3。Backend #224 已合入 main(`c164950`)。P1 付费探针另提资源方案。
- 日期:2026-10-20;作者:host;Dev 任务:`feature/fast-slow-o2-i2-backend`(Dev 草稿 PR [#652](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/652))。
- 依据:[阶段 4 方案 §4.5](2026-10-19-fast-slow-o2-route-contract-eof-design.md) 与[阶段 5 计划 §3](../plans/2026-10-19-fast-slow-o2-route-contract-eof-plan.md);I1 已于 2026-10-20 通过,Agent-Native #48 合入 `2fc66be`。
- 交付对象:Backend 草稿 PR [#224](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/224),base `b5eb89c`(origin/main),head `16f98b8`。
## 1. 交付内容
| 计划条目 | 实现 | 位置 |
|---|---|---|
| 改钉 Agent-Native | `deps/agent-native` `28f3ea7 → 2fc66be`(I1 合入点) | gitlink |
| 系统层配置键 | `models.routeContractEOF.model/.baseUrl/.identitySha256`,`SettingScopeSystem`、缺省空;任一为空即关闭;用户/项目层写入被 `ManagedPaths` 剥除 | `internal/settings/settings.go` |
| 按身份挂合同 | `routeContractFor(eff, route)`:三项非空、模型名精确相等、`NormalizeRouteBaseURL(route.Base)` 成功且等于配置值、`RouteContractIdentity` 等于摘要,全部满足才挂;只看本 client 实际解析出的 (model, base),不看 `Kind` | `internal/runtime/llm.go` |
| 5 个调用点全覆盖 | `llm.go`、`sub_loop.go`、`squad_runner.go`、`verify.go`、`workflow_compiled.go` 统一改用 `openRouteClient(route, eff)`;轻量档、视觉改模、子代理各自独立判定 | 同左 |
| 运行记录透传 | Backend 包装器(`annotateKeyFailure`、`GuardProjectStream`、`budgetedStream` 等)原样转发事件,`CompletionBasis`/`TerminalObservation` 不丢;runmgr/store 本来不记录终态观测,无需改 | 测试断言 |
| 快慢通道收据透传 | 评测工具按同一规则挂合同(导出薄封装 `runtime.RouteContractFor`);受保护 route 文件可选 `routeContractEOF{…}` 移入系统层;`provider-records.json` 每条记录新增 `completionBasis`,`terminalObservation` 透传 `completionBasis`/`contractCheck`,均按枚举白名单(其它值记 `unknown`,空保持空) | `internal/server/work_checkpoint_eval_test.go`(`live` tag) |
## 2. 验证
- 实施:两个 Cursor worker 单元,均经 `agent-exec apply` 快进集成。
- `o2-i2-backend-route-contract-config`:attempt 2 success(attempt 1 是 host 把写单元包与派发并行,导致 invalid-config)。
- `o2-i2b-eval-receipt-route-contract`:补收据透传,attempt 2 success(attempt 1 因 Cursor CLI 连接中断记为 failed-unknown)。两次重跑均经用户授权。
- host 验证(SELF)@`16f98b8`:
- `gofmt`、`git diff --check`、`go vet ./internal/runtime ./internal/server`(含 `-tags live`)通过。
- `go test ./internal/runtime ./internal/settings -count=1` 通过。
- `go test -tags live ./internal/server` 新增 4 个 `TestEvalRouteContract*` 与既有 20 个评测预算/脱敏测试全部通过。
- CI(GATE):Backend CI 跑 `go vet ./... && go test ./...`。
- `e1a90a5` 已 success。
- `16f98b8` success(`ci / vet-and-test` runs/4409、`governance` runs/4410)。
- **`live` tag 的评测测试不在 CI 内**,这部分只有 SELF 和独立评审重放。
- 独立 Review(全新会话,只接收需求、base/head 与 diff):
- 第 1 轮 @`e1a90a5`:PASS-with-fixes。5 条单元验收满足;指出计划 §3 的“快慢通道收据透传”缺失,由第二个单元补齐。
- 第 2 轮 @`16f98b8`:**PASS,无阻塞项**。确认生产代码零行为变化,评测判定经真实 settings 服务与生产同源,白名单无泄漏,不匹配时失败关闭,既有断言未删减;评审者重放 `live` 评测测试与 runtime 测试均通过(REPLAY)。
## 3. 需人审确认与非阻塞项
1. **小队 agent-native 内核不挂合同**(非阻塞,失败关闭):`internal/app/app.go:350` 用主模型路由直接构造 client,不在计划列出的 5 个调用点内,行为维持今天的拒绝。若希望小队路径也享受合同放行,需另开增量。
2. **意图生成器无合同**(无影响):`app.go:519` 不涉及工具放行。
3. **调用点接线靠审读确认**(非阻塞):测试注入 `Stream`,没有直接执行 `Execute` 的 nil-stream 分支;判定函数与包装器透传均有直接测试。
4. **`baseUrl` 说明措辞**(非阻塞):只写了“无查询串”,未提 fragment/userinfo 同样不匹配。
5. **评测配置写错时静默无合同**(非阻塞,建议 P1 前处理):route 文件写了 `routeContractEOF` 但与路由不匹配时,评测按“无合同”运行(安全),但可能白花一次付费请求才发现。建议在 P1 资源方案前,把这种情况改为直接失败,且报错不带配置值。
## 4. 下一步(通过后)
1. 合入 Backend #224(组件仓,无需 #518 窗口);Dev #652 收口合入。
2. 启动 I3:Dev 改钉 Agent-Native `2fc66be` 与 Backend 合入点,`make test` 组合验证,经 #518 窗口合入。
3. P1 付费探针另提资源方案(预算上限、停止条件、收据路径)并单独批准;在此之前不写任何实例的系统层配置。
+11 -10
View File
@@ -73,18 +73,19 @@
[AGENT-EXECUTION.md](../AGENT-EXECUTION.md) 为唯一权威;按角色声明的候选顺序在新进程与
隔离工作区中尝试外部 Agent。不得跨单元复用同一外部进程,也不得 resume 同一次尝试。
实施、修复与测试的正常候选只有 Cursor、Antigravity(`agy`)和 PI。每个候选对安全可恢复失败
最多 3 次全新尝试:`unavailable`,或外部无副作用已被机制证明的 `failed-clean`。三次仍属这类失败后才进入
下一候选。单元包的 `network=false` 与 `external_cost=false` 只是声明,不证明外部干净;当前没有强制的
实施、修复、测试与 Review 的候选为 Cursor、Antigravity(`agy`)、PI(GLM 与 MiniMax 两个档)和
Codex。每个候选对安全可恢复失败最多 3 次全新尝试:`unavailable`,或外部无副作用已被机制证明的
`failed-clean`。三次仍属这类失败后由控制器自动进入下一候选,host 不为此询问用户。
单元包的 `network=false` 与 `external_cost=false` 只是声明,不证明外部干净;当前没有强制的
网络/外部费用隔离或可信对账,所以已启动的失败尝试即使私有克隆可精确恢复,也记为 `failed-unknown`
并保留现场。三个正常候选都安全耗尽后,才允许一次全新的 Codex CLI 紧急尝试;这次不按每候选 3 次计算。
紧急尝试若仍是安全可恢复失败,运行停在 `blocked`。host 不接过该单元继续撰写。
并保留现场。
Codex 平时只用于规划、方案设计、实施计划,或独立 Review。执行配置没有单独的 plan 角色;
上述规划与设计工作可以直接使用 Codex CLI。`review` 角色的候选可以包含 Codex,并按该角色自己的
顺序和尝试上限执行。Codex 不出现在实施、修复、测试的正常候选里;这三个角色上的一次紧急尝试是唯一例外。
Codex 之外的候选顺序可按角色在 [AGENT-EXECUTION.md](../AGENT-EXECUTION.md) 中调整,但 Codex
必须是每个角色的最后一个候选,不设单次紧急尝试。全部候选安全耗尽后运行停在 `unavailable` 或
`blocked`,host 暂停该单元并询问用户是否重试,不接过该单元继续撰写。Codex 另可直接用于规划、
方案设计、实施计划(执行配置没有单独的 plan 角色)。
显式 fail-stop 立即停止整次运行,不重试、不换候选、不启动紧急尝试:`failed-unknown`、
显式 fail-stop 立即停止整次运行,不重试、不换候选:`failed-unknown`、
`scope-expansion`、`blocked`、`cancelled`、无效配置、未对账的 Git 状态与安全失败。总超时,
以及 stdin/stdout/stderr 都没有活动的空闲超时,归入 `failed-unknown`。
@@ -123,7 +124,7 @@ host 可以直接编写并提交的豁免只有 `.task/**`、`docs/superpowers/s
`docs/superpowers/plans/**`。除此之外,host 不直接撰写实施单元。
安全耗尽不发出 `host-fallback-authorized`,`host_fallback_authorizations` 保持为 0。
未配置紧急候选时终态为 unavailable 或 blocked,不授权 host 撰写实施单元。现行
安全耗尽的终态为 unavailable 或 blocked,不授权 host 撰写实施单元。现行
[AGENT-EXECUTION.md](../AGENT-EXECUTION.md) 的 `fallback_to_host` 是 `never`。旧值
`all-unavailable` 仍可解析,但同样不产生 host 撰写授权。已归档任务卡里的旧表述保持原样,
不改写成现行规则。
+3 -3
View File
@@ -11,12 +11,12 @@
### Agent 实施收据与来源
每次外部实施尝试须在任务卡「Agent 实施收据」记录:配置摘要(`AGENT-EXECUTION.md` digest)、
角色、声明候选顺序、attempt、CLI/模型、终态、transport、fallback(只表示该行是否为 Codex
紧急尝试),以及源码外原始收据路径。初始生成状态为 `NOT_RUN`。原始事件流与超限输出保留在
角色、声明候选顺序、attempt、CLI/模型、终态、transport、fallback(是否为应急尝试;现行配置无
应急档,恒为否),以及源码外原始收据路径。初始生成状态为 `NOT_RUN`。原始事件流与超限输出保留在
源码外;未知终态(`failed-unknown`)与 `scope-expansion` 的隔离工作区须保留待对账,不得静默丢弃。
清理须有精确恢复或保留现场的可复核证据。
候选、尝试上限、Codex 紧急尝试、fallback、fail-stop、尝试结束条件,以及 transport/admit
候选、尝试上限、fallback、fail-stop、尝试结束条件,以及 transport/admit
与 host 豁免路径,以[迭代交付](delivery.md#agent-实施单元与主模型职责)为唯一权威。
## 启动与恢复
+1 -1
View File
@@ -14,7 +14,7 @@
| A5 回收 | 本地命令检查;写者退出须可证明,无法证明时才请求 owner 决策 | 登记根目录、锁/操作状态、父子仓与唯一文件、合入核验 | `tests/test_task.py` |
| A6 秘密 | 本地脱敏及 CI 获取边界;权限与宿主隔离另验 | 命令/输出/摘要脱敏,凭据不持久写 Git 配置 | `tests/test_evidence.py`、`tests/test_ci_credentials.py` |
| A7 证据 | 本地 SELF 收据;外部来源独立核验 | 首次捕获、完整脱敏输出/摘要、对象记录、原样导入 | `tests/test_evidence.py`;CI/审阅链接另核 |
| A8 阶段记录与迭代 | goal-first + agent-per-unit(AGENT-EXECUTION.md);模板默认连续执行,仅真实决策点需人工,没有全流程授权强制;实施/修复/测试仅 Cursor、agy、PI,每候选对安全可恢复失败最多 3 次全新尝试,全部安全耗尽后一次 Codex CLI 紧急尝试;Codex 平时仅规划、设计、计划或独立 Review;显式 fail-stop 立即停止;不限制推理时长、工具次数、规划方式或首次写文件时间;集成经成功 transport 的 agent-exec apply,或 pre-commit admit 精确内容来源;host 豁免仅为 .task/** 与 docs/superpowers/specs/**、plans/**;host 不直接实施;fallback_to_host 为 never;安全耗尽不发出 host-fallback-authorized,终态为 unavailable 或 blocked | policy/delivery.md、AGENT-EXECUTION.md;任务卡分别记录阶段状态、决策点、Agent 实施收据(配置摘要/角色/候选/attempt/CLI-模型/终态/transport/紧急尝试/源码外路径)、Review、冲突、当前 HEAD 的 CI 和合入;post-merge 默认仅提示 | `tests/test_task.py` 核对 goal-first/agent-per-unit 模板、正常路由、尝试上限、fail-stop、空闲超时与 apply/admit 来源表述,及钩子不自动写入;`scripts/agent-exec validate`(CI)与 parser·adapter·controller 假 CLI 契约(Development-Manager internal/agentexec 测试,经 deps/development-manager 钉住)为本地 SELF 强制行为;已安装 provider/model 身份待 U5,远端平台准入为 GATE;智能体核对授权范围、实施单元边界、Review、冲突及匹配 HEAD 的 CI/平台准入 |
| A8 阶段记录与迭代 | goal-first + agent-per-unit(AGENT-EXECUTION.md);模板默认连续执行,仅真实决策点需人工,没有全流程授权强制;实施/修复/测试/Review 候选为 Cursor、agy、PI(GLM、MiniMax)与最后的 Codex,每候选对安全可恢复失败最多 3 次全新尝试并自动换候选,全部安全耗尽后暂停询问用户是否重试;显式 fail-stop 立即停止;不限制推理时长、工具次数、规划方式或首次写文件时间;集成经成功 transport 的 agent-exec apply,或 pre-commit admit 精确内容来源;host 豁免仅为 .task/** 与 docs/superpowers/specs/**、plans/**;host 不直接实施;fallback_to_host 为 never;安全耗尽不发出 host-fallback-authorized,终态为 unavailable 或 blocked | policy/delivery.md、AGENT-EXECUTION.md;任务卡分别记录阶段状态、决策点、Agent 实施收据(配置摘要/角色/候选/attempt/CLI-模型/终态/transport/fallback/源码外路径)、Review、冲突、当前 HEAD 的 CI 和合入;post-merge 默认仅提示 | `tests/test_task.py` 核对 goal-first/agent-per-unit 模板、正常路由、尝试上限、fail-stop、空闲超时与 apply/admit 来源表述,及钩子不自动写入;`scripts/agent-exec validate`(CI)与 parser·adapter·controller 假 CLI 契约(Development-Manager internal/agentexec 测试,经 deps/development-manager 钉住)为本地 SELF 强制行为;已安装 provider/model 身份待 U5,远端平台准入为 GATE;智能体核对授权范围、实施单元边界、Review、冲突及匹配 HEAD 的 CI/平台准入 |
| A9 长期方向与后续任务 | manual;模板不校验规划有效性或自动调度任务 | policy/delivery.md;PROJECT.md 提供规划入口,任务卡关联规划/里程碑并记录下一步建议 | `tests/test_task.py` 核对生成字段与未授权默认值;智能体核对当前规划、进展、重复任务和建议依据,新任务仍不自动获得授权 |
| A10 交付窗口 | manual;无自动互斥或接管 | [合入调度](delivery.md#合入调度)与 #518:同一目标一个最终窗口,等待分支不追 main;轮到后同步、固定、验证并由智能体合入 | 每个实际 PR 核对窗口记录、精确 HEAD 三项 GATE、Review 和合入后 main;不要求额外试行或全写者审计 |
| A11 固定后证据 | manual 选择源码外位置;工具捕获绝对未用路径/原始输出;无 OS 冻结 | policy/governance.md;RECEIPT 捕获,后续授权闭合再原样导入 | `tests/test_evidence.py` 固定对象、权限、覆盖拒绝、原样导入与幂等 |