@fitlab-ai/agent-infra 0.11.10 → 0.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/bin/internal-cli.js +2 -2
  2. package/dist/lib/agent-clients/adapter.js +27 -1
  3. package/dist/lib/agent-clients/adapters/claude-code.js +5 -1
  4. package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +78 -63
  5. package/dist/lib/agent-clients/adapters/codex-lifecycle/binding.js +114 -0
  6. package/dist/lib/agent-clients/adapters/codex-lifecycle/cli.js +447 -0
  7. package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-client.js +130 -0
  8. package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-operation.js +131 -0
  9. package/dist/lib/{sandbox/control → agent-clients/adapters/codex-lifecycle}/controller-registration.js +2 -2
  10. package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +48 -1
  11. package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +124 -62
  12. package/dist/lib/{internal/codex-sandbox-controller.js → agent-clients/adapters/codex-lifecycle/sandbox-controller-cli.js} +3 -3
  13. package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +3 -5
  14. package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +222 -210
  15. package/dist/lib/agent-clients/adapters/codex-orchestration.js +468 -0
  16. package/dist/lib/agent-clients/adapters/codex-sandbox.js +13 -0
  17. package/dist/lib/agent-clients/adapters/codex.js +44 -1
  18. package/dist/lib/agent-clients/adapters/index.js +2 -10
  19. package/dist/lib/agent-clients/tokens.js +3 -2
  20. package/dist/lib/internal/agent-client.js +132 -72
  21. package/dist/lib/internal/cli-route-inventory.js +2 -2
  22. package/dist/lib/internal/manual-validation.js +2 -2
  23. package/dist/lib/internal/platform-pr.js +4 -5
  24. package/dist/lib/internal/task-artifact.js +1 -1
  25. package/dist/lib/internal/task-create.js +15 -1
  26. package/dist/lib/internal/task-finalization.js +1 -3
  27. package/dist/lib/internal/task-operation-registry.js +5 -139
  28. package/dist/lib/internal/task-validate.js +1 -1
  29. package/dist/lib/platform/issues.js +18 -6
  30. package/dist/lib/platform/pr-summary.js +45 -8
  31. package/dist/lib/platform/pull-requests.js +79 -14
  32. package/dist/lib/platform/verification-sync.js +17 -14
  33. package/dist/lib/runtime/agent-runtime.js +6 -29
  34. package/dist/lib/sandbox/commands/control-status.js +1 -0
  35. package/dist/lib/sandbox/commands/create.js +19 -2
  36. package/dist/lib/sandbox/commands/enter.js +47 -33
  37. package/dist/lib/sandbox/control/agent-operation.js +34 -0
  38. package/dist/lib/sandbox/control/client.js +68 -161
  39. package/dist/lib/sandbox/control/executor.js +13 -87
  40. package/dist/lib/sandbox/control/host-recovery.js +218 -0
  41. package/dist/lib/sandbox/control/protocol.js +15 -44
  42. package/dist/lib/sandbox/control/server.js +57 -51
  43. package/dist/lib/sandbox/environment.js +150 -0
  44. package/dist/lib/sandbox/mounts.js +2 -1
  45. package/dist/lib/sandbox/recovery.js +11 -1
  46. package/dist/lib/sandbox/removal.js +9 -5
  47. package/dist/lib/sandbox/workspace-identity.js +0 -14
  48. package/dist/lib/sandbox/workspace-view.js +41 -23
  49. package/dist/lib/task/artifact-command.js +7 -2
  50. package/dist/lib/task/artifact-lifecycle.js +2 -1
  51. package/dist/lib/task/capabilities.js +4 -1
  52. package/dist/lib/task/control-authority.js +54 -266
  53. package/dist/lib/task/control-recovery.js +1 -1
  54. package/dist/lib/task/create.js +2 -2
  55. package/dist/lib/task/delegation-receipts.js +74 -161
  56. package/dist/lib/task/events.js +89 -45
  57. package/dist/lib/task/finalization.js +58 -60
  58. package/dist/lib/task/frontmatter.js +24 -1
  59. package/dist/lib/task/ledger-intents.js +2 -1
  60. package/dist/lib/task/lifecycle.js +84 -97
  61. package/dist/lib/task/orchestration.js +182 -129
  62. package/dist/lib/task/platform-operation-journal.js +12 -0
  63. package/dist/lib/task/platform-operation-recovery.js +14 -7
  64. package/dist/lib/task/resolve-ref.js +8 -3
  65. package/dist/lib/task/runtime-paths.js +10 -0
  66. package/dist/lib/task/verification-engine.js +28 -15
  67. package/dist/lib/task/workspace-snapshot.js +1 -1
  68. package/dist/lifecycle-build-manifest.json +3 -3
  69. package/lib/agent-clients/adapter.ts +61 -0
  70. package/lib/agent-clients/adapters/claude-code.ts +5 -1
  71. package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +105 -80
  72. package/lib/agent-clients/adapters/codex-lifecycle/binding.ts +147 -0
  73. package/lib/agent-clients/adapters/codex-lifecycle/cli.ts +510 -0
  74. package/lib/agent-clients/adapters/codex-lifecycle/controller-client.ts +158 -0
  75. package/lib/agent-clients/adapters/codex-lifecycle/controller-context.ts +1 -1
  76. package/lib/agent-clients/adapters/codex-lifecycle/controller-operation.ts +151 -0
  77. package/lib/{sandbox/control → agent-clients/adapters/codex-lifecycle}/controller-registration.ts +4 -4
  78. package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +43 -0
  79. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +8 -5
  80. package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +190 -65
  81. package/lib/{internal/codex-sandbox-controller.ts → agent-clients/adapters/codex-lifecycle/sandbox-controller-cli.ts} +2 -2
  82. package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +3 -5
  83. package/lib/agent-clients/adapters/codex-lifecycle/store.ts +272 -223
  84. package/lib/agent-clients/adapters/codex-orchestration.ts +632 -0
  85. package/lib/agent-clients/adapters/codex-sandbox.ts +13 -0
  86. package/lib/agent-clients/adapters/codex.ts +48 -1
  87. package/lib/agent-clients/adapters/index.ts +7 -20
  88. package/lib/agent-clients/tokens.ts +4 -3
  89. package/lib/internal/agent-client.ts +142 -73
  90. package/lib/internal/cli-route-inventory.ts +2 -2
  91. package/lib/internal/manual-validation.ts +2 -2
  92. package/lib/internal/platform-pr.ts +3 -4
  93. package/lib/internal/task-artifact.ts +1 -1
  94. package/lib/internal/task-create.ts +15 -2
  95. package/lib/internal/task-finalization.ts +1 -3
  96. package/lib/internal/task-operation-registry.ts +5 -151
  97. package/lib/internal/task-validate.ts +1 -1
  98. package/lib/platform/issues.ts +18 -6
  99. package/lib/platform/pr-summary.ts +43 -7
  100. package/lib/platform/pull-requests.ts +74 -13
  101. package/lib/platform/verification-sync.ts +18 -14
  102. package/lib/runtime/agent-runtime.ts +6 -41
  103. package/lib/sandbox/commands/control-status.ts +1 -0
  104. package/lib/sandbox/commands/create.ts +25 -2
  105. package/lib/sandbox/commands/enter.ts +42 -39
  106. package/lib/sandbox/control/agent-operation.ts +49 -0
  107. package/lib/sandbox/control/client.ts +86 -210
  108. package/lib/sandbox/control/executor.ts +17 -96
  109. package/lib/sandbox/control/host-recovery.ts +195 -0
  110. package/lib/sandbox/control/protocol.ts +24 -55
  111. package/lib/sandbox/control/server.ts +54 -52
  112. package/lib/sandbox/environment.ts +162 -0
  113. package/lib/sandbox/mounts.ts +2 -1
  114. package/lib/sandbox/recovery.ts +13 -1
  115. package/lib/sandbox/removal.ts +12 -5
  116. package/lib/sandbox/tool-types.ts +1 -0
  117. package/lib/sandbox/workspace-identity.ts +0 -26
  118. package/lib/sandbox/workspace-view.ts +42 -24
  119. package/lib/task/artifact-command.ts +9 -2
  120. package/lib/task/artifact-lifecycle.ts +2 -1
  121. package/lib/task/capabilities.ts +5 -2
  122. package/lib/task/control-authority.ts +65 -382
  123. package/lib/task/control-recovery.ts +2 -2
  124. package/lib/task/create.ts +3 -3
  125. package/lib/task/delegation-receipts.ts +87 -231
  126. package/lib/task/events.ts +101 -43
  127. package/lib/task/finalization.ts +57 -58
  128. package/lib/task/frontmatter.ts +25 -1
  129. package/lib/task/ledger-intents.ts +2 -1
  130. package/lib/task/lifecycle.ts +82 -87
  131. package/lib/task/orchestration.ts +237 -176
  132. package/lib/task/platform-operation-journal.ts +29 -2
  133. package/lib/task/platform-operation-recovery.ts +12 -6
  134. package/lib/task/resolve-ref.ts +8 -3
  135. package/lib/task/runtime-paths.ts +12 -0
  136. package/lib/task/verification-engine.ts +27 -16
  137. package/lib/task/workspace-snapshot.ts +1 -1
  138. package/package.json +1 -1
  139. package/templates/.agents/hooks/lifecycle-delegation.js +1 -25
  140. package/templates/.agents/rules/README.en.md +2 -2
  141. package/templates/.agents/rules/README.zh-CN.md +2 -2
  142. package/templates/.agents/rules/issue-sync.en.md +1 -1
  143. package/templates/.agents/rules/issue-sync.zh-CN.md +1 -1
  144. package/templates/.agents/rules/next-step-output.en.md +6 -19
  145. package/templates/.agents/rules/next-step-output.zh-CN.md +6 -19
  146. package/templates/.agents/rules/no-mid-flow-questions.en.md +19 -0
  147. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +19 -0
  148. package/templates/.agents/rules/review-handshake.en.md +3 -0
  149. package/templates/.agents/rules/review-handshake.zh-CN.md +3 -0
  150. package/templates/.agents/rules/task-management.en.md +1 -1
  151. package/templates/.agents/rules/task-management.zh-CN.md +1 -1
  152. package/templates/.agents/skills/analyze-task/SKILL.en.md +2 -2
  153. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +2 -2
  154. package/templates/.agents/skills/block-task/SKILL.en.md +1 -1
  155. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +1 -1
  156. package/templates/.agents/skills/cancel-task/SKILL.en.md +1 -1
  157. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +1 -1
  158. package/templates/.agents/skills/check-task/SKILL.en.md +1 -1
  159. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +1 -1
  160. package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -0
  161. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -0
  162. package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -0
  163. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -0
  164. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  165. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +2 -2
  166. package/templates/.agents/skills/code-task/reference/branch-management.en.md +1 -1
  167. package/templates/.agents/skills/code-task/reference/branch-management.zh-CN.md +1 -1
  168. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +2 -0
  169. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +2 -0
  170. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +1 -1
  171. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +1 -1
  172. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +1 -2
  173. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +1 -2
  174. package/templates/.agents/skills/complete-task/SKILL.en.md +0 -3
  175. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +0 -3
  176. package/templates/.agents/skills/create-pr/SKILL.en.md +1 -1
  177. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +1 -1
  178. package/templates/.agents/skills/create-pr/reference/branch-strategy.en.md +2 -2
  179. package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +2 -2
  180. package/templates/.agents/skills/create-task/SKILL.en.md +3 -5
  181. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +3 -4
  182. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  183. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  184. package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
  185. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
  186. package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
  187. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
  188. package/templates/.agents/skills/plan-task/SKILL.en.md +1 -1
  189. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +1 -1
  190. package/templates/.agents/skills/review-analysis/SKILL.en.md +1 -1
  191. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +1 -1
  192. package/templates/.agents/skills/review-code/SKILL.en.md +5 -5
  193. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -5
  194. package/templates/.agents/skills/review-plan/SKILL.en.md +1 -1
  195. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +1 -1
  196. package/templates/.agents/skills/review-pr/SKILL.en.md +1 -1
  197. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -1
  198. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -1
  199. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -1
  200. package/templates/.agents/skills/test/SKILL.en.md +4 -1
  201. package/templates/.agents/skills/test/SKILL.zh-CN.md +4 -1
  202. package/templates/.agents/skills/test-integration/SKILL.en.md +5 -2
  203. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +5 -2
  204. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +4 -1
  205. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +4 -1
  206. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +5 -2
  207. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +5 -2
  208. package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
  209. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
  210. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +1 -1
  211. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +1 -1
  212. package/dist/lib/agent-clients/adapters/codex-lifecycle/capability-store.js +0 -546
  213. package/dist/lib/internal/codex-lifecycle.js +0 -385
  214. package/dist/lib/task/codex-orchestration.js +0 -206
  215. package/dist/lib/task/finalization-handoff.js +0 -93
  216. package/lib/agent-clients/adapters/codex-lifecycle/capability-store.ts +0 -776
  217. package/lib/internal/codex-lifecycle.ts +0 -390
  218. package/lib/task/codex-orchestration.ts +0 -276
  219. package/lib/task/finalization-handoff.ts +0 -105
@@ -120,7 +120,7 @@ Runs after Step 0 state check and Step 3 (questioning is an external-state actio
120
120
  2. If `start_date` is empty, write today (`date +%F`), then run `agent-infra-internal task-event {task-id} analyze.awaiting-input --agent {standard-agent-token} --question {question_count}` so the core updates base metadata and Activity Log.
121
121
  3. Issue sync (when a valid `platform_issue_identity` exists, skip on any failure): run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}` to update only the **task comment**; keep the `status` label at `pending-design-work`; do **not** publish an analysis artifact comment.
122
122
  4. Verification (replaces the step 8 artifact gate): `agent-infra-internal task-verify {task-id} analyze.awaiting-input --format text` (the early-exit set `current_step: requirement-analysis` and wrote `start_date`, so it should pass); also keep `rg -n 'Analyze Task \(Brainstorming\)' .agents/workspace/active/{task-id}/task.md` and the task-comment sync evidence. Do **not** run the artifact gate, nor `check activity-log` / `check platform-sync` (both bind to the analysis artifact path).
123
- 5. User output: show only the current **single question** plus how to answer/continue (re-trigger `analyze-task {task-ref}` with the answer), and append the `Completed at` line per `.agents/rules/next-step-output.md`.
123
+ 5. User output: show only the current **single question** plus how to answer/continue (re-trigger `analyze-task {task-ref}` with the answer).
124
124
  6. **STOP** and wait for the answer. The next trigger returns to this step.
125
125
 
126
126
  ### 5. Perform Requirements Analysis
@@ -263,7 +263,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
263
263
  Handle the result as follows:
264
264
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
265
265
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
266
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
266
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
267
267
 
268
268
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
269
269
 
@@ -123,7 +123,7 @@ agent-infra-internal task-event {task-id} analyze.started --agent {standard-agen
123
123
  2. 若 `start_date` 为空,写入当日日期(`date +%F`);随后执行 `agent-infra-internal task-event {task-id} analyze.awaiting-input --agent {standard-agent-token} --question {question_count}`,由核心统一更新基础 frontmatter 和 Activity Log。
124
124
  3. Issue 同步(存在有效 `platform_issue_identity` 时,任一失败跳过):调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}` 更新 **task 评论**;`status` label 维持 `pending-design-work`;**不**发布分析产物评论。
125
125
  4. 校验(替代步骤 8 的 artifact gate):`agent-infra-internal task-verify {task-id} analyze.awaiting-input --format text`(早退已置 `current_step: requirement-analysis` 且已写入 `start_date`,预期通过);并保留 `rg -n 'Analyze Task \(Brainstorming\)' .agents/workspace/active/{task-id}/task.md` 与 task 评论同步证据。**不**跑 artifact gate,也不跑 `check activity-log` / `check platform-sync`(二者绑定分析产物路径)。
126
- 5. 用户输出:只展示当前**单个问题** + 如何回答/继续(再次触发 `analyze-task {task-ref}` 并附答案),并按 `.agents/rules/next-step-output.md` 在末行追加 `Completed at`。
126
+ 5. 用户输出:只展示当前**单个问题** + 如何回答/继续(再次触发 `analyze-task {task-ref}` 并附答案)。
127
127
  6. **STOP**,等待回答。下一次触发回到本步骤。
128
128
 
129
129
  ### 5. 执行需求分析
@@ -261,7 +261,7 @@ agent-infra-internal task-verify {task-id} analyze.completed --artifact {analysi
261
261
  处理结果:
262
262
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
263
263
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
264
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
264
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
265
265
 
266
266
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
267
267
 
@@ -91,7 +91,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
91
91
  Handle the result as follows:
92
92
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
93
93
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
94
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
94
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
95
95
 
96
96
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
97
97
 
@@ -90,7 +90,7 @@ agent-infra-internal task-verify {task-id} block-task.completed --format text
90
90
  处理结果:
91
91
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
92
92
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
93
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
93
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
94
94
 
95
95
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
96
96
 
@@ -100,7 +100,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
100
100
  Handle the result as follows:
101
101
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
102
102
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
103
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
103
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
104
104
 
105
105
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
106
106
 
@@ -97,7 +97,7 @@ agent-infra-internal task-verify {task-id} cancel-task.completed --format text
97
97
  处理结果:
98
98
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
99
99
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
100
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
100
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
101
101
 
102
102
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
103
103
 
@@ -70,7 +70,7 @@ When the action is non-empty, perform only this literal action-to-skill conversi
70
70
  | `code` | `code-task` |
71
71
  | any other action | same-named skill |
72
72
 
73
- When the action is empty, do not invoke the helper; state that no next skill is currently recommended. Before rendering the final output, read `.agents/rules/next-step-output.md`; invoke `agent-infra-internal agent-client next-steps --skill {next-skill} --task-ref {task-ref}` and render stdout verbatim as `{next-step-commands}`. Append the `Completed at` trailing line last.
73
+ When the action is empty, do not invoke the helper; state that no next skill is currently recommended. Before rendering the final output, read `.agents/rules/next-step-output.md`; invoke `agent-infra-internal agent-client next-steps --skill {next-skill} --task-ref {task-ref}` and render stdout verbatim as `{next-step-commands}`.
74
74
 
75
75
  ## Notes
76
76
 
@@ -70,7 +70,7 @@ ai task status --task {task-id}
70
70
  | `code` | `code-task` |
71
71
  | 其他 action | 同名 skill |
72
72
 
73
- `action` 为空时不调用 helper,只说明当前没有可推荐的下一技能。渲染最终输出前先读取 `.agents/rules/next-step-output.md`;helper 命令为 `agent-infra-internal agent-client next-steps --skill {next-skill} --task-ref {task-ref}`,stdout 原样作为 `{next-step-commands}` 下一步命令。最后追加 `Completed at` 收尾行。
73
+ `action` 为空时不调用 helper,只说明当前没有可推荐的下一技能。渲染最终输出前先读取 `.agents/rules/next-step-output.md`;helper 命令为 `agent-infra-internal agent-client next-steps --skill {next-skill} --task-ref {task-ref}`,stdout 原样作为 `{next-step-commands}` 下一步命令。
74
74
 
75
75
  ## 注意事项
76
76
 
@@ -135,3 +135,6 @@ Next step - complete and archive the task if a related task exists:
135
135
  - Already closed: output "Alert #{number} is already {state}"
136
136
  - Permission error: output "No permission to modify alerts"
137
137
  - User canceled: output "Cancellation acknowledged"
138
+
139
+
140
+ Security responsibility boundary: preserve the accurate disposition reason, impact explanation, and required confirmation before closing. Do not infer that risk is gone, confirm on behalf of an authorized person, or bypass platform security confirmation to keep moving. Independent local preparation may continue.
@@ -135,3 +135,6 @@ ai sandbox rm {branch}
135
135
  - 已关闭:提示 "Alert #{number} is already {state}"
136
136
  - 权限错误:提示 "No permission to modify alerts"
137
137
  - 用户取消:提示 "Cancellation acknowledged"
138
+
139
+
140
+ 安全责任边界:关闭前必须保留准确的处置理由、影响说明和所需确认。不得为追求继续执行而推断风险已消失、代替授权人确认,或绕过平台要求的安全确认;其他可独立完成的本地整理仍可继续。
@@ -143,3 +143,6 @@ Next step - complete and archive the task if a related task exists:
143
143
  - Already closed: output "Alert #{number} is already {state}"
144
144
  - Permission error: output "No permission to modify alerts"
145
145
  - User canceled: output "Cancellation acknowledged"
146
+
147
+
148
+ Security responsibility boundary: preserve the accurate disposition reason, impact explanation, and required confirmation before closing. Do not infer that risk is gone, confirm on behalf of an authorized person, or bypass platform security confirmation to keep moving. Independent local preparation may continue.
@@ -143,3 +143,6 @@ ai sandbox rm {branch}
143
143
  - 已关闭:提示 "Alert #{number} is already {state}"
144
144
  - 权限错误:提示 "No permission to modify alerts"
145
145
  - 用户取消:提示 "Cancellation acknowledged"
146
+
147
+
148
+ 安全责任边界:关闭前必须保留准确的处置理由、影响说明和所需确认。不得为追求继续执行而推断风险已消失、代替授权人确认,或绕过平台要求的安全确认;其他可独立完成的本地整理仍可继续。
@@ -187,4 +187,4 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
187
187
 
188
188
  Use `reference/output-template.md` (or `reference/fix-mode.md` in fix mode) and render the selected next-step commands through the shared helper. The local checkpoint is required for this skill; do not invoke the standalone `commit` skill, push, or create a PR here.
189
189
 
190
- > Before rendering the final output, read `.agents/rules/next-step-output.md` and apply both of its rules: (1) render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form; (2) append the `Completed at` line as the very last line of the user-facing output (this applies to every user-facing output — success, error, and early-return paths alike, not only the success path).
190
+ > Before rendering the final output, read `.agents/rules/next-step-output.md`; render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form.
@@ -231,7 +231,7 @@ agent-infra-internal task-verify {task-id} code.completed --artifact {code-artif
231
231
  处理结果:
232
232
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
233
233
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
234
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
234
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
235
235
 
236
236
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
237
237
 
@@ -241,7 +241,7 @@ agent-infra-internal task-verify {task-id} code.completed --artifact {code-artif
241
241
 
242
242
  > 渲染下一步前先读取 `.agents/rules/next-step-output.md`,并按 `reference/output-template.md` 或 `reference/fix-mode.md` 的已选场景调用统一 helper。
243
243
 
244
- > 渲染最终输出前先读取 `.agents/rules/next-step-output.md` 并落实其两类规则:(1) 「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件),其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式;(2) 在面向用户输出的绝对最后一行追加 `Completed at` 收尾行(成功、错误、早退等任何面向用户输出都适用,不限于校验通过的成功态)。
244
+ > 渲染最终输出前先读取 `.agents/rules/next-step-output.md`,并将「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件);其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式。
245
245
 
246
246
  ## 完成检查清单
247
247
 
@@ -39,7 +39,7 @@ git ls-remote --heads origin {branch-name}
39
39
  - only remote branch exists: `git switch --track origin/{branch-name}`
40
40
  - neither exists: `git switch -c {branch-name}`
41
41
 
42
- If switching fails, stop and ask the user to resolve the branch or working tree conflict first.
42
+ If switching fails, inspect stderr, `git status`, and conflicting paths to distinguish an Agent branch/command error from user workspace changes. Fix only Agent-owned errors; never stash, reset, or overwrite user content. Continue safe read-only work independent of the branch switch and record any remaining branch condition.
43
43
 
44
44
  ## task.md Write-back
45
45
 
@@ -40,7 +40,7 @@ git ls-remote --heads origin {branch-name}
40
40
  - 仅远程分支存在:`git switch --track origin/{branch-name}`
41
41
  - 本地和远程都不存在:`git switch -c {branch-name}`
42
42
 
43
- 如果切换失败,立即停止并提示用户先处理工作区冲突或未解决的分支问题。
43
+ 如果切换失败,读取 stderr、`git status` 与冲突路径,区分 Agent 自身的分支/命令错误和用户工作区冲突。只修复 Agent 自身错误;不得 stash、reset 或覆盖用户内容。安全时继续不依赖切换的只读工作,并记录无法完成的分支条件。
44
44
 
45
45
  ## task.md 回写要求
46
46
 
@@ -31,6 +31,8 @@ The core reads the path decision from the latest analysis and selects the lifecy
31
31
  > - `rev_max == code_max`: AI fix round (`review-code` reviews the same-numbered code artifact produced by `code-task`).
32
32
  > - `rev_max > code_max`: human-supplemented review round — after a PR is opened a maintainer appends a `review-code-r{N}` round against the existing latest code. `fix` mode then uses `next_round = code_max + 1`.
33
33
  >
34
+ > To add human opinions against the same code snapshot, first run `task-artifact inspect --family review-code --reason-code manual-review-supplement` to open a review round, then record `review-code.started` with `--initiator human --reason-code manual-review-supplement`. Findings in the new report enter the regular `code-task` fix mode.
35
+ >
34
36
  > If the latest `review-code` verdict cannot be parsed, the script still returns `error` (exit 2) as the retained anomaly guard.
35
37
 
36
38
  ## Verdict Parsing
@@ -31,6 +31,8 @@ agent-infra-internal task-artifact {task-id} inspect --family code
31
31
  > - `rev_max == code_max`:AI 修复轮(`code-task` 产出代码后由 `review-code` 审查同号产物)。
32
32
  > - `rev_max > code_max`:人工补审轮——PR 创建后维护者追加一轮 `review-code-r{N}` 审查既有最新代码。此时 `fix` 模式的 `next_round = code_max + 1`。
33
33
  >
34
+ > 对同一代码快照追加人工意见时,先用 `task-artifact inspect --family review-code --reason-code manual-review-supplement` 创建新的 review 轮次,并以 `--initiator human --reason-code manual-review-supplement` 记录 `review-code.started`。新报告中的 finding 随后按普通修复模式进入 `code-task`。
35
+ >
34
36
  > 若最新 `review-code` 的 verdict 无法解析,仍返回 `error`(exit 2),作为保留的异常拦截。
35
37
 
36
38
  ## verdict 解析
@@ -4,7 +4,7 @@ Read this file before changing code during fix mode.
4
4
 
5
5
  ## Plan the Fixes
6
6
 
7
- **Verify each finding first (mandatory before editing)**: for every finding in `{review-artifact}`, Read/Grep the cited `file:line` and corresponding `git diff`, then choose one of the four states in `.agents/rules/review-handshake.md`. Record the response and evidence, then submit it through `agent-infra-internal task-ledger {task-id} finding-respond --id {ledger-id} --round {code-round} --status {state} --evidence {evidence}` after the code report preflight passes (every state needs commensurate evidence; "accept" is not a zero-cost default):
7
+ **Verify each finding first (mandatory before editing)**: for every finding in `{review-artifact}`, Read/Grep the cited `file:line` and corresponding `git diff`, then choose one of the four states in `.agents/rules/review-handshake.md`. Read each finding's current ledger `round` from `agent-infra-internal task-ledger {task-id} stage-status --stage code`. The code artifact's `{code-round}` and a finding's response round are independent; `finding-respond --round` must be that finding's current ledger `round + 1`, never `{code-round}` by default. Record the response and evidence, then submit it through `agent-infra-internal task-ledger {task-id} finding-respond --id {ledger-id} --round {finding-response-round} --status {state} --evidence {evidence}` after the code report preflight passes (every state needs commensurate evidence; "accept" is not a zero-cost default):
8
8
  - `accepted` → include it in the classification and fixes below; evidence cites the fix `file:line`
9
9
  - `adjusted` → use an alternative fix, with rationale; awaits review-code confirmation
10
10
  - `refuted` → verification judged it unfounded / a wrong `file:line` / hallucinated → do not change code; give a counter-argument in the report's `## Per-Finding Verification` section; awaits review-code confirmation
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 规划修复
6
6
 
7
- **先逐条核实(动手前必做)**:对 `{review-artifact}` 的每一条发现,先 Read/Grep 其引用的 `file:line` 与对应 `git diff`,确认问题真实存在,再按 `.agents/rules/review-handshake.md` 的四态处置;记录每条待写入的响应及相称证据,等 code 报告 preflight 通过后,再逐条调用 `agent-infra-internal task-ledger {task-id} finding-respond --id {ledger-id} --round {code-round} --status {四态} --evidence {相称证据}`(“接受”不是零成本默认):
7
+ **先逐条核实(动手前必做)**:对 `{review-artifact}` 的每一条发现,先 Read/Grep 其引用的 `file:line` 与对应 `git diff`,确认问题真实存在,再按 `.agents/rules/review-handshake.md` 的四态处置;通过 `agent-infra-internal task-ledger {task-id} stage-status --stage code` 读取每条账本记录的当前 `round`。code artifact 的 `{code-round}` 与 finding 的响应轮次相互独立;每条 finding 的 `finding-respond --round` 必须取该 finding 当前账本 `round + 1`,不得直接使用 `{code-round}`。记录每条待写入的响应及相称证据,等 code 报告 preflight 通过后,再逐条调用 `agent-infra-internal task-ledger {task-id} finding-respond --id {ledger-id} --round {finding-response-round} --status {四态} --evidence {相称证据}`(“接受”不是零成本默认):
8
8
  - `accepted` → 纳入下方分类与修复,证据指向修复点 `file:line`
9
9
  - `adjusted` → 采用替代修法,附理由,待 review-code 复核确认
10
10
  - `refuted` → 核实判定不成立 / 基于错误 `file:line` / 幻觉 → 不改代码,在报告 `## 对审查发现的逐条核实` 给出反证,待 review-code 复核确认
@@ -119,7 +119,7 @@ agent-infra-internal task-verify {task-id} manual-validation.completed --artifac
119
119
  Handle the result:
120
120
  - Exit code 0 -> tell the user
121
121
  - Exit code 1 -> fix the reported problem and rerun
122
- - Exit code 2 -> stop and report that manual intervention is required
122
+ - Exit code 2 (blocked) -> retain the incomplete state and inspect this run's summary; do not fabricate manual-validation evidence. If real-environment or permission validation is still required, state the specific pending check and wait for an authorized person to complete it before retrying.
123
123
 
124
124
  ### 9. Tell the User
125
125
 
@@ -129,7 +129,6 @@ Report:
129
129
  - Present the completion verification summary per `.agents/rules/validation-output.md`
130
130
  - Suggested next step: enter the final closing flow and run /complete-task --task {task-ref}
131
131
 
132
- Before rendering the final output, read `.agents/rules/next-step-output.md` and append `Completed at: YYYY-MM-DD HH:mm:ss` as the absolute last line.
133
132
 
134
133
  ## Completion Checklist
135
134
 
@@ -119,7 +119,7 @@ agent-infra-internal task-verify {task-id} manual-validation.completed --artifac
119
119
  处理结果:
120
120
  - 退出码 0 -> 告知用户
121
121
  - 退出码 1 -> 修复问题后重新运行
122
- - 退出码 2 -> 停止并告知需要人工介入
122
+ - 退出码 2(阻塞)-> 保留未完成状态并检查当次摘要;不得伪造人工验证证据。若仍需真实环境或权限验证,说明具体待验证项,等待授权人员完成后再重试。
123
123
 
124
124
  ### 9. 告知用户
125
125
 
@@ -129,7 +129,6 @@ agent-infra-internal task-verify {task-id} manual-validation.completed --artifac
129
129
  - 按 `.agents/rules/validation-output.md` 展示当次完成校验摘要
130
130
  - 下一步建议:进入最终收尾流程,运行 /complete-task --task {task-ref}
131
131
 
132
- 渲染最终输出前,先读取 `.agents/rules/next-step-output.md`,并在绝对最后一行追加 `Completed at: YYYY-MM-DD HH:mm:ss`。
133
132
 
134
133
  ## 完成检查清单
135
134
 
@@ -213,8 +213,6 @@ Do not submit a new request for an accepted task finalization. If the request ID
213
213
 
214
214
  > Execute this step only after the verification gate passes.
215
215
 
216
- > The completion timestamp line (the last line of the whole output) uses `date "+%Y-%m-%d %H:%M:%S"` (local timezone, no offset) and always sits at the very end of the output for at-a-glance scanning across windows. This skill renders no "Next steps" commands, but it does render an **optional sandbox-cleanup hint** before the timestamp line (see the gate below), and still prints the line.
217
-
218
216
  > **Optional sandbox-cleanup hint (gated)**: Render the "Optional: clean up this task's sandbox" block in the output below only when BOTH (1) `.agents/.airc.json` has a `sandbox` field and (2) task.md's `branch` field exists and is not `main` / `master`; otherwise omit the whole block. Use the full `{task-id}` for cleanup; do not substitute the branch name. This block is independent of "Next steps" semantics — it is not a workflow successor command.
219
217
 
220
218
  Output format:
@@ -234,7 +232,6 @@ Optional: clean up this task's sandbox
234
232
 
235
233
  ai sandbox rm {task-id}
236
234
 
237
- Completed at: {completion-time}
238
235
  ```
239
236
 
240
237
 
@@ -209,8 +209,6 @@ accepted 的 task finalization 不得提交新请求。若 request ID 缺失或
209
209
 
210
210
  > 仅在校验通过后执行本步骤。
211
211
 
212
- > 完成时间收尾行(整段输出的最后一行)取值 `date "+%Y-%m-%d %H:%M:%S"`(本地时区、不带偏移),固定放在输出的绝对末尾,便于多窗口扫视。本 skill 不渲染「下一步」命令,但会在收尾行之前渲染一段**可选的沙箱清理提示**(见下方门控),且仍统一打印该收尾行。
213
-
214
212
  > **可选沙箱清理提示(门控渲染)**:仅当同时满足 (1) `.agents/.airc.json` 存在 `sandbox` 字段、(2) task.md 的 `branch` 字段存在且不是 `main` / `master` 时,才渲染下方输出中的「可选:清理本任务的沙箱」块;任一不满足则整段省略。清理时使用完整 `{task-id}`,不要改用 branch 名。该块独立于「下一步」语义,不是工作流后继命令。
215
213
 
216
214
  输出格式:
@@ -230,7 +228,6 @@ accepted 的 task finalization 不得提交新请求。若 request ID 缺失或
230
228
 
231
229
  ai sandbox rm {task-id}
232
230
 
233
- Completed at: {completion-time}
234
231
  ```
235
232
 
236
233
 
@@ -107,7 +107,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
107
107
  Handle the result as follows:
108
108
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
109
109
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
110
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
110
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
111
111
 
112
112
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
113
113
 
@@ -105,7 +105,7 @@ agent-infra-internal task-verify {task-id} create-pr.completed --format text
105
105
  处理结果:
106
106
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
107
107
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
108
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
108
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
109
109
 
110
110
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
111
111
 
@@ -15,13 +15,13 @@ git log --oneline --decorate --first-parent -20
15
15
  Decision rules:
16
16
  - current branch is `main` or `trunk` -> use that branch
17
17
  - current branch is a feature branch -> infer the nearest parent branch from log decorations
18
- - cannot determine -> ask the user
18
+ - cannot derive from current configuration, branch, or PR facts -> request only the missing target-branch fact; do not guess
19
19
 
20
20
  Feature-branch parent inference details:
21
21
  - inspect the nearest decorated ancestor in first-parent history
22
22
  - prefer `{major}.{minor}.x` release lines over `main` / `master` when the feature branch was cut from a release line
23
23
  - if both a release line and `main` seem plausible, choose the nearer ancestor in history
24
- - if no reliable parent can be inferred, stop and ask the user instead of guessing
24
+ - if no reliable parent can be inferred, request only the missing target-branch fact; do not guess
25
25
 
26
26
  Next-step rule after PR creation:
27
27
  - `create-pr` already publishes the reviewer summary inline, so do not recommend an extra PR sync command
@@ -15,13 +15,13 @@ git log --oneline --decorate --first-parent -20
15
15
  判断规则:
16
16
  - 当前分支是 `main` 或 `trunk` -> 使用该分支
17
17
  - 当前分支是 feature branch -> 从 log decoration 推断最近的父分支
18
- - 无法可靠判断 -> 直接询问用户
18
+ - 无法从当前配置、分支和 PR 事实推导 -> 只请求缺失的目标分支事实;不得猜测
19
19
 
20
20
  Feature branch 父分支推断细则:
21
21
  - 在 first-parent 历史中检查最近的已标记祖先
22
22
  - 如果该 feature branch 是从 release line 切出的,优先选择 `{major}.{minor}.x`,而不是 `main` / `master`
23
23
  - 如果 release line 和 `main` 看起来都合理,选择历史上更近的那个祖先
24
- - 如果无法可靠推断父分支,不要猜测,直接停止并询问用户
24
+ - 如果无法可靠推断父分支,只请求缺失的目标分支事实;不得猜测
25
25
 
26
26
  创建 PR 后的下一步规则:
27
27
  - `create-pr` 已内联发布 reviewer 摘要,不再推荐额外的 PR 同步命令
@@ -83,7 +83,7 @@ date +%Y%m%d-%H%M%S
83
83
 
84
84
  - Generate one UUID v4 `idempotencyKey` and write the parsed fields to one JSON file.
85
85
  - The candidate follows `TaskCreateCandidateV1`: version, key, standard agent, title, type, unprefixed branch slug, priority, effort, description, and the seven task-input lists.
86
- - Write it once before the first request. A timeout retry must reuse the same file and let the client generate a new outer request id; do not rerun AI derivation.
86
+ - Write it once before the first request. A timeout retry must reuse the same file and let the client generate a new outer request id; do not rerun AI derivation. If the client explicitly reports `accepted: false`, `recovery: new-request-id`, and `requestId: null` for a JSON/schema validation error, correct the Agent-generated structure while preserving domain meaning, then validate it with the same validator. Regenerate the idempotency key only when that key itself is invalid; preserve an already valid key. Do not invent missing domain facts or edit the candidate for other failures. Once accepted, keep the candidate and key unchanged and recover using the returned request identity.
87
87
 
88
88
  Invoke the single entry point:
89
89
 
@@ -128,9 +128,7 @@ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
128
128
 
129
129
  A controlled invocation may return `control` request evidence: `accepted: true`
130
130
  with `recovery: none` means the current result can be consumed; `accepted: false`
131
- with `recovery: new-request-id` means the request was not admitted and the same
132
- candidate may be retried with a new outer request ID after the transient problem
133
- is fixed; `recovery: same-request-id` or `recovery: inspect-domain-state` means
131
+ with `recovery: new-request-id` permits candidate correction only when evidence identifies a pre-transport JSON/schema validator rejection; revalidate with that validator before using a new outer request ID. Diagnose other unaccepted failures from their evidence without automatically editing the candidate; `recovery: same-request-id` or `recovery: inspect-domain-state` means
134
132
  the request was accepted, so do not create a new candidate or replay it
135
133
  automatically. Recover with the original request or inspect host task state first.
136
134
 
@@ -158,7 +156,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
158
156
  Handle the result as follows:
159
157
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
160
158
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
161
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
159
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
162
160
 
163
161
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
164
162
 
@@ -82,7 +82,7 @@ date +%Y%m%d-%H%M%S
82
82
 
83
83
  - 生成随机 UUID v4 作为 `idempotencyKey`,并把步骤 1 的结果写入单个 JSON 文件。
84
84
  - candidate 必须符合宿主 `TaskCreateCandidateV1`:`version`、`idempotencyKey`、标准 `agent`、`title`、`type`、不带项目前缀的 `branchSlug`、`priority`、`effort`、`description` 和 `taskInput` 七类列表。
85
- - 首次提交前只写一次 candidate;等待终态期间不得重新运行 AI 推导或改写文件。超时重试必须复用同一文件,由客户端生成新的 outer request ID。
85
+ - 首次提交前校验 candidate。只有客户端在 `requestSandboxTaskCreate` 前明确返回 `accepted: false`、`recovery: new-request-id` 的 schema/JSON 校验拒绝,才可修正 Agent 自身生成的结构或格式问题,并用同一 validator 再校验;不得补造缺失领域事实。若 `idempotencyKey` 本身不是 UUID v4,因请求未提交,可重新生成合法 UUID v4;已有合法 key 必须保留。其余未接纳失败按原错误根因处理,不自动假定可改 candidate。请求一经接纳,candidate 与 key 不得修改;按原 `requestId` 和 control recovery 事实检查或恢复。
86
86
 
87
87
  调用统一入口:
88
88
 
@@ -127,8 +127,7 @@ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
127
127
 
128
128
  受控调用可能在结果中返回 `control` 请求证据:`accepted: true` 且
129
129
  `recovery: none` 表示可以消费当前结果;`accepted: false` 且
130
- `recovery: new-request-id` 表示请求尚未受理,暂态问题恢复后才能用同一份
131
- candidate 和新的 outer request ID 重试;`recovery: same-request-id` 或
130
+ `recovery: new-request-id` 仅当证据表明错误来自 transport 前 JSON/schema validator 时,才允许修正自身格式错误,并通过同一 validator 后使用新的 outer request ID;其他未接纳失败按错误证据诊断,不自动改写 candidate。`recovery: same-request-id` 或
132
131
  `recovery: inspect-domain-state` 表示请求已经受理,不得创建新的 candidate 或
133
132
  自动重放,必须先使用原 request 检查结果或宿主任务状态。
134
133
 
@@ -154,7 +153,7 @@ agent-infra-internal task-verify {task-id} create-task.completed --format text
154
153
  处理结果:
155
154
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
156
155
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
157
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
156
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
158
157
 
159
158
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
160
159
 
@@ -91,7 +91,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
91
91
  Handle the result as follows:
92
92
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
93
93
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
94
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
94
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
95
95
 
96
96
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
97
97
 
@@ -89,7 +89,7 @@ agent-infra-internal task-verify {task-id} import-codescan.completed --format te
89
89
  处理结果:
90
90
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
91
91
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
92
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
92
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
93
93
 
94
94
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
95
95
 
@@ -94,7 +94,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
94
94
  Handle the result as follows:
95
95
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
96
96
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
97
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
97
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
98
98
 
99
99
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
100
100
 
@@ -92,7 +92,7 @@ agent-infra-internal task-verify {task-id} import-dependabot.completed --format
92
92
  处理结果:
93
93
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
94
94
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
95
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
95
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
96
96
 
97
97
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
98
98
 
@@ -172,7 +172,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
172
172
  Handle the result as follows:
173
173
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
174
174
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
175
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
175
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
176
176
 
177
177
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
178
178
 
@@ -170,7 +170,7 @@ agent-infra-internal task-verify {task-id} import-issue.completed --format text
170
170
  处理结果:
171
171
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
172
172
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
173
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
173
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
174
174
 
175
175
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
176
176
 
@@ -164,7 +164,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
164
164
  Handle the result as follows:
165
165
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
166
166
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
167
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
167
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
168
168
 
169
169
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
170
170
 
@@ -158,7 +158,7 @@ agent-infra-internal task-verify {task-id} plan.completed --artifact {plan-artif
158
158
  处理结果:
159
159
  - 退出码 0(全部通过)-> 继续到「告知用户」步骤
160
160
  - 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
161
- - 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
161
+ - 退出码 2(阻塞)-> 保留阻塞状态并读取当次摘要;只继续与该校验无依赖的本地工作,不得宣称阶段完成,也不得仅凭退出码归因为网络故障。仅在缺少用户专属事实/授权或无法安全恢复时请求用户动作。
162
162
 
163
163
  按 `.agents/rules/validation-output.md` 展示当次校验摘要;没有当次校验输出,不得声明完成。
164
164
 
@@ -117,4 +117,4 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
117
117
 
118
118
  Use the conclusion branch in `reference/output-templates.md` and render the selected next-step commands through the shared helper.
119
119
 
120
- > Before rendering the final output, read `.agents/rules/next-step-output.md` and apply both of its rules: (1) render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form; (2) append the `Completed at` line as the very last line of the user-facing output (this applies to every user-facing output — success, error, and early-return paths alike, not only the success path).
120
+ > Before rendering the final output, read `.agents/rules/next-step-output.md`; render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form.
@@ -122,7 +122,7 @@ agent-infra-internal task-verify {task-id} review-analysis.completed --artifact
122
122
 
123
123
  按 `reference/output-templates.md` 的结论分支输出,并通过统一 helper 渲染已选场景的下一步命令。
124
124
 
125
- > 渲染最终输出前先读取 `.agents/rules/next-step-output.md` 并落实其两类规则:(1) 「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件),其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式;(2) 在面向用户输出的绝对最后一行追加 `Completed at` 收尾行(成功、错误、早退等任何面向用户输出都适用,不限于校验通过的成功态)。
125
+ > 渲染最终输出前先读取 `.agents/rules/next-step-output.md`,并将「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件);其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式。
126
126
 
127
127
  ## 完成检查清单
128
128
 
@@ -9,7 +9,7 @@ description: >
9
9
  # Code Review
10
10
  > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
11
11
 
12
- If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to both the summary finalizer and completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts. Lifecycle events also require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request` or `review-finding`. Reuse the same values for started and completed.
12
+ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to both the summary finalizer and completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts. Lifecycle events also require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request` or `review-finding` for ordinary reviews. Only an explicitly requested supplemental human review uses `--initiator human --reason-code manual-review-supplement`. Reuse the same values for started and completed.
13
13
 
14
14
  Review the latest code round and produce `review-code.md` or `review-code-r{N}.md`.
15
15
 
@@ -59,7 +59,7 @@ Before the state check is complete, do not make external-state assertions such a
59
59
 
60
60
  ## Step Start: Write the started Marker
61
61
 
62
- After resolving the artifact context and before this round's first artifact action, run `agent-infra-internal task-event {task-id} review-code.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}`.
62
+ After resolving the artifact context and before this round's first artifact action, run `agent-infra-internal task-event {task-id} review-code.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}`. For a supplemental round, use `--initiator human --reason-code manual-review-supplement`, and record each human opinion, its verification evidence, and finding disposition in the report.
63
63
 
64
64
  ## Steps
65
65
 
@@ -71,7 +71,7 @@ Require:
71
71
 
72
72
  ### 2. Resolve the Artifact Context
73
73
 
74
- Run `agent-infra-internal task-artifact {task-id} inspect --family review-code`. Continue only for `ready`. When `selection.disposition` is `reuse`, reuse `selection.artifact`, do not run started/init or write a new artifact, and continue directly to completion verification and next-step guidance. Otherwise take any available latest `{code-artifact}` and `{plan-artifact}` from `inputs`, and `{review-round}` / `{review-artifact}` from `next.round` / `next.name`. Do not scan rounds or construct names in the skill. If no code or plan artifact exists, review the Git diff and record the missing context in the report. Then run the started event and verify the returned identity.
74
+ For a normal review, run `agent-infra-internal task-artifact {task-id} inspect --family review-code`. When the user explicitly asks to enter supplied human opinions as a new review round, use `--reason-code manual-review-supplement` to inspect and open that round. This reason is allowed only for a human-initiated `review-code`; do not use it to repeat an ordinary review. Continue only for `ready`. For a normal review, when `selection.disposition` is `reuse`, reuse `selection.artifact`, do not run started/init or write a new artifact, and continue directly to completion verification and next-step guidance. When a supplemental review returns `create`, continue with the new round. Otherwise take any available latest `{code-artifact}` and `{plan-artifact}` from `inputs`, and `{review-round}` / `{review-artifact}` from `next.round` / `next.name`. Do not scan rounds or construct names in the skill. If no code or plan artifact exists, review the Git diff and record the missing context in the report. Then run the started event and verify the returned identity.
75
75
 
76
76
  ### 3. Read Implementation and Refinement Context
77
77
 
@@ -154,7 +154,7 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
154
154
  Handle the result as follows:
155
155
  - exit code 0 (all checks passed) -> continue to the "Inform User" step
156
156
  - exit code 1 (validation failed) -> fix the reported issues and run the gate again
157
- - exit code 2 (network blocked) -> stop and tell the user that human intervention is required
157
+ - exit code 2 (blocked) -> retain the blocked state and inspect this run's summary; continue only local work independent of the blocked gate, and do not claim stage completion or infer a network cause from the exit code alone. Ask for user action only when user-specific facts or authorization are missing, or recovery cannot be made safe.
158
158
 
159
159
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
160
160
 
@@ -173,7 +173,7 @@ manual-validation counts do not influence branch selection; they are displayed o
173
173
 
174
174
  > The A/B/C output templates, selection rules, and prohibition clauses live in `reference/output-templates.md`. Read `reference/output-templates.md` before reporting the review result.
175
175
 
176
- > Before rendering the final output, read `.agents/rules/next-step-output.md` and apply both of its rules: (1) render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form; (2) append the `Completed at` line as the very last line of the user-facing output (this applies to every user-facing output — success, error, and early-return paths alike, not only the success path).
176
+ > Before rendering the final output, read `.agents/rules/next-step-output.md`; render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form.
177
177
 
178
178
  Render only the selected scenario's commands returned by the shared helper. The helper builds custom tool commands from `sandbox.tools.ids` and `sandbox.tools.definitions`; do not reread configuration or manually append commands.
179
179