@fitlab-ai/agent-infra 0.9.11 → 0.9.13

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 (356) hide show
  1. package/README.md +13 -13
  2. package/README.zh-CN.md +13 -13
  3. package/dist/bin/internal-cli.js +29 -19
  4. package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
  5. package/dist/lib/agent-clients/next-steps.js +6 -1
  6. package/dist/lib/decide.js +3 -3
  7. package/dist/lib/defaults.json +4 -0
  8. package/dist/lib/git/workflow.js +43 -1
  9. package/dist/lib/init.js +1 -0
  10. package/dist/lib/internal/git-workflow.js +8 -1
  11. package/dist/lib/internal/platform-checks.js +3 -3
  12. package/dist/lib/internal/platform-comment.js +9 -9
  13. package/dist/lib/internal/platform-context.js +2 -2
  14. package/dist/lib/internal/platform-issue.js +8 -9
  15. package/dist/lib/internal/platform-pr-review.js +10 -10
  16. package/dist/lib/internal/platform-pr.js +68 -23
  17. package/dist/lib/internal/platform-release-notes.js +3 -3
  18. package/dist/lib/internal/pr-review-grade.js +11 -9
  19. package/dist/lib/internal/release-workflow.js +4 -4
  20. package/dist/lib/internal/sandbox-control.js +30 -4
  21. package/dist/lib/internal/task-activity.js +3 -3
  22. package/dist/lib/internal/task-artifact.js +76 -24
  23. package/dist/lib/internal/task-create.js +2 -2
  24. package/dist/lib/internal/task-delivery.js +59 -0
  25. package/dist/lib/internal/task-event.js +6 -3
  26. package/dist/lib/internal/task-finalization.js +2 -2
  27. package/dist/lib/internal/task-invalidation.js +60 -0
  28. package/dist/lib/internal/task-ledger.js +9 -6
  29. package/dist/lib/internal/task-lifecycle.js +2 -2
  30. package/dist/lib/internal/task-override.js +4 -4
  31. package/dist/lib/internal/task-review.js +3 -3
  32. package/dist/lib/internal/task-verify.js +6 -6
  33. package/dist/lib/internal/task-warning.js +3 -3
  34. package/dist/lib/platform/adapters.js +1 -3
  35. package/dist/lib/platform/change-request-git-evidence.js +27 -7
  36. package/dist/lib/platform/completion-backfill.js +6 -5
  37. package/dist/lib/platform/context.js +70 -130
  38. package/dist/lib/platform/github-client.js +8 -2
  39. package/dist/lib/platform/github-provider.js +903 -0
  40. package/dist/lib/platform/in-label-sync.js +143 -0
  41. package/dist/lib/platform/issue-comments.js +94 -41
  42. package/dist/lib/platform/issues.js +335 -189
  43. package/dist/lib/platform/metadata-labels.js +6 -2
  44. package/dist/lib/platform/none-provider.js +28 -0
  45. package/dist/lib/platform/pr-change-report.js +551 -0
  46. package/dist/lib/platform/pr-checks.js +124 -106
  47. package/dist/lib/platform/pr-review.js +88 -72
  48. package/dist/lib/platform/pr-summary.js +523 -49
  49. package/dist/lib/platform/provider-bridge.js +45 -0
  50. package/dist/lib/platform/provider-contract.d.ts +487 -0
  51. package/dist/lib/platform/provider-contract.js +95 -0
  52. package/dist/lib/platform/provider-loader.js +251 -0
  53. package/dist/lib/platform/provider-validation.js +504 -0
  54. package/dist/lib/platform/pull-request-metadata.js +8 -6
  55. package/dist/lib/platform/pull-requests.js +1050 -502
  56. package/dist/lib/platform/release-notes.js +78 -55
  57. package/dist/lib/platform/releases.js +79 -50
  58. package/dist/lib/platform/resource-identity.d.ts +26 -0
  59. package/dist/lib/platform/resource-identity.js +92 -0
  60. package/dist/lib/platform/task-identities.js +31 -0
  61. package/dist/lib/platform/verification-required.js +22 -12
  62. package/dist/lib/platform/verification-sync.js +118 -239
  63. package/dist/lib/pr-review/evidence-grading.js +30 -9
  64. package/dist/lib/run/index.js +63 -23
  65. package/dist/lib/sandbox/config.js +5 -0
  66. package/dist/lib/sandbox/control/client.js +96 -15
  67. package/dist/lib/sandbox/control/executor.js +3 -3
  68. package/dist/lib/sandbox/control/lifecycle.js +29 -7
  69. package/dist/lib/sandbox/control/protocol.js +77 -0
  70. package/dist/lib/sandbox/control/server.js +398 -25
  71. package/dist/lib/sandbox/control/state.js +204 -1
  72. package/dist/lib/server/process-state.js +2 -2
  73. package/dist/lib/server/protocol.js +38 -1
  74. package/dist/lib/task/activity-log.js +8 -1
  75. package/dist/lib/task/artifact-lifecycle.js +35 -7
  76. package/dist/lib/task/capabilities.js +239 -0
  77. package/dist/lib/task/commands/status.js +32 -0
  78. package/dist/lib/task/commit-intent.js +100 -0
  79. package/dist/lib/task/commit-operation.js +207 -102
  80. package/dist/lib/task/control-authority.js +8 -5
  81. package/dist/lib/task/create-service.js +8 -8
  82. package/dist/lib/task/create.js +33 -7
  83. package/dist/lib/task/current-contract.js +5 -1
  84. package/dist/lib/task/decision-details.js +3 -48
  85. package/dist/lib/task/delivery-target.js +97 -0
  86. package/dist/lib/task/delivery.js +153 -0
  87. package/dist/lib/task/events.js +297 -17
  88. package/dist/lib/task/finalization.js +37 -13
  89. package/dist/lib/task/human-override.js +61 -36
  90. package/dist/lib/task/invalidation-command.js +86 -0
  91. package/dist/lib/task/invalidation.js +260 -0
  92. package/dist/lib/task/ledger-intents.js +37 -0
  93. package/dist/lib/task/lifecycle.js +106 -9
  94. package/dist/lib/task/local-artifact-finalization.js +374 -0
  95. package/dist/lib/task/orchestration.js +100 -151
  96. package/dist/lib/task/pr-delivery-fact.js +183 -0
  97. package/dist/lib/task/review-finalization.js +4 -8
  98. package/dist/lib/task/review-fingerprint.js +32 -2
  99. package/dist/lib/task/rework-intent.js +138 -0
  100. package/dist/lib/task/skill-scope.js +23 -0
  101. package/dist/lib/task/task-execution-lock.js +27 -17
  102. package/dist/lib/task/verification-engine.js +89 -38
  103. package/dist/lib/task/verification-review.js +1 -1
  104. package/dist/lib/task/verification.js +3 -3
  105. package/dist/lib/task/workflow-warning-intents.js +1 -1
  106. package/dist/lib/task/write.js +11 -0
  107. package/dist/lib/update.js +9 -0
  108. package/dist/lib/version.js +11 -1
  109. package/dist/lifecycle-build-manifest.json +3 -3
  110. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +105 -10
  111. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +12 -1
  112. package/lib/agent-clients/next-steps.ts +6 -1
  113. package/lib/decide.ts +3 -3
  114. package/lib/defaults.json +4 -0
  115. package/lib/git/workflow.ts +38 -1
  116. package/lib/init.ts +4 -1
  117. package/lib/internal/git-workflow.ts +7 -1
  118. package/lib/internal/platform-checks.ts +3 -3
  119. package/lib/internal/platform-comment.ts +8 -8
  120. package/lib/internal/platform-context.ts +2 -2
  121. package/lib/internal/platform-issue.ts +7 -8
  122. package/lib/internal/platform-pr-review.ts +9 -9
  123. package/lib/internal/platform-pr.ts +53 -21
  124. package/lib/internal/platform-release-notes.ts +3 -3
  125. package/lib/internal/pr-review-grade.ts +10 -8
  126. package/lib/internal/release-workflow.ts +4 -4
  127. package/lib/internal/sandbox-control.ts +27 -3
  128. package/lib/internal/task-activity.ts +3 -3
  129. package/lib/internal/task-artifact.ts +65 -22
  130. package/lib/internal/task-create.ts +2 -2
  131. package/lib/internal/task-delivery.ts +53 -0
  132. package/lib/internal/task-event.ts +6 -3
  133. package/lib/internal/task-finalization.ts +3 -3
  134. package/lib/internal/task-invalidation.ts +39 -0
  135. package/lib/internal/task-ledger.ts +11 -8
  136. package/lib/internal/task-lifecycle.ts +2 -2
  137. package/lib/internal/task-override.ts +6 -6
  138. package/lib/internal/task-review.ts +3 -3
  139. package/lib/internal/task-verify.ts +6 -6
  140. package/lib/internal/task-warning.ts +3 -3
  141. package/lib/platform/adapters.ts +3 -2
  142. package/lib/platform/change-request-git-evidence.ts +36 -9
  143. package/lib/platform/completion-backfill.ts +9 -8
  144. package/lib/platform/context.ts +97 -134
  145. package/lib/platform/github-client.ts +10 -3
  146. package/lib/platform/github-provider.ts +910 -0
  147. package/lib/platform/in-label-sync.ts +208 -0
  148. package/lib/platform/issue-comments.ts +97 -47
  149. package/lib/platform/issues.ts +344 -174
  150. package/lib/platform/metadata-labels.ts +5 -2
  151. package/lib/platform/none-provider.ts +35 -0
  152. package/lib/platform/pr-change-report.ts +645 -0
  153. package/lib/platform/pr-checks.ts +129 -107
  154. package/lib/platform/pr-review.ts +88 -85
  155. package/lib/platform/pr-summary.ts +562 -52
  156. package/lib/platform/provider-bridge.ts +82 -0
  157. package/lib/platform/provider-contract.ts +536 -0
  158. package/lib/platform/provider-loader.ts +307 -0
  159. package/lib/platform/provider-validation.ts +529 -0
  160. package/lib/platform/pull-request-metadata.ts +10 -7
  161. package/lib/platform/pull-requests.ts +1126 -505
  162. package/lib/platform/release-notes.ts +76 -59
  163. package/lib/platform/releases.ts +77 -43
  164. package/lib/platform/resource-identity.ts +121 -0
  165. package/lib/platform/task-identities.ts +40 -0
  166. package/lib/platform/types.ts +4 -2
  167. package/lib/platform/verification-required.ts +21 -13
  168. package/lib/platform/verification-sync.ts +118 -293
  169. package/lib/pr-review/evidence-grading.ts +31 -11
  170. package/lib/run/index.ts +57 -22
  171. package/lib/sandbox/config.ts +7 -0
  172. package/lib/sandbox/control/client.ts +105 -15
  173. package/lib/sandbox/control/executor.ts +4 -4
  174. package/lib/sandbox/control/lifecycle.ts +30 -8
  175. package/lib/sandbox/control/protocol.ts +113 -0
  176. package/lib/sandbox/control/server.ts +431 -23
  177. package/lib/sandbox/control/state.ts +251 -1
  178. package/lib/server/process-state.ts +2 -2
  179. package/lib/server/protocol.ts +36 -1
  180. package/lib/task/activity-log.ts +8 -0
  181. package/lib/task/artifact-lifecycle.ts +34 -8
  182. package/lib/task/capabilities.ts +262 -0
  183. package/lib/task/commands/status.ts +38 -0
  184. package/lib/task/commit-intent.ts +137 -0
  185. package/lib/task/commit-operation.ts +186 -88
  186. package/lib/task/control-authority.ts +11 -8
  187. package/lib/task/create-service.ts +8 -8
  188. package/lib/task/create.ts +34 -9
  189. package/lib/task/current-contract.ts +6 -1
  190. package/lib/task/decision-details.ts +8 -64
  191. package/lib/task/delivery-target.ts +130 -0
  192. package/lib/task/delivery.ts +160 -0
  193. package/lib/task/events.ts +296 -16
  194. package/lib/task/finalization.ts +50 -14
  195. package/lib/task/human-override.ts +73 -46
  196. package/lib/task/invalidation-command.ts +86 -0
  197. package/lib/task/invalidation.ts +332 -0
  198. package/lib/task/ledger-intents.ts +35 -1
  199. package/lib/task/lifecycle.ts +93 -4
  200. package/lib/task/local-artifact-finalization.ts +563 -0
  201. package/lib/task/orchestration.ts +110 -146
  202. package/lib/task/pr-delivery-fact.ts +237 -0
  203. package/lib/task/review-finalization.ts +4 -14
  204. package/lib/task/review-fingerprint.ts +33 -2
  205. package/lib/task/rework-intent.ts +165 -0
  206. package/lib/task/skill-scope.ts +24 -0
  207. package/lib/task/task-execution-lock.ts +23 -14
  208. package/lib/task/verification-engine.ts +95 -43
  209. package/lib/task/verification-review.ts +2 -0
  210. package/lib/task/verification.ts +4 -4
  211. package/lib/task/workflow-warning-intents.ts +1 -1
  212. package/lib/task/write.ts +19 -0
  213. package/lib/update.ts +11 -1
  214. package/lib/version.ts +15 -1
  215. package/package.json +7 -1
  216. package/templates/.agents/rules/README.en.md +4 -2
  217. package/templates/.agents/rules/README.zh-CN.md +4 -2
  218. package/templates/.agents/rules/create-issue.en.md +11 -2
  219. package/templates/.agents/rules/create-issue.zh-CN.md +24 -2
  220. package/templates/.agents/rules/issue-pr-commands.en.md +4 -17
  221. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
  222. package/templates/.agents/rules/issue-sync.en.md +28 -5
  223. package/templates/.agents/rules/issue-sync.zh-CN.md +64 -5
  224. package/templates/.agents/rules/label-milestone-setup.en.md +15 -2
  225. package/templates/.agents/rules/label-milestone-setup.zh-CN.md +15 -2
  226. package/templates/.agents/rules/local-artifact-repair.en.md +53 -0
  227. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +53 -0
  228. package/templates/.agents/rules/milestone-inference.en.md +12 -2
  229. package/templates/.agents/rules/milestone-inference.zh-CN.md +25 -3
  230. package/templates/.agents/rules/pr-sync.en.md +28 -13
  231. package/templates/.agents/rules/pr-sync.zh-CN.md +39 -5
  232. package/templates/.agents/rules/release-commands.en.md +42 -3
  233. package/templates/.agents/rules/release-commands.zh-CN.md +42 -3
  234. package/templates/.agents/rules/security-alerts.en.md +17 -2
  235. package/templates/.agents/rules/security-alerts.zh-CN.md +17 -2
  236. package/templates/.agents/rules/sync-content-generation.en.md +8 -0
  237. package/templates/.agents/rules/sync-content-generation.zh-CN.md +8 -0
  238. package/templates/.agents/rules/task-management.en.md +1 -1
  239. package/templates/.agents/rules/task-management.zh-CN.md +1 -1
  240. package/templates/.agents/rules/task-short-id.en.md +1 -4
  241. package/templates/.agents/rules/task-short-id.zh-CN.md +1 -3
  242. package/templates/.agents/scripts/security-alerts.github.sh +151 -0
  243. package/templates/.agents/scripts/security-alerts.sh +31 -0
  244. package/templates/.agents/skills/analyze-task/SKILL.en.md +14 -3
  245. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +11 -3
  246. package/templates/.agents/skills/check-task/SKILL.en.md +16 -37
  247. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -37
  248. package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
  249. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  250. package/templates/.agents/skills/close-dependabot/SKILL.en.md +2 -2
  251. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
  252. package/templates/.agents/skills/code-task/SKILL.en.md +32 -10
  253. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +35 -13
  254. package/templates/.agents/skills/code-task/config/verify.en.json +1 -0
  255. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -0
  256. package/templates/.agents/skills/commit/SKILL.en.md +3 -3
  257. package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -3
  258. package/templates/.agents/skills/commit/config/verify.json +1 -1
  259. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +3 -3
  260. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +3 -3
  261. package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +2 -0
  262. package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +2 -0
  263. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +4 -4
  264. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +4 -4
  265. package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -2
  266. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
  267. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +7 -4
  268. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +7 -4
  269. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
  270. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
  271. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +5 -4
  272. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +5 -4
  273. package/templates/.agents/skills/complete-task/SKILL.en.md +31 -13
  274. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +30 -13
  275. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +2 -2
  276. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +2 -2
  277. package/templates/.agents/skills/create-pr/SKILL.en.md +11 -10
  278. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +11 -11
  279. package/templates/.agents/skills/create-pr/config/verify.json +1 -0
  280. package/templates/.agents/skills/create-pr/reference/change-report.en.md +16 -4
  281. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +16 -4
  282. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +5 -3
  283. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +5 -3
  284. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
  285. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
  286. package/templates/.agents/skills/create-pr/scripts/change-report.mjs +3 -0
  287. package/templates/.agents/skills/create-task/SKILL.en.md +1 -0
  288. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -0
  289. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  290. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  291. package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
  292. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
  293. package/templates/.agents/skills/init-labels/SKILL.en.md +9 -10
  294. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -10
  295. package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +57 -1
  296. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +27 -1
  297. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -5
  298. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -5
  299. package/templates/.agents/skills/plan-task/SKILL.en.md +14 -3
  300. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +11 -3
  301. package/templates/.agents/skills/review-analysis/SKILL.en.md +6 -5
  302. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +6 -5
  303. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +18 -0
  304. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +18 -0
  305. package/templates/.agents/skills/review-code/SKILL.en.md +10 -9
  306. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +10 -9
  307. package/templates/.agents/skills/review-code/reference/output-templates.en.md +19 -1
  308. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +19 -1
  309. package/templates/.agents/skills/review-code/reference/report-template.en.md +4 -2
  310. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +4 -2
  311. package/templates/.agents/skills/review-plan/SKILL.en.md +6 -5
  312. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +6 -5
  313. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +18 -0
  314. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +18 -0
  315. package/templates/.agents/skills/review-pr/SKILL.en.md +1 -0
  316. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -0
  317. package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +2 -2
  318. package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +2 -2
  319. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -2
  320. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -2
  321. package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
  322. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
  323. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +4 -0
  324. package/templates/.agents/skills/watch-pr/SKILL.en.md +6 -6
  325. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +6 -6
  326. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +6 -0
  327. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +6 -0
  328. package/templates/.agents/templates/task.en.md +23 -2
  329. package/templates/.agents/templates/task.zh-CN.md +23 -2
  330. package/templates/.agents/workflows/bug-fix.en.yaml +9 -8
  331. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +9 -8
  332. package/templates/.agents/workflows/feature-development.en.yaml +9 -8
  333. package/templates/.agents/workflows/feature-development.zh-CN.yaml +9 -8
  334. package/templates/.agents/workflows/refactoring.en.yaml +9 -8
  335. package/templates/.agents/workflows/refactoring.zh-CN.yaml +9 -8
  336. package/templates/.github/workflows/pr-label.yml +7 -26
  337. package/templates/.agents/rules/create-issue.github.en.md +0 -14
  338. package/templates/.agents/rules/create-issue.github.zh-CN.md +0 -27
  339. package/templates/.agents/rules/issue-pr-commands.github.en.md +0 -34
  340. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +0 -49
  341. package/templates/.agents/rules/issue-sync.github.en.md +0 -40
  342. package/templates/.agents/rules/issue-sync.github.zh-CN.md +0 -76
  343. package/templates/.agents/rules/label-milestone-setup.github.en.md +0 -60
  344. package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +0 -60
  345. package/templates/.agents/rules/milestone-inference.github.en.md +0 -15
  346. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +0 -27
  347. package/templates/.agents/rules/pr-checks-commands.github.en.md +0 -18
  348. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +0 -34
  349. package/templates/.agents/rules/pr-sync.github.en.md +0 -43
  350. package/templates/.agents/rules/pr-sync.github.zh-CN.md +0 -69
  351. package/templates/.agents/rules/release-commands.github.en.md +0 -44
  352. package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -44
  353. package/templates/.agents/rules/security-alerts.github.en.md +0 -43
  354. package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
  355. /package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +0 -0
  356. /package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +0 -0
@@ -1,16 +1,17 @@
1
1
  # Manual-validation PR Summary Update
2
2
 
3
- Run only for a valid `{task-id}` whose task.md binds a `pr_number`; any user-supplied PR identity must match it.
3
+ Run only for a valid `{task-id}` whose task.md binds a verified `pr_delivery_fact`; any user-supplied PR identity must match it.
4
4
 
5
5
  Follow `.agents/rules/pr-sync.md` for the shared summary structure and failure semantics.
6
6
 
7
7
  1. After the canonical `manual-validation*` artifact is written, run `agent-infra-internal platform-pr summary-context {task-id}`.
8
8
  2. Rebuild the summary from canonical inputs and render `### ✅ Manual Validation Passed` with the validation time and explanation.
9
- 3. Write the plain body to a temporary file and run:
9
+ 3. Write the plain body with exactly one `<!-- canonical-pr-change-report -->` placeholder to a temporary file and run:
10
10
 
11
11
  ```bash
12
12
  agent-infra-internal platform-pr summary-sync {task-id} \
13
- --agent {standard-agent-token} --body-file {summary-body-file}
13
+ --agent {standard-agent-token} --body-file {summary-body-file} \
14
+ --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json --result no_op
14
15
  ```
15
16
 
16
- The core owns marker/HEAD wrapping, pagination, and in-place reconciliation. If context says no manual validation is required, stop without marking it passed.
17
+ The core owns the rendered report, marker/authoritative PR-head wrapping, pagination, and in-place reconciliation. If context says no manual validation is required, stop without marking it passed.
@@ -1,18 +1,19 @@
1
1
  # PR 摘要人工验证更新
2
2
 
3
- 人工验证产物结构见 `reference/report-template.md`。本步骤只在有效 `{task-id}` 且 task.md 已绑定 `pr_number` 时执行;用户另传 PR 身份时必须与绑定值一致。
3
+ 人工验证产物结构见 `reference/report-template.md`。本步骤只在有效 `{task-id}` 且 task.md 已绑定 verified `pr_delivery_fact` 时执行;用户另传 PR 身份时必须与 fact identity 一致。
4
4
 
5
5
  摘要结构与失败语义统一遵循 `.agents/rules/pr-sync.md`。
6
6
 
7
7
  1. 在 canonical `manual-validation*` artifact 落盘后,调用 `agent-infra-internal platform-pr summary-context {task-id}`。
8
8
  2. 从返回的最新产物重新聚合摘要,将人工校验段渲染为 `### ✅ 人工验证已通过`,写明验证时间和说明。
9
- 3. 把纯正文写入临时文件,调用:
9
+ 3. 把只含一次 `<!-- canonical-pr-change-report -->` 的纯正文写入临时文件,调用:
10
10
 
11
11
  ```bash
12
12
  agent-infra-internal platform-pr summary-sync {task-id} \
13
- --agent {standard-agent-token} --body-file {summary-body-file}
13
+ --agent {standard-agent-token} --body-file {summary-body-file} \
14
+ --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json --result no_op
14
15
  ```
15
16
 
16
- marker、当前 HEAD、分页查找和原地更新由 core 负责。若当前 context 表明无需人工校验,则停止并返回 `summary failed: no manual validation required`,不误标通过。
17
+ marker、报告段、权威 PR head、分页查找和原地更新由 core 负责。若当前 context 表明无需人工校验,则停止并返回 `summary failed: no manual validation required`,不误标通过。
17
18
 
18
19
  结果回传:`summary updated`、`summary skipped (no diff)` 或 `summary failed: <reason>`。
@@ -66,35 +66,35 @@ agent-infra-internal platform-pr resolve-external {task-id} --agent {standard-ag
66
66
  ```
67
67
 
68
68
  - `mode=external`: only this invocation's typed `authorization` and `selected` fields authorize and identify external delivery; continue through the required-PR, local lifecycle, and terminal checks, while peripheral evidence failures become warnings after lifecycle.
69
- - `mode=normal`: use the existing local lifecycle prerequisites; historical `pr_number` / `pr_status` values do not authorize external delivery.
69
+ - `mode=normal`: use the existing local lifecycle prerequisites; historical legacy PR fields do not authorize external delivery.
70
70
  - `status=failed|blocked`: stop immediately and show the stable error; `--force` cannot bypass it.
71
71
 
72
- **Gate read (project-level PR flow policy)**: Before running this step, read `.agents/.airc.json`'s `prFlow` field (three states: field absent = recommend PR by default, skipping allowed; `"required"` = PR mandatory; `"disabled"` = no PR flow), and `pr_status` from `task.md` frontmatter (`pending` / `created` / `skipped`).
72
+ **Gate read (project-level PR flow policy)**: Before running this step, read `.agents/.airc.json`'s `prFlow` field (three states: field absent = recommend PR by default, skipping allowed; `"required"` = PR mandatory; `"disabled"` = no PR flow), and `pr_delivery_fact` from `task.md` frontmatter (`unbound` / `bound` / `skipped`).
73
73
 
74
- **PR dimension decision (evaluate the `prFlow` strong constraint FIRST, then `pr_status`)**:
74
+ **PR dimension decision (evaluate the `prFlow` strong constraint FIRST, then `pr_delivery_fact.state`)**:
75
75
 
76
- | `prFlow` | `pr_status` | Decision |
76
+ | `prFlow` | `pr_delivery_fact.state` | Decision |
77
77
  |---|---|---|
78
78
  | `disabled` | any | No PR path -> PR dimension satisfied, continue with the other prerequisites |
79
- | `required` | `created` | PR dimension satisfied, continue |
80
- | `required` | `pending` / `skipped` | **Stop**: under a mandatory PR flow you must run `/create-pr` first; `--skip-pr` is NOT accepted (including a pre-existing / manually-set `skipped`) |
81
- | absent | `created` / `skipped` | PR dimension satisfied, continue |
82
- | absent | `pending` | **Stop by default** and print the two-option guidance below; unless the user passes `--skip-pr` (writes `pr_status: skipped`, then continues) or `--force` |
79
+ | `required` | `bound` | PR dimension satisfied, continue |
80
+ | `required` | `unbound` / `skipped` | **Stop**: under a mandatory PR flow you must run `/create-pr` first; `--skip-pr` is NOT accepted (including a pre-existing / manually-set `skipped`) |
81
+ | absent | `bound` / `skipped` | PR dimension satisfied, continue |
82
+ | absent | `unbound` | **Stop by default** and print the two-option guidance below; unless the user passes `--skip-pr` (writes `pr_delivery_fact.state=skipped` through the current `platform-pr skip` writer, then continues) or `--force` |
83
83
 
84
- - `--skip-pr` handling: effective only when `prFlow` is not `required` -> set `pr_status` to `skipped` in `task.md`, then continue; when `prFlow=required`, ignore `--skip-pr` and stop per the table.
84
+ - `--skip-pr` handling: effective only when `prFlow` is not `required` -> write `pr_delivery_fact.state=skipped` through the current `platform-pr skip` writer, then continue; when `prFlow=required`, ignore `--skip-pr` and stop per the table.
85
85
  - Note: `--force` may override the other prerequisites below, but does **NOT** lift the `prFlow=required` PR constraint (the only exit from the strong constraint is creating a PR).
86
86
 
87
87
  Two-option guidance for absent + `pending`:
88
88
  ```
89
- Task {task-id} has no PR yet (pr_status: pending). Choose one:
90
- - Go through the PR flow: /create-pr {task-ref}
91
- - Explicitly skip and complete: /complete-task {task-ref} --skip-pr
89
+ Task {task-id} has no PR delivery decision yet (pr_delivery_fact: unbound). Choose one:
90
+ - Go through the PR flow: /create-pr --task {task-ref}
91
+ - Explicitly skip and complete: /complete-task --task {task-ref} --skip-pr
92
92
  ```
93
93
 
94
94
  Stop message for `required` + `pending`/`skipped`:
95
95
  ```
96
96
  This project enforces the PR flow (prFlow: "required") and the task has no PR yet.
97
- Run /create-pr {task-ref} first, then complete; --skip-pr is not accepted under a mandatory PR flow.
97
+ Run /create-pr --task {task-ref} first, then complete; --skip-pr is not accepted under a mandatory PR flow.
98
98
  ```
99
99
 
100
100
  Before lifecycle, verify only the hard gates:
@@ -198,6 +198,24 @@ Handle the result as follows:
198
198
 
199
199
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
200
200
 
201
+ ### Accepted sandbox-control result recovery
202
+
203
+ When this skill is invoked from a sandbox and the control client reports an
204
+ accepted request without a terminal result, preserve the request identity. The
205
+ client prints `SANDBOX_CONTROL_REQUEST_ID: <request-id>` on stderr for this
206
+ case. After the broker is healthy again, recover the same terminal response:
207
+
208
+ ```bash
209
+ agent-infra-internal sandbox-control recover <request-id>
210
+ ```
211
+
212
+ Do not submit a new request for an accepted task finalization. The broker's
213
+ `processing/<request-id>/result.json` is private transport evidence; it is not
214
+ a task receipt and cannot by itself prove completion. The finalization receipt
215
+ and the host completion gate remain authoritative. If the request was rejected
216
+ before acceptance, a new request ID may be used according to the error's
217
+ retryability.
218
+
201
219
  ### 8. Inform User
202
220
 
203
221
  > Execute this step only after the verification gate passes.
@@ -65,35 +65,35 @@ agent-infra-internal platform-pr resolve-external {task-id} --agent {standard-ag
65
65
  ```
66
66
 
67
67
  - `mode=external`:只以本次 typed result 的 `authorization` 和 `selected` 作为外部交付授权与绑定身份,继续 required-PR、本地生命周期和终态校验;外围证据失败在 lifecycle 后记录为 warning。
68
- - `mode=normal`:走现有本地生命周期前置条件;历史 `pr_number` / `pr_status` 不构成外部授权。
68
+ - `mode=normal`:走现有本地生命周期前置条件;历史 PR 字段不构成外部授权。
69
69
  - `status=failed|blocked`:立即停止并展示稳定错误;`--force` 不得绕过。
70
70
 
71
- **门控读取(项目级 PR 流程策略)**:在执行本步骤前,读取 `.agents/.airc.json` 的 `prFlow` 字段(三态:字段缺省 = 默认推荐 PR、允许跳过;`"required"` = 强制 PR;`"disabled"` = 强制无 PR),以及 `task.md` frontmatter 的 `pr_status`(`pending` / `created` / `skipped`)。
71
+ **门控读取(项目级 PR 流程策略)**:在执行本步骤前,读取 `.agents/.airc.json` 的 `prFlow` 字段(三态:字段缺省 = 默认推荐 PR、允许跳过;`"required"` = 强制 PR;`"disabled"` = 强制无 PR),以及 `task.md` frontmatter 的 `pr_delivery_fact`(`unbound` / `bound` / `skipped`)。
72
72
 
73
- **PR 维度判定(先判 `prFlow` 强约束,后看 `pr_status`)**:
73
+ **PR 维度判定(先判 `prFlow` 强约束,后看 `pr_delivery_fact.state`)**:
74
74
 
75
- | `prFlow` | `pr_status` | 判定 |
75
+ | `prFlow` | `pr_delivery_fact.state` | 判定 |
76
76
  |---|---|---|
77
77
  | `disabled` | 任意 | 无 PR 路径 → PR 维度满足,继续其余前置条件 |
78
- | `required` | `created` | PR 维度满足,继续 |
79
- | `required` | `pending` / `skipped` | **停止**:强制 PR 下必须先 `/create-pr`;`--skip-pr` 不被接受(含既有/手动写入的 `skipped`) |
80
- | 缺省 | `created` / `skipped` | PR 维度满足,继续 |
81
- | 缺省 | `pending` | **默认停止**并输出下方二选一引导;除非用户提供 `--skip-pr`(写 `pr_status: skipped` 后继续)或 `--force` |
78
+ | `required` | `bound` | PR 维度满足,继续 |
79
+ | `required` | `unbound` / `skipped` | **停止**:强制 PR 下必须先 `/create-pr`;`--skip-pr` 不被接受(含既有/手动写入的 `skipped`) |
80
+ | 缺省 | `bound` / `skipped` | PR 维度满足,继续 |
81
+ | 缺省 | `unbound` | **默认停止**并输出下方二选一引导;除非用户提供 `--skip-pr`(通过当前 `platform-pr skip` 写入器写入 `pr_delivery_fact.state=skipped` 后继续)或 `--force` |
82
82
 
83
- - `--skip-pr` 处理:仅在 `prFlow` 非 `required` 时生效——把 `task.md` 的 `pr_status` 写为 `skipped` 后继续;`prFlow=required` 时忽略 `--skip-pr` 并按上表停止。
83
+ - `--skip-pr` 处理:仅在 `prFlow` 非 `required` 时生效——通过当前 `platform-pr skip` 写入器把 `task.md` 的 `pr_delivery_fact.state` 写为 `skipped` 后继续;`prFlow=required` 时忽略 `--skip-pr` 并按上表停止。
84
84
  - 注:`--force` 可越过下方其余前置条件,但**不解除 `prFlow=required` 的 PR 强约束**(强约束的唯一出口是创建 PR)。
85
85
 
86
86
  缺省 + `pending` 的二选一引导消息:
87
87
  ```
88
- 任务 {task-id} 尚未创建 PR(pr_status: pending)。请二选一:
89
- - 走 PR 流程:/create-pr {task-ref}
90
- - 显式跳过并完成:/complete-task {task-ref} --skip-pr
88
+ 任务 {task-id} 尚未决定 PR 交付(pr_delivery_fact: unbound)。请二选一:
89
+ - 走 PR 流程:/create-pr --task {task-ref}
90
+ - 显式跳过并完成:/complete-task --task {task-ref} --skip-pr
91
91
  ```
92
92
 
93
93
  `required` + `pending`/`skipped` 的停止消息:
94
94
  ```
95
95
  当前项目强制 PR 流程(prFlow: "required"),任务尚未创建 PR。
96
- 请先运行 /create-pr {task-ref} 创建 PR 后再完成;--skip-pr 在强制 PR 下不被接受。
96
+ 请先运行 /create-pr --task {task-ref} 创建 PR 后再完成;--skip-pr 在强制 PR 下不被接受。
97
97
  ```
98
98
 
99
99
  生命周期前只验证硬门禁:
@@ -197,6 +197,23 @@ agent-infra-internal task-verify {task-id} complete-task.completed --format text
197
197
 
198
198
  将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
199
199
 
200
+ ### accepted 后的 sandbox-control 结果恢复
201
+
202
+ 如果本技能在沙箱内执行,且 control client 报告请求已经 accepted 但没有
203
+ terminal result,必须保留原 request identity。此时 client 会在 stderr 输出
204
+ `SANDBOX_CONTROL_REQUEST_ID: <request-id>`。broker 恢复健康后,使用同一个
205
+ request ID 读取 terminal response:
206
+
207
+ ```bash
208
+ agent-infra-internal sandbox-control recover <request-id>
209
+ ```
210
+
211
+ accepted 的 task finalization 不得提交新请求。broker 的
212
+ `processing/<request-id>/result.json` 只是私有 transport evidence,不是 task
213
+ receipt,单凭它不能证明任务完成;finalization receipt 和宿主完成校验仍是
214
+ 权威。如果请求在 accepted 之前已被拒绝,则可依据错误的 retryability 使用
215
+ 新的 request ID。
216
+
200
217
  ### 8. 告知用户
201
218
 
202
219
  > 仅在校验通过后执行本步骤。
@@ -10,8 +10,8 @@ The platform adapter supplies authoritative Issue closing change requests across
10
10
 
11
11
  ## Authorization and Persistent Audit
12
12
 
13
- Only the current typed result's `mode=external`, `authorization`, and `selected` fields control the machine branch. `pr_status: created` is a compatibility shim for existing verifiers: it means a verifiable PR is bound, not that this task created it, and it cannot authorize lifecycle skipping by itself.
13
+ Only the current typed result's `mode=external`, `authorization`, and `selected` fields control the machine branch. Persistent `pr_delivery_fact` stores the verified binding and provenance; it does not say that the current invocation created the PR and cannot authorize lifecycle skipping by itself.
14
14
 
15
- A successful bind atomically writes PR fields and appends a `Bind External PR` Activity Log entry containing the authorization source, Issue, PR URL/number, base/head repository/ref/SHA, merge time, and merge commit. Replaying identical complete evidence is a no-op; an existing same-number binding without the signature adds it once; number or identity changes fail. The PR create path must never run.
15
+ A successful bind atomically writes `pr_delivery_fact` and appends a `Bind External PR` Activity Log entry containing the authorization source, Issue, PR URL/number, base/head repository/ref/SHA, merge time, and merge commit. Replaying identical complete evidence is a no-op; an existing same-number binding without the signature adds it once; number or identity changes fail. The PR create path must never run.
16
16
 
17
17
  External mode still passes identity, required-PR, local lifecycle, and terminal checks; review-ledger, manual-validation, post-review-commit, and platform-sync evidence is projected as warning/pending steps after lifecycle. Without a canonical review-code artifact, only existing verifier N/A rules apply. `--force` does not disable identity, local atomicity, or required-PR hard gates.
@@ -10,8 +10,8 @@ core 通过平台 adapter 读取 Issue 的权威 closing change requests,穷
10
10
 
11
11
  ## 授权与持久审计
12
12
 
13
- 当次调用只以 typed result 的 `mode=external`、`authorization` 和 `selected` 为机器分支依据。`pr_status: created` 只是现有 verifier 的兼容 shim,表示任务已绑定可验证的 PR;它既不表示 PR 由本任务创建,也不能单独授权跳过 lifecycle。
13
+ 当次调用只以 typed result 的 `mode=external`、`authorization` 和 `selected` 为机器分支依据。持久化 `pr_delivery_fact` 保存已验证绑定及 provenance;它不表示本次调用创建了 PR,也不能单独授权跳过 lifecycle。
14
14
 
15
- 成功绑定会原子写入 PR 字段并追加 `Bind External PR` Activity Log,记录授权来源、Issue、PR URL/编号、base/head repository/ref/SHA、合并时间和 merge commit。相同完整证据重试为 no-op;已有同号但缺审计签名时补写一次;编号或身份变化失败。不得调用 PR create 路径。
15
+ 成功绑定会原子写入 `pr_delivery_fact` 并追加 `Bind External PR` Activity Log,记录授权来源、Issue、PR URL/编号、base/head repository/ref/SHA、合并时间和 merge commit。相同完整证据重试为 no-op;已有同号但缺审计签名时补写一次;编号或身份变化失败。不得调用 PR create 路径。
16
16
 
17
17
  外部模式仍须通过身份、required-PR、本地生命周期与终态校验;review ledger、manual validation、post-review commit 和平台同步等外围证据在 lifecycle 后作为 warning/pending steps 投影。无 canonical review-code 时仅沿用 verifier 已定义的 N/A 规则;`--force` 不解除身份、本地原子性或 required-PR 硬门禁。
@@ -33,7 +33,7 @@ On a real `platform-pr create`, the typed core idempotently records `Create PR [
33
33
 
34
34
  Branch on the result:
35
35
  - absent / `"required"` -> continue to Step 1 below
36
- - `"disabled"` -> output the message below and **stop immediately**. Do not run any subsequent numbered step, do not trigger any PR-creation command, do not modify `pr_number` / `pr_status` in `task.md`, and do not publish a PR summary comment:
36
+ - `"disabled"` -> output the message below and **stop immediately**. Do not run any subsequent numbered step, do not trigger any PR-creation command, do not modify `pr_delivery_fact` in `task.md`, and do not publish a PR summary comment:
37
37
 
38
38
  Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}`.
39
39
 
@@ -64,7 +64,7 @@ Read the PR template through `.agents/rules/issue-pr-commands.md`, review recent
64
64
 
65
65
  ### 4. Check Remote Branch State
66
66
 
67
- Use `agent-infra-internal git-workflow inspect` for already-delivered upstream/remote facts. `create-pr` never performs the first push; a missing remote branch or a remote SHA that differs from local HEAD fails and points back to `commit`/push-only. Core rechecks the remote branch SHA before and immediately before bind, and requires exact repository/ref, base, and `head.sha` identity. A post-POST race never deletes the created PR or remote branch; the next retry recovers only by resource identity.
67
+ Run `agent-infra-internal task-delivery {task-id} deliver --agent {standard-agent-token}` to deliver the task branch through one core. The core handles first creation, same-SHA no-op, a known-last-delivered SHA update with `--force-with-lease`, and unknown drift fail-closed. After delivery it verifies the remote SHA again and continues only when it equals local `HEAD`. Optional `--remote` / `--base` values must match the task binding. Core still rechecks the remote branch SHA before and immediately before bind, and requires exact repository/ref, base, and `head.sha` identity. A post-POST race never deletes the created PR or remote branch; the next retry recovers only by resource identity.
68
68
 
69
69
  ### 5. Create or Recover the PR
70
70
 
@@ -74,25 +74,25 @@ If `{task-id}` is available and the related task provides `issue_number`, keep `
74
74
 
75
75
  ### 6. Sync PR Metadata
76
76
 
77
- Capture the `result` field from `platform-pr create` (`pr_created`, `pr_reused`, or `no_op`), then run `agent-infra-internal platform-pr sync {task-id} --agent {standard-agent-token} --metadata --closing-issue --result {primary-result}`. The core copies type / `in:` labels, assignee, and a specific milestone from the Issue and maintains the closing association. Permission-bound items degrade independently, and the Issue is never updated in reverse. After the PR identity is bound, metadata or summary sync failures produce `pr_created_with_warnings`, `pr_reused_with_warnings`, or `no_op_with_warnings` from that primary result, preserve the primary-action fact, and retry only unfinished sync steps.
77
+ Capture the `result` field from `platform-pr create` (`pr_created`, `pr_reused`, or `no_op`), then run `agent-infra-internal platform-pr sync {task-id} --agent {standard-agent-token} --metadata --closing-issue --result {primary-result}`. The shared core computes one `in:` target from task-bound diff/PR evidence and the repository mapping, converges a unique closing Issue before the PR, and syncs other metadata from the Issue. It never copies `in:` labels back from the Issue or removes unrelated labels. Permission failures degrade independently; partial side effects return blocked/`IN_LABEL_SYNC_PARTIAL`.
78
78
 
79
79
  ### 7. Generate the PR Code Change Report
80
80
 
81
- After creating or uniquely reusing the PR, run `agent-infra-internal platform-pr inspect {task-id}` to obtain the authoritative base/head SHAs, then follow `reference/change-report.md` to classify the complete PR line counts, Git blob byte sizes, renames, and potentially unnecessary changes. Read that reference before this step.
81
+ After creating or uniquely reusing the PR, run `agent-infra-internal platform-pr inspect {task-id}` to obtain the authoritative base/head SHAs, then follow `reference/change-report.md` for the mechanical complete-PR report. Combine the task goal with the complete three-dot diff to produce a six-check precheck candidate with file evidence, then run `platform-pr change-report` to write the task-bound `pr-change-report.json` sidecar. Read that reference before this step.
82
82
 
83
- The report is part of the reviewer summary below and must also appear in the final user response. Do not provide only total lines, omit byte changes, or inspect only the last commit.
83
+ The core renderer owns the report section. It is part of the reviewer summary below and must also appear in the final user response. Do not provide only total lines, omit byte changes, inspect only the last commit, or let the caller assemble the report section.
84
84
 
85
85
  ### 8. Publish the Review Summary
86
86
 
87
87
  Read the latest context artifacts when they exist: `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.md`, `code.md` / `code-r{N}.md`, and `review-code.md` / `review-code-r{N}.md`.
88
88
 
89
- Aggregate a reviewer-facing summary from those artifacts, append the `### PR Code Changes` section generated in step 7, and maintain a single idempotent summary comment via the hidden marker. Pass the same `--result {primary-result}` to `summary-sync`; a sync substep must not infer whether the PR was created or reused.
89
+ Aggregate a reviewer-facing summary from those artifacts with exactly one `<!-- canonical-pr-change-report -->` placeholder, and maintain a single idempotent summary comment via the hidden marker. Pass `--change-report-file .agents/workspace/active/{task-id}/pr-change-report.json` and the same `--result {primary-result}` to `summary-sync`; a sync substep must not infer whether the PR was created or reused.
90
90
 
91
91
  > Canonical context, aggregation, and the `summary-sync` call live in `reference/comment-publish.md`, which points to `.agents/rules/pr-sync.md`. Read that reference before publishing.
92
92
 
93
93
  ### 9. Confirm Task Status
94
94
 
95
- After a PR is created or uniquely recovered, `platform-pr create` atomically updates `pr_number`, `pr_status`, canonical time/version metadata, and the Create PR completion log through the task write core. The caller verifies the structured result and does not edit those fields again.
95
+ After a PR is created or uniquely recovered, `platform-pr create` atomically updates the verified `pr_delivery_fact`, canonical time/version metadata, and the Create PR completion log through the task write core. The caller verifies the structured result and does not edit the fact again.
96
96
 
97
97
  ### 10. Verification Gate
98
98
 
@@ -139,14 +139,15 @@ Next step (alternative) - Skip active monitoring and attempt completion:
139
139
 
140
140
  - Review every commit in the branch, not only the latest one
141
141
  - `create-pr` must not defer type-label mapping to another skill; inline the mapping here when `{task-id}` is available
142
- - The summary marker and current HEAD are wrapped by `platform-pr summary-sync`
142
+ - The summary marker, authoritative PR head, and `### PR Code Changes` section are wrapped by `platform-pr summary-sync`
143
+ - An existing PR still goes through binding, report generation, summary synchronization, and result verification; reuse must not end the flow early
143
144
  - When metadata inheritance from the Issue fails, continue with task.md and branch-based fallbacks
144
145
 
145
146
  ## Error Handling
146
147
 
147
148
  - No commits found between `{target}` and `HEAD`
148
149
  - Push rejected: suggest `git pull --rebase`
149
- - Existing PR found: show the current PR URL and stop
150
+ - Existing PR found: continue through binding, report generation, summary synchronization, and result verification before showing the current PR URL
150
151
  - Inaccessible Issue metadata: skip inheritance and continue
151
- - PR creation failed with an associated `{task-id}`: run `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "Fix push, permission, or platform issues and rerun create-pr"` to submit a structured warning intent, and do not write `pr_number`
152
+ - PR creation failed with an associated `{task-id}`: run `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "Fix push, permission, or platform issues and rerun create-pr"` to submit a structured warning intent, and do not write an incomplete `pr_delivery_fact`
152
153
  - PR summary comment failed with an associated `{task-id}`: record a `COMMENT_SYNC_FAILED` warning per `.agents/rules/pr-sync.md`, without rolling back an already-created PR
@@ -33,7 +33,7 @@ description: >
33
33
 
34
34
  按读取结果分支:
35
35
  - 缺省 / `"required"` → 继续到下方第 1 步
36
- - `"disabled"` → 输出以下消息后**立即停止**,不要执行任何后续编号步骤、不要触发任何 PR 创建命令、不要修改 `task.md` 的 `pr_number` / `pr_status`、不要发布 PR 摘要评论:
36
+ - `"disabled"` → 输出以下消息后**立即停止**,不要执行任何后续编号步骤、不要触发任何 PR 创建命令、不要修改 `task.md` 的 `pr_delivery_fact`、不要发布 PR 摘要评论:
37
37
 
38
38
  使用 `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
39
39
 
@@ -64,7 +64,7 @@ description: >
64
64
 
65
65
  ### 4. 检查远程分支状态
66
66
 
67
- 调用 `agent-infra-internal git-workflow inspect` 检查已交付的 upstream/remote branch;`create-pr` 不执行首次 push,远端 branch 缺失或 SHA 与本地 HEAD 不一致时直接失败并指向 `commit`/push-only。随后在 locate/create/bind 前后再次读取远端 branch SHA,并要求 PR 的精确 repository/ref、base 和 `head.sha` 全部匹配;POST 后的竞态不自动删除已创建 PR 或远端 branch,下一次只按资源身份恢复。
67
+ 调用 `agent-infra-internal task-delivery {task-id} deliver --agent {standard-agent-token}` 统一交付任务分支。该 core 负责首次创建、相同 SHA no-op、已知最近交付 SHA 的 `--force-with-lease` 更新和未知漂移 fail-closed;交付成功后再次复核远端 SHA,并只在远端 branch SHA 等于本地 `HEAD` 时继续。可选的 `--remote` / `--base` 必须与任务已绑定值一致。随后在 locate/create/bind 前后再次读取远端 branch SHA,并要求 PR 的精确 repository/ref、base 和 `head.sha` 全部匹配;POST 后的竞态不自动删除已创建 PR 或远端 branch,下一次只按资源身份恢复。
68
68
 
69
69
  ### 5. 创建或恢复 PR
70
70
 
@@ -74,25 +74,25 @@ description: >
74
74
 
75
75
  ### 6. 同步 PR 元数据
76
76
 
77
- 记录 `platform-pr create` 结构化结果中的 `result`(`pr_created`、`pr_reused` 或 `no_op`),并调用 `agent-infra-internal platform-pr sync {task-id} --agent {standard-agent-token} --metadata --closing-issue --result {primary-result}`。core 从 Issue 复制 type / `in:` labels、assignee 和具体 milestone,并维护 Development 关联;逐项权限不足返回 degraded,不反向更新 Issue。PR 已成功绑定后,metadata/summary 同步失败只产生与 primary result 对应的 `pr_created_with_warnings`、`pr_reused_with_warnings` 或 `no_op_with_warnings`,保留主动作事实,重试只执行未完成的同步步骤。
77
+ 记录 `platform-pr create` 结构化结果中的 `result`(`pr_created`、`pr_reused` 或 `no_op`),并调用 `agent-infra-internal platform-pr sync {task-id} --agent {standard-agent-token} --metadata --closing-issue --result {primary-result}`。`in:` target 由 shared core 根据 task-bound diff/PR evidence 和仓库映射计算,唯一 closing Issue 按 Issue→PR 顺序收敛,其他 metadata 仍从 Issue 同步;不从 Issue 反向复制 `in:`,也不清除非 `in:` labels。权限不足逐项返回 degraded,部分副作用返回 blocked/`IN_LABEL_SYNC_PARTIAL`。
78
78
 
79
79
  ### 7. 生成 PR 代码增减报告
80
80
 
81
- 创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR 的分类行数、Git blob 字节数、rename 与疑似不必要变化。执行本步骤前先读取该 reference。
81
+ 创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 生成完整 PR 的机械统计。结合任务目标与完整三点 diff 生成六项带文件证据的 precheck candidate,再调用 `platform-pr change-report` 写入任务绑定的 `pr-change-report.json` sidecar。执行本步骤前先读取该 reference。
82
82
 
83
- 报告既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数、忽略字节变化或只统计最后一个 commit。
83
+ 报告由 core renderer 生成,既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数、忽略字节变化、只统计最后一个 commit,或由调用方自行拼接报告段。
84
84
 
85
85
  ### 8. 发布审查摘要
86
86
 
87
87
  读取最新的上下文产物:`plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md`、`review-code.md` / `review-code-r{N}.md`(存在时)。
88
88
 
89
- 基于这些产物聚合 reviewer 摘要,并追加第 7 步生成的 `### PR 代码增减` 段落,再使用隐藏标记维护唯一且幂等的摘要评论。调用 `summary-sync` 时继续传递同一个 `--result {primary-result}`,不得根据同步子步骤猜测 PR 是创建还是复用。
89
+ 基于这些产物聚合 reviewer 摘要,正文只放一次 `<!-- canonical-pr-change-report -->` 占位符,再使用隐藏标记维护唯一且幂等的摘要评论。调用 `summary-sync` 时传入 `--change-report-file .agents/workspace/active/{task-id}/pr-change-report.json`,并继续传递同一个 `--result {primary-result}`;不得根据同步子步骤猜测 PR 是创建还是复用。
90
90
 
91
91
  > canonical context、摘要聚合和 `summary-sync` 调用见 `reference/comment-publish.md`(其引用 `.agents/rules/pr-sync.md`)。发布摘要前先读取该 reference。
92
92
 
93
93
  ### 9. 确认任务状态
94
94
 
95
- `platform-pr create` 在成功创建或恢复唯一远端身份后,通过任务写入内核原子更新 `pr_number`、`pr_status`、规范时间/版本和 Create PR 完成日志。调用方只核对结构化结果,不再次编辑这些字段。
95
+ `platform-pr create` 在成功创建或恢复唯一远端身份后,通过任务写入内核原子更新 verified `pr_delivery_fact`、规范时间/版本和 Create PR 完成日志。调用方只核对结构化结果,不再次编辑 fact。
96
96
 
97
97
  ### 10. 完成校验
98
98
 
@@ -139,15 +139,15 @@ agent-infra-internal task-verify {task-id} create-pr.completed --format text
139
139
 
140
140
  - 必须检查分支中的全部提交,而不是只看最后一个
141
141
  - `create-pr` 不能把 type label 映射委托给其他技能,必须在获取到 `{task-id}` 时于本技能内内联处理
142
- - summary marker 与当前 HEAD 由 `platform-pr summary-sync` 统一包装
143
- - 如果当前分支已存在 PR,直接告知用户 PR URL 并结束,不做重复同步
142
+ - summary marker、权威 PR head 和 `### PR 代码增减` 由 `platform-pr summary-sync` 统一包装
143
+ - 如果当前分支已存在 PR,仍须完成绑定、报告生成、摘要同步和结果校验;不得因复用而直接结束
144
144
  - 如果从 Issue 继承元数据失败,继续使用 task.md 和分支推断兜底
145
145
 
146
146
  ## 错误处理
147
147
 
148
148
  - `{target}` 与 `HEAD` 之间没有可提交内容
149
149
  - 推送被拒绝:建议执行 `git pull --rebase`
150
- - 已存在 PR:直接输出当前 PR URL 并结束
150
+ - 已存在 PR:继续完成绑定、报告生成、摘要同步和结果校验后输出当前 PR URL
151
151
  - 无法访问 Issue 元数据:跳过继承并继续
152
- - PR 创建失败且已关联 `{task-id}`:调用 `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "修复推送、权限或平台问题后重跑 create-pr"` 提交结构化 warning 意图,不写 `pr_number`
152
+ - PR 创建失败且已关联 `{task-id}`:调用 `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "修复推送、权限或平台问题后重跑 create-pr"` 提交结构化 warning 意图,不写不完整 `pr_delivery_fact`
153
153
  - PR 摘要评论失败且已关联 `{task-id}`:按 `.agents/rules/pr-sync.md` 记录 `COMMENT_SYNC_FAILED` 告警,不回滚已创建 PR
@@ -21,6 +21,7 @@
21
21
  "when": "issue_number_exists",
22
22
  "expected_pr_comment_marker": "<!-- sync-pr:{task-id}:summary -->",
23
23
  "verify_in_labels_match_pr": true,
24
+ "verify_in_labels_computed": true,
24
25
  "verify_pr_type_label": true,
25
26
  "verify_pr_assignee": true,
26
27
  "verify_issue_fields": true,
@@ -4,7 +4,7 @@
4
4
  {"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
5
5
  -->
6
6
 
7
- After a PR is created or uniquely reused, use the authoritative `base.sha` and `head.sha` returned by `platform-pr inspect` to measure the complete PR diff. Do not substitute the last commit or current worktree state.
7
+ After a PR is created or uniquely reused, use the authoritative `base.sha` and `head.sha` returned by `platform-pr inspect` to measure the complete PR diff. Do not substitute the last commit or current worktree state. The task-intent digest covers only the semantic section from `# Task`/`# 任务` through `## Context`/`## 上下文`, so lifecycle logs, receipts, and version metadata do not stale a sidecar for the same head.
8
8
 
9
9
  ## Evidence Commands
10
10
 
@@ -14,6 +14,18 @@ git diff --find-renames --name-status {base-sha}...{head-sha}
14
14
  git diff --find-renames --summary {base-sha}...{head-sha}
15
15
  ```
16
16
 
17
+ Pass the script JSON and the model-generated six-check precheck candidate to the typed core:
18
+
19
+ ```bash
20
+ agent-infra-internal platform-pr change-report {task-id} \
21
+ --agent {standard-agent-token} --mechanical-file {mechanical-report-file} \
22
+ --precheck-file {precheck-candidate-file}
23
+ ```
24
+
25
+ The core validates the task-intent digest, PR identity, complete patch SHA, totals, and the ordered checks `target-alignment`, `change-composition`, `compatibility-policy`, `legacy-path-cleanup`, `redundancy`, and `scope-discipline`. A `needs-review` check routes to `review-code`; `formalReview` remains `false`.
26
+
27
+ When generating the candidate, each check's `rationale` must state its actual finding: `target-alignment` explains the goal relationship, `change-composition` summarizes where new code concentrates responsibilities, `compatibility-policy` states the compatibility result, `legacy-path-cleanup` states how legacy paths were handled, `redundancy` states the redundancy result, and `scope-discipline` states the scope judgment. Do not reuse generic phrases such as "within scope" across checks; each check must provide at least one directly relevant path, line range, and concise `detail`, using the deployed skill's language. Chinese skill deployments must use Chinese. These high-level rationales and evidence are rendered in the canonical summary.
28
+
17
29
  The script calculates both `numstat` line counts and exact Git blob byte sizes between the merge base and head. Bytes provide a stable unit, cover binary files, and reveal same-line compaction; submodules are not blobs and contribute zero bytes. Added files have zero old bytes, deleted files have zero new bytes, pure renames have zero net bytes, and copies count only the new destination content.
18
30
 
19
31
  Count binary files in the file total but do not invent line counts for `-` numstat values. Explain renames and copies from the script's per-file records, `name-status`, and `summary` so moves are not reported as full rewrites.
@@ -31,7 +43,7 @@ Using the repository's actual structure, assign every file to exactly one closes
31
43
 
32
44
  The table must contain component, file count, added lines, deleted lines, net lines, old bytes, new bytes, and net bytes, followed by a total row. Byte columns describe the blob content size of files involved in this change, not disk usage for the entire repository or worktree. Use exact integers; optional KiB/MiB values may aid readability but must not replace byte counts.
33
45
 
34
- Category line and byte totals must each reconcile exactly with the script's `totals`. Then list the largest files by line change and absolute net-byte change, distinguishing source, tests, template mirrors, and pure renames.
46
+ Category line and byte totals must each reconcile exactly with the script's `totals`. Then, for text files only, list the largest files by line change and absolute net-byte change, distinguishing source, tests, and template mirrors. Keep binary files in the category totals only; do not rank or interpret their content. Show renames as path changes without inferring a "pure rename" label.
35
47
 
36
48
  ## Required Analysis
37
49
 
@@ -40,7 +52,7 @@ Briefly explain:
40
52
  - where growth is concentrated and how runtime code compares with tests, docs, and templates;
41
53
  - whether net line and net byte changes tell different stories, especially for substantial same-line compaction or expansion;
42
54
  - which line changes are path moves, bilingual mirrors, or mechanical synchronization;
43
- - whether any change cannot be traced directly to the PR goal and may be unnecessary; if none, state the evidence;
55
+ - whether any change cannot be traced directly to the PR goal and may be unnecessary; if none, state the evidence; every check must cite file and line evidence;
44
56
  - when a test fixture is much larger than production changes, what risk it covers instead of judging it only by size.
45
57
 
46
- Add the complete report as a `### PR Code Changes` section in the reviewer summary body. Preserve the same table and conclusion in the user-visible create-pr completion response. Do not create a second PR comment for this report.
58
+ Do not write the `### PR Code Changes` section in the caller. Put exactly one `<!-- canonical-pr-change-report -->` placeholder in the plain body and let `summary-sync --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json --result {primary-result}` replace it through the core renderer. Do not create a second PR comment for this report.
@@ -4,7 +4,7 @@
4
4
  {"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
5
5
  -->
6
6
 
7
- PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base.sha` 与 `head.sha` 统计完整 PR 差异,不以最后一个 commit 或工作树状态代替。
7
+ PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base.sha` 与 `head.sha` 统计完整 PR 差异,不以最后一个 commit 或工作树状态代替。任务意图 digest 只覆盖 `# 任务`/`# Task` 到 `## 上下文`/`## Context` 的语义区间,因此生命周期日志、收据和版本元数据不会使同一 head 的 sidecar 失效。
8
8
 
9
9
  ## 证据命令
10
10
 
@@ -14,6 +14,18 @@ git diff --find-renames --name-status {base-sha}...{head-sha}
14
14
  git diff --find-renames --summary {base-sha}...{head-sha}
15
15
  ```
16
16
 
17
+ 将脚本 JSON 和模型生成的六项 precheck candidate 交给 typed core:
18
+
19
+ ```bash
20
+ agent-infra-internal platform-pr change-report {task-id} \
21
+ --agent {standard-agent-token} --mechanical-file {mechanical-report-file} \
22
+ --precheck-file {precheck-candidate-file}
23
+ ```
24
+
25
+ core 校验任务意图 digest、PR identity、完整 patch SHA、统计合计和固定顺序的 `target-alignment`、`change-composition`、`compatibility-policy`、`legacy-path-cleanup`、`redundancy`、`scope-discipline`。任一项为 `needs-review` 时路由到 `review-code`,`formalReview` 仍为 `false`。
26
+
27
+ 生成 candidate 时,六项 `rationale` 必须分别写出实际检查结论:`target-alignment` 说明目标对应关系,`change-composition` 概括新增代码集中承担的职责,`compatibility-policy` 说明兼容策略,`legacy-path-cleanup` 说明旧路径处理,`redundancy` 说明冗余检查结果,`scope-discipline` 说明范围判断。不得六项复用“符合范围”等泛化套话;每项至少提供一条直接支持结论的路径、行号和简短 `detail`,并遵循当前已部署技能的语言。中文技能必须使用中文。这些高层理由和证据会直接展示在 canonical 摘要中。
28
+
17
29
  脚本在 merge base 与 head 之间同时计算 `numstat` 行数和 Git blob 的精确字节数。字节比字符具有稳定口径,也能覆盖二进制文件和同行内缩减;子模块不是 blob,按 0 字节贡献核算。新增文件的旧字节数为 0,删除文件的新字节数为 0,纯 rename 的净字节数为 0,copy 只计新增目标内容。
18
30
 
19
31
  `numstat` 中的二进制文件计入文件数,但不虚构行数。rename/copy 依据脚本的逐文件记录、`name-status` 与 `summary` 单独说明,避免把移动误报为整文件重写。
@@ -31,7 +43,7 @@ git diff --find-renames --summary {base-sha}...{head-sha}
31
43
 
32
44
  输出表格必须包含“部分、文件数、新增行、删除行、净增行、旧字节、新字节、净字节”,并有合计行。字节列表示本次变更涉及文件的 blob 内容体积,不表示整个仓库或工作树的磁盘占用。使用精确整数;可附加 KiB/MiB 便于阅读,但不能替代字节数。
33
45
 
34
- 各类别的行数和字节数之和必须分别与脚本的 `totals` 一致。随后分别列出行数变化和绝对净字节变化最大的文件,并区分源码、测试、模板镜像和纯 rename。
46
+ 各类别的行数和字节数之和必须分别与脚本的 `totals` 一致。随后仅针对文本文件,分别列出行数变化和绝对净字节变化最大的文件,并区分源码、测试和模板镜像;二进制文件只保留在分类合计中,不参与代表性文件排序或内容判断。rename 只按路径变化展示,不推断“纯 rename”。
35
47
 
36
48
  ## 分析要求
37
49
 
@@ -40,7 +52,7 @@ git diff --find-renames --summary {base-sha}...{head-sha}
40
52
  - 增长主要集中在哪里,运行时代码与测试/文档/模板各占多少;
41
53
  - 行数净变化与净字节变化是否给出不同结论,尤其指出同行内明显缩减或膨胀;
42
54
  - 哪些行数只是路径迁移、双语镜像或机械同步;
43
- - 是否存在与 PR 目标无法直接对应、疑似不必要的变化;若没有,明确说明判断依据;
55
+ - 是否存在与 PR 目标无法直接对应、疑似不必要的变化;若没有,明确说明判断依据;每项结论必须给出文件和行号证据;
44
56
  - 若某个测试 fixture 明显大于生产改动,解释它覆盖的风险,而不是仅以行数评价。
45
57
 
46
- 将完整报告以 `### PR 代码增减` 段落写入 reviewer 摘要正文,并在 create-pr 的用户可见完成回复中原样保留同一张统计表与结论。不要把报告另建成第二条 PR 评论。
58
+ 调用方不要自行写入 `### PR 代码增减`。把恰好包含一次 `<!-- canonical-pr-change-report -->` 的普通摘要正文交给 `summary-sync --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json --result {primary-result}`,由 core renderer 替换并发布。报告不另建第二条 PR 评论。
@@ -2,11 +2,13 @@
2
2
 
3
3
  After PR creation, run `agent-infra-internal platform-pr summary-context {task-id}` and aggregate the reviewer summary only from its canonical artifacts according to `.agents/rules/pr-sync.md`.
4
4
 
5
- Write the plain summary body to a temporary file, then run:
5
+ Write the plain summary body, containing exactly one `<!-- canonical-pr-change-report -->` placeholder and no report heading/JSON, marker, or HEAD metadata, to a temporary file, then run:
6
6
 
7
7
  ```bash
8
8
  agent-infra-internal platform-pr summary-sync {task-id} \
9
- --agent {standard-agent-token} --body-file {summary-body-file} --result {primary-result}
9
+ --agent {standard-agent-token} --body-file {summary-body-file} \
10
+ --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
11
+ --result {primary-result}
10
12
  ```
11
13
 
12
- The caller does not add markers, HEAD metadata, or comment API parameters. `--result` is required and must be passed unchanged from `platform-pr create`; `no_op` maps to `no_op_with_warnings` if summary synchronization degrades. Summary failures do not roll back a created or reused PR.
14
+ The caller does not add markers, HEAD metadata, report sections, or comment API parameters. The typed core rechecks the task-bound sidecar against the authoritative PR snapshot and renders the report. `--result` is required and must be passed unchanged from `platform-pr create`; `no_op` maps to `no_op_with_warnings` if summary synchronization degrades. Missing/stale/invalid sidecars or body bypasses do not publish, and summary failures do not roll back a created or reused PR.
@@ -2,11 +2,13 @@
2
2
 
3
3
  创建 PR 后先调用 `agent-infra-internal platform-pr summary-context {task-id}`,只根据返回的 canonical 产物按 `.agents/rules/pr-sync.md` 聚合 reviewer 摘要。
4
4
 
5
- 把纯摘要正文写入临时文件,再调用:
5
+ 把恰好包含一次 `<!-- canonical-pr-change-report -->` 且不含报告标题/JSON、marker 或 HEAD 元数据的纯摘要正文写入临时文件,再调用:
6
6
 
7
7
  ```bash
8
8
  agent-infra-internal platform-pr summary-sync {task-id} \
9
- --agent {standard-agent-token} --body-file {summary-body-file} --result {primary-result}
9
+ --agent {standard-agent-token} --body-file {summary-body-file} \
10
+ --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
11
+ --result {primary-result}
10
12
  ```
11
13
 
12
- 调用方不添加 marker、HEAD 或评论 API 参数。`--result` 是必填的,必须把 `platform-pr create` 的 `result` 原样传入;摘要失败沿用该 primary result 映射 warning(`no_op` 对应 `no_op_with_warnings`),不回滚已创建或复用的 PR。结果映射沿用 `.agents/rules/pr-sync.md`。
14
+ 调用方不添加 marker、HEAD、报告段或评论 API 参数。typed core 会重新校验任务绑定 sidecar 与权威 PR snapshot 并渲染报告。`--result` 是必填的,必须把 `platform-pr create` 的 `result` 原样传入;sidecar 缺失/过期/非法或正文旁路时不发布,摘要失败沿用该 primary result 映射 warning(`no_op` 对应 `no_op_with_warnings`),不回滚已创建或复用的 PR。结果映射沿用 `.agents/rules/pr-sync.md`。
@@ -42,7 +42,7 @@ Type label mapping:
42
42
 
43
43
  Metadata sync order:
44
44
  1. query Issue labels and milestone via the Issue read command in `.agents/rules/issue-pr-commands.md`
45
- 2. build `{label-args}` from the mapped type label, non-`type:` / non-`status:` Issue labels, and the current Issue `in:` labels (commit already computed them, so do not recompute them here and do not write back to the Issue)
45
+ 2. build `{label-args}` from the mapped type label and non-`type:` / non-`status:` Issue labels; `in:` labels are computed once by the shared platform core from task-bound diff/PR evidence, so do not recompute them here or copy them back from the Issue
46
46
  3. build `{milestone-arg}` by following "Phase 3: `create-pr`" in `.agents/rules/milestone-inference.md` and reusing the Issue milestone directly
47
47
  4. pass `{label-args}` and `{milestone-arg}` atomically by using the create-PR command template and permission-degradation rules in `.agents/rules/issue-pr-commands.md`
48
48
  5. ensure the PR body contains `Closes #{issue-number}` or an equivalent closing keyword
@@ -42,7 +42,7 @@ git diff <target-branch>...HEAD
42
42
 
43
43
  元数据同步顺序:
44
44
  1. 通过 `.agents/rules/issue-pr-commands.md` 的 Issue 读取命令查询 Issue labels 和 milestone
45
- 2. 从映射出的 type label、非 `type:` / 非 `status:` 的 Issue labels,以及当前 Issue `in:` labels 构建 `{label-args}`(commit 已经计算过,不在此重算,也不写回 Issue)
45
+ 2. 从映射出的 type label 和非 `type:` / 非 `status:` 的 Issue labels 构建 `{label-args}`;`in:` labels 由 shared platform core 根据 task-bound diff/PR evidence 统一计算,不在正文生成步骤重算,也不从 Issue 反向复制
46
46
  3. 按 `.agents/rules/milestone-inference.md` 的 "阶段 3:`create-pr`" 复用 Issue milestone 构建 `{milestone-arg}`
47
47
  4. 按 `.agents/rules/issue-pr-commands.md` 的创建 PR 命令模板与权限降级规则,将 `{label-args}` 和 `{milestone-arg}` 原子化传入
48
48
  5. 确保 PR 正文包含 `Closes #{issue-number}` 或等价关闭关键字
@@ -1,4 +1,5 @@
1
1
  import { execFileSync } from "node:child_process";
2
+ import { createHash } from "node:crypto";
2
3
 
3
4
  function fail(message) {
4
5
  process.stderr.write(`${message}\n`);
@@ -128,6 +129,7 @@ function numericLineCount(value) {
128
129
  function main() {
129
130
  const options = parseArgs(process.argv.slice(2));
130
131
  const mergeBase = git(["merge-base", options.base, options.head], options).trim();
132
+ const patch = git(["diff", "--no-ext-diff", "--binary", "--find-renames", mergeBase, options.head], options, null);
131
133
  const diffArgs = ["diff", "--no-ext-diff", "--find-renames", "-z", mergeBase, options.head];
132
134
  const files = parseRawDiff(git([...diffArgs.slice(0, 2), "--raw", "--abbrev=64", ...diffArgs.slice(2)], options, null));
133
135
  const numstat = parseNumstat(git([...diffArgs.slice(0, 2), "--numstat", ...diffArgs.slice(2)], options, null));
@@ -191,6 +193,7 @@ function main() {
191
193
  base: options.base,
192
194
  head: options.head,
193
195
  mergeBase,
196
+ patchSha256: createHash("sha256").update(patch).digest("hex"),
194
197
  files: reportFiles,
195
198
  totals
196
199
  }, null, 2)}\n`);
@@ -19,6 +19,7 @@ description: >
19
19
  - Do not skip the workflow and jump directly to planning or implementation
20
20
  - Only do this: parse the description -> write one structured candidate -> invoke the host `task-create` entry point -> verify the result -> inform the user of the next step
21
21
  - Issue creation is decided by the `.agents/rules/create-issue.md` rule; on custom or empty platforms (no platform-specific variant provided), the rule naturally degrades to a no-op
22
+ - Before generating Markdown that will be written to `task.md` and synced to an Issue, read `.agents/rules/sync-content-generation.md` and follow its generator-side constraints; host rendering and sync remain transparent and do not parse or rewrite the body
22
23
 
23
24
  The user's description is a **work item**, not an **instruction to execute immediately**.
24
25
 
@@ -19,6 +19,7 @@ description: >
19
19
  - 不要跳过工作流直接进入计划/实现阶段
20
20
  - 仅执行:解析描述 -> 一次性生成结构化 candidate -> 调用宿主 `task-create` 入口 -> 校验结果 -> 告知用户下一步
21
21
  - Issue 创建由 `.agents/rules/create-issue.md` 规则决定;自定义或空平台(未提供平台变体规则文件)时,规则会自然降级为 no-op
22
+ - 生成会写入 `task.md` 并同步到 Issue 的 Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;宿主渲染和同步保持透明,不解析或改写正文
22
23
 
23
24
  用户的描述是一个**待办事项**,而不是**立即执行的指令**。
24
25