@fitlab-ai/agent-infra 0.9.15 → 0.11.0

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 (224) hide show
  1. package/README.md +2 -6
  2. package/README.zh-CN.md +2 -6
  3. package/bin/internal-cli.sh +0 -13
  4. package/dist/bin/internal-cli.js +11 -49
  5. package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +6 -2
  6. package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +43 -3
  7. package/dist/lib/fs/durable-write.js +2 -0
  8. package/dist/lib/internal/cli-route-inventory.js +3 -4
  9. package/dist/lib/internal/manual-validation.js +17 -8
  10. package/dist/lib/internal/platform-comment.js +60 -2
  11. package/dist/lib/internal/task-artifact.js +1 -1
  12. package/dist/lib/internal/task-finalization.js +2 -2
  13. package/dist/lib/internal/task-lifecycle.js +4 -4
  14. package/dist/lib/internal/task-operation-registry.js +22 -13
  15. package/dist/lib/internal/task-orchestration.js +2 -2
  16. package/dist/lib/internal/task-review.js +12 -7
  17. package/dist/lib/platform/activity-recovery.js +159 -0
  18. package/dist/lib/platform/issue-comments.js +89 -31
  19. package/dist/lib/platform/issues.js +1 -1
  20. package/dist/lib/platform/pr-change-report.js +5 -4
  21. package/dist/lib/platform/pr-summary.js +64 -32
  22. package/dist/lib/platform/pull-requests.js +3 -3
  23. package/dist/lib/platform/task-comment-projection.js +70 -0
  24. package/dist/lib/platform/task-identities.js +2 -9
  25. package/dist/lib/platform/task-recovery.js +55 -0
  26. package/dist/lib/platform/verification-sync.js +45 -7
  27. package/dist/lib/pr-review/evidence-grading.js +4 -8
  28. package/dist/lib/sandbox/commands/rm.js +21 -2
  29. package/dist/lib/sandbox/control/executor.js +4 -2
  30. package/dist/lib/sandbox/control/server.js +29 -9
  31. package/dist/lib/sandbox/control/state.js +7 -1
  32. package/dist/lib/sandbox/control/task-workflow.js +1 -1
  33. package/dist/lib/sandbox/control/workflow-executor.js +87 -35
  34. package/dist/lib/sandbox/index.js +1 -2
  35. package/dist/lib/sandbox/removal.js +116 -1011
  36. package/dist/lib/sandbox/workspace-identity.js +17 -1
  37. package/dist/lib/server/process-state.js +17 -5
  38. package/dist/lib/task/artifact-command.js +11 -30
  39. package/dist/lib/task/artifact-operations.js +17 -231
  40. package/dist/lib/task/artifact-recovery.js +476 -0
  41. package/dist/lib/task/artifact-repair-intent.js +90 -39
  42. package/dist/lib/task/commit-operation.js +31 -4
  43. package/dist/lib/task/control-authority.js +39 -8
  44. package/dist/lib/task/control-recovery.js +14 -2
  45. package/dist/lib/task/create-service.js +1 -8
  46. package/dist/lib/task/delegation-receipts.js +64 -3
  47. package/dist/lib/task/events.js +165 -23
  48. package/dist/lib/task/human-override.js +5 -8
  49. package/dist/lib/task/intermediate-cleanup.js +91 -8
  50. package/dist/lib/task/lifecycle-recovery.js +549 -0
  51. package/dist/lib/task/lifecycle.js +12 -3
  52. package/dist/lib/task/local-artifact-finalization.js +212 -123
  53. package/dist/lib/task/manual-validation-receipt.js +5 -1
  54. package/dist/lib/task/orchestration.js +52 -2
  55. package/dist/lib/task/pr-delivery-fact.js +12 -56
  56. package/dist/lib/task/recovery-warning.js +19 -0
  57. package/dist/lib/task/review-command.js +3 -2
  58. package/dist/lib/task/review-finalization.js +294 -74
  59. package/dist/lib/{host-control → task}/secure-fs.js +8 -19
  60. package/dist/lib/task/short-id.js +15 -7
  61. package/dist/lib/task/task-execution-lock.js +1 -1
  62. package/dist/lib/task/verification-engine.js +3 -14
  63. package/dist/lib/task/workflow-command.js +2 -1
  64. package/dist/lib/task/workflow-dispatch.js +161 -0
  65. package/dist/lib/version.js +1 -11
  66. package/dist/lifecycle-build-manifest.json +3 -3
  67. package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +7 -2
  68. package/lib/agent-clients/adapters/codex-lifecycle/store.ts +55 -3
  69. package/lib/fs/durable-write.ts +1 -0
  70. package/lib/internal/cli-route-inventory.ts +3 -4
  71. package/lib/internal/manual-validation.ts +17 -8
  72. package/lib/internal/platform-comment.ts +53 -2
  73. package/lib/internal/task-artifact.ts +1 -1
  74. package/lib/internal/task-finalization.ts +1 -1
  75. package/lib/internal/task-lifecycle.ts +5 -4
  76. package/lib/internal/task-operation-registry.ts +22 -13
  77. package/lib/internal/task-orchestration.ts +1 -1
  78. package/lib/internal/task-review.ts +11 -7
  79. package/lib/platform/activity-recovery.ts +179 -0
  80. package/lib/platform/issue-comments.ts +105 -30
  81. package/lib/platform/issues.ts +1 -1
  82. package/lib/platform/pr-change-report.ts +7 -5
  83. package/lib/platform/pr-summary.ts +64 -32
  84. package/lib/platform/pull-requests.ts +3 -3
  85. package/lib/platform/task-comment-projection.ts +79 -0
  86. package/lib/platform/task-identities.ts +3 -14
  87. package/lib/platform/task-recovery.ts +54 -0
  88. package/lib/platform/verification-sync.ts +48 -11
  89. package/lib/pr-review/evidence-grading.ts +4 -9
  90. package/lib/sandbox/commands/rm.ts +34 -2
  91. package/lib/sandbox/control/executor.ts +4 -2
  92. package/lib/sandbox/control/protocol.ts +6 -1
  93. package/lib/sandbox/control/server.ts +30 -10
  94. package/lib/sandbox/control/state.ts +9 -1
  95. package/lib/sandbox/control/task-workflow.ts +1 -1
  96. package/lib/sandbox/control/workflow-executor.ts +106 -35
  97. package/lib/sandbox/index.ts +1 -2
  98. package/lib/sandbox/removal.ts +126 -1128
  99. package/lib/sandbox/workspace-identity.ts +19 -3
  100. package/lib/server/process-state.ts +26 -5
  101. package/lib/task/artifact-command.ts +12 -29
  102. package/lib/task/artifact-operations.ts +22 -252
  103. package/lib/task/artifact-recovery.ts +572 -0
  104. package/lib/task/artifact-repair-intent.ts +126 -51
  105. package/lib/task/commit-operation.ts +35 -4
  106. package/lib/task/control-authority.ts +48 -15
  107. package/lib/task/control-recovery.ts +13 -1
  108. package/lib/task/create-service.ts +1 -10
  109. package/lib/task/delegation-receipts.ts +73 -2
  110. package/lib/task/events.ts +188 -24
  111. package/lib/task/human-override.ts +5 -8
  112. package/lib/task/intermediate-cleanup.ts +66 -12
  113. package/lib/task/lifecycle-recovery.ts +691 -0
  114. package/lib/task/lifecycle.ts +13 -4
  115. package/lib/task/local-artifact-finalization.ts +249 -131
  116. package/lib/task/manual-validation-receipt.ts +5 -1
  117. package/lib/task/orchestration.ts +65 -0
  118. package/lib/task/pr-delivery-fact.ts +15 -62
  119. package/lib/task/recovery-warning.ts +21 -0
  120. package/lib/task/review-command.ts +2 -1
  121. package/lib/task/review-finalization.ts +298 -84
  122. package/lib/{host-control → task}/secure-fs.ts +10 -32
  123. package/lib/task/short-id.ts +27 -5
  124. package/lib/task/task-execution-lock.ts +1 -1
  125. package/lib/task/verification-engine.ts +3 -17
  126. package/lib/task/verification-types.ts +0 -2
  127. package/lib/task/workflow-command.ts +2 -1
  128. package/lib/task/workflow-dispatch.ts +171 -0
  129. package/lib/version.ts +1 -15
  130. package/package.json +1 -1
  131. package/templates/.agents/rules/create-issue.en.md +1 -1
  132. package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
  133. package/templates/.agents/rules/issue-sync.en.md +12 -2
  134. package/templates/.agents/rules/issue-sync.zh-CN.md +13 -5
  135. package/templates/.agents/rules/local-artifact-repair.en.md +47 -39
  136. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +45 -36
  137. package/templates/.agents/skills/analyze-task/SKILL.en.md +6 -6
  138. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +6 -6
  139. package/templates/.agents/skills/analyze-task/config/verify.en.json +1 -1
  140. package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +1 -1
  141. package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
  142. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
  143. package/templates/.agents/skills/block-task/config/verify.json +1 -1
  144. package/templates/.agents/skills/cancel-task/SKILL.en.md +3 -3
  145. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +3 -3
  146. package/templates/.agents/skills/cancel-task/config/verify.json +1 -1
  147. package/templates/.agents/skills/code-task/SKILL.en.md +7 -7
  148. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +8 -8
  149. package/templates/.agents/skills/code-task/config/verify.en.json +1 -1
  150. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -1
  151. package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +1 -1
  152. package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +1 -1
  153. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +1 -1
  154. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +1 -1
  155. package/templates/.agents/skills/complete-task/SKILL.en.md +2 -2
  156. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +2 -2
  157. package/templates/.agents/skills/complete-task/config/verify.en.json +2 -2
  158. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +2 -2
  159. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +1 -1
  160. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +1 -1
  161. package/templates/.agents/skills/create-pr/SKILL.en.md +2 -2
  162. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +2 -2
  163. package/templates/.agents/skills/create-pr/config/verify.json +1 -1
  164. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +2 -2
  165. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +2 -2
  166. package/templates/.agents/skills/create-task/SKILL.en.md +5 -5
  167. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +5 -5
  168. package/templates/.agents/skills/create-task/config/verify.json +1 -1
  169. package/templates/.agents/skills/import-issue/SKILL.en.md +8 -8
  170. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +8 -8
  171. package/templates/.agents/skills/import-issue/config/verify.json +2 -2
  172. package/templates/.agents/skills/plan-task/SKILL.en.md +4 -4
  173. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -4
  174. package/templates/.agents/skills/plan-task/config/verify.en.json +1 -1
  175. package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +1 -1
  176. package/templates/.agents/skills/restore-task/SKILL.en.md +11 -6
  177. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +11 -6
  178. package/templates/.agents/skills/restore-task/config/verify.json +1 -1
  179. package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
  180. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
  181. package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -1
  182. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -1
  183. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +7 -7
  184. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +6 -6
  185. package/templates/.agents/skills/review-code/SKILL.en.md +5 -4
  186. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -4
  187. package/templates/.agents/skills/review-code/config/verify.en.json +1 -1
  188. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -1
  189. package/templates/.agents/skills/review-code/reference/report-template.en.md +12 -12
  190. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +12 -12
  191. package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
  192. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
  193. package/templates/.agents/skills/review-plan/config/verify.en.json +1 -1
  194. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -1
  195. package/templates/.agents/skills/review-plan/reference/report-template.en.md +7 -7
  196. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +7 -7
  197. package/templates/.agents/skills/review-pr/config/verify.en.json +1 -1
  198. package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +1 -1
  199. package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +3 -3
  200. package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +3 -3
  201. package/templates/.agents/skills/run-manual-validation/config/verify.en.json +1 -1
  202. package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +1 -1
  203. package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
  204. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
  205. package/templates/.agents/templates/task.en.md +1 -1
  206. package/templates/.agents/templates/task.zh-CN.md +1 -1
  207. package/templates/.claude/commands/import-issue.en.md +1 -1
  208. package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
  209. package/templates/.claude/commands/restore-task.en.md +1 -1
  210. package/templates/.claude/commands/restore-task.zh-CN.md +1 -1
  211. package/dist/lib/host-control/audit.js +0 -19
  212. package/dist/lib/host-control/client.js +0 -142
  213. package/dist/lib/host-control/command.js +0 -49
  214. package/dist/lib/host-control/path.js +0 -160
  215. package/dist/lib/host-control/server.js +0 -159
  216. package/dist/lib/host-control/service.js +0 -112
  217. package/dist/lib/internal/host-control.js +0 -28
  218. package/lib/host-control/audit.ts +0 -22
  219. package/lib/host-control/client.ts +0 -172
  220. package/lib/host-control/command.ts +0 -60
  221. package/lib/host-control/path.ts +0 -167
  222. package/lib/host-control/server.ts +0 -180
  223. package/lib/host-control/service.ts +0 -133
  224. package/lib/internal/host-control.ts +0 -28
@@ -4,7 +4,7 @@ This scenario applies only to an active task whose completion canonical inventor
4
4
 
5
5
  ## Typed State Machine
6
6
 
7
- Run `agent-infra-internal platform-pr resolve-external {task-id} --agent {agent} [--pr {N}]`. Core checks the completion inventory first. A non-empty inventory returns `mode=normal`, and supplying `--pr` then fails. An empty inventory requires a positive `issue_number`; otherwise core returns `EXTERNAL_DELIVERY_ISSUE_REQUIRED`.
7
+ Run `agent-infra-internal platform-pr resolve-external {task-id} --agent {agent} [--pr {N}]`. Core checks the completion inventory first. A non-empty inventory returns `mode=normal`, and supplying `--pr` then fails. An empty inventory requires a valid `platform_issue_identity`; otherwise core returns `EXTERNAL_DELIVERY_ISSUE_REQUIRED`.
8
8
 
9
9
  The platform adapter supplies authoritative Issue closing change requests across all pages. Only candidates with a matching base repository, complete identity, and merge evidence are eligible. One candidate is selected automatically; ambiguity, conflicts, and missing evidence fail closed. `--pr` may only select an authoritative eligible closing candidate and cannot bypass repository, Issue, merge, or identity validation.
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Typed 状态机
6
6
 
7
- 调用 `agent-infra-internal platform-pr resolve-external {task-id} --agent {agent} [--pr {N}]`。core 先检查 completion inventory;非空时返回 `mode=normal`,且显式 `--pr` 会失败。空 inventory 必须有正整数 `issue_number`,否则返回 `EXTERNAL_DELIVERY_ISSUE_REQUIRED`。
7
+ 调用 `agent-infra-internal platform-pr resolve-external {task-id} --agent {agent} [--pr {N}]`。core 先检查 completion inventory;非空时返回 `mode=normal`,且显式 `--pr` 会失败。空 inventory 必须有有效 `platform_issue_identity`,否则返回 `EXTERNAL_DELIVERY_ISSUE_REQUIRED`。
8
8
 
9
9
  core 通过平台 adapter 读取 Issue 的权威 closing change requests,穷尽分页后只把 base 仓库匹配任务仓库且已经合并、身份字段完整的候选视为 eligible。唯一候选自动选择;多候选、身份冲突或证据缺失均 fail closed。`--pr` 只能从权威 closing eligible 集合中显式选择,不能绕过仓库、Issue、合并或身份校验。
10
10
 
@@ -47,7 +47,7 @@ No Pull Request is required; run instead:
47
47
 
48
48
  Parse the task scope first: an optional `--task <ref>` or `-t <ref>` selects `{task-id}`; a positional task ref is not interpreted. The remaining positional argument, when present, is `{target-branch}`.
49
49
 
50
- If `{task-id}` is provided, read `.agents/workspace/active/{task-id}/task.md` to load task metadata such as `issue_number` and `type`.
50
+ If `{task-id}` is provided, read `.agents/workspace/active/{task-id}/task.md` to load task metadata such as `platform_issue_identity` and `type`.
51
51
  If `{task-id}` is omitted, try to resolve it from the current session context; if it still cannot be determined, skip task-association logic in later steps.
52
52
 
53
53
  ### 2. Determine the Target Branch
@@ -70,7 +70,7 @@ Run `agent-infra-internal task-delivery {task-id} deliver --agent {standard-agen
70
70
 
71
71
  Read `.agents/rules/issue-pr-commands.md`, write the title and body to temporary files, then invoke its `platform-pr create` intent. Under the task lock, core uses remote branch and exact head/base/PR identity facts: one existing PR is reused and bound, zero creates, and multiple matches fail deterministically. Review artifacts and task sync records are not create-pr prerequisites, and replays must not create duplicate PRs.
72
72
 
73
- If `{task-id}` is available and the related task provides `issue_number`, keep `Closes #{issue-number}` in the PR body.
73
+ If `{task-id}` is available and the related task provides `platform_issue_identity`, keep `Closes #{issue-number}` or the provider-equivalent closing keyword in the PR body when supported.
74
74
 
75
75
  ### 6. Sync PR Metadata
76
76
 
@@ -47,7 +47,7 @@ description: >
47
47
 
48
48
  先解析 task scope:可选的 `--task <ref>` 或 `-t <ref>` 绑定 `{task-id}`;位置 task ref 不再解释。剩余的可选位置参数绑定为 `{target-branch}`。
49
49
 
50
- 如果提供了 `{task-id}`,读取 `.agents/workspace/active/{task-id}/task.md` 获取任务信息(例如 `issue_number`、`type` 等)。
50
+ 如果提供了 `{task-id}`,读取 `.agents/workspace/active/{task-id}/task.md` 获取任务信息(例如 `platform_issue_identity`、`type` 等)。
51
51
  如果未提供,可从当前 session 上下文获取;仍无法确定 `{task-id}` 时,后续步骤中的任务关联逻辑跳过。
52
52
 
53
53
  ### 2. 确定目标分支
@@ -70,7 +70,7 @@ description: >
70
70
 
71
71
  执行前先读取 `.agents/rules/issue-pr-commands.md`,把标题和正文写入临时文件,并调用其中的 `platform-pr create` intent。core 在任务锁内按 remote branch、head/base 和 PR 身份事实执行:唯一既有 PR 会复用并绑定,零个才创建,多个稳定失败;review 或 task sync 记录不作为创建 PR 的前置门禁,重放不得产生重复 PR。
72
72
 
73
- 如果获取到 `{task-id}` 且对应任务提供了 `issue_number`,必须在 PR 正文中保留 `Closes #{issue-number}`。
73
+ 如果获取到 `{task-id}` 且对应任务提供了 `platform_issue_identity`,在 provider 支持 numeric closing reference 时必须在 PR 正文中保留 `Closes #{issue-number}` 或 provider 等价关闭关键字。
74
74
 
75
75
  ### 6. 同步 PR 元数据
76
76
 
@@ -18,7 +18,7 @@
18
18
  "expected_action_pattern": "(Create PR|PR Created)"
19
19
  },
20
20
  "platform-sync": {
21
- "when": "issue_number_exists",
21
+ "when": "platform_issue_identity_exists",
22
22
  "expected_pr_comment_marker": "<!-- sync-pr:{task-id}:summary -->",
23
23
  "verify_in_labels_match_pr": true,
24
24
  "verify_in_labels_computed": true,
@@ -55,8 +55,8 @@ Milestone rule:
55
55
 
56
56
  ## Create the PR
57
57
 
58
- - Extract `issue_number` from task.md when this work belongs to an active task
59
- - If `issue_number` exists, complete the prerequisite code-hosting platform detection steps first, then query the Issue via `.agents/rules/issue-pr-commands.md`
58
+ - Extract `platform_issue_identity` from task.md when this work belongs to an active task
59
+ - If `platform_issue_identity` exists, complete the prerequisite code-hosting platform detection steps first, then query the Issue via `.agents/rules/issue-pr-commands.md`
60
60
  - Before calling the PR creation command, check whether the current branch already has a PR. If it does, report the PR URL and state, then stop without repeating metadata sync or summary publication
61
61
  - Use HEREDOC to pass the PR body
62
62
  - Replace `{$IssueNumber}` in the template when present
@@ -55,8 +55,8 @@ Milestone 规则:
55
55
 
56
56
  ## 创建 PR
57
57
 
58
- - 当前工作属于 active task 时,从 task.md 提取 `issue_number`
59
- - 如果存在 `issue_number`,先完成代码托管平台检测,再通过 `.agents/rules/issue-pr-commands.md` 查询 Issue
58
+ - 当前工作属于 active task 时,从 task.md 提取 `platform_issue_identity`
59
+ - 如果存在 `platform_issue_identity`,先完成代码托管平台检测,再通过 `.agents/rules/issue-pr-commands.md` 查询 Issue
60
60
  - 调用 PR 创建命令前,先检查当前分支是否已有 PR;若已有,报告 PR URL 和状态后停止,不重复执行元数据同步或 summary 发布
61
61
  - 使用 HEREDOC 传入 PR 正文
62
62
  - 模板中存在 `{$IssueNumber}` 时进行替换
@@ -139,7 +139,7 @@ automatically. Recover with the original request or inspect host task state firs
139
139
  The host service owns platform cascading. The compatibility recovery commands remain visible in the host warning and are not run from the sandbox:
140
140
 
141
141
  ```bash
142
- agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "Fix auth/network/template issues and manually retry Issue creation, or create/find an Issue and write issue_number"
142
+ agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "Fix auth/network/template issues and manually retry Issue creation, or create/find an Issue and run platform-issue bind"
143
143
  agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}
144
144
  ```
145
145
 
@@ -177,7 +177,7 @@ Task information:
177
177
  - Title: {title}
178
178
  - Type: {type}
179
179
  - Workflow: {workflow}
180
- - Issue: #{issue_number} {issue_url}
180
+ - Issue: #{issue-number} {issue_url}
181
181
 
182
182
  Output file:
183
183
  - Task file: .agents/workspace/active/{task-id}/task.md
@@ -228,10 +228,10 @@ Output file:
228
228
  Next step - run requirements analysis:
229
229
  {next-step-commands}
230
230
 
231
- For later platform sync: after fixing auth / network / template issues, manually run the Issue creation flow in `.agents/rules/create-issue.md` for this task; or manually create/find an Issue and write `issue_number` into task.md so later skills can take over cascade sync.
231
+ For later platform sync: after fixing auth / network / template issues, manually run the Issue creation flow in `.agents/rules/create-issue.md` for this task; or manually create/find an Issue and run `platform-issue bind`, which resolves the token through the provider and writes `platform_issue_identity` so later skills can take over cascade sync.
232
232
 
233
233
  [ACTION REQUIRED] Workflow warnings are open:
234
- - WW-N ISSUE_CREATE_FAILED (issue): Fix auth/network/template issues and manually retry Issue creation, or create/find an Issue and write issue_number
234
+ - WW-N ISSUE_CREATE_FAILED (issue): Fix auth/network/template issues and manually retry Issue creation, or create/find an Issue and run `platform-issue bind`
235
235
  ```
236
236
 
237
237
 
@@ -256,7 +256,7 @@ Wait for the user to run the `analyze-task` skill.
256
256
  1. **Clarity**: if the user description is vague or missing key information, ask for clarification first
257
257
  2. **Difference from `import-issue`**: `import-issue` imports from an Issue; `create-task` creates from a free-form description
258
258
  3. **Workflow order**: after creating a task, typically run `analyze-task` before `plan-task`
259
- 4. **Issue cascade failure**: if the rule fails, task.md remains; when platform sync is needed later, manually write `issue_number` and continue the workflow
259
+ 4. **Issue cascade failure**: if the rule fails, task.md remains; when platform sync is needed later, run `platform-issue bind` and do not hand-write the legacy Issue field
260
260
 
261
261
  ## Error Handling
262
262
 
@@ -137,7 +137,7 @@ candidate 和新的 outer request ID 重试;`recovery: same-request-id` 或
137
137
  平台级联由宿主服务完成。兼容的人工恢复命令仍由宿主 warning 指引,不在沙箱内执行:
138
138
 
139
139
  ```bash
140
- agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "修复认证/网络/模板问题后手动重试 Issue 创建,或手动创建/找到 Issue 后写入 issue_number"
140
+ agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "修复认证/网络/模板问题后手动重试 Issue 创建,或手动创建/找到 Issue 后执行 platform-issue bind"
141
141
  agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}
142
142
  ```
143
143
 
@@ -175,7 +175,7 @@ agent-infra-internal task-verify {task-id} create-task.completed --format text
175
175
  - 标题:{title}
176
176
  - 类型:{type}
177
177
  - 工作流:{workflow}
178
- - Issue:#{issue_number} {issue_url}
178
+ - Issue:#{issue-number} {issue_url}
179
179
 
180
180
  产出文件:
181
181
  - 任务文件:.agents/workspace/active/{task-id}/task.md
@@ -226,10 +226,10 @@ Issue 创建失败:
226
226
  下一步 - 执行需求分析:
227
227
  {next-step-commands}
228
228
 
229
- 后续如需平台同步:修复认证/网络/模板问题后,可按 `.agents/rules/create-issue.md` 对当前任务手动执行一次 Issue 创建;或手动创建/查找 Issue,并把 `issue_number` 写入 task.md,后续技能会接管级联同步。
229
+ 后续如需平台同步:修复认证/网络/模板问题后,可按 `.agents/rules/create-issue.md` 对当前任务手动执行一次 Issue 创建;或手动创建/查找 Issue 后执行 `platform-issue bind`,由 provider 解析 token 并写入 `platform_issue_identity`,后续技能会接管级联同步。
230
230
 
231
231
  [ACTION REQUIRED] Workflow warnings are open:
232
- - WW-N ISSUE_CREATE_FAILED (issue): 修复认证/网络/模板问题后手动重试 Issue 创建,或手动创建/找到 Issue 后写入 issue_number
232
+ - WW-N ISSUE_CREATE_FAILED (issue): 修复认证/网络/模板问题后手动重试 Issue 创建,或手动创建/找到 Issue 后执行 `platform-issue bind`
233
233
  ```
234
234
 
235
235
 
@@ -254,7 +254,7 @@ Issue 创建失败:
254
254
  1. **清晰度**:如果用户描述模糊或缺少关键信息,先要求澄清
255
255
  2. **与 import-issue 的区别**:`import-issue` 从 Issue 导入任务;`create-task` 从自由描述创建
256
256
  3. **工作流顺序**:创建任务后,通常先执行 `analyze-task` 再进入 `plan-task`
257
- 4. **Issue 级联失败**:如果规则执行失败,task.md 仍保留;需要后续平台同步时,可手动写入 `issue_number` 后继续执行工作流
257
+ 4. **Issue 级联失败**:如果规则执行失败,task.md 仍保留;需要后续平台同步时,可手动执行 `platform-issue bind`,不得手工写入旧的 Issue 字段
258
258
 
259
259
  ## 错误处理
260
260
 
@@ -21,7 +21,7 @@
21
21
  "expected_action_pattern": "(Create Task|Task Created)"
22
22
  },
23
23
  "platform-sync": {
24
- "when": "issue_number_exists",
24
+ "when": "platform_issue_identity_exists",
25
25
  "issue_must_exist": true,
26
26
  "verify_task_comment_content": true,
27
27
  "verify_milestone": true,
@@ -9,7 +9,7 @@ description: >
9
9
  > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
10
10
 
11
11
 
12
- Import the specified Issue and create a task. Argument: issue number.
12
+ Import the specified Issue and create a task. Argument: a raw Issue token, parsed after the provider is selected.
13
13
 
14
14
  ## Boundary / Critical Rules
15
15
 
@@ -43,7 +43,7 @@ This skill **creates** task.md, so there is no file to write at the start. Captu
43
43
 
44
44
  Read `.agents/rules/issue-pr-commands.md` first, follow its prerequisite steps to complete authentication and code-hosting platform detection, then load the Issue data with its "Read an Issue" command.
45
45
 
46
- Extract: issue number, title, description, and labels.
46
+ Extract: Issue identity, title, description, and labels.
47
47
 
48
48
  Derive the task title from the Issue title by stripping an optional single leading Conventional Commits prefix, following the contract below; preserve the rest of the description verbatim and in its original language. This fenced contract is the authoritative, language-neutral rule — keep it byte-for-byte identical across every `import-issue` variant:
49
49
 
@@ -67,7 +67,7 @@ Strip only the first layer, and only when the leading token is a `prefix-types`
67
67
  - If found, **reuse the existing task by default** (Scenario A); do not ask the user. State clearly in the final notice: "Reused existing task `{task-id}`; not re-imported." If the user wants to re-import, they must first archive or delete the existing task and run this skill again
68
68
  - If not found, continue to 2.2
69
69
 
70
- 2.2 Run `agent-infra-internal platform-comment list --issue {issue-number}` to scan registered markers for a recoverable historical task ID.
70
+ 2.2 Run `agent-infra-internal platform-comment list --issue {issue-token}` to scan registered markers for a recoverable historical task ID.
71
71
 
72
72
  This command depends on `$upstream_repo` being set in step 1.
73
73
 
@@ -101,7 +101,7 @@ date +%Y%m%d-%H%M%S
101
101
  Task metadata:
102
102
  ```yaml
103
103
  id: {task-id}
104
- issue_number: <issue-number>
104
+ platform_issue_identity: <canonical identity JSON string returned by the provider>
105
105
  type: feature|bugfix|refactor|docs|chore
106
106
  branch: <project>-<type>-<slug>
107
107
  workflow: feature-development|bug-fix|refactoring
@@ -146,8 +146,8 @@ Update `.agents/workspace/active/{task-id}/task.md`:
146
146
 
147
147
  ### 5. Bind and Sync the Issue
148
148
 
149
- If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
150
- - Run `agent-infra-internal platform-issue bind {task-id} --issue {issue-number} --agent {standard-agent-token}`
149
+ After creating task.md, always perform the following binding and sync actions (skip and continue on any platform failure):
150
+ - Run `agent-infra-internal platform-issue bind {task-id} --issue {issue-token} --agent {standard-agent-token}`; the provider parses the token and atomically writes `platform_issue_identity`
151
151
  - Run `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --assignees current --milestone initial`
152
152
  - After every scenario, run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
153
153
 
@@ -202,7 +202,7 @@ Next step - run requirements analysis:
202
202
  ## Completion Checklist
203
203
 
204
204
  - [ ] Created the task file `.agents/workspace/active/{task-id}/task.md`
205
- - [ ] Recorded `issue_number` in task.md
205
+ - [ ] Provider wrote the Issue identity to `platform_issue_identity` in task.md
206
206
  - [ ] Updated `current_step` to requirement-analysis
207
207
  - [ ] Updated `updated_at` to the current time
208
208
  - [ ] Appended an Activity Log entry to task.md
@@ -224,6 +224,6 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
224
224
 
225
225
  ## Error Handling
226
226
 
227
- - Issue not found: output "Issue #{number} not found, please check the issue number"
227
+ - Issue not found: output "Issue {issue-token} not found, please check the Issue token"
228
228
  - Network error: output "Cannot connect to the platform, please check network"
229
229
  - Permission error: output "No access to this repository"
@@ -9,7 +9,7 @@ description: >
9
9
  > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
10
10
 
11
11
 
12
- 导入指定的 Issue 并创建任务。参数:issue 编号。
12
+ 导入指定的 Issue 并创建任务。参数:Issue 原始 token,由选定 provider 解析。
13
13
 
14
14
  ## 行为边界 / 关键规则
15
15
 
@@ -43,7 +43,7 @@ description: >
43
43
 
44
44
  执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的前置步骤完成认证和代码托管平台检测;随后按其中的 “读取 Issue” 命令获取 Issue 信息。
45
45
 
46
- 提取:issue 编号、标题、描述、标签。
46
+ 提取:Issue identity、标题、描述、标签。
47
47
 
48
48
  从 Issue 标题派生任务标题:按下方契约剥掉可选的单层前导 Conventional Commits 前缀,其余描述原文与原始语言保持不变。下方 fenced 契约是权威的、与语言无关的规则——在所有 `import-issue` 变体中保持逐字节一致:
49
49
 
@@ -67,7 +67,7 @@ example-single-layer: "feat: add A: B" => "add A: B"
67
67
  - 如果找到,**默认复用现有任务**(场景 A),不询问用户;在最终告知中明确「已复用现有任务 `{task-id}`,未重新导入」。若用户希望重新导入,需要先手动归档/删除已有任务再次执行本技能
68
68
  - 如果未找到,继续执行 2.2
69
69
 
70
- 2.2 调用 `agent-infra-internal platform-comment list --issue {issue-number}` 扫描注册 marker,查找可恢复的历史任务 ID。
70
+ 2.2 调用 `agent-infra-internal platform-comment list --issue {issue-token}` 扫描注册 marker,查找可恢复的历史任务 ID。
71
71
 
72
72
  该命令内部解析 upstream、认证与分页。
73
73
 
@@ -101,7 +101,7 @@ date +%Y%m%d-%H%M%S
101
101
  任务元数据:
102
102
  ```yaml
103
103
  id: {task-id}
104
- issue_number: <issue-number>
104
+ platform_issue_identity: <provider 返回的 canonical identity JSON 字符串>
105
105
  type: feature|bugfix|refactor|docs|chore
106
106
  branch: <project>-<type>-<slug>
107
107
  workflow: feature-development|bug-fix|refactoring
@@ -146,8 +146,8 @@ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
146
146
 
147
147
  ### 5. 绑定并同步 Issue
148
148
 
149
- 如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
150
- - 调用 `agent-infra-internal platform-issue bind {task-id} --issue {issue-number} --agent {standard-agent-token}` 校验并原子绑定
149
+ 创建 task.md 后始终执行以下绑定和同步操作(任一平台失败则跳过并继续):
150
+ - 调用 `agent-infra-internal platform-issue bind {task-id} --issue {issue-token} --agent {standard-agent-token}`,由 provider 解析并原子写入 `platform_issue_identity`
151
151
  - 调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --assignees current --milestone initial`
152
152
  - 所有场景结束后,必须调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
153
153
 
@@ -202,7 +202,7 @@ Issue #{number} 已导入。
202
202
  ## 完成检查清单
203
203
 
204
204
  - [ ] 创建了任务文件 `.agents/workspace/active/{task-id}/task.md`
205
- - [ ] 在 task.md 中记录了 issue_number
205
+ - [ ] 已由 provider 将 Issue identity 写入 task.md 的 `platform_issue_identity`
206
206
  - [ ] 更新了 `current_step` 为 requirement-analysis
207
207
  - [ ] 更新了 `updated_at` 为当前时间
208
208
  - [ ] 追加了 Activity Log 条目到 task.md
@@ -224,6 +224,6 @@ Issue #{number} 已导入。
224
224
 
225
225
  ## 错误处理
226
226
 
227
- - Issue 未找到:提示 "Issue #{number} not found, please check the issue number"
227
+ - Issue 未找到:提示 "Issue {issue-token} not found, please check the Issue token"
228
228
  - 网络错误:提示 "Cannot connect to the platform, please check network"
229
229
  - 权限错误:提示 "No access to this repository"
@@ -15,13 +15,13 @@
15
15
  "assigned_to"
16
16
  ],
17
17
  "expected_step": "requirement-analysis",
18
- "require_issue_number": true
18
+ "require_platform_issue_identity": true
19
19
  },
20
20
  "activity-log": {
21
21
  "expected_action_pattern": "Import Issue"
22
22
  },
23
23
  "platform-sync": {
24
- "when": "issue_number_exists",
24
+ "when": "platform_issue_identity_exists",
25
25
  "issue_must_exist": true,
26
26
  "verify_task_comment_content": true
27
27
  }
@@ -114,7 +114,7 @@ Before writing this round's `{plan-artifact}`, create the controlled report skel
114
114
  agent-infra-internal task-artifact {task-id} init --family plan --artifact {plan-artifact} --locale en
115
115
  ```
116
116
 
117
- The skeleton contains identity metadata, stable section markers, and required headings only; real plan content is required before the completion gate can pass. If the finalizer returns one provably safe structural error, call `task-artifact {task-id} repair --family plan --artifact {plan-artifact} --expected-sha256 {artifact-sha256} --expected-semantic-digest {semantic-digest}`, then rerun the same finalizer.
117
+ The skeleton contains identity metadata, stable section markers, and required headings only; real plan content is required before the completion gate can pass. If the finalizer returns one provably safe structural error, it returns a controlled recovery candidate; edit only its `candidatePath`, then rerun `task-artifact {task-id} finalize-local --family plan --artifact {plan-artifact} --recovery-id {recovery-id}` with the same `recoveryId`. Candidate-only is a protocol authorization boundary, not OS isolation; arbitrary same-UID host writers are outside the protocol's protection claim, and fingerprint/state checks fail closed on anomalies.
118
118
 
119
119
  Create `.agents/workspace/active/{task-id}/{plan-artifact}`.
120
120
 
@@ -135,14 +135,14 @@ agent-infra-internal task-artifact {task-id} finalize-local --family plan --arti
135
135
  ```
136
136
 
137
137
  - On `status=passed`, save that result's `artifactSha256` and `semanticDigest`; the finalizer has recorded the matching one-shot local provenance intent.
138
- - On `status=failed` with `repairable=true`, apply only the diagnostic's `replace-line` operation once, then rerun the same command completely; count an attempt only after bytes change, up to 8 attempts.
139
- - The first repairable failure's `semanticDigest` is retained as the baseline; a retried `status=passed` result must match it. On baseline mismatch, any other failure, no progress, or a repeated diagnostic, stop without publishing a completed event.
138
+ - On `status=failed` with recovery context, edit only the returned `candidatePath` once after the completion gates pass, then rerun the finalizer completely with the same `recoveryId`; the formal artifact must remain unchanged until commit.
139
+ - The recovery candidate must match the recorded task, round, artifact, baseline, and request identity. On baseline conflict, unknown state, no progress, or repeated failure, stop without publishing a completed event.
140
140
 
141
141
  Use the digests from that same `status=passed` result in `agent-infra-internal task-event {task-id} plan.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {plan-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} {execution-flag}` so the core records the link, stage, agent, metadata, and Activity Log atomically.
142
142
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Plan Task (Round {N})** by {agent} — Plan completed, awaiting human review → {artifact-filename}
143
143
  ```
144
144
 
145
- If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
145
+ If task.md contains a valid `platform_issue_identity`, perform these sync actions (skip and continue on any failure):
146
146
  - Run `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status pending-design-work --fields`
147
147
  - Run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
148
148
  - Run `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {plan-artifact} --agent {standard-agent-token}`
@@ -117,7 +117,7 @@ agent-infra-internal task-event {task-id} plan.started --agent {standard-agent-t
117
117
  agent-infra-internal task-artifact {task-id} init --family plan --artifact {plan-artifact}
118
118
  ```
119
119
 
120
- 骨架只包含身份元数据、稳定 section marker 和必需标题;必须填入真实方案内容后才能通过完成门禁。finalizer 返回可证明的单个结构错误时,使用其 SHA 和 semantic digest 调用 `task-artifact {task-id} repair --family plan --artifact {plan-artifact} --expected-sha256 {artifact-sha256} --expected-semantic-digest {semantic-digest}`,然后完整重跑 finalizer。
120
+ 骨架只包含身份元数据、稳定 section marker 和必需标题;必须填入真实方案内容后才能通过完成门禁。finalizer 返回可证明的单个结构错误时,会返回受控 recovery candidate;只能编辑返回的 `candidatePath`,然后使用同一个 `recoveryId` 重跑 `task-artifact {task-id} finalize-local --family plan --artifact {plan-artifact} --recovery-id {recovery-id}`。candidate-only 是协议授权边界,不是操作系统隔离;同 UID 的任意宿主写入者不在本协议的防护承诺内,异常由指纹/状态校验失败关闭。
121
121
 
122
122
  创建 `.agents/workspace/active/{task-id}/{plan-artifact}`。
123
123
 
@@ -134,11 +134,11 @@ agent-infra-internal task-artifact {task-id} init --family plan --artifact {plan
134
134
  agent-infra-internal task-artifact {task-id} finalize-local --family plan --artifact {plan-artifact}
135
135
  ```
136
136
  - `status=passed`:保存本次返回的 `artifactSha256` 和 `semanticDigest`;finalizer 已记录对应的一次性本地 provenance intent。
137
- - `status=failed` 且 `repairable=true`:仅按诊断中的 `replace-line` 操作做一次最小修改,然后完整重跑同一命令;实际字节发生变化才计一次 `repairAttempts`,最多 8 次。
138
- - 首次可修复失败的 `semanticDigest` 由 finalizer 保留为基线;重试后的 `status=passed` 必须匹配该基线。基线不匹配、其他失败、无进展或重复诊断:停止,不发布 completed 事件。
137
+ - `status=failed` 且返回 recovery context:完成门禁通过后,只编辑返回的 `candidatePath` 一次,然后使用同一个 `recoveryId` 完整重跑 finalizer;formal artifact 在 commit 前必须保持不变。
138
+ - recovery candidate 必须与记录的任务、轮次、产物、baseline 和 request identity 匹配;基线冲突、未知状态、无进展或重复失败:停止,不发布 completed 事件。
139
139
  - 使用同一次 `status=passed` 返回的摘要执行 `agent-infra-internal task-event {task-id} plan.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {plan-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} {execution-flag}`,由核心登记链接、阶段、代理、时间、版本和 Activity Log。
140
140
 
141
- 如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
141
+ 如果 task.md 中存在有效的 `platform_issue_identity`,执行以下同步操作(任一失败则跳过并继续):
142
142
  - 调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status pending-design-work --fields`
143
143
  - 调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
144
144
  - 调用 `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {plan-artifact} --agent {standard-agent-token}`
@@ -28,7 +28,7 @@
28
28
  ]
29
29
  },
30
30
  "platform-sync": {
31
- "when": "issue_number_exists",
31
+ "when": "platform_issue_identity_exists",
32
32
  "expected_status_label": "status: pending-design-work",
33
33
  "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
34
34
  "verify_comment_content": true,
@@ -28,7 +28,7 @@
28
28
  ]
29
29
  },
30
30
  "platform-sync": {
31
- "when": "issue_number_exists",
31
+ "when": "platform_issue_identity_exists",
32
32
  "expected_status_label": "status: pending-design-work",
33
33
  "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
34
34
  "verify_comment_content": true,
@@ -33,7 +33,7 @@ Comment parsing must not write the formal active directory. Step 6 declares one
33
33
  ### 1. Verify Input and Environment
34
34
 
35
35
  Check:
36
- - required `{issue-number}`
36
+ - required `{issue-token}`
37
37
  - optional `{task-id}`
38
38
  - read `.agents/rules/issue-pr-commands.md` first and use its authentication commands to verify current platform access
39
39
 
@@ -41,17 +41,18 @@ If the user provided `{task-id}`, validate the `TASK-{yyyyMMdd-HHmmss}` format.
41
41
 
42
42
  ### 2. Fetch Issue Comments
43
43
 
44
- Run `agent-infra-internal platform-comment list --issue {issue-number}` to read all paginated comments while preserving order and comment IDs; the intent owns platform context, authentication, and upstream resolution.
44
+ Run `agent-infra-internal platform-comment list --issue {issue-token}` to read all paginated comments while preserving order and comment IDs; the intent owns platform context, authentication, and upstream resolution.
45
45
 
46
46
  ### 3. Determine the task-id and Files to Restore
47
47
 
48
- Filter comments by the task, artifact, and chunked artifact markers defined in `.agents/rules/issue-sync.md`.
48
+ Filter comments by the task, artifact, chunked artifact, and recovery markers defined in `.agents/rules/issue-sync.md`.
49
49
 
50
50
  Rules:
51
51
  - when `{task-id}` was provided, match only that task
52
52
  - when `{task-id}` was omitted, infer it from the task comment marker first
53
53
  - if you cannot determine a unique task-id, stop and tell the user
54
54
  - ignore `summary` marker comments because they are complete-task aggregate output rather than restorable local task files
55
+ - use the `task` comment only for the current projection and snapshot identity; the controlled recovery core validates `recovery-action`, `recovery-prepare`, and `recovery-commit` comments and reconstructs the complete `task.md`
55
56
  - map `{file-stem}` back to filenames:
56
57
  - `task` -> `task.md`
57
58
  - `analysis` / `analysis-r{N}` -> matching `.md`
@@ -68,7 +69,7 @@ Read `.agents/rules/issue-sync.md` before executing this step.
68
69
 
69
70
  For each file:
70
71
  - collect its single comment or chunked comments
71
- - for `task.md` comments, reverse the `<details>` frontmatter wrapper described in issue-sync.md before reassembling the file body
72
+ - do not reverse the projected task comment directly into `task.md`; the complete task content must come from a recovery commit matching the current projection
72
73
  - when a chunk marker includes part and total indexes, sort by part and verify the set is complete
73
74
  - extract the file body by removing the hidden marker, heading, and footer
74
75
  - concatenate chunk bodies into the final file content
@@ -83,10 +84,14 @@ If the directory already exists, stop immediately and tell the user to handle it
83
84
 
84
85
  Create the controlled staging directory and write files back in this order:
85
86
 
86
- 1. `task.md`
87
+ 1. call the recovery core to write `task.md`:
88
+ ```bash
89
+ agent-infra-internal platform-comment recover --issue {issue-token} --task-id {task-id} \
90
+ --output "{staging-dir}/task.md"
91
+ ```
87
92
  2. every other restored artifact file in filename order
88
93
 
89
- Write only files that were actually recovered from Issue comments. Do not invent missing files.
94
+ Write only files that were actually recovered from Issue comments. Do not invent missing files. Stop without calling the lifecycle intent if the recovery core fails.
90
95
 
91
96
  ### 6. Apply the Restore Lifecycle Intent
92
97
 
@@ -32,7 +32,7 @@ description: >
32
32
  ### 1. 验证输入与环境
33
33
 
34
34
  检查:
35
- - 必填参数 `{issue-number}`
35
+ - 必填参数 `{issue-token}`
36
36
  - 可选参数 `{task-id}`
37
37
  - 执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的认证命令验证当前平台访问能力
38
38
 
@@ -40,17 +40,18 @@ description: >
40
40
 
41
41
  ### 2. 获取 Issue 评论
42
42
 
43
- 调用 `agent-infra-internal platform-comment list --issue {issue-number}` 读取全部分页评论,保留原始顺序和评论 ID;平台上下文、认证和 upstream 由 internal intent 处理。
43
+ 调用 `agent-infra-internal platform-comment list --issue {issue-token}` 读取全部分页评论,保留原始顺序和评论 ID;平台上下文、认证和 upstream 由 internal intent 处理。
44
44
 
45
45
  ### 3. 确定 task-id 与待恢复文件
46
46
 
47
- 按 `.agents/rules/issue-sync.md` 中定义的 task、artifact 和分片 artifact 标记筛选评论。
47
+ 按 `.agents/rules/issue-sync.md` 中定义的 task、artifact、分片 artifact 和 recovery 标记筛选评论。
48
48
 
49
49
  处理规则:
50
50
  - 用户提供了 `{task-id}` 时,仅匹配该任务
51
51
  - 未提供时,优先从 task 评论标记推断
52
52
  - 若找不到唯一 task-id,立即停止并告知用户
53
53
  - 忽略 `summary` 标记评论;它是 complete-task 的聚合产物,不对应本地任务文件
54
+ - `task` 评论仅用于确定当前投影和 snapshot 身份;`recovery-action`、`recovery-prepare`、`recovery-commit` 由受控 recovery core 验证并重建完整 `task.md`
54
55
  - 将 `{file-stem}` 映射回文件名:
55
56
  - `task` -> `task.md`
56
57
  - `analysis` / `analysis-r{N}` -> 对应 `.md`
@@ -67,7 +68,7 @@ description: >
67
68
 
68
69
  对每个文件执行:
69
70
  - 收集单条评论或分片评论
70
- - 对 `task.md` 评论按 issue-sync.md 中的 `<details>` frontmatter 格式反向拆解,提取 frontmatter 后再与正文拼合
71
+ - 不直接把投影 task 评论反向拆成 `task.md`;完整 task 内容必须来自匹配当前投影的 recovery commit
71
72
  - 如分片标记中存在 part 和 total 序号,按 part 升序排序并校验分片完整
72
73
  - 从评论正文中提取文件内容,去掉隐藏标记、标题和页脚
73
74
  - 拼接得到最终文件内容
@@ -82,10 +83,14 @@ description: >
82
83
 
83
84
  创建受控 staging 目录,按以下顺序写回:
84
85
 
85
- 1. `task.md`
86
+ 1. 调用 recovery core 写入 `task.md`:
87
+ ```bash
88
+ agent-infra-internal platform-comment recover --issue {issue-token} --task-id {task-id} \
89
+ --output "{staging-dir}/task.md"
90
+ ```
86
91
  2. 其余产物文件(按文件名排序)
87
92
 
88
- 仅写回从 Issue 评论中实际恢复出的文件,不补造缺失文件。
93
+ 仅写回从 Issue 评论中实际恢复出的文件,不补造缺失文件。recovery core 返回失败时停止,不调用 lifecycle intent。
89
94
 
90
95
  ### 6. 执行 restore 生命周期意图
91
96
 
@@ -14,7 +14,7 @@
14
14
  "assigned_to"
15
15
  ],
16
16
  "expected_status": "active",
17
- "require_issue_number": true
17
+ "require_platform_issue_identity": true
18
18
  },
19
19
  "activity-log": {
20
20
  "expected_action_pattern": "Restore Task"
@@ -75,7 +75,7 @@ Before writing this round's `{review-artifact}`, create the controlled review sk
75
75
  agent-infra-internal task-artifact {task-id} init --family review-analysis --artifact {review-artifact} --locale en
76
76
  ```
77
77
 
78
- The skeleton contains identity metadata, stable section markers, and required headings only; complete review content is required before summary finalization. If structural finalization returns one provably safe error, call `task-artifact {task-id} repair --family review-analysis --artifact {review-artifact} --expected-sha256 {artifact-sha256} --expected-semantic-digest {semantic-digest}`, then rerun the original finalizer.
78
+ The skeleton contains identity metadata, stable section markers, and required headings only; complete review content is required before summary finalization. If structural finalization returns one provably safe error, it returns a controlled recovery candidate; edit only its `candidatePath`, then rerun the original finalizer with the same `recoveryId`. Candidate-only is a protocol authorization boundary, not OS isolation; arbitrary same-UID host writers are outside the protocol's protection claim, and fingerprint/state checks fail closed on anomalies.
79
79
 
80
80
  Create `.agents/workspace/active/{task-id}/{review-artifact}`.
81
81
 
@@ -83,7 +83,7 @@ Create `.agents/workspace/active/{task-id}/{review-artifact}`.
83
83
 
84
84
  ### 6. Update Task Status
85
85
 
86
- After the report, submit each new finding with `agent-infra-internal task-ledger {task-id} finding-upsert --stage analysis --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`; submit prior-response dispositions with `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {evidence}`. Do not scan ids or edit ledger rows. After all ledger writes, make the initial call to `agent-infra-internal task-review {task-id} finalize-summary --stage analysis --artifact {review-artifact} {execution-flag}`; after a failure, follow `.agents/rules/local-artifact-repair.md` to decide whether to edit and rerun, and never treat an error type or `changed=false` as automatic authorization.
86
+ After the report, call `agent-infra-internal task-review {task-id} preflight --stage analysis --artifact {review-artifact} {execution-flag}` before any ledger write. On failure, follow `.agents/rules/local-artifact-repair.md`; on success, bind `{recovery-id}` from the response. Only after preflight passes, submit each new finding with `agent-infra-internal task-ledger {task-id} finding-upsert --stage analysis --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}` or prior-response dispositions with `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {evidence}`. Do not scan ids or edit ledger rows. After all ledger writes, call `agent-infra-internal task-review {task-id} finalize-summary --stage analysis --artifact {review-artifact} --recovery-id {recovery-id} {execution-flag}`; never treat an error type or `changed=false` as automatic authorization.
87
87
 
88
88
  Bind and reuse this structured mapping from that one response:
89
89
 
@@ -97,7 +97,7 @@ The intent atomically finalizes the report summary and returns the same ledger s
97
97
 
98
98
  `manual-validation` is the data source for the `Manual-validation` count folded into review rows in `ai task log`; do not add a parallel manual-verification field.
99
99
 
100
- If task.md has a valid `issue_number`, run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`, then `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {review-artifact} --agent {standard-agent-token}`.
100
+ If task.md has a valid `platform_issue_identity`, run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`, then `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {review-artifact} --agent {standard-agent-token}`.
101
101
 
102
102
  Before writing the summary, the finalization intent checks decision-detail ids; any visible duplicate returns a structured failure and preserves the artifact bytes, while the model decides whether a minimal edit is safe under the shared rule. If the safety gates fail, diagnostics repeat, no byte-level progress occurs, or the emergency cap is reached, stop before the completion event; the stop path must still show the existing review result instead of hiding the artifact.
103
103
 
@@ -78,7 +78,7 @@ agent-infra-internal task-snapshot {task-id} --format text
78
78
  agent-infra-internal task-artifact {task-id} init --family review-analysis --artifact {review-artifact}
79
79
  ```
80
80
 
81
- 骨架不生成审查结论、发现或计数;完成审查内容后才能进入 summary finalizer。结构 finalizer 返回可证明的单个错误时,使用其 SHA 和 semantic digest 调用 `task-artifact {task-id} repair --family review-analysis --artifact {review-artifact} --expected-sha256 {artifact-sha256} --expected-semantic-digest {semantic-digest}`,再重跑原 finalizer。
81
+ 骨架不生成审查结论、发现或计数;完成审查内容后才能进入 summary finalizer。结构 finalizer 返回可证明的单个错误时,会返回受控 recovery candidate;只能编辑返回的 `candidatePath`,然后使用同一个 `recoveryId` 重跑原 finalizer。candidate-only 是协议授权边界,不是操作系统隔离;同 UID 的任意宿主写入者不在本协议的防护承诺内,异常由指纹/状态校验失败关闭。
82
82
 
83
83
  创建 `.agents/workspace/active/{task-id}/{review-artifact}`。
84
84
 
@@ -86,7 +86,7 @@ agent-infra-internal task-artifact {task-id} init --family review-analysis --art
86
86
 
87
87
  ### 6. 更新任务状态
88
88
 
89
- 报告完成后,新 finding 逐条调用 `agent-infra-internal task-ledger {task-id} finding-upsert --stage analysis --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`;复核上一轮响应时调用 `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {相称证据}`。不得扫描编号或手写账本行。全部账本写入完成后首次调用 `agent-infra-internal task-review {task-id} finalize-summary --stage analysis --artifact {review-artifact} {execution-flag}`;失败后是否继续编辑并重跑,必须遵循 `.agents/rules/local-artifact-repair.md`,不能把失败类型或 `changed=false` 当作自动授权。
89
+ 报告完成后,先调用 `agent-infra-internal task-review {task-id} preflight --stage analysis --artifact {review-artifact} {execution-flag}`,不得先写入账本。失败后是否继续编辑并重跑,必须遵循 `.agents/rules/local-artifact-repair.md`;通过时从返回值绑定 `{recovery-id}`。只有 preflight 通过后,才逐条调用 `agent-infra-internal task-ledger {task-id} finding-upsert --stage analysis --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`,或复核上一轮响应时调用 `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {相称证据}`。不得扫描编号或手写账本行。全部账本写入完成后调用 `agent-infra-internal task-review {task-id} finalize-summary --stage analysis --artifact {review-artifact} --recovery-id {recovery-id} {execution-flag}`;不能把失败类型或 `changed=false` 当作自动授权。
90
90
 
91
91
  从该次返回值绑定并复用以下结构化映射:
92
92
 
@@ -100,7 +100,7 @@ agent-infra-internal task-artifact {task-id} init --family review-analysis --art
100
100
 
101
101
  `manual-validation` 是 `ai task log` 中 review 行「人工校验点」(EN `Manual-validation`)计数的数据源;不要新增并行人工验证字段。
102
102
 
103
- 如果 task.md 中存在有效的 `issue_number`,调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`,再调用 `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {review-artifact} --agent {standard-agent-token}`;失败按 `.agents/rules/issue-sync.md` 记录 warning。
103
+ 如果 task.md 中存在有效的 `platform_issue_identity`,调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`,再调用 `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {review-artifact} --agent {standard-agent-token}`;失败按 `.agents/rules/issue-sync.md` 记录 warning。
104
104
 
105
105
  最终化 intent 会在写入摘要前检查详情块 ID;任何可见重复都返回结构化失败并保持 artifact 字节不变,由模型按共享规则判断是否进行最小编辑。无法通过安全门、诊断重复、没有实际字节变化或达到紧急熔断时,停止在完成事件之前;停止路径仍必须展示已有审查结果,不得吞掉 artifact 内容。
106
106
 
@@ -27,7 +27,7 @@
27
27
  "expected_action_pattern": "(Review Analysis|Analysis Review) \\(Round \\d+\\)"
28
28
  },
29
29
  "platform-sync": {
30
- "when": "issue_number_exists",
30
+ "when": "platform_issue_identity_exists",
31
31
  "expected_status_label": "status: pending-design-work",
32
32
  "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
33
33
  "verify_comment_content": true,