diff --git a/.task/archive/feature-cli-agent-fallback-chain.md b/.task/archive/feature-cli-agent-fallback-chain.md new file mode 100644 index 00000000..5fa0137d --- /dev/null +++ b/.task/archive/feature-cli-agent-fallback-chain.md @@ -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) + + +| 时间(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/分支/任务卡处置) + + +```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" +} +``` + + +```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" +} +``` + + +```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" +} +``` + + +```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" +} +``` + + +```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" +} +``` + + +```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 | + + +```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" +} +``` + + +```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。 diff --git a/.task/archive/feature-docker-test-image.md b/.task/archive/feature-docker-test-image.md new file mode 100644 index 00000000..1ab27962 --- /dev/null +++ b/.task/archive/feature-docker-test-image.md @@ -0,0 +1,254 @@ +# feature/docker-test-image 任务卡 + +任务主记录:PR #645 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/645;状态:已完成(合入前闭合);owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 162c5a0160955989608f325b4be30458e3717d16 +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-docker-test-image(worktree);分支:feature/docker-test-image +- 分支类型:standalone;root_target:main;immediate_target:main;accepting_requirements:false +- 需求分流:verdict=NEW;selected_initiative=无;requirement_sha256=614aefe70dd97a672de9522beee5fece3da4719ee310d1c7cfc4d13fea081ac2;triage_receipt=/tmp/docker-image-triage.json;receipt_sha256=bc1c9cab074d853273d064a98599c6ef2519aa4022f2272bcc0830d3d97d01c0 + +- 授权与交付终点:用户直接请求(2026-10-20):为本系统准备 Docker 测试镜像(含系统环境、SSH、无头浏览器),后续测试用该镜像启动容器做隔离测试。终点=镜像定义与构建/验证入口合入 main:docker/ 定义文件 + Makefile image-build/image-verify + docker/README.md,镜像本机构建通过、容器内环境自检通过。未授权事项:不改动 modules/**、CI/治理脚本、部署形态(本仓交付仍非容器化);不发布镜像到外部 registry;不把本镜像用于生产部署。 +- 交付模式:goal-first(目标、范围和交付终点一次确认;范围内连续推进) +- 实施执行:agent-per-unit(配置:AGENT-EXECUTION.md) +- 合入执行:agent(已授权交付范围内,Review 通过、冲突解决且当前 HEAD 的 CI 通过后合入) +- 人工决策点:仅限目标/范围/验收变更、重大取舍、高后果操作或无法自动判定的业务验收 +- 当前阶段:需求拆解;当前增量:I1(待定义) +- 流程依据:仓库根目录 policy/delivery.md(归档后仍按仓库根目录定位) + +## 目标与非目标 + +目标:一份可重复构建的测试环境镜像定义(docker/),镜像内提供与本机开发一致的工具链(Go 1.27.1、Node 26.10.0、Python 3.14、git、make)、SSH 服务(仅公钥、专用 dev 用户)与无头浏览器(Playwright 1.64.0 chromium,系统级缓存 /opt/ms-playwright),供后续以 `docker run` 启动一次性容器、挂载仓库做隔离测试。 + +入口/影响:新增 docker/(Dockerfile、entrypoint.sh、verify-env.sh、README.md);根 Makefile 新增 image-build / image-verify 两个目标。不嵌入仓库代码与任何密钥;不改变 `make test`/CI 行为;不引入部署容器化。 + +非目标:镜像注册表发布、CI 内构建镜像、多架构构建、给镜像装业务代码/子模块、Windows/macOS 镜像。 + +## Agent 实施收据 + +路由与 fail-stop 规则见根目录 AGENT-EXECUTION.md 与 policy/delivery.md;每次尝试一行,原始日志留在源码外收据路径。 + +| 单元 ID | 预期范围 | 配置摘要 | 角色 | 候选顺序 | attempt | CLI/模型 | 终态 | transport | fallback | 源码外收据路径 | +|---|---|---|---|---|---|---|---|---|---|---| +| docker-test-image | docker/**、Makefile | AGENT-EXECUTION.md(agent-execution/v1) | implementation | cursor→antigravity→pi(紧急 codex) | cursor#a1(运行 1) | cursor-agent-stable/auto | failed-unknown(cursor 后端连接反复中断,exit 1) | 未发生 | 无 | /tmp/docker-image-unit1-receipt.json;隔离工作区保留于 /tmp/agent-exec-1000/ebd031a7b7be000aca6f401395d70cd1/wt-bb3cf3ec9e85 | +| docker-test-image | 同上(重派发) | 同上 | implementation | 同上 | cursor#a1(运行 2,重发前已对账+探活) | cursor-agent-stable/auto | failed-unknown(Cursor 月度额度耗尽 ActionRequiredError,非瞬时) | 未发生 | 无 | /tmp/docker-image-unit2-receipt.json;隔离工作区保留于 /tmp/agent-exec-1000/90bc3c29e3ea2d9fbebc9e376461846f/wt-c0358fa94a6b | +| docker-test-image | 同上(误派发) | 同上 | implementation | 同上 | — | — | invalid-config(运行前检出脏:host 对 AGENT-EXECUTION.md 的直接改动被 admit 拒绝后残留,已回滚,未启动任何候选) | 未发生 | 无 | /tmp/docker-image-unit3-receipt.json | +| docker-test-image | 同上(重派发) | AGENT-EXECUTION.md(cursor 停用后,16776aa) | implementation | antigravity→pi(紧急 codex) | agy#a1(运行 4) | antigravity/auto | failed-unknown(实现与验证全部完成、终态记录已输出,但会话尾部一次后端 API EOF 污染 result 信封,控制器 fail-closed 未建 transport;镜像已建成且 verify-env PASS 经 host 独立复核) | 未发生 | 无 | /tmp/docker-image-unit4-receipt.json;隔离区 /tmp/agent-exec-1000/78f91904001532b603bf0ceeb292b893/wt-3ec6b80250c3(含已验证实现) | +| docker-test-image | 同上(重验证派发) | 同上 | implementation | 同上 | agy#a2(运行 5,对账后;连续第二次因传输机制的 failed-unknown 重派发,若再失败则回到用户决策,不无限循环) | 待运行 | NOT_RUN | NOT_RUN | NOT_RUN | /tmp/docker-image-unit5-receipt.json | + +- 配置摘要来源:AGENT-EXECUTION.md `agent-execution` 块(schema v1;implementation 候选 cursor/agy/pi,每候选至多 3 次,紧急 codex 一次,fallback_to_host=never);运行收据由 scripts/agent-exec run 写出后原样保留在源码外路径。 +- 运行 1 对账(2026-10-20):镜像未构建(docker images 无 agent-system-test-*)、无新增容器、规范检出干净;改动仅存在于保留的隔离工作区(Makefile M + docker/ 4 文件);cursor 探活已恢复(探针 exit 0)。据此授权同一单元重新派发(新 run,非同 run 盲重试)。 +- 运行 2 对账(2026-10-20):终态原因实为 Cursor Ultra 月度用量额度耗尽(ActionRequiredError,重置日 2026-11-10),属确定性不可用;host 依配置 enabled 机制停用 cursor 时被 pre-commit admit 拒绝(非豁免路径须 transport 来源),路由改动本身又需一次成功运行——死锁,经用户选项 1 解除(见下方决策点)。 +- 运行 4 对账(2026-10-20):worker 完成实现且四条验证自报通过,host 独立重跑 `docker run --rm --shm-size=1g agent-system-test-env:dev /usr/local/bin/verify-env.sh` → verify-env: PASS;失败纯属会话尾部 API EOF 污染 result 信封(raw log 尾部 `streamGenerateContent: EOF`),非内容缺陷。镜像 agent-system-test-env:dev 已在 daemon 中(层缓存可复用)。授权重派发运行 5 作纯重验证;若再因传输机制失败,停止并回用户决策。 + +## 关联方向与规划 + +- 适用状态:待核对(无适用规划时说明原因) +- 主记录路径/版本:待核对(路径按仓库根目录定位,归档后不变;只引用唯一正文) +- 对应里程碑:待核对 + +## 需求分析 + +| ID | 描述 | 项目符合度及依据 | 优先级 | 验收条件 | 依赖 | 结论 | +|---|---|---|---|---|---|---| +| R1 | 测试环境镜像定义:docker/ 内 Dockerfile 固定 ubuntu:24.04(amd64)+ Go 1.27.1 + Node 26.10.0 + Python 3.14(deadsnakes)+ git/make/openssh-server/sudo + Playwright 1.64.0 chromium(/opt/ms-playwright) | 与本机开发工具链版本一致(实测:go1.27.1 / v26.10.0 / 3.14.8 / playwright 1.64.0),避免测试行为漂移 | 高 | `docker build -t agent-system-test-env:dev docker/` 退出 0 | 无 | 已确认 | +| R2 | SSH 就绪:容器以 root 入口前台跑 sshd;PermitRootLogin no、PasswordAuthentication no;dev 用户(UID 1000、NOPASSWD sudo);host key 首启生成;authorized_keys 运行时只读挂载注入 | 隔离测试需要经 SSH 进入容器;公钥注入避免镜像携带凭据 | 高 | 容器内 `sshd -t` 通过;dev 存在且 sudo NOPASSWD;镜像内无任何私钥/secret | R1 | 已确认 | +| R3 | 无头浏览器可用:镜像内预装 playwright 1.64.0 chromium 及系统依赖,ENV PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright | frontend e2e(@playwright/test ^1.50.1,解析 1.64.0)容器内可直接跑;版本对齐避免浏览器 revision 漂移 | 高 | verify-env.sh 中 chromium --headless --dump-dom about:blank 输出 HTML | R1 | 已确认 | +| R4 | 构建/验证入口与文档:Makefile image-build / image-verify;docker/README.md 覆盖构建、启动(端口映射、--shm-size、公钥挂载、仓库挂载 /workspace)、容器内跑 e2e 示例与安全边界 | 用户后续直接用这两个入口启动隔离测试容器 | 中 | `make image-build`、`make image-verify` 可用;README 含最小可复现命令 | R1–R3 | 已确认 | + +## 方案与计划 + +- 方案引用:本卡「目标与非目标」+ 单元包 /tmp/unit-docker-test-image.json(digest 由运行收据记录);固定版本事实:go1.27.1、node v26.10.0、python 3.14.8、playwright 1.64.0(本机实测于 2026-10-20) +- 实施计划引用:单单元 docker-test-image(docker/** + Makefile 内聚小任务,合为一个包) +- 测试计划引用:R1–R4 验收条件 = worker 窄检查(docker build + 容器内 verify-env.sh);host 权威验证在 apply 后本仓重跑同两命令 + +## 阶段记录 + +| 阶段 | 对象版本 | 状态 | 决策/执行者 | 时间 | 依据 | +|---|---|---|---|---|---| +| 需求拆解 | R0=162c5a0160 | 已完成 | host 主模型 | 2026-10-20 | AGENTS.md 路由 + policy/delivery.md | +| 需求评估 | R0=162c5a0160 | 已完成 | host 主模型 | 2026-10-20 | 本卡需求表 R1–R4 | +| 需求表确认 | R0=162c5a0160 | 已完成 | 用户直接请求即授权 | 2026-10-20 | 授权与交付终点节 | +| 方案设计 | R0=162c5a0160 | 已完成 | host 主模型 | 2026-10-20 | 见方案与计划 | +| 实施计划 | R0=162c5a0160 | 已完成 | host 主模型 | 2026-10-20 | 单元 docker-test-image(单元包 /tmp/unit-docker-test-image.json) | +| 实施与自检 | de3d3aff(transport de3d3aff285e0dcfd185c9904a3a9b01af34e2fa) | 已完成 | agy worker(运行 4 实现、运行 5 重验证)→ host apply | 2026-10-20 | /tmp/docker-image-unit5-receipt.json;运行 1–5 详见收据表 | +| 正式测试与验收 | de3d3aff | 已完成(SELF;GATE 待 CI) | host 主模型 | 2026-10-20 | make image-build / image-verify 证据入卡;CI 待验 | +| 代码 Review | de3d3aff | 进行中 | host 主模型(policy 允许,独立于实施会话) | 2026-10-20 | 见合入与清理节 Review 记录 | +| 合入 | de3d3aff | 待执行 | host(授权范围内) | — | 按 policy/delivery.md 合入流程 | +| 合入核验与收口 | — | 待执行 | host | — | — | + +### 决策点(2026-10-20,已闭合) + +implementation/repair 角色首候选 cursor 因月度额度耗尽必然失败,且路由配置无法由 host/worker 合规变更。选项及结果: + +1. **已采纳(用户 2026-10-20 选定选项 1)**:用户以自身授权在任务 worktree 编辑 AGENT-EXECUTION.md 将 cursor profile `enabled: false`(附注释,额度重置后恢复),并亲自 `git commit --no-verify` 提交为 16776aa(配置 diff 已在决策菜单中预告并经用户选择,validate 通过)。host 据此重派发,路由落到探活正常的 antigravity。额度重置后应恢复 enabled: true。 +2. 用户在 Cursor 提高 Spend Limit(未采用)。 +3. 等待 2026-11-10 重置(未采用)。 +4. host 以 role=test 派发(未采用,角色标签与工作性质不符)。 + +## 探索试验与迭代 + +| 增量/试验 | 假设 | 范围 | 判断和停止条件 | 授权/决策依据 | 结果 | 变更影响 | 需重审补测 | +|---|---|---|---|---|---|---|---| +| I1 | docker/ 镜像定义可构建、容器内自检通过 | 单一交付 | build+verify 通过即停,不做镜像优化迭代 | 授权与交付终点节 | NOT_RUN | 待评估 | 待评估 | + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | 162c5a0160955989608f325b4be30458e3717d16 | 162c5a0160955989608f325b4be30458e3717d16 | 2026-10-20T02:39:22Z | + +## 证据(Evidence) + + +| 时间(UTC) | 命令 | 被测HEAD | exit | 来源 | sha256(16) | +|---|---|---|---|---|---| + +## 交付调度 + +- 调度状态:未入队;调度记录:无 +- entry_id:无;attempt_id:无;窗口执行者:无 +- 固定候选:无(base/head、组件与相关配置引用实际尝试) +- 调度依据:policy/delivery.md#合入调度 +- 固定后证据:源码外 RECEIPT;实际结果后按授权原样导入和闭合 + +## 结果与验证 + +- 结果:docker/ 测试环境镜像定义(Dockerfile + entrypoint.sh + verify-env.sh + README.md)与根 Makefile image-build/image-verify 目标已由 worker 交付、host apply 入分支(de3d3aff)。镜像 ubuntu:24.04 + Go 1.27.1 + Node 26.10.0 + Python 3.14(deadsnakes)+ Playwright 1.64.0 chromium(/opt/ms-playwright)+ sshd(仅公钥、dev 用户 NOPASSWD sudo、root 登录关闭)。 +- 验证:`make image-build` exit=0(SELF,证据块);`make image-verify` exit=0 且 verify-env: PASS(SELF);worker 四条自检通过;R1–R4 验收条件全部满足。已知非阻塞项:Dockerfile `FROM --platform=linux/amd64` 触发 buildkit 一条 lint 警告(有意钉住 amd64,不改)。CI GATE 与 Review 见合入与清理节。 +- 影响与剩余项:仅新增 docker/ 与 Makefile 两个目标,不触碰 modules/CI/治理脚本;镜像不发布外部 registry。剩余:PR CI、独立 Review、合入与回收。 + +## 规划进展与下一步 + +- 本次推进/剩余:待核对(依据实际成果更新适用方案/规划) +- 首选下一任务:待核对(无适用规划、已完成或受阻时如实说明,不虚构任务) +- 推荐依据:待填写 +- 前置条件/待确认:待核对 +- 预期产物/验收条件:待定义 +- 重复任务核对:待核对(已有/在途任务、PR 与规划记录) +- 启动授权:未授权(建议不自动启动新任务,仍须明确授权) + +## 合入与清理 + +- Review 记录:PASS(host 主模型独立 Review,非实施会话;对象 base=origin/main/d2035c76 head=b9c0fc3)。范围核对:7 文件全部在授权内(docker/ 4 文件 + Makefile 增量 + 任务卡 + AGENT-EXECUTION.md 路由调整 16776aa);Go/CI/脚本/modules 零触碰;secret 扫描无命中(仅 task-start 等词的 sk- 误报);Makefile 除 .PHONY 一行外纯增量。非阻塞观察:① FROM --platform=linux/amd64 触发 buildkit lint 警告(有意钉 amd64,接受);② sshd_config 追加式覆盖依赖 stock ubuntu 默认(测试镜像可接受,verify-env 已断言 sshd -t)。 +- 冲突记录:main 前进至 d2035c7(含 #644)后合并 origin/main(merge commit b9c0fc3),无冲突;新 gitlink 物化后 make test-worktree 递归核对通过;modules/frontend 仍解析 @playwright/test ^1.50.1(镜像内浏览器 1.64.0 对齐不变)。 +- CI 记录:CI_SUCCESS @ b9c0fc3fa1817812295394e069b457cc098e1f24(ci / test、test-pg、svc-realcombo 全绿,runs 4360)。过程备注:首候选 HEAD 8e062ca 的 test-pg 首跑 TestArtifactFacadeCard 失败(伴随 database is closed 收尾噪音),重跑同 job 即 success,判偶发;b9c0fc3 的 test 首跑为 npm EIDLETIMEOUT 网络抖动,重跑 success。两次均非本 PR 内容缺陷(本 PR 未触碰 Go/npm 依赖)。 +- 合入记录:待执行(合入后回填) +- 清理记录:待执行(合入后回填) + + +```json +{ + "summary_schema": 1, + "source": "SELF", + "timestamp": "2026-10-20T02:38:25.695061+00:00", + "command": "make precheck", + "exit_code": 0, + "cwd": "/home/weichen/projects/Agent-System-Dev", + "before_head": "162c5a0160955989608f325b4be30458e3717d16", + "after_head": "162c5a0160955989608f325b4be30458e3717d16", + "branch": "main", + "target_branch": "main", + "target_head": "162c5a0160955989608f325b4be30458e3717d16", + "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=162c5a0160", + "[remote] origin/main=162c5a0160 ahead=0 behind=0", + "[tree] clean submodules_drift=0 uninit=0", + "[worktrees] linked=6", + "[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] 162c5a0160(完整:162c5a0160955989608f325b4be30458e3717d16)", + "[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": "9e1904b7470a27857bd0243bc42faff0a9eb9cafc6916ad823fb1ccfea32f3b3", + "receipt_sha256": "838d0ce05fc8661b279c5ccd7696cbe4712cd582b3bf39411ede4265e314a7f1", + "receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/838d0ce05fc8661b279c5ccd7696cbe4712cd582b3bf39411ede4265e314a7f1.json" +} +``` + + +```json +{ + "summary_schema": 1, + "source": "SELF", + "timestamp": "2026-10-20T04:24:06.218569+00:00", + "command": "make image-build", + "exit_code": 0, + "cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-docker-test-image", + "before_head": "de3d3aff285e0dcfd185c9904a3a9b01af34e2fa", + "after_head": "de3d3aff285e0dcfd185c9904a3a9b01af34e2fa", + "branch": "feature/docker-test-image", + "target_branch": "main", + "target_head": "d2035c76dc1cb15e01d2c184af5155d9d773cd9f", + "root_target": "main", + "immediate_target": "main", + "before_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "after_tracked_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "output_tail": [ + "#10 CACHED", + "", + "#11 exporting to image", + "#11 exporting layers done", + "#11 exporting manifest sha256:1b70b78c47f81555bca6525d04f8fefa836eb817d37bd018fcd71632c9cce13b done", + "#11 exporting config sha256:af4c14981be06d79e082e1685dd6f5aac947bc2f08022de3efdb8a158d656ffb done", + "#11 exporting attestation manifest sha256:bebc178b5c4328c737af45858184422a642deb66ac627d6cc80d6ec3c003f246 done", + "#11 exporting manifest list sha256:b9244ca7c49a4192b6beee8cb66ea148f2b07d6c26e613f3661aba4e569b6fa4 done", + "#11 naming to docker.io/library/agent-system-test-env:dev done", + "#11 unpacking to docker.io/library/agent-system-test-env:dev done", + "#11 DONE 0.0s", + "", + " \u001b[33m1 warning found (use docker --debug to expand):", + "\u001b[0m - FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value \"linux/amd64\" (line 1)", + "make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-docker-test-image'" + ], + "output_sha256": "9d5d28f761a75ec302f735b181d53f3a31893b29a7db1417da0b580d39a6ede9", + "receipt_sha256": "10c826d7803683685c0fe49e99b8a86a04e0d675b14aad637f50220a48b13d58", + "receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/10c826d7803683685c0fe49e99b8a86a04e0d675b14aad637f50220a48b13d58.json" +} +``` + + +```json +{ + "summary_schema": 1, + "source": "SELF", + "timestamp": "2026-10-20T04:24:15.223285+00:00", + "command": "make image-verify", + "exit_code": 0, + "cwd": "/home/weichen/projects/Agent-System-Dev-wt-feature-docker-test-image", + "before_head": "de3d3aff285e0dcfd185c9904a3a9b01af34e2fa", + "after_head": "de3d3aff285e0dcfd185c9904a3a9b01af34e2fa", + "branch": "feature/docker-test-image", + "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-docker-test-image'", + "docker run --rm --shm-size=1g agent-system-test-env:dev /usr/local/bin/verify-env.sh", + "verify-env: PASS", + "make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-docker-test-image'" + ], + "output_sha256": "4e670ae97df841f706396291f73ef43e7702f9fd60cfe163b37699ca5968804a", + "receipt_sha256": "3c69f4644d10998f86733da4486b1967e49c310aad4a932aa13a7bddaf387265", + "receipt_path": "/home/weichen/.cache/agent-system-dev/evidence/3c69f4644d10998f86733da4486b1967e49c310aad4a932aa13a7bddaf387265.json" +} +``` + +## 闭合记录(合入前折叠) + +- 本卡在 PR #645(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/645)合入前闭合并归档,随该 PR 一同合入。 +- 该 PR 的合并提交即本任务的落地记录。 +- 合入后无需回填,也无需单独的闭合 PR。 diff --git a/.task/archive/feature-fast-slow-o2-i1-agent-native.md b/.task/archive/feature-fast-slow-o2-i1-agent-native.md new file mode 100644 index 00000000..d9947912 --- /dev/null +++ b/.task/archive/feature-fast-slow-o2-i1-agent-native.md @@ -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) + + +| 时间(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 合入后回收。 + + +```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 | diff --git a/AGENT-EXECUTION.md b/AGENT-EXECUTION.md index e2113d1e..502cc4c0 100644 --- a/AGENT-EXECUTION.md +++ b/AGENT-EXECUTION.md @@ -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,25 +39,34 @@ 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: adapter: cursor executable: cursor-agent-stable model: auto + # Re-enabled 2026-10-20: the earlier disable was based on a misreading + # of ActionRequiredError — the real cause was the DM executor not + # passing --model auto (cursor fell back to a quota-limited model). + # Fixed by PR #644 (deps/development-manager pin); quota itself is fine. enabled: true 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: @@ -67,7 +78,7 @@ profiles: codex: adapter: codex executable: codex - model: auto + model: gpt-6.1-sol enabled: true integration: @@ -92,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 diff --git a/Makefile b/Makefile index 253954bb..49ef2bb9 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ PLUGINS := plugins COMBO := core=$(shell git -C $(CORE) rev-parse --short HEAD 2>/dev/null)+backend=$(shell git -C $(BACKEND) rev-parse --short HEAD 2>/dev/null)+frontend=$(shell git -C $(FRONTEND) rev-parse --short HEAD 2>/dev/null)+ui=$(shell git -C $(UI) rev-parse --short HEAD 2>/dev/null)+agentcmd=$(shell git -C deps/agent-command rev-parse --short HEAD 2>/dev/null)+documents=$(shell git -C modules/documents rev-parse --short HEAD 2>/dev/null)+native=$(shell git -C deps/agent-native rev-parse --short HEAD 2>/dev/null)+squad=$(shell git -C deps/agent-squad rev-parse --short HEAD 2>/dev/null)+intent=$(shell git -C deps/agent-intent rev-parse --short HEAD 2>/dev/null) VERSION := $(shell git describe --tags --always --dirty 2>/dev/null)+$(COMBO) -.PHONY: help sync status build frontend svc svc-list svc-info svc-commits svc-history svc-update svc-recover svc-watchdog test-backend test-backend-pg test-multi-instance test-lifecycle test-regulations-kb test-frontend test-ui test-core test-agentcmd test-pins test-libs dev pin clean setup precheck task-triage task-triage-decide task-start task-resume task-sync task-close task-finish task-pr-check ci-wait facts-verify evidence version agent-exec-validate agent-exec-apply agent-exec-admit +.PHONY: help sync status build frontend svc svc-list svc-info svc-commits svc-history svc-update svc-recover svc-watchdog test-backend test-backend-pg test-multi-instance test-lifecycle test-regulations-kb test-frontend test-ui test-core test-agentcmd test-pins test-libs dev pin clean setup precheck task-triage task-triage-decide task-start task-resume task-sync task-close task-finish task-pr-check ci-wait facts-verify evidence version agent-exec-validate agent-exec-apply agent-exec-admit image-build image-verify version: @echo "agent-system $(VERSION)" @@ -99,6 +99,8 @@ help: @echo "make dev 开发模式说明(前后端分离热更新)" @echo "make pin 推进 submodule 指针到各仓远端 main(提交前须 make test 通过)" @echo "make status submodule 状态" + @echo "make image-build 构建 Docker 测试环境镜像 agent-system-test-env:dev" + @echo "make image-verify 运行镜像内环境自检 verify-env.sh" @echo "make agent-exec-validate 校验 AGENT-EXECUTION.md(scripts/agent-exec validate,经 dm-server agent-exec)" @echo "make agent-exec-apply RECEIPT= 快进当前分支到成功收据的 transport" @echo "make agent-exec-admit 校验暂存路径具备 transport 来源或属于 host 豁免" @@ -118,6 +120,12 @@ agent-exec-apply: agent-exec-admit: scripts/agent-exec admit --repo . +image-build: + docker build -t agent-system-test-env:dev docker/ + +image-verify: + docker run --rm --shm-size=1g agent-system-test-env:dev /usr/local/bin/verify-env.sh + sync: git submodule update --init --recursive --jobs 8 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..60494a26 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,50 @@ +FROM --platform=linux/amd64 ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive +ENV PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright +ENV PATH=/usr/local/go/bin:/usr/local/lib/nodejs/node-v26.10.0-linux-x64/bin:${PATH} + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + git \ + libatomic1 \ + make \ + openssh-server \ + sudo \ + xz-utils \ + software-properties-common \ + && add-apt-repository -y ppa:deadsnakes/ppa \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + python3.14 \ + python3.14-venv \ + && python3.14 -m ensurepip --upgrade \ + && ln -sf /usr/bin/python3.14 /usr/local/bin/python3 \ + && ln -sf /usr/bin/python3.14 /usr/local/bin/python \ + && rm -rf /var/lib/apt/lists/* + +RUN curl -fsSL https://go.dev/dl/go1.27.1.linux-amd64.tar.gz -o /tmp/go1.27.1.linux-amd64.tar.gz \ + && rm -rf /usr/local/go \ + && tar -C /usr/local -xzf /tmp/go1.27.1.linux-amd64.tar.gz \ + && curl -fsSL https://nodejs.org/dist/v26.10.0/node-v26.10.0-linux-x64.tar.xz -o /tmp/node-v26.10.0-linux-x64.tar.xz \ + && mkdir -p /usr/local/lib/nodejs \ + && tar -C /usr/local/lib/nodejs -xJf /tmp/node-v26.10.0-linux-x64.tar.xz \ + && npx -y playwright@1.64.0 install --with-deps chromium \ + && rm -f /tmp/go1.27.1.linux-amd64.tar.gz /tmp/node-v26.10.0-linux-x64.tar.xz \ + && rm -rf /var/lib/apt/lists/* + +RUN userdel -r ubuntu 2>/dev/null || true \ + && groupdel ubuntu 2>/dev/null || true \ + && groupadd --gid 1000 dev \ + && useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash dev \ + && echo "dev ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/dev \ + && chmod 0440 /etc/sudoers.d/dev \ + && printf '\nPermitRootLogin no\nPasswordAuthentication no\nPubkeyAuthentication yes\n' >> /etc/ssh/sshd_config + +COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh +COPY --chmod=755 verify-env.sh /usr/local/bin/verify-env.sh + +EXPOSE 22 +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000..e27ba214 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,57 @@ +# Docker 测试环境镜像说明 + +## 用途与边界 + +本目录用于定义一个可重复构建的隔离测试环境镜像,供后续用该镜像启动一次性容器、挂载当前仓库做隔离测试。 + +- 该镜像只提供测试运行环境,不包含仓库代码。 +- 该镜像不包含任何密钥、私钥或凭据。 +- 本仓正式交付流程仍以非容器化路径为准,此镜像仅用于辅助隔离测试。 + +## 构建与自检 + +在仓库根目录执行: + +```bash +make image-build +make image-verify +``` + +- `make image-build`:构建镜像 `agent-system-test-env:dev`。 +- `make image-verify`:运行镜像内环境自检脚本 `/usr/local/bin/verify-env.sh`。 + +## 启动测试容器示例 + +```bash +docker run -d --name asdev-test --shm-size=1g -p 127.0.0.1:2222:22 -v ~/.ssh/id_ed25519.pub:/home/dev/.ssh/authorized_keys:ro -v $PWD:/workspace agent-system-test-env:dev +``` + +说明: + +- `authorized_keys` 挂载源可以替换为任意可用的 `.pub` 公钥文件。 +- 容器内 SSH 登录用户为 `dev`。 +- `dev` 用户已配置 sudo 免密。 + +进入容器: + +```bash +ssh -p 2222 dev@127.0.0.1 +``` + +## 容器内最小测试流程 + +```bash +cd /workspace +make sync +cd modules/frontend +npm ci +npx playwright test +``` + +说明:镜像已内置 `PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright` 下的 Chromium,通常无需在容器内再次执行 `playwright install`。 + +## 安全说明 + +- 容器内无密码登录,仅允许公钥认证。 +- 每个容器实例在启动时独立生成 SSH host key。 +- 不要将生产凭据、私钥或其他敏感文件带进容器。 diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 00000000..709c028b --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +mkdir -p /run/sshd +ssh-keygen -A + +install -d -m 0700 -o dev -g dev /home/dev/.ssh + +if [ -f /home/dev/.ssh/authorized_keys ]; then + tmp_authorized_keys="$(mktemp)" + cp /home/dev/.ssh/authorized_keys "${tmp_authorized_keys}" + install -m 0600 -o dev -g dev "${tmp_authorized_keys}" /home/dev/.ssh/authorized_keys 2>/dev/null || { + chown dev:dev /home/dev/.ssh/authorized_keys 2>/dev/null || true + chmod 0600 /home/dev/.ssh/authorized_keys 2>/dev/null || true + } + rm -f "${tmp_authorized_keys}" +fi + +if [ "$#" -gt 0 ]; then + exec "$@" +fi + +exec /usr/sbin/sshd -D -e diff --git a/docker/verify-env.sh b/docker/verify-env.sh new file mode 100644 index 00000000..483a67fe --- /dev/null +++ b/docker/verify-env.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -euo pipefail + +fail_expect() { + local expected="$1" + local actual="$2" + echo "校验失败: 期望: ${expected}" + echo "校验失败: 实际: ${actual}" + exit 1 +} + +command -v git >/dev/null 2>&1 || fail_expect "git 可执行文件存在" "git 不存在" +command -v make >/dev/null 2>&1 || fail_expect "make 可执行文件存在" "make 不存在" + +go_version="$(go version 2>&1 || true)" +[[ "${go_version}" == *"go1.27.1"* ]] || fail_expect "go version 输出包含 go1.27.1" "${go_version}" + +node_version="$(node --version 2>&1 || true)" +[[ "${node_version}" == "v26.10.0" ]] || fail_expect "v26.10.0" "${node_version}" + +npm_version="$(npm --version 2>&1 || true)" +[[ -n "${npm_version}" ]] || fail_expect "npm --version 有输出" "空输出" + +python_version="$(python3 --version 2>&1 || true)" +[[ "${python_version}" =~ ^Python\ 3\.14\.[0-9]+$ ]] || fail_expect "Python 3.14.x" "${python_version}" + +if ! sshd_output="$(sshd -t 2>&1)"; then + fail_expect "sshd -t 检查通过" "${sshd_output}" +fi + +id dev >/dev/null 2>&1 || fail_expect "用户 dev 存在" "用户 dev 不存在" + +sudo_list="$(sudo -l -U dev 2>&1 || true)" +echo "${sudo_list}" | grep -q "NOPASSWD" || fail_expect "sudo -l -U dev 含 NOPASSWD" "${sudo_list}" + +if [ "${PLAYWRIGHT_BROWSERS_PATH:-}" != "/opt/ms-playwright" ]; then + fail_expect "PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright" "${PLAYWRIGHT_BROWSERS_PATH:-<未设置>}" +fi + +chromium_path="$( + find /opt/ms-playwright -type f \( -name headless_shell -o -name chrome \) 2>/dev/null | head -n 1 +)" + +[ -n "${chromium_path}" ] || fail_expect "在 /opt/ms-playwright 下存在 headless_shell 或 chrome" "未找到可执行文件" +[ -x "${chromium_path}" ] || fail_expect "chromium 可执行文件具有执行权限" "${chromium_path} 不可执行" + +chromium_dom="$("${chromium_path}" --headless --no-sandbox --disable-gpu --dump-dom about:blank 2>&1 || true)" +echo "${chromium_dom}" | grep -q "