@fitlab-ai/agent-infra 0.9.8 → 0.9.10
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.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/bin/internal-cli.js +11 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +58 -21
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +25 -11
- package/dist/lib/agent-clients/adapters/codex-lifecycle/capability-store.js +173 -10
- package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-context.js +127 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +14 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +63 -92
- package/dist/lib/agent-clients/adapters/codex-sandbox.js +72 -11
- package/dist/lib/agent-clients/adapters/index.js +3 -1
- package/dist/lib/agent-clients/adapters/traecli.js +66 -0
- package/dist/lib/agent-clients/tokens.js +2 -2
- package/dist/lib/agent-clients/types.js +2 -1
- package/dist/lib/defaults.json +5 -0
- package/dist/lib/git/workflow.js +10 -1
- package/dist/lib/internal/codex-lifecycle.js +20 -6
- package/dist/lib/internal/codex-sandbox-controller.js +9 -15
- package/dist/lib/internal/git-workflow.js +5 -7
- package/dist/lib/internal/platform-pr.js +20 -7
- package/dist/lib/internal/release-workflow.js +2 -1
- package/dist/lib/internal/sandbox-control.js +79 -2
- package/dist/lib/internal/task-finalization.js +54 -0
- package/dist/lib/internal/task-orchestration.js +156 -291
- package/dist/lib/{task/commands/validate.js → internal/task-validate.js} +75 -42
- package/dist/lib/platform/pr-summary.js +48 -10
- package/dist/lib/platform/pull-requests.js +205 -41
- package/dist/lib/run/tui.js +5 -2
- package/dist/lib/sandbox/commands/rm.js +316 -55
- package/dist/lib/sandbox/control/client.js +190 -6
- package/dist/lib/sandbox/control/controller-registration.js +275 -0
- package/dist/lib/sandbox/control/executor.js +140 -5
- package/dist/lib/sandbox/control/lifecycle.js +3 -1
- package/dist/lib/sandbox/control/protocol.js +67 -6
- package/dist/lib/sandbox/index.js +5 -3
- package/dist/lib/sandbox/managed-fs.js +5 -0
- package/dist/lib/sandbox/task-resolver.js +50 -6
- package/dist/lib/sandbox/workspace-identity.js +27 -0
- package/dist/lib/sandbox/worktree-safety.js +215 -2
- package/dist/lib/task/codex-orchestration.js +161 -39
- package/dist/lib/task/commands/status.js +59 -1
- package/dist/lib/task/commit-operation.js +335 -0
- package/dist/lib/task/commit-policy.js +18 -0
- package/dist/lib/task/delegation-receipts.js +248 -6
- package/dist/lib/task/finalization.js +593 -0
- package/dist/lib/task/index.js +0 -9
- package/dist/lib/task/operation-outcome.js +33 -0
- package/dist/lib/task/orchestration.js +187 -761
- package/dist/lib/task/short-id.js +59 -1
- package/dist/lib/task/task-execution-lock.js +6 -1
- package/dist/lib/task/verification-engine.js +110 -60
- package/dist/lib/task/verification.js +2 -1
- package/dist/lib/task/workflow-warning-intents.js +50 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +61 -19
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +37 -10
- package/lib/agent-clients/adapters/codex-lifecycle/capability-store.ts +276 -12
- package/lib/agent-clients/adapters/codex-lifecycle/controller-context.ts +163 -0
- package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +19 -0
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +9 -1
- package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +91 -118
- package/lib/agent-clients/adapters/codex-sandbox.ts +89 -14
- package/lib/agent-clients/adapters/index.ts +3 -1
- package/lib/agent-clients/adapters/traecli.ts +67 -0
- package/lib/agent-clients/tokens.ts +2 -2
- package/lib/agent-clients/types.ts +2 -1
- package/lib/defaults.json +5 -0
- package/lib/git/workflow.ts +11 -2
- package/lib/internal/codex-lifecycle.ts +19 -6
- package/lib/internal/codex-sandbox-controller.ts +9 -14
- package/lib/internal/git-workflow.ts +5 -6
- package/lib/internal/platform-pr.ts +14 -7
- package/lib/internal/release-workflow.ts +2 -1
- package/lib/internal/sandbox-control.ts +92 -2
- package/lib/internal/task-finalization.ts +68 -0
- package/lib/internal/task-orchestration.ts +20 -103
- package/lib/{task/commands/validate.ts → internal/task-validate.ts} +75 -40
- package/lib/platform/pr-summary.ts +55 -11
- package/lib/platform/pull-requests.ts +211 -41
- package/lib/run/tui.ts +5 -3
- package/lib/sandbox/commands/rm.ts +413 -61
- package/lib/sandbox/control/client.ts +255 -6
- package/lib/sandbox/control/controller-registration.ts +352 -0
- package/lib/sandbox/control/executor.ts +169 -5
- package/lib/sandbox/control/lifecycle.ts +2 -1
- package/lib/sandbox/control/protocol.ts +80 -7
- package/lib/sandbox/index.ts +5 -3
- package/lib/sandbox/managed-fs.ts +5 -0
- package/lib/sandbox/task-resolver.ts +58 -7
- package/lib/sandbox/workspace-identity.ts +50 -2
- package/lib/sandbox/workspace-view.ts +3 -3
- package/lib/sandbox/worktree-safety.ts +236 -2
- package/lib/task/codex-orchestration.ts +168 -40
- package/lib/task/commands/status.ts +78 -1
- package/lib/task/commit-operation.ts +430 -0
- package/lib/task/commit-policy.ts +30 -0
- package/lib/task/delegation-receipts.ts +263 -4
- package/lib/task/finalization.ts +761 -0
- package/lib/task/index.ts +0 -8
- package/lib/task/operation-outcome.ts +48 -0
- package/lib/task/orchestration.ts +218 -982
- package/lib/task/short-id.ts +65 -1
- package/lib/task/task-execution-lock.ts +10 -1
- package/lib/task/verification-engine.ts +115 -63
- package/lib/task/verification.ts +3 -2
- package/lib/task/workflow-warning-intents.ts +57 -2
- package/package.json +2 -2
- package/templates/.agents/QUICKSTART.en.md +3 -4
- package/templates/.agents/QUICKSTART.zh-CN.md +3 -4
- package/templates/.agents/hooks/lifecycle-delegation.js +1 -21
- package/templates/.agents/rules/README.en.md +1 -0
- package/templates/.agents/rules/README.zh-CN.md +1 -0
- package/templates/.agents/rules/compatibility-policy.en.md +39 -0
- package/templates/.agents/rules/compatibility-policy.zh-CN.md +39 -0
- package/templates/.agents/rules/lifecycle-orchestration.en.md +4 -4
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +4 -4
- package/templates/.agents/rules/pr-sync.en.md +1 -1
- package/templates/.agents/rules/pr-sync.github.en.md +2 -1
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +2 -0
- package/templates/.agents/rules/pr-sync.zh-CN.md +1 -0
- package/templates/.agents/rules/review-method.en.md +1 -0
- package/templates/.agents/rules/review-method.zh-CN.md +1 -0
- package/templates/.agents/rules/task-management.en.md +2 -2
- package/templates/.agents/rules/task-management.zh-CN.md +2 -2
- package/templates/.agents/skills/analyze-task/SKILL.en.md +1 -0
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/block-task/SKILL.en.md +2 -4
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -4
- package/templates/.agents/skills/cancel-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/close-codescan/SKILL.en.md +6 -2
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +6 -2
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +6 -2
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +6 -2
- package/templates/.agents/skills/code-task/SKILL.en.md +1 -0
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +2 -0
- package/templates/.agents/skills/commit/SKILL.en.md +41 -125
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +52 -123
- package/templates/.agents/skills/commit/reference/commit-message.en.md +1 -1
- package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +14 -43
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +14 -49
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -35
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -35
- package/templates/.agents/skills/complete-task/SKILL.en.md +31 -38
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +31 -38
- package/templates/.agents/skills/complete-task/config/verify.en.json +1 -0
- package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +1 -1
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/SKILL.en.md +17 -9
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +17 -9
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +41 -0
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +41 -0
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +2 -2
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +2 -2
- package/templates/.agents/skills/plan-task/SKILL.en.md +2 -1
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -1
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +8 -6
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +8 -6
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +3 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.en.md +1 -1
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.zh-CN.md +1 -1
- package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -2
- package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -2
- package/templates/.agents/skills/run-task/SKILL.en.md +6 -6
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +2 -2
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +24 -0
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +1 -1
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +1 -1
- package/templates/.codex/hooks.json +4 -4
- package/templates/.trae/skills/update-agent-infra.en.md +8 -0
- package/templates/.trae/skills/update-agent-infra.zh-CN.md +8 -0
- package/dist/lib/task/commit-finalization.js +0 -305
- package/dist/lib/task/commit-intent.js +0 -165
- package/lib/task/commit-finalization.ts +0 -419
- package/lib/task/commit-intent.ts +0 -230
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
1. 调用 `agent-infra-internal platform-pr summary-context {task-id}` 获取 canonical 聚合输入。
|
|
6
6
|
2. 按 `.agents/rules/pr-sync.md` 生成纯摘要正文并写入临时文件。
|
|
7
|
-
3. 调用 `agent-infra-internal platform-pr summary-sync {task-id} --agent {standard-agent-token} --body-file {summary-body-file}`。
|
|
7
|
+
3. 调用 `agent-infra-internal platform-pr summary-sync {task-id} --agent {standard-agent-token} --body-file {summary-body-file} --result no_op`。commit 路径只同步已有 PR 摘要,不创建或复用 PR,因此固定使用 `no_op` 表示 PR 身份未变化。
|
|
8
8
|
|
|
9
9
|
同步失败只记录 warning,不阻塞或回滚已经完成的 commit。`no-op` 回传 `summary skipped (no diff)`。
|
|
@@ -12,19 +12,13 @@ Get the current time first:
|
|
|
12
12
|
date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
The `commit-
|
|
15
|
+
The `commit-operation.execute` core writes this Activity Log entry for task-bound operations:
|
|
16
16
|
|
|
17
17
|
```text
|
|
18
18
|
- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Commit** by {agent} — {commit hash short} {commit subject}
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```yaml
|
|
24
|
-
last_reviewed_commit: {new_head}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This field is the only baseline for the `complete-task` `post-review-commit` gate. The caller must not append Commit done again or write this field directly.
|
|
21
|
+
Task metadata is best-effort synchronization after the Git primary action: an Activity Log or frontmatter write failure returns a `TASK_STATUS_SYNC_FAILED` warning without undoing the commit or push, and a later no-change retry may repair the record. `review-code`, review anchors, and `last_reviewed_commit` are not commit/push prerequisites. The caller must not append Activity Log entries directly.
|
|
28
22
|
|
|
29
23
|
### Scenario 5: Existing-PR push wrap-up
|
|
30
24
|
|
|
@@ -39,33 +33,6 @@ Next step - watch PR checks:
|
|
|
39
33
|
|
|
40
34
|
If push fails, keep the task active and preserve local HEAD; show diagnostics and manual push guidance only, never `watch-pr` or `complete-task`. This scenario takes precedence over the final `prFlow` route below.
|
|
41
35
|
|
|
42
|
-
### Scenario 4: pre-commit snapshot block
|
|
43
|
-
|
|
44
|
-
This scenario ends the run before `git commit` and does not enter the successful post-commit scenario selection below. When any of `pre_head != R`, `W != T`, or `S != T` applies:
|
|
45
|
-
|
|
46
|
-
- Do not run `git commit`, push, successful state updates, Issue/PR success sync, or the commit completion gate; preserve the current worktree and index.
|
|
47
|
-
- Refresh task `updated_at`, `assigned_to`, and `agent_infra_version`, then append a done log with action `Commit`: `Blocked before git commit: reviewed snapshot mismatch (worktree added={a}, missing={m}, different={d}; staged added={a}, missing={m}, different={d})`.
|
|
48
|
-
- User output must include `No commit was created.` and show Added/Missing/Different under both `Current worktree vs reviewed snapshot` and `Staged snapshot vs reviewed snapshot`; render an empty set as `- (none)` and list paths only in user output.
|
|
49
|
-
- When `pre_head != R` or `W != T`, the only next step is a fresh `review-code`; when only `W == T && S != T`, tell the user to fix staging and rerun `commit` without re-review.
|
|
50
|
-
|
|
51
|
-
Full re-review commands:
|
|
52
|
-
|
|
53
|
-
Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill review-code --task-ref {task-ref}`.
|
|
54
|
-
|
|
55
|
-
```text
|
|
56
|
-
Next step - re-run code review:
|
|
57
|
-
{next-step-commands}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Full staging-only retry commands:
|
|
61
|
-
|
|
62
|
-
Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill commit --task-ref {task-ref}`.
|
|
63
|
-
|
|
64
|
-
```text
|
|
65
|
-
Next step - fix staging and retry commit:
|
|
66
|
-
{next-step-commands}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
36
|
Before selecting the next step, verify:
|
|
70
37
|
- `current_step` and the latest workflow progress in `task.md`
|
|
71
38
|
- whether the latest `review-code.md` / `review-code-r{N}.md` passed without findings
|
|
@@ -12,19 +12,13 @@
|
|
|
12
12
|
date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
`commit-
|
|
15
|
+
`commit-operation.execute` 在 task-bound 模式下负责写入以下 Activity Log:
|
|
16
16
|
|
|
17
17
|
```text
|
|
18
18
|
- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Commit** by {agent} — {commit hash short} {commit subject}
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```yaml
|
|
24
|
-
last_reviewed_commit: {new_head}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
该字段是 `complete-task` 的 `post-review-commit` gate 唯一 baseline。调用方只读取核心结果选择后续路由,不得再次追加 Commit done 或手写/推进该字段。
|
|
21
|
+
任务记录是 Git 主动作之后的尽力同步:Activity Log 或 frontmatter 写入失败只返回 `TASK_STATUS_SYNC_FAILED` warning,不撤销 commit 或 push;后续无改动重跑可以再次尝试补齐记录。`review-code`、review anchor 和 `last_reviewed_commit` 不再是 commit/push 的前置条件,调用方只读取核心结果选择后续路由,不得手写 Activity Log。
|
|
28
22
|
|
|
29
23
|
### 场景 5:已有 PR 推送收尾
|
|
30
24
|
|
|
@@ -39,33 +33,6 @@ last_reviewed_commit: {new_head}
|
|
|
39
33
|
|
|
40
34
|
push 失败时保留任务 active 与本地 HEAD,只展示诊断和人工推送提示;不得渲染 `watch-pr` 或 `complete-task`。该场景优先于下方 `prFlow` 终态路由。
|
|
41
35
|
|
|
42
|
-
### 场景 4:提交前快照阻断
|
|
43
|
-
|
|
44
|
-
此场景在 `git commit` 前终止本轮,不进入下方提交成功后的场景选择。任一 `pre_head != R`、`W != T` 或 `S != T` 命中时:
|
|
45
|
-
|
|
46
|
-
- 不执行 `git commit`、push、成功状态更新、Issue/PR 成功同步或 commit 完成 gate;保留当前工作区与暂存区。
|
|
47
|
-
- 刷新任务的 `updated_at`、`assigned_to`、`agent_infra_version`,并以 action `Commit` 追加 done 日志:`Blocked before git commit: reviewed snapshot mismatch (worktree added={a}, missing={m}, different={d}; staged added={a}, missing={m}, different={d})`。
|
|
48
|
-
- 用户输出必须包含 `No commit was created.`,并分别按 `Current worktree vs reviewed snapshot`、`Staged snapshot vs reviewed snapshot` 展示 Added/Missing/Different;空集合显示 `- (none)`,路径只在用户输出中逐行展示。
|
|
49
|
-
- `pre_head != R` 或 `W != T` 时,下一步只指向重新 `review-code`;仅 `W == T && S != T` 时,提示修正暂存后重跑 `commit`,无需重审。
|
|
50
|
-
|
|
51
|
-
重新审查的完整命令:
|
|
52
|
-
|
|
53
|
-
使用 `agent-infra-internal agent-client next-steps --skill review-code --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
|
|
54
|
-
|
|
55
|
-
```text
|
|
56
|
-
下一步 - 重新代码审查:
|
|
57
|
-
{next-step-commands}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
仅修正暂存的完整命令:
|
|
61
|
-
|
|
62
|
-
使用 `agent-infra-internal agent-client next-steps --skill commit --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
|
|
63
|
-
|
|
64
|
-
```text
|
|
65
|
-
下一步 - 修正暂存后重新提交:
|
|
66
|
-
{next-step-commands}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
36
|
在决定下一步之前,先确认:
|
|
70
37
|
- `task.md` 中的 `current_step` 和最新工作流进度
|
|
71
38
|
- 最新的 `review-code.md` / `review-code-r{N}.md` 是否无问题通过
|
|
@@ -9,6 +9,8 @@ description: >
|
|
|
9
9
|
# Complete Task
|
|
10
10
|
> `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
|
|
11
11
|
|
|
12
|
+
Host finalization uses receipt v2 with an immutable `receiptId`, monotonic `revision`, and canonical warnings. Lifecycle/identity/required-PR hard failures return `result: failed|blocked`; after lifecycle succeeds, comment, peripheral verification, and other sync failures return `result: completed_with_warnings` and six-field warnings, retrying only receipt-pending steps.
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
## Boundary / Critical Rules
|
|
14
16
|
|
|
@@ -38,7 +40,7 @@ Before the state check is complete, do not make external-state assertions such a
|
|
|
38
40
|
|
|
39
41
|
## Step Start: Local Lifecycle Boundary
|
|
40
42
|
|
|
41
|
-
On the normal path, complete business updates, platform sync, and the pre-completion gate while the task is active. Only then may the
|
|
43
|
+
On the normal path, complete business updates, platform sync, and the pre-completion gate while the task is active. Only then may the single finalization intent in Step 6 advance lifecycle, the terminal task comment, and the completion gate in a fixed order. Do not write those mechanical fields first. An archived task may only enter `finalization-retry`; do not move it back or rerun lifecycle.
|
|
42
44
|
|
|
43
45
|
## Steps
|
|
44
46
|
|
|
@@ -63,7 +65,7 @@ Read `reference/external-delivery.md`, then run for the active task:
|
|
|
63
65
|
agent-infra-internal platform-pr resolve-external {task-id} --agent {standard-agent-token} [--pr {external-pr}]
|
|
64
66
|
```
|
|
65
67
|
|
|
66
|
-
- `mode=external`: only this invocation's typed `authorization` and `selected` fields authorize and identify external delivery; continue through
|
|
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.
|
|
67
69
|
- `mode=normal`: use the existing local lifecycle prerequisites; historical `pr_number` / `pr_status` values do not authorize external delivery.
|
|
68
70
|
- `status=failed|blocked`: stop immediately and show the stable error; `--force` cannot bypass it.
|
|
69
71
|
|
|
@@ -95,31 +97,28 @@ This project enforces the PR flow (prFlow: "required") and the task has no PR ye
|
|
|
95
97
|
Run /create-pr {task-ref} first, then complete; --skip-pr is not accepted under a mandatory PR flow.
|
|
96
98
|
```
|
|
97
99
|
|
|
98
|
-
Before
|
|
99
|
-
- [ ]
|
|
100
|
-
- [ ]
|
|
101
|
-
- [ ]
|
|
102
|
-
- [ ] Tests are passing
|
|
103
|
-
- [ ] The disagreement ledger has no unclosed disagreements or un-re-reviewed post-review commits; on a bound-PR path local HEAD, `last_reviewed_commit`, and PR head either match strictly, or a merged squash has complete platform snapshot and remote Git equivalence evidence and current Git credentials can read the evidence refs; without a valid PR, a single-parent local rewrite is content-equivalent to `last_reviewed_commit` and has no later protected commits
|
|
104
|
-
- [ ] Manual validation items are complete (when the latest review-code's Manual validation count is > 0, a passed manual-validation artifact and its completion record must exist, and that completion record must sit after the latest review-code; skipped when the count is 0 or there are no pending items)
|
|
100
|
+
Before lifecycle, verify only the hard gates:
|
|
101
|
+
- [ ] Task identity, active state, concurrency locks, and local atomic lifecycle operations are available
|
|
102
|
+
- [ ] Required-PR delivery is satisfied when `prFlow=required`
|
|
103
|
+
- [ ] Other business evidence (workflow, review, commit, tests, disagreement ledger, manual validation, and platform sync) is recorded or can be checked after lifecycle
|
|
105
104
|
|
|
106
105
|
> **⚠️ Prerequisite Branch Check — you must decide whether to continue or stop before proceeding:**
|
|
107
106
|
>
|
|
108
|
-
> - If
|
|
109
|
-
> - If
|
|
110
|
-
> -
|
|
107
|
+
> - If the hard gates pass -> continue to Step 3
|
|
108
|
+
> - If a hard gate is missing -> stop and output the prerequisite warning
|
|
109
|
+
> - Missing peripheral evidence does not block lifecycle; represent it as warning/pending steps after lifecycle
|
|
111
110
|
>
|
|
112
111
|
> **Do not continue to Steps 3-8 when prerequisites are not met, and do not output "Task {task-id} completed; task directory moved to completed/."**
|
|
113
112
|
|
|
114
|
-
If
|
|
113
|
+
If a hard prerequisite is not met, warn the user:
|
|
115
114
|
```
|
|
116
115
|
Cannot complete task {task-id} - prerequisites not met:
|
|
117
116
|
- [ ] {Missing prerequisite}
|
|
118
117
|
|
|
119
|
-
Please
|
|
118
|
+
Please satisfy the hard prerequisite first, then retry complete-task.
|
|
120
119
|
```
|
|
121
120
|
|
|
122
|
-
If
|
|
121
|
+
If a hard gate is not met, stop immediately and do not execute Steps 3-8.
|
|
123
122
|
|
|
124
123
|
### 3. Complete Business-Only Content
|
|
125
124
|
|
|
@@ -146,7 +145,7 @@ When the ledger contains a valid `PRC-N` post-review exemption, the summary body
|
|
|
146
145
|
|
|
147
146
|
Do not sync the task comment here; it requires the terminal task.md written by lifecycle. Do not set a `status:` label; platform automation clears status labels after the Issue closes.
|
|
148
147
|
|
|
149
|
-
If any operation fails, the task must remain active and its short id must remain valid. Record the failure with the matching structured warning intent, then
|
|
148
|
+
If any operation fails, the task must remain active and its short id must remain valid. Record the failure with the matching structured warning intent, then continue to Step 5. Platform failures do not block the local lifecycle:
|
|
150
149
|
|
|
151
150
|
```bash
|
|
152
151
|
agent-infra-internal task-warning {task-id} add --step complete-task --severity ACTION_REQUIRED --code {COMMENT_SYNC_FAILED|REQUIREMENTS_SYNC_FAILED|SUMMARY_SYNC_FAILED|NETWORK_RETRY_EXHAUSTED} --target {artifact|issue|summary|platform} --message "{error_code}: {error_message}" --action "Fix the platform sync problem and rerun complete-task"
|
|
@@ -162,46 +161,40 @@ After platform writes succeed and before moving the directory or releasing the s
|
|
|
162
161
|
agent-infra-internal task-verify {task-id} complete-task.preflight --format text
|
|
163
162
|
```
|
|
164
163
|
|
|
165
|
-
This event runs
|
|
164
|
+
This event runs only the required-PR delivery hard preflight; host finalization still enforces identity, concurrency, and local atomicity before lifecycle. Peripheral review/manual/platform checks run through `complete-task.completed` after lifecycle and are projected as warning/pending steps. On a hard-gate non-zero exit (fail/blocked), keep the task active, record the stable code/target, and stop.
|
|
166
165
|
|
|
167
|
-
|
|
166
|
+
If a summary must mirror a human-decided `post-review-commit` exemption, make a best-effort sync in Step 4 with the original failure code/message, PRC id/evidence, and ruling details. A sync failure records `SUMMARY_SYNC_FAILED` and still allows lifecycle; terminal verification decides the final state.
|
|
168
167
|
|
|
169
|
-
`--force`
|
|
168
|
+
`--force` cannot lift identity, concurrency, local atomicity, or required-PR hard gates; failures there must stop. Other review, manual-validation, and platform evidence is recorded by terminal verification as warning/pending and can be repaired by retrying.
|
|
170
169
|
|
|
171
|
-
### 6.
|
|
170
|
+
### 6. Run the Host Finalization Entry Point and Verify the Terminal State
|
|
172
171
|
|
|
173
172
|
```bash
|
|
174
|
-
agent-infra-internal task-
|
|
173
|
+
agent-infra-internal task-finalization {task-id} complete --agent {standard-agent-token}
|
|
175
174
|
```
|
|
176
175
|
|
|
177
|
-
|
|
176
|
+
Finalization runs lifecycle -> the terminal task comment -> the `complete-task.completed` gate in a fixed order and records each step in the host receipt. `result=completed` means lifecycle completed safely; if peripheral warnings remain, return `result=completed_with_warnings`, warnings, and pending steps. Use `result=failed` or `result=blocked` only for hard or receipt/capability failures, then fix the cause and retry through the same entry point; do not claim completion or hand-repair partial state.
|
|
178
177
|
|
|
179
178
|
```bash
|
|
180
179
|
ls .agents/workspace/completed/{task-id}/task.md
|
|
181
180
|
```
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
### 7. Sync the Terminal Task Comment and Run the Gate
|
|
186
|
-
|
|
187
|
-
Both Scenario A and Scenario B `finalization-retry` execute this step from the completed directory. If a valid `issue_number` exists, first run:
|
|
182
|
+
Check the task directory only after finalization returns `status=completed`.
|
|
188
183
|
|
|
189
|
-
|
|
190
|
-
agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}
|
|
191
|
-
```
|
|
184
|
+
### 7. Handle Finalization Retries and Results
|
|
192
185
|
|
|
193
|
-
|
|
186
|
+
Both Scenario A and Scenario B `finalization-retry` run the same `task-finalization` entry point from the host. The receipt is only a re-entry hint, not canonical truth: every re-entry revalidates the terminal task comment and completion gate; only an already `completed` task with its short-id registry entry released may skip the irreversible lifecycle. Do not split the operation into the former lifecycle, comment-sync, or completion-gate commands. If the task comment or gate is blocked by the network, preserve the receipt and completed steps, fix the network, and rerun complete-task. If lifecycle has not completed, keep the task active and resume the pending steps from the receipt.
|
|
194
187
|
|
|
195
|
-
|
|
188
|
+
The result must include the structured output from this finalization run, confirming that the task artifact and sync state are valid:
|
|
196
189
|
|
|
197
190
|
```bash
|
|
198
191
|
agent-infra-internal task-verify {task-id} complete-task.completed --format text
|
|
199
192
|
```
|
|
200
193
|
|
|
201
194
|
Handle the result as follows:
|
|
202
|
-
- exit code 0 (all checks passed) -> continue to the "Inform User" step
|
|
203
|
-
- exit code 1
|
|
204
|
-
- exit code 2
|
|
195
|
+
- `status=completed` / exit code 0 (all checks passed) -> continue to the "Inform User" step
|
|
196
|
+
- `status=failed` / exit code 1 -> fix the reported issues and run finalization again
|
|
197
|
+
- `status=blocked` / exit code 2 -> preserve the receipt and completed steps and stop; rerun complete-task later to enter `finalization-retry`
|
|
205
198
|
|
|
206
199
|
Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
|
|
207
200
|
|
|
@@ -211,7 +204,7 @@ Keep the gate output in your reply as fresh evidence. Do not claim completion wi
|
|
|
211
204
|
|
|
212
205
|
> The completion timestamp line (the last line of the whole output) uses `date "+%Y-%m-%d %H:%M:%S"` (local timezone, no offset) and always sits at the very end of the output for at-a-glance scanning across windows. This skill renders no "Next steps" commands, but it does render an **optional sandbox-cleanup hint** before the timestamp line (see the gate below), and still prints the line.
|
|
213
206
|
|
|
214
|
-
> **Optional sandbox-cleanup hint (gated)**: Render the "Optional: clean up this task's sandbox" block in the output below only when BOTH (1) `.agents/.airc.json` has a `sandbox` field and (2) task.md's `branch` field exists and is not `main` / `master`; otherwise omit the whole block.
|
|
207
|
+
> **Optional sandbox-cleanup hint (gated)**: Render the "Optional: clean up this task's sandbox" block in the output below only when BOTH (1) `.agents/.airc.json` has a `sandbox` field and (2) task.md's `branch` field exists and is not `main` / `master`; otherwise omit the whole block. Use the full `{task-id}` for cleanup; do not substitute the branch name. This block is independent of "Next steps" semantics — it is not a workflow successor command.
|
|
215
208
|
|
|
216
209
|
Output format:
|
|
217
210
|
```
|
|
@@ -226,9 +219,9 @@ Deliverables:
|
|
|
226
219
|
- {List of key outputs: files modified, tests added, etc.}
|
|
227
220
|
|
|
228
221
|
Optional: clean up this task's sandbox
|
|
229
|
-
(The task is
|
|
222
|
+
(The task is completed; the sandbox container and per-branch config directory are not reclaimed automatically. Run this if you no longer need them:)
|
|
230
223
|
|
|
231
|
-
ai sandbox rm {
|
|
224
|
+
ai sandbox rm {task-id}
|
|
232
225
|
|
|
233
226
|
Completed at: {completion-time}
|
|
234
227
|
```
|
|
@@ -9,6 +9,8 @@ description: >
|
|
|
9
9
|
# 完成任务
|
|
10
10
|
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
|
|
11
11
|
|
|
12
|
+
宿主 finalization 使用 receipt v2(不可变 `receiptId`、单调 `revision` 和 canonical warnings)。生命周期/身份/required PR 等硬失败返回 `result: failed|blocked`;生命周期完成后,评论、外围验证和其他同步失败返回 `result: completed_with_warnings` 及六字段 warning,并仅重试 receipt 中的 pending step。
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
## 行为边界 / 关键规则
|
|
14
16
|
|
|
@@ -38,7 +40,7 @@ agent-infra-internal task-snapshot {task-id} --format text
|
|
|
38
40
|
|
|
39
41
|
## 步骤开始:本地生命周期边界
|
|
40
42
|
|
|
41
|
-
正常完成路径在 active 阶段完成业务更新、平台同步和预完成门禁后,才由步骤 6 的单次
|
|
43
|
+
正常完成路径在 active 阶段完成业务更新、平台同步和预完成门禁后,才由步骤 6 的单次 finalization intent 按固定顺序原子推进生命周期、终态 task 评论和完成校验;不得提前手工写入这些机械状态。已归档任务只允许进入 `finalization-retry` 场景,不回迁目录或重新执行 lifecycle。
|
|
42
44
|
|
|
43
45
|
## 执行步骤
|
|
44
46
|
### 1. 验证任务存在
|
|
@@ -62,7 +64,7 @@ agent-infra-internal task-snapshot {task-id} --format text
|
|
|
62
64
|
agent-infra-internal platform-pr resolve-external {task-id} --agent {standard-agent-token} [--pr {external-pr}]
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
- `mode=external`:只以本次 typed result 的 `authorization` 和 `selected`
|
|
67
|
+
- `mode=external`:只以本次 typed result 的 `authorization` 和 `selected` 作为外部交付授权与绑定身份,继续 required-PR、本地生命周期和终态校验;外围证据失败在 lifecycle 后记录为 warning。
|
|
66
68
|
- `mode=normal`:走现有本地生命周期前置条件;历史 `pr_number` / `pr_status` 不构成外部授权。
|
|
67
69
|
- `status=failed|blocked`:立即停止并展示稳定错误;`--force` 不得绕过。
|
|
68
70
|
|
|
@@ -94,31 +96,28 @@ agent-infra-internal platform-pr resolve-external {task-id} --agent {standard-ag
|
|
|
94
96
|
请先运行 /create-pr {task-ref} 创建 PR 后再完成;--skip-pr 在强制 PR 下不被接受。
|
|
95
97
|
```
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
- [ ]
|
|
99
|
-
- [ ]
|
|
100
|
-
- [ ]
|
|
101
|
-
- [ ] 测试通过
|
|
102
|
-
- [ ] 审查分歧账本无未关闭分歧、无未复审的 post-review 提交;绑定 PR 路径中本地 HEAD、`last_reviewed_commit`、PR head 严格一致,或已合并 squash 的平台快照与远端 Git 等价证据完整且当前 Git 凭据可读取证据 refs;无有效 PR 路径中本地单父重写与 `last_reviewed_commit` 内容等价且之后无受保护提交
|
|
103
|
-
- [ ] 人工校验项已完成(最新 review-code 的 Manual validation 计数 > 0 时,须存在通过校验的 manual-validation 产物及其完成记录,且该完成记录位于最新 review-code 之后;计数为 0 或无未决项时跳过)
|
|
99
|
+
生命周期前只验证硬门禁:
|
|
100
|
+
- [ ] task 身份、active 状态、并发锁和本地原子生命周期操作可用
|
|
101
|
+
- [ ] `prFlow=required` 时已满足 required-PR delivery
|
|
102
|
+
- [ ] 其余业务证据(工作流、审查、提交、测试、分歧账本、人工校验和平台同步)已记录或可在生命周期后校验
|
|
104
103
|
|
|
105
104
|
> **⚠️ 前置条件分支判断 — 你必须先判断“继续”还是“停止”:**
|
|
106
105
|
>
|
|
107
|
-
> -
|
|
108
|
-
> -
|
|
109
|
-
> -
|
|
106
|
+
> - 如果硬门禁满足 → 继续步骤 3
|
|
107
|
+
> - 如果硬门禁不满足 → 停止并输出前置条件未满足的警告
|
|
108
|
+
> - 外围业务证据不满足不阻止生命周期;在生命周期后以 warning/pending steps 表示
|
|
110
109
|
>
|
|
111
110
|
> **禁止在前置条件未满足时继续执行步骤 3-8,也不要输出「任务 {task-id} 已完成,任务目录已转移到 completed/。」**
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
如果硬门禁未满足,警告用户:
|
|
114
113
|
```
|
|
115
114
|
Cannot complete task {task-id} - prerequisites not met:
|
|
116
115
|
- [ ] {缺失的前置条件}
|
|
117
116
|
|
|
118
|
-
Please
|
|
117
|
+
Please satisfy the hard prerequisite first, then retry complete-task.
|
|
119
118
|
```
|
|
120
119
|
|
|
121
|
-
|
|
120
|
+
如果硬门禁未满足,立即停止,不执行步骤 3-8。
|
|
122
121
|
|
|
123
122
|
### 3. 完成业务内容更新
|
|
124
123
|
|
|
@@ -145,7 +144,7 @@ Please complete the missing steps first, or use --force to override.
|
|
|
145
144
|
|
|
146
145
|
不要在本步骤同步 task 评论;它依赖 lifecycle 写入后的完整终态 task.md。不要设置 `status:` label,平台自动化应在 Issue 关闭后清理状态标签。
|
|
147
146
|
|
|
148
|
-
任一操作失败时,任务仍必须位于 active
|
|
147
|
+
任一操作失败时,任务仍必须位于 active 且短号仍有效;按失败类型调用以下结构化 warning intent,随后继续步骤 5。平台失败不会阻止本地生命周期。
|
|
149
148
|
|
|
150
149
|
```bash
|
|
151
150
|
agent-infra-internal task-warning {task-id} add --step complete-task --severity ACTION_REQUIRED --code {COMMENT_SYNC_FAILED|REQUIREMENTS_SYNC_FAILED|SUMMARY_SYNC_FAILED|NETWORK_RETRY_EXHAUSTED} --target {artifact|issue|summary|platform} --message "{error_code}: {error_message}" --action "修复平台同步问题后重跑 complete-task"
|
|
@@ -161,46 +160,40 @@ agent-infra-internal task-warning {task-id} add --step complete-task --severity
|
|
|
161
160
|
agent-infra-internal task-verify {task-id} complete-task.preflight --format text
|
|
162
161
|
```
|
|
163
162
|
|
|
164
|
-
|
|
163
|
+
该事件只执行 required-PR delivery hard preflight;身份、并发和本地原子性仍由宿主 finalization 强制执行。外围 review/manual/platform 检查在 lifecycle 后由 `complete-task.completed` 处理,并投影为 warning/pending steps。硬门禁退出码非 0(fail/blocked)时,任务继续留在 active,记录稳定 code/target 后停止。
|
|
165
164
|
|
|
166
|
-
|
|
165
|
+
若需要在摘要中镜像 `post-review-commit` 的 human-decided exemption,在步骤 4 尽力同步原始 failure code/message、PRC id/evidence 和裁决信息;同步失败只记录 `SUMMARY_SYNC_FAILED` warning,仍继续生命周期。最终是否完成由生命周期后的 terminal verification 决定。
|
|
167
166
|
|
|
168
|
-
`--force`
|
|
167
|
+
`--force` 不能解除身份、并发、本地原子性或 required-PR hard gate;这些能力失败时必须停止。其余审查、人工校验和平台证据由 terminal verification 记录为 warning/pending,并通过后续重试恢复。
|
|
169
168
|
|
|
170
|
-
### 6.
|
|
169
|
+
### 6. 执行宿主 finalization 入口并验证终态
|
|
171
170
|
|
|
172
171
|
```bash
|
|
173
|
-
agent-infra-internal task-
|
|
172
|
+
agent-infra-internal task-finalization {task-id} complete --agent {standard-agent-token}
|
|
174
173
|
```
|
|
175
174
|
|
|
176
|
-
|
|
175
|
+
finalization 按 lifecycle → task 评论 → `complete-task.completed` 校验的固定顺序执行,并将每一步的状态写入宿主 receipt。`result=completed` 即表示 lifecycle 已安全完成;若还有外围 warning,返回 `result=completed_with_warnings`、warnings 和 pending steps。`result=failed` 或 `result=blocked` 仅用于硬失败或 receipt/capability 失败,修复原因后以同一入口重试,不得宣称完成或手工补写局部状态。
|
|
177
176
|
|
|
178
177
|
```bash
|
|
179
178
|
ls .agents/workspace/completed/{task-id}/task.md
|
|
180
179
|
```
|
|
181
180
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
### 7. 同步终态 task 评论并完成校验
|
|
185
|
-
|
|
186
|
-
场景 A 与场景 B `finalization-retry` 都从 completed 目录执行本步骤。若存在有效的 `issue_number`,先调用:
|
|
181
|
+
仅在 finalization 返回 `status=completed` 后确认任务目录已成功移动。
|
|
187
182
|
|
|
188
|
-
|
|
189
|
-
agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}
|
|
190
|
-
```
|
|
183
|
+
### 7. 处理 finalization 重试与结果
|
|
191
184
|
|
|
192
|
-
|
|
185
|
+
场景 A 与场景 B `finalization-retry` 都从宿主执行同一个 `task-finalization` 入口。receipt 只是重入提示,不是 canonical truth:每次重入都要重新验证终态 task 评论和完成校验;只有任务已处于 `completed` 且短号 registry 已释放时,才可跳过不可逆的 lifecycle。不得拆开调用旧的 lifecycle、评论同步或完成校验命令。若 task 评论或校验因网络问题返回 `blocked`,保留 receipt 和已完成状态,修复网络后重跑 complete-task;若生命周期仍未完成,任务保持 active 并从 receipt 的待处理步骤继续。
|
|
193
186
|
|
|
194
|
-
|
|
187
|
+
完成结果必须包含本次 finalization 的结构化输出,确认任务产物和同步状态符合规范:
|
|
195
188
|
|
|
196
189
|
```bash
|
|
197
190
|
agent-infra-internal task-verify {task-id} complete-task.completed --format text
|
|
198
191
|
```
|
|
199
192
|
|
|
200
193
|
处理结果:
|
|
201
|
-
- 退出码 0(全部通过)-> 继续到「告知用户」步骤
|
|
202
|
-
- 退出码 1
|
|
203
|
-
- 退出码 2
|
|
194
|
+
- `status=completed` / 退出码 0(全部通过)-> 继续到「告知用户」步骤
|
|
195
|
+
- `status=failed` / 退出码 1 -> 根据输出修复问题后重新运行 finalization
|
|
196
|
+
- `status=blocked` / 退出码 2 -> 保留 receipt 与已完成的步骤并停止;稍后重跑 complete-task 进入 `finalization-retry`
|
|
204
197
|
|
|
205
198
|
将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
|
|
206
199
|
|
|
@@ -210,7 +203,7 @@ agent-infra-internal task-verify {task-id} complete-task.completed --format text
|
|
|
210
203
|
|
|
211
204
|
> 完成时间收尾行(整段输出的最后一行)取值 `date "+%Y-%m-%d %H:%M:%S"`(本地时区、不带偏移),固定放在输出的绝对末尾,便于多窗口扫视。本 skill 不渲染「下一步」命令,但会在收尾行之前渲染一段**可选的沙箱清理提示**(见下方门控),且仍统一打印该收尾行。
|
|
212
205
|
|
|
213
|
-
> **可选沙箱清理提示(门控渲染)**:仅当同时满足 (1) `.agents/.airc.json` 存在 `sandbox` 字段、(2) task.md 的 `branch` 字段存在且不是 `main` / `master`
|
|
206
|
+
> **可选沙箱清理提示(门控渲染)**:仅当同时满足 (1) `.agents/.airc.json` 存在 `sandbox` 字段、(2) task.md 的 `branch` 字段存在且不是 `main` / `master` 时,才渲染下方输出中的「可选:清理本任务的沙箱」块;任一不满足则整段省略。清理时使用完整 `{task-id}`,不要改用 branch 名。该块独立于「下一步」语义,不是工作流后继命令。
|
|
214
207
|
|
|
215
208
|
输出格式:
|
|
216
209
|
```
|
|
@@ -225,9 +218,9 @@ agent-infra-internal task-verify {task-id} complete-task.completed --format text
|
|
|
225
218
|
- {关键产出列表:修改的文件、添加的测试等}
|
|
226
219
|
|
|
227
220
|
可选:清理本任务的沙箱
|
|
228
|
-
|
|
221
|
+
(任务已完成,沙箱容器和 per-branch 配置目录不会自动回收。如果不再需要可执行:)
|
|
229
222
|
|
|
230
|
-
ai sandbox rm {
|
|
223
|
+
ai sandbox rm {task-id}
|
|
231
224
|
|
|
232
225
|
Completed at: {completion-time}
|
|
233
226
|
```
|
|
@@ -14,4 +14,4 @@ Only the current typed result's `mode=external`, `authorization`, and `selected`
|
|
|
14
14
|
|
|
15
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.
|
|
16
16
|
|
|
17
|
-
External mode still passes review-ledger, manual-validation, post-review-commit, platform-sync
|
|
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.
|
|
@@ -14,4 +14,4 @@ core 通过平台 adapter 读取 Issue 的权威 closing change requests,穷
|
|
|
14
14
|
|
|
15
15
|
成功绑定会原子写入 PR 字段并追加 `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 硬门禁。
|
|
@@ -11,6 +11,8 @@ description: >
|
|
|
11
11
|
|
|
12
12
|
Create a Pull Request and, when task-related, sync the essential metadata and reviewer summary immediately.
|
|
13
13
|
|
|
14
|
+
`platform-pr create` returns the single `result` / `warnings` fields; successful results are `pr_created`, `pr_reused`, or `no_op`, with the corresponding `_with_warnings` result (including `no_op_with_warnings`) for degraded synchronization. Before locate/create/bind, the task branch must be proven pushed and its remote branch SHA must equal the expected local `HEAD`. Missing or drifting remote refs, a mismatched PR head SHA, and bind-time races are hard failures, never success warnings.
|
|
15
|
+
|
|
14
16
|
## Boundary / Critical Rules
|
|
15
17
|
|
|
16
18
|
Version stamp rule: when creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
|
|
@@ -64,31 +66,37 @@ Read the PR template through `.agents/rules/issue-pr-commands.md`, review recent
|
|
|
64
66
|
|
|
65
67
|
### 4. Check Remote Branch State
|
|
66
68
|
|
|
67
|
-
Use `agent-infra-internal git-workflow inspect` for upstream/remote facts
|
|
69
|
+
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.
|
|
68
70
|
|
|
69
71
|
### 5. Create or Recover the PR
|
|
70
72
|
|
|
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
|
|
73
|
+
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
74
|
|
|
73
75
|
If `{task-id}` is available and the related task provides `issue_number`, keep `Closes #{issue-number}` in the PR body.
|
|
74
76
|
|
|
75
77
|
### 6. Sync PR Metadata
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
### 7. Generate the PR Code Change Report
|
|
82
|
+
|
|
83
|
+
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 additions/deletions, renames, and potentially unnecessary changes. Read that reference before this step.
|
|
84
|
+
|
|
85
|
+
The report is part of the reviewer summary below and must also appear in the final user response. Do not provide only a grand total or inspect only the last commit.
|
|
78
86
|
|
|
79
|
-
###
|
|
87
|
+
### 8. Publish the Review Summary
|
|
80
88
|
|
|
81
89
|
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`.
|
|
82
90
|
|
|
83
|
-
Aggregate a reviewer-facing summary from those artifacts and maintain a single idempotent summary comment via the hidden marker.
|
|
91
|
+
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.
|
|
84
92
|
|
|
85
93
|
> 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.
|
|
86
94
|
|
|
87
|
-
###
|
|
95
|
+
### 9. Confirm Task Status
|
|
88
96
|
|
|
89
97
|
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.
|
|
90
98
|
|
|
91
|
-
###
|
|
99
|
+
### 10. Verification Gate
|
|
92
100
|
|
|
93
101
|
If this operation is associated with `{task-id}`, run the verification gate to confirm task metadata and sync state. If there is no task context, skip this step.
|
|
94
102
|
|
|
@@ -103,13 +111,13 @@ Handle the result as follows:
|
|
|
103
111
|
|
|
104
112
|
Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
|
|
105
113
|
|
|
106
|
-
###
|
|
114
|
+
### 11. Inform User
|
|
107
115
|
|
|
108
116
|
> Execute this step only after the verification gate passes.
|
|
109
117
|
|
|
110
118
|
> Before rendering next steps, read `.agents/rules/next-step-output.md`, invoke the shared helper only for the selected scenario, and insert its stdout at `{next-step-commands}`.
|
|
111
119
|
|
|
112
|
-
Explain the created PR URL, summarize metadata sync and summary-comment results, and recommend watching the PR's checks next (render `{task-ref}` as the short id `NN` per `.agents/rules/next-step-output.md`):
|
|
120
|
+
Explain the created PR URL, summarize metadata sync and summary-comment results, show the complete step 7 category table and necessity conclusion, and recommend watching the PR's checks next (render `{task-ref}` as the short id `NN` per `.agents/rules/next-step-output.md`):
|
|
113
121
|
|
|
114
122
|
Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}`.
|
|
115
123
|
|