@fitlab-ai/agent-infra 0.9.3 → 0.9.5
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 +3 -1
- package/README.zh-CN.md +3 -1
- package/bin/cli.ts +12 -0
- package/dist/bin/cli.js +14 -0
- package/dist/bin/internal-cli.js +144 -123
- package/dist/lib/agent-clients/adapter.js +94 -4
- package/dist/lib/{sandbox/credentials.js → agent-clients/adapters/claude-code-credentials.js} +4 -14
- package/dist/lib/agent-clients/adapters/claude-code-refresh.js +85 -0
- package/dist/lib/agent-clients/adapters/claude-code-sandbox.js +247 -0
- package/dist/lib/agent-clients/adapters/claude-code.js +17 -3
- package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +382 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +163 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +211 -0
- package/dist/lib/agent-clients/adapters/codex.js +2 -2
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +108 -0
- package/dist/lib/agent-clients/adapters/opencode.js +15 -3
- package/dist/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
- package/dist/lib/agent-clients/registry.js +9 -1
- package/dist/lib/git/worktree-identity.js +64 -0
- package/dist/lib/internal/codex-lifecycle.js +202 -0
- package/dist/lib/internal/sandbox-control.js +24 -0
- package/dist/lib/internal/task-activity.js +45 -13
- package/dist/lib/internal/task-create.js +48 -0
- package/dist/lib/internal/task-ledger.js +12 -3
- package/dist/lib/internal/task-lifecycle.js +19 -1
- package/dist/lib/internal/task-orchestration.js +170 -27
- package/dist/lib/platform/github-client.js +19 -2
- package/dist/lib/platform/pr-checks.js +1 -1
- package/dist/lib/platform/pull-requests.js +47 -1
- package/dist/lib/platform/releases.js +13 -5
- package/dist/lib/process-data/index.js +239 -0
- package/dist/lib/process-data/normalize.js +198 -0
- package/dist/lib/process-data/privacy.js +33 -0
- package/dist/lib/process-data/reconcile.js +95 -0
- package/dist/lib/process-data/repair.js +58 -0
- package/dist/lib/process-data/sources.js +345 -0
- package/dist/lib/process-data/store.js +282 -0
- package/dist/lib/process-data/types.js +2 -0
- package/dist/lib/run/index.js +4 -3
- package/dist/lib/run/tui.js +7 -8
- package/dist/lib/sandbox/agent-client-reconciler.js +26 -2
- package/dist/lib/sandbox/capture.js +7 -2
- package/dist/lib/sandbox/commands/create.js +110 -228
- package/dist/lib/sandbox/commands/enter.js +15 -47
- package/dist/lib/sandbox/commands/list-running.js +16 -6
- package/dist/lib/sandbox/commands/ls.js +10 -6
- package/dist/lib/sandbox/commands/rebuild.js +4 -3
- package/dist/lib/sandbox/commands/refresh.js +4 -84
- package/dist/lib/sandbox/commands/rm.js +24 -3
- package/dist/lib/sandbox/commands/show.js +12 -3
- package/dist/lib/sandbox/commands/start.js +7 -4
- package/dist/lib/sandbox/config.js +2 -0
- package/dist/lib/sandbox/constants.js +6 -0
- package/dist/lib/sandbox/control/client.js +58 -0
- package/dist/lib/sandbox/control/protocol.js +54 -0
- package/dist/lib/sandbox/control/server.js +144 -0
- package/dist/lib/sandbox/dockerfile.js +36 -13
- package/dist/lib/sandbox/mounts.js +17 -4
- package/dist/lib/sandbox/recovery.js +128 -5
- package/dist/lib/sandbox/redaction.js +12 -0
- package/dist/lib/sandbox/runtimes/base.dockerfile +24 -74
- package/dist/lib/sandbox/workspace-identity.js +95 -0
- package/dist/lib/sandbox/workspace-view.js +109 -0
- package/dist/lib/task/activity-intent.js +257 -51
- package/dist/lib/task/activity-log.js +32 -5
- package/dist/lib/task/commit-finalization.js +278 -0
- package/dist/lib/task/commit-intent.js +165 -0
- package/dist/lib/task/create-service.js +137 -0
- package/dist/lib/task/create.js +333 -0
- package/dist/lib/task/decision-intents.js +31 -17
- package/dist/lib/task/delegation-receipts.js +2 -2
- package/dist/lib/task/implementation-inputs.js +54 -7
- package/dist/lib/task/ledger-intents.js +35 -1
- package/dist/lib/task/orchestration.js +505 -34
- package/dist/lib/task/resolve-ref.js +41 -1
- package/dist/lib/task/review-fingerprint.js +4 -0
- package/dist/lib/task/workspace-snapshot.js +78 -3
- package/lib/agent-clients/adapter.ts +130 -6
- package/lib/{sandbox/credentials.ts → agent-clients/adapters/claude-code-credentials.ts} +3 -18
- package/lib/agent-clients/adapters/claude-code-refresh.ts +128 -0
- package/lib/agent-clients/adapters/claude-code-sandbox.ts +295 -0
- package/lib/agent-clients/adapters/claude-code.ts +21 -3
- package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +442 -0
- package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +307 -0
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +250 -0
- package/lib/agent-clients/adapters/codex.ts +2 -2
- package/lib/agent-clients/adapters/opencode-sandbox.ts +136 -0
- package/lib/agent-clients/adapters/opencode.ts +18 -3
- package/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
- package/lib/agent-clients/registry.ts +9 -1
- package/lib/git/worktree-identity.ts +86 -0
- package/lib/internal/codex-lifecycle.ts +204 -0
- package/lib/internal/sandbox-control.ts +24 -0
- package/lib/internal/task-activity.ts +50 -14
- package/lib/internal/task-create.ts +49 -0
- package/lib/internal/task-ledger.ts +12 -3
- package/lib/internal/task-lifecycle.ts +22 -1
- package/lib/internal/task-orchestration.ts +117 -21
- package/lib/platform/github-client.ts +20 -2
- package/lib/platform/pr-checks.ts +1 -1
- package/lib/platform/pull-requests.ts +49 -1
- package/lib/platform/releases.ts +16 -4
- package/lib/process-data/index.ts +224 -0
- package/lib/process-data/normalize.ts +202 -0
- package/lib/process-data/privacy.ts +41 -0
- package/lib/process-data/reconcile.ts +110 -0
- package/lib/process-data/repair.ts +64 -0
- package/lib/process-data/sources.ts +354 -0
- package/lib/process-data/store.ts +315 -0
- package/lib/process-data/types.ts +135 -0
- package/lib/run/index.ts +5 -3
- package/lib/run/tui.ts +11 -8
- package/lib/sandbox/agent-client-reconciler.ts +44 -2
- package/lib/sandbox/capture.ts +9 -2
- package/lib/sandbox/commands/create.ts +127 -260
- package/lib/sandbox/commands/enter.ts +13 -59
- package/lib/sandbox/commands/list-running.ts +23 -6
- package/lib/sandbox/commands/ls.ts +22 -6
- package/lib/sandbox/commands/rebuild.ts +4 -3
- package/lib/sandbox/commands/refresh.ts +4 -126
- package/lib/sandbox/commands/rm.ts +24 -3
- package/lib/sandbox/commands/show.ts +29 -3
- package/lib/sandbox/commands/start.ts +6 -4
- package/lib/sandbox/config.ts +4 -0
- package/lib/sandbox/constants.ts +8 -0
- package/lib/sandbox/control/client.ts +79 -0
- package/lib/sandbox/control/protocol.ts +110 -0
- package/lib/sandbox/control/server.ts +155 -0
- package/lib/sandbox/dockerfile.ts +66 -13
- package/lib/sandbox/mounts.ts +24 -4
- package/lib/sandbox/recovery.ts +163 -6
- package/lib/sandbox/redaction.ts +14 -0
- package/lib/sandbox/runtimes/base.dockerfile +24 -74
- package/lib/sandbox/tool-types.ts +16 -0
- package/lib/sandbox/workspace-identity.ts +123 -0
- package/lib/sandbox/workspace-view.ts +150 -0
- package/lib/task/activity-intent.ts +350 -61
- package/lib/task/activity-log.ts +46 -7
- package/lib/task/commit-finalization.ts +376 -0
- package/lib/task/commit-intent.ts +230 -0
- package/lib/task/create-service.ts +171 -0
- package/lib/task/create.ts +372 -0
- package/lib/task/decision-intents.ts +32 -12
- package/lib/task/delegation-receipts.ts +2 -2
- package/lib/task/implementation-inputs.ts +62 -8
- package/lib/task/ledger-intents.ts +43 -3
- package/lib/task/orchestration.ts +673 -41
- package/lib/task/resolve-ref.ts +46 -1
- package/lib/task/review-fingerprint.ts +9 -0
- package/lib/task/workspace-snapshot.ts +98 -4
- package/package.json +7 -7
- package/templates/.agents/hooks/lifecycle-delegation.js +47 -3
- package/templates/.agents/rules/README.en.md +1 -1
- package/templates/.agents/rules/README.zh-CN.md +1 -1
- package/templates/.agents/rules/human-decision-context.en.md +11 -2
- package/templates/.agents/rules/human-decision-context.zh-CN.md +11 -2
- package/templates/.agents/rules/pr-checks-commands.en.md +1 -1
- package/templates/.agents/rules/pr-checks-commands.github.en.md +1 -1
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +2 -2
- package/templates/.agents/rules/pr-checks-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/task-management.en.md +3 -0
- package/templates/.agents/rules/task-management.zh-CN.md +3 -0
- package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/SKILL.en.md +21 -17
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +28 -16
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +50 -0
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +56 -0
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +4 -4
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +4 -4
- package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/SKILL.en.md +4 -4
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/create-task/SKILL.en.md +26 -43
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +26 -43
- package/templates/.agents/skills/create-task/reference/context-capture.en.md +34 -0
- package/templates/.agents/skills/create-task/reference/context-capture.zh-CN.md +34 -0
- package/templates/.agents/skills/review-code/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +1 -1
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +1 -1
- package/templates/.agents/skills/review-pr/SKILL.en.md +36 -8
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +36 -8
- package/templates/.agents/skills/review-pr/reference/report-template.en.md +1 -1
- package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +1 -1
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +67 -50
- package/templates/.agents/skills/watch-pr/SKILL.en.md +4 -4
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +2 -2
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +2 -2
- package/templates/.agents/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/.claude/rules/tool-preferences.en.md +20 -0
- package/templates/.claude/rules/tool-preferences.zh-CN.md +20 -0
- package/templates/.codex/hooks.json +50 -0
- package/templates/.opencode/commands/watch-pr.en.md +1 -1
- package/templates/.opencode/commands/watch-pr.zh-CN.md +1 -1
- package/templates/.gemini/commands/_project_/review-pr.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-pr.zh-CN.toml +0 -10
|
@@ -13,7 +13,9 @@ Create a Git commit without overwriting user work and update the related task st
|
|
|
13
13
|
|
|
14
14
|
When updating related `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
When the entry business operands literally contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated`; otherwise bind it to empty. Never infer the source from a run file or environment.
|
|
17
|
+
|
|
18
|
+
Direct invocation still requires explicit user authorization. An orchestrated invocation may continue only after the commit intent validates its activated receipt and one-use `commitAuthorization` before side effects; every other commit gate remains unchanged.
|
|
17
19
|
|
|
18
20
|
## Common Rationalizations and Rebuttals
|
|
19
21
|
|
|
@@ -29,15 +31,11 @@ Direct invocation still requires explicit user authorization. For an active orch
|
|
|
29
31
|
|
|
30
32
|
Without explicit task scope, only `TASK_CONTEXT_NOT_FOUND` may continue through the existing bare-commit path. Detached HEAD, damaged candidates, or multiple matches are ambiguity errors. Any explicit task-scope failure is fatal.
|
|
31
33
|
|
|
32
|
-
## Step Start:
|
|
33
|
-
|
|
34
|
-
Before checking local modifications, append a started marker to task.md `## Activity Log` (same base action as this step's done entry plus a ` [started]` suffix, note `started`):
|
|
34
|
+
## Step Start: Recover or Create a Controlled Attempt
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Commit [started]** by {agent} — started
|
|
38
|
-
```
|
|
36
|
+
When `{task-id}` is resolved, call `commit-status` first. Finalize `recoverable`; safely clear `prepared` and query status again; reuse `retryable-start` through `commit-recover --agent {standard-agent-token}`. Fail closed for `invalid` / `conflict` / `orphaned-start`. For `idle`, call `commit-start --agent {standard-agent-token}` so the core atomically writes the structured started entry and returns its attempt/baseline.
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
Read `{commit-attempt}` only from structured `commit-start` / `commit-recover` output. Never hand-write, copy, or guess an attempt. A bare commit without task context skips this protocol.
|
|
41
39
|
|
|
42
40
|
## 1. Check Local Modifications (CRITICAL)
|
|
43
41
|
|
|
@@ -64,14 +62,18 @@ Review status, diff, and recent history, then prepare a Conventional Commit with
|
|
|
64
62
|
|
|
65
63
|
## 4. Create the Commit
|
|
66
64
|
|
|
65
|
+
When `{task-id}` was resolved, read `reference/commit-orchestration.md` before this step and complete `commit-begin` before any successful Git/platform side effect. A taskless Git-only commit skips the intent protocol entirely.
|
|
66
|
+
|
|
67
67
|
Detect the restricted push-only scenario first. Otherwise write message, explicit paths, and expected HEAD/tree to JSON and call `agent-infra-internal git-workflow commit --input {file}`.
|
|
68
68
|
|
|
69
|
+
Immediately after a normal commit succeeds, run the committed checkpoint from that reference. If the checkpoint fails, retain the intent and stop before push or success-state writes.
|
|
70
|
+
|
|
69
71
|
If this commit is associated with a task and a `review-code` artifact exists, read the highest-round `review-code` artifact before committing:
|
|
70
72
|
- If that artifact's `Overall Verdict` / `总体结论` is Approved, parse `R`, `F`, and `Reviewed Snapshot Tree` / `审查快照树` (`T`)
|
|
71
73
|
- After staging the explicit files, record `pre_head=$(git rev-parse HEAD)` and use the helper's JSON mode to generate the complete worktree tree `W` and normalized staged tree `S`
|
|
72
74
|
- Before `git commit`, require `pre_head == R && W == T && S == T`; use the helper's `compare` mode to produce added, missing, and different diagnostics for both worktree and staged snapshots
|
|
73
75
|
- If any condition fails, enter Scenario 4 in `reference/task-status-update.md`; do not run `git commit`, push, successful state updates, PR summary sync, or the completion gate
|
|
74
|
-
- After all comparisons match and the commit succeeds,
|
|
76
|
+
- After all comparisons match and the commit succeeds, the Step 6 `commit-complete` core finalizer atomically writes `last_reviewed_commit` and Commit done; the caller must not write them
|
|
75
77
|
- Do not scan backward to earlier Approved artifacts; the highest-round `review-code` artifact is the only authoritative source
|
|
76
78
|
|
|
77
79
|
## 5. Push to the Existing PR When Applicable
|
|
@@ -86,6 +88,8 @@ b. On an open PR -> push the current branch:
|
|
|
86
88
|
|
|
87
89
|
Use `agent-infra-internal git-workflow push --input {file}` for per-ref normal push and verification. Never force push.
|
|
88
90
|
|
|
91
|
+
After push succeeds and remote verification completes, immediately run the pushed checkpoint from `reference/commit-orchestration.md`.
|
|
92
|
+
|
|
89
93
|
c. Safe degradation (never block an already completed `git commit`; only warn the user):
|
|
90
94
|
- Platform unavailable / unauthenticated / detection failed / no open PR -> do not push; continue.
|
|
91
95
|
- `git push` fails (needs `git pull --rebase`, no upstream, network error) -> keep the local commit and tell the user to push manually.
|
|
@@ -94,6 +98,12 @@ Fold the push outcome (pushed / skipped(no PR) / failed) into the next step's "U
|
|
|
94
98
|
|
|
95
99
|
## 6. Update Task Status When Applicable
|
|
96
100
|
|
|
101
|
+
After checkpoints and before synchronization or the completion gate, call `commit-complete`. Under the task lock, core writes the review anchor, Commit done, and planned orchestration bytes, then deletes the intent last. On failure retain the intent and let the next skill run use status/recover.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
agent-infra-internal task-orchestration {task-id} commit-complete --token "$commit_intent_token" --agent {standard-agent-token}
|
|
105
|
+
```
|
|
106
|
+
|
|
97
107
|
Get the current time:
|
|
98
108
|
|
|
99
109
|
```bash
|
|
@@ -104,7 +114,7 @@ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
|
|
|
104
114
|
|
|
105
115
|
> Before rendering next steps, read `.agents/rules/next-step-output.md` and invoke the shared helper for the scenario selected from `reference/task-status-update.md`.
|
|
106
116
|
|
|
107
|
-
|
|
117
|
+
After core finalization succeeds, choose exactly one next-step case:
|
|
108
118
|
- open PR and successful push -> `watch-pr {task-ref}`; this takes precedence over the final-commit `prFlow` route
|
|
109
119
|
- failed push -> keep the task active and show only push/synchronization diagnostics; do not show `watch-pr` or `complete-task`
|
|
110
120
|
- final commit -> render the next step by `.agents/.airc.json`'s `prFlow` (`disabled` -> single option `complete-task`; `required` -> single option `create-pr`; absent -> two options `create-pr` / `complete-task`); see Case 1 in `reference/task-status-update.md`
|
|
@@ -146,13 +156,7 @@ Handle the result as follows:
|
|
|
146
156
|
|
|
147
157
|
Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
|
|
148
158
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
agent-infra-internal task-orchestration {task-id} stage-completed --agent {standard-agent-token}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Stop if the command fails; a run without the full receipt lifecycle must not be marked completed.
|
|
159
|
+
Run this gate only after core finalization succeeds; never place it before `commit-complete`.
|
|
156
160
|
|
|
157
161
|
## Notes
|
|
158
162
|
|
|
@@ -13,7 +13,9 @@ description: >
|
|
|
13
13
|
|
|
14
14
|
更新关联 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
若入口业务操作数包含字面 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated`;否则绑定为空。不得从 run 文件或环境推断来源。
|
|
17
|
+
|
|
18
|
+
直接调用仍要求用户显式授权。编排调用只有在副作用前通过 commit intent 对 activated receipt 与一次性 `commitAuthorization` 的联合校验后才可继续,其他提交门禁保持不变。
|
|
17
19
|
|
|
18
20
|
## 常见违规借口与反驳
|
|
19
21
|
|
|
@@ -29,15 +31,17 @@ description: >
|
|
|
29
31
|
|
|
30
32
|
未显式指定 task scope 时,只有 `TASK_CONTEXT_NOT_FOUND` 可继续既有纯提交路径;detached HEAD、损坏候选或多匹配属于歧义,必须失败。显式 task scope 解析失败时一律失败。
|
|
31
33
|
|
|
32
|
-
##
|
|
34
|
+
## 步骤开始:恢复或创建受控 attempt
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
已解析出 `{task-id}` 时,先调用 `agent-infra-internal task-orchestration {task-id} commit-status`:
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
- {
|
|
38
|
-
|
|
38
|
+
- `recoverable`:调用 `commit-recover --agent {standard-agent-token}` 完成收尾,不得重复 commit 或 push。
|
|
39
|
+
- `prepared`:调用 `commit-recover --agent {standard-agent-token}` 安全清理 intent,再次查询 status 并复用返回的 `retryable-start` attempt。
|
|
40
|
+
- `retryable-start`:调用 `commit-recover --agent {standard-agent-token}` 取得原 attempt,不追加第二条 started。
|
|
41
|
+
- `invalid` / `conflict` / `orphaned-start`:输出结构化 code 与状态证据并停止。
|
|
42
|
+
- `idle`:调用 `commit-start --agent {standard-agent-token}`,由核心在任务锁内原子写入结构化 started 并返回 attempt/baseline。
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
只从 `commit-start` / `commit-recover` 的结构化输出读取 `{commit-attempt}`;不得手写、复制或猜测 attempt。无任务上下文的纯提交跳过本协议。
|
|
41
45
|
|
|
42
46
|
## 1. 检查本地修改(关键)
|
|
43
47
|
|
|
@@ -64,14 +68,18 @@ git diff
|
|
|
64
68
|
|
|
65
69
|
## 4. 创建提交
|
|
66
70
|
|
|
71
|
+
已解析出 `{task-id}` 时,执行本步骤前先读取 `reference/commit-orchestration.md`,并在任何 Git/平台成功副作用前完成 `commit-begin`;无任务上下文的纯 Git 提交完全跳过 intent 协议。
|
|
72
|
+
|
|
67
73
|
先判断受限 push-only 场景;否则把 message、显式路径、expected HEAD/tree 写入临时 JSON,并调用 `agent-infra-internal git-workflow commit --input {file}`。core 负责范围、敏感文件、暂存树和幂等校验。
|
|
68
74
|
|
|
75
|
+
普通 commit 成功后必须立即按该 reference 执行 committed checkpoint;checkpoint 失败时保留 intent 并停止,不得继续 push 或写成功状态。
|
|
76
|
+
|
|
69
77
|
如果本次提交关联任务且存在 `review-code` 产物,在提交前读取最高轮 `review-code` 产物:
|
|
70
78
|
- 若该产物 `总体结论` / `Overall Verdict` 为 Approved,解析 `R`、`F` 与 `审查快照树` / `Reviewed Snapshot Tree`(`T`)
|
|
71
79
|
- 暂存明确文件后记录 `pre_head=$(git rev-parse HEAD)`,并以 helper 的 JSON 模式生成当前完整工作区树 `W` 与规范化暂存树 `S`
|
|
72
80
|
- 在 `git commit` 前要求 `pre_head == R && W == T && S == T`;分别运行 helper 的 `compare` 模式生成 worktree/staged 的 added、missing、different 路径诊断
|
|
73
81
|
- 任一条件不满足时进入 `reference/task-status-update.md` 的“场景 4:提交前快照阻断”,不得执行 `git commit`、push、成功状态更新、PR 摘要同步或完成 gate
|
|
74
|
-
-
|
|
82
|
+
- 全部相等并成功提交后,由步骤 6 的 `commit-complete` 核心收尾原子写入 `last_reviewed_commit` 与 Commit done;调用方不得手写
|
|
75
83
|
- 不向后扫描更早的 Approved 产物;最高轮 `review-code` 产物是唯一权威来源
|
|
76
84
|
|
|
77
85
|
## 5. 推送到已有 PR(按需)
|
|
@@ -86,6 +94,8 @@ b. 命中开放 PR -> 推送当前分支:
|
|
|
86
94
|
|
|
87
95
|
通过 `agent-infra-internal git-workflow push --input {file}` 逐 ref 普通推送并复核,禁止 force push。
|
|
88
96
|
|
|
97
|
+
推送成功并完成远端复核后,必须立即按 `reference/commit-orchestration.md` 执行 pushed checkpoint。
|
|
98
|
+
|
|
89
99
|
c. 安全降级(不阻塞已完成的 `git commit`,仅提示用户):
|
|
90
100
|
- 平台不可用 / 未认证 / 检测失败 / 未命中开放 PR -> 不推送,继续后续步骤。
|
|
91
101
|
- `git push` 失败(如需 `git pull --rebase`、无 upstream、网络异常)-> 保留本地提交,提示用户手动推送。
|
|
@@ -94,6 +104,14 @@ c. 安全降级(不阻塞已完成的 `git commit`,仅提示用户):
|
|
|
94
104
|
|
|
95
105
|
## 6. 按需更新任务状态
|
|
96
106
|
|
|
107
|
+
普通 commit/push checkpoint 完成后,先调用核心收尾;它在同一任务锁内写入审查锚点、Commit done 与 orchestration planned bytes,最后删除 intent:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
agent-infra-internal task-orchestration {task-id} commit-complete --token "$commit_intent_token" --agent {standard-agent-token}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
失败时保留 intent,输出 `commit-status` 后停止;重跑本技能由开头的 status/recover 路由恢复。调用方不得重复追加 Commit done 或修改 `last_reviewed_commit`。
|
|
114
|
+
|
|
97
115
|
获取当前时间:
|
|
98
116
|
|
|
99
117
|
```bash
|
|
@@ -104,7 +122,7 @@ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
|
|
|
104
122
|
|
|
105
123
|
> 渲染下一步前先读取 `.agents/rules/next-step-output.md`,并按 `reference/task-status-update.md` 的已选场景调用统一 helper。
|
|
106
124
|
|
|
107
|
-
|
|
125
|
+
核心收尾成功后只能选择一个下一步分支:
|
|
108
126
|
- 已有开放 PR 且 push 成功 -> `watch-pr {task-ref}`;该分支优先于最终提交的 `prFlow` 路由
|
|
109
127
|
- push 失败 -> 保持任务 active,只输出推送/同步诊断,不输出 `watch-pr` 或 `complete-task`
|
|
110
128
|
- 最终提交 -> 按 `.agents/.airc.json` 的 `prFlow` 渲染下一步(`disabled` → 单选 `complete-task`;`required` → 单选 `create-pr`;缺省 → 二选一 `create-pr` / `complete-task`),详见 `reference/task-status-update.md` 场景 1
|
|
@@ -146,13 +164,7 @@ agent-infra-internal task-verify {task-id} commit.completed --format text
|
|
|
146
164
|
|
|
147
165
|
将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
|
|
148
166
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
agent-infra-internal task-orchestration {task-id} stage-completed --agent {standard-agent-token}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
命令失败时停止,不得把缺少完整 receipt 生命周期的 run 标记为完成。
|
|
167
|
+
本 gate 只在步骤 6 核心收尾成功后运行;不得把完成校验放在 `commit-complete` 之前。
|
|
156
168
|
|
|
157
169
|
## 注意事项
|
|
158
170
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Commit Orchestration Coordination
|
|
2
|
+
|
|
3
|
+
This protocol applies only when `{task-id}` was resolved. A taskless Git-only commit must not read, create, or complete a commit intent.
|
|
4
|
+
|
|
5
|
+
## Execution source
|
|
6
|
+
|
|
7
|
+
- Bind `{execution-flag}` to `--orchestrated` only when that literal flag appears in the entry business operands.
|
|
8
|
+
- Every other invocation is standalone. Never infer the source from `orchestration.json`, environment variables, or activity history.
|
|
9
|
+
|
|
10
|
+
## Begin before side effects
|
|
11
|
+
|
|
12
|
+
Call `commit-status` whenever the commit skill starts. Use `commit-recover --agent {standard-agent-token}` for `recoverable` / `prepared` / `retryable-start`; use `commit-start --agent {standard-agent-token}` for `idle`; fail closed for every other state. Read `commit_attempt` only from `finalization.attempt.attempt` in start/recover output.
|
|
13
|
+
|
|
14
|
+
After read-only preparation of status, copyright, message, review snapshot, and push routing, record `baseline_head=$(git rev-parse HEAD)` and run this before any commit, push, success log, or platform success sync:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
commit_intent_result=$(agent-infra-internal task-orchestration {task-id} commit-begin --agent {standard-agent-token} {execution-flag} --baseline-head "$baseline_head" --attempt "$commit_attempt")
|
|
18
|
+
commit_intent_token=$(printf '%s' "$commit_intent_result" | node -e 'let input = ""; process.stdin.on("data", chunk => input += chunk).on("end", () => process.stdout.write(JSON.parse(input).token))')
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Set `commit_intent_token` from the one-use `token` in structured output and keep it only in the current process. A failed begin forbids all later side effects.
|
|
22
|
+
|
|
23
|
+
## Side-effect checkpoints
|
|
24
|
+
|
|
25
|
+
Immediately after a normal commit succeeds, record its new HEAD:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
agent-infra-internal task-orchestration {task-id} commit-checkpoint --token "$commit_intent_token" --kind committed --head "$new_head"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Immediately after a push succeeds and remote verification completes, record the verified remote/ref/HEAD:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
agent-infra-internal task-orchestration {task-id} commit-checkpoint --token "$commit_intent_token" --kind pushed --head "$pushed_head" --remote "$remote" --ref "$ref"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
A push-only path skips the committed checkpoint; its pushed HEAD must equal the begin baseline.
|
|
38
|
+
|
|
39
|
+
## Completion and recovery
|
|
40
|
+
|
|
41
|
+
After the committed/pushed checkpoint and before task synchronization or `task-verify commit.completed`, run:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
agent-infra-internal task-orchestration {task-id} commit-complete --token "$commit_intent_token" --agent {standard-agent-token}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- If an intent exists but no side effect occurred, use `commit-abort --token ... --expected-head ...` while HEAD still equals baseline; when abandoning the attempt, then close it with `commit-terminate --attempt "$commit_attempt" --agent {standard-agent-token} --code <STABLE_CODE>`.
|
|
48
|
+
- If begin failed before intent creation, retain the attempt for retry or terminate it only while HEAD is unchanged.
|
|
49
|
+
- After a commit or push, never abort. Retain the intent and use `commit-status` / `commit-recover` for cross-session recovery.
|
|
50
|
+
- Stop when `commit-complete` fails. Do not repeat commit/push or mark a run complete without its full receipt lifecycle.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Commit 编排协调
|
|
2
|
+
|
|
3
|
+
本规则仅适用于已解析出 `{task-id}` 的提交。无任务上下文的纯 Git 提交不得读取、创建或完成 commit intent。
|
|
4
|
+
|
|
5
|
+
## 执行来源
|
|
6
|
+
|
|
7
|
+
- 只有入口业务操作数中字面出现 `--orchestrated` 时,`{execution-flag}` 才绑定为 `--orchestrated`。
|
|
8
|
+
- 其他调用一律为 standalone;不得从 `orchestration.json`、环境变量或历史活动日志推断来源。
|
|
9
|
+
|
|
10
|
+
## 副作用前 begin
|
|
11
|
+
|
|
12
|
+
每次进入 commit 技能先调用 `commit-status`。`recoverable` / `prepared` / `retryable-start` 调用以下无 token 恢复入口,`idle` 调用 `commit-start --agent {standard-agent-token}`;其他状态 fail closed:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
agent-infra-internal task-orchestration {task-id} commit-recover --agent {standard-agent-token}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
恢复入口只接受 `--agent`;不得传 token、head 或 `--orchestrated`。从 start/recover 结构化输出读取 `finalization.attempt.attempt` 为 `commit_attempt`,不得手写 attempt。
|
|
19
|
+
|
|
20
|
+
完成状态、版权、提交信息、review snapshot 和 push 场景的只读准备后,记录 `baseline_head=$(git rev-parse HEAD)`,并在任何 commit、push、任务成功日志或平台成功同步之前调用:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
commit_intent_result=$(agent-infra-internal task-orchestration {task-id} commit-begin --agent {standard-agent-token} {execution-flag} --baseline-head "$baseline_head" --attempt "$commit_attempt")
|
|
24
|
+
commit_intent_token=$(printf '%s' "$commit_intent_result" | node -e 'let input = ""; process.stdin.on("data", chunk => input += chunk).on("end", () => process.stdout.write(JSON.parse(input).token))')
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`commit_intent_token` 只从结构化输出读取一次性 `token`,并仅保存在当前进程内。begin 失败时不得执行后续副作用。
|
|
28
|
+
|
|
29
|
+
## 副作用 checkpoint
|
|
30
|
+
|
|
31
|
+
普通 commit 成功后立即记录新 HEAD:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
agent-infra-internal task-orchestration {task-id} commit-checkpoint --token "$commit_intent_token" --kind committed --head "$new_head"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
push 成功并完成远端复核后立即记录已验证的 remote/ref/HEAD:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
agent-infra-internal task-orchestration {task-id} commit-checkpoint --token "$commit_intent_token" --kind pushed --head "$pushed_head" --remote "$remote" --ref "$ref"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
push-only 路径跳过 committed checkpoint,pushed HEAD 必须等于 begin 时的 baseline HEAD。
|
|
44
|
+
|
|
45
|
+
## 完成与恢复
|
|
46
|
+
|
|
47
|
+
committed/pushed checkpoint 完成后、任务同步与 `task-verify commit.completed` 之前调用:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
agent-infra-internal task-orchestration {task-id} commit-complete --token "$commit_intent_token" --agent {standard-agent-token}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- begin 已创建 intent、但第一个副作用前失败时,先在 HEAD 仍等于 baseline 时调用 `commit-abort --token ... --expected-head ...`;若本轮明确放弃,再调用 `commit-terminate --attempt "$commit_attempt" --agent {standard-agent-token} --code <STABLE_CODE>` 闭合 started。
|
|
54
|
+
- begin 在 intent 创建前失败时可保留 attempt 供下次复用;明确放弃时仅可在 HEAD 未漂移时调用 `commit-terminate`。
|
|
55
|
+
- commit 或 push 发生后失败时不得 abort;保留 intent,并调用 `commit-status` 输出不含 token/digest 的恢复证据。跨会话重跑通过 `commit-recover` 收尾。
|
|
56
|
+
- `commit-complete` 失败时停止。不得重复执行 commit/push,也不得把缺少完整 receipt 生命周期的 run 标记为完成。
|
|
@@ -12,23 +12,23 @@ 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
|
-
|
|
15
|
+
The `commit-complete` / `commit-recover` core has already atomically written this Activity Log entry:
|
|
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
|
-
|
|
21
|
+
When the evidence is satisfied, core also writes or refreshes:
|
|
22
22
|
|
|
23
23
|
```yaml
|
|
24
24
|
last_reviewed_commit: {new_head}
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
This field is the only baseline for the `complete-task` `post-review-commit` gate.
|
|
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.
|
|
28
28
|
|
|
29
29
|
### Scenario 5: Existing-PR push wrap-up
|
|
30
30
|
|
|
31
|
-
After a new commit or the restricted push-only path is successfully pushed to an existing open PR, the only next step is to watch
|
|
31
|
+
After a new commit or the restricted push-only path is successfully pushed to an existing open PR, the only next step is to watch all checks for the new head:
|
|
32
32
|
|
|
33
33
|
Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}`.
|
|
34
34
|
|
|
@@ -12,23 +12,23 @@
|
|
|
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
|
-
|
|
15
|
+
`commit-complete` / `commit-recover` 核心已原子写入以下 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
|
-
|
|
21
|
+
证据满足时核心同时写入或刷新:
|
|
22
22
|
|
|
23
23
|
```yaml
|
|
24
24
|
last_reviewed_commit: {new_head}
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
该字段是 `complete-task` 的 `post-review-commit` gate 唯一 baseline
|
|
27
|
+
该字段是 `complete-task` 的 `post-review-commit` gate 唯一 baseline。调用方只读取核心结果选择后续路由,不得再次追加 Commit done 或手写/推进该字段。
|
|
28
28
|
|
|
29
29
|
### 场景 5:已有 PR 推送收尾
|
|
30
30
|
|
|
31
|
-
新 commit 或受限 push-only 场景成功推送到已有开放 PR 后,唯一下一步是监控新 head
|
|
31
|
+
新 commit 或受限 push-only 场景成功推送到已有开放 PR 后,唯一下一步是监控新 head 的全部 checks:
|
|
32
32
|
|
|
33
33
|
使用 `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
|
|
34
34
|
|
|
@@ -162,7 +162,7 @@ agent-infra-internal task-verify {task-id} complete-task.preflight --format text
|
|
|
162
162
|
|
|
163
163
|
This event runs `review-ledger`, `manual-validation`, `post-review-commit`, then `platform-sync-preflight`. On any non-zero exit (fail/blocked), keep the task active, derive the stable code/target from the gate result, record it through `task-warning ... add --step complete-task ...`, and stop. For a review/head mismatch, rerun `commit` or `review-code`; never fall back to the review baseline.
|
|
164
164
|
|
|
165
|
-
`--force` does not lift this hard gate: close ledger disagreements; re-review or exempt post-review commits, use the platform adapter's authoritative snapshot and remote refs for the bound change request (PR/MR) to prove a content-equivalent single-parent squash merge in an isolated temporary repository, or, without a valid change request, prove from local Git objects that the only protected commit is a content-equivalent single-parent rewrite with no later protected commits; then pass platform preflight. An unsupported adapter capability, missing required platform facts, Git objects, topology, or content evidence, or current Git credentials that cannot read the remote evidence refs fails closed. The platform adapter supplies normalized
|
|
165
|
+
`--force` does not lift this hard gate: close ledger disagreements; re-review or exempt post-review commits, use the platform adapter's authoritative snapshot and remote refs for the bound change request (PR/MR) to prove a content-equivalent single-parent squash merge in an isolated temporary repository, or, without a valid change request, prove from local Git objects that the only protected commit is a content-equivalent single-parent rewrite with no later protected commits; then pass platform preflight. An unsupported adapter capability, missing required platform facts, Git objects, topology, or content evidence, or current Git credentials that cannot read the remote evidence refs fails closed. The platform adapter supplies normalized state for all checks, enforced before merge by the `review-code` / `watch-pr` routes; required checks remain additionally enforced by branch protection / rulesets.
|
|
166
166
|
|
|
167
167
|
### 6. Apply the Local Lifecycle Intent and Verify the Move
|
|
168
168
|
|
|
@@ -161,7 +161,7 @@ agent-infra-internal task-verify {task-id} complete-task.preflight --format text
|
|
|
161
161
|
|
|
162
162
|
该事件依次执行 `review-ledger`、`manual-validation`、`post-review-commit`、`platform-sync-preflight`。任一退出码非 0(fail/blocked)时,任务必须继续留在 active;从 gate 结果取稳定 code/target,通过 `task-warning ... add --step complete-task ...` 落账后停止。若审查基线或 head 不一致,必须先重新 `commit` / `review-code`;不得回退审查基线。
|
|
163
163
|
|
|
164
|
-
`--force` 不解除本硬门禁:未关闭分歧必须先在账本闭合,未复审提交必须重新审查、具备有效豁免,或由平台适配器为绑定的变更请求(PR/MR)提供权威合并快照与远端 refs,并在隔离临时仓库中证明单父 squash merge 等价,或在无有效变更请求时由本地 Git 对象证明唯一受保护提交是内容等价的单父重写且之后无受保护提交;平台 preflight 必须通过。适配器不支持所需能力,平台事实、Git 对象、拓扑、内容证据缺失,或当前 Git 凭据不能读取远端证据 refs 时 fail closed
|
|
164
|
+
`--force` 不解除本硬门禁:未关闭分歧必须先在账本闭合,未复审提交必须重新审查、具备有效豁免,或由平台适配器为绑定的变更请求(PR/MR)提供权威合并快照与远端 refs,并在隔离临时仓库中证明单父 squash merge 等价,或在无有效变更请求时由本地 Git 对象证明唯一受保护提交是内容等价的单父重写且之后无受保护提交;平台 preflight 必须通过。适配器不支持所需能力,平台事实、Git 对象、拓扑、内容证据缺失,或当前 Git 凭据不能读取远端证据 refs 时 fail closed。全部 checks 由平台适配器提供规范化状态,并在合并前通过 `review-code` / `watch-pr` 路由承担;其中 required checks 仍受分支保护 / ruleset 强制。
|
|
165
165
|
|
|
166
166
|
### 6. 执行本地生命周期意图并验证转移
|
|
167
167
|
|
|
@@ -68,7 +68,7 @@ Use `agent-infra-internal git-workflow inspect` for upstream/remote facts and `g
|
|
|
68
68
|
|
|
69
69
|
### 5. Create or Recover the PR
|
|
70
70
|
|
|
71
|
-
Read `.agents/rules/issue-pr-commands.md`, write the title and body to temporary files, then invoke its `platform-pr create` intent.
|
|
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 and before any Create PR started entry, POST, or reuse-bind, core checks commit finalization. An active intent, open Commit, missing review anchor, or tree drift returns a stable code and directs the caller to rerun commit/review-code; create-pr never repairs Commit state. Only after the gate passes does core perform exact head/base lookup: one existing PR is reused and bound, zero creates, and multiple matches fail deterministically. Replays must not create duplicate PRs.
|
|
72
72
|
|
|
73
73
|
If `{task-id}` is available and the related task provides `issue_number`, keep `Closes #{issue-number}` in the PR body.
|
|
74
74
|
|
|
@@ -114,11 +114,11 @@ Explain the created PR URL, summarize metadata sync and summary-comment results,
|
|
|
114
114
|
Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}`.
|
|
115
115
|
|
|
116
116
|
```
|
|
117
|
-
Next step - Watch PR checks (auto self-heal until
|
|
117
|
+
Next step - Watch PR checks (auto self-heal until all checks are green):
|
|
118
118
|
{next-step-commands}
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
Alternatively, to skip active monitoring and attempt completion immediately, use `complete-task`; its
|
|
121
|
+
Alternatively, to skip active monitoring and attempt completion immediately, use `complete-task`; its all-checks hard gate still fails closed for pending/failed checks or head mismatch:
|
|
122
122
|
|
|
123
123
|
Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}`.
|
|
124
124
|
|
|
@@ -127,7 +127,7 @@ Next step (alternative) - Skip active monitoring and attempt completion:
|
|
|
127
127
|
{next-step-commands}
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
`watch-pr` is the primary path. The alternative `complete-task` block skips active polling only; it never skips
|
|
130
|
+
`watch-pr` is the primary path. The alternative `complete-task` block skips active polling only; it never skips the full check set and does not guarantee immediate archival.
|
|
131
131
|
|
|
132
132
|
## Notes
|
|
133
133
|
|
|
@@ -68,7 +68,7 @@ description: >
|
|
|
68
68
|
|
|
69
69
|
### 5. 创建或恢复 PR
|
|
70
70
|
|
|
71
|
-
执行前先读取 `.agents/rules/issue-pr-commands.md`,把标题和正文写入临时文件,并调用其中的 `platform-pr create` intent。core
|
|
71
|
+
执行前先读取 `.agents/rules/issue-pr-commands.md`,把标题和正文写入临时文件,并调用其中的 `platform-pr create` intent。core 在任务锁内、任何 Create PR started / POST / reuse-bind 之前检查 commit finalization;active intent、open Commit、审查锚点缺失或 tree 漂移时返回稳定 code 并指向重跑 commit/review-code,不自动恢复。门禁通过后才按 head/base 精确定位:唯一既有 PR 会复用并绑定,零个才创建,多个稳定失败;重放不得产生重复 PR。
|
|
72
72
|
|
|
73
73
|
如果获取到 `{task-id}` 且对应任务提供了 `issue_number`,必须在 PR 正文中保留 `Closes #{issue-number}`。
|
|
74
74
|
|
|
@@ -114,11 +114,11 @@ agent-infra-internal task-verify {task-id} create-pr.completed --format text
|
|
|
114
114
|
使用 `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
|
|
115
115
|
|
|
116
116
|
```
|
|
117
|
-
下一步 - 监控 PR
|
|
117
|
+
下一步 - 监控 PR 检查(全部 checks 全绿前自动自愈):
|
|
118
118
|
{next-step-commands}
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
或者,若想跳过主动监控并立即尝试完成,改用 `complete-task
|
|
121
|
+
或者,若想跳过主动监控并立即尝试完成,改用 `complete-task`;其全部 checks 硬门禁仍会对 pending/failed/head mismatch fail-closed:
|
|
122
122
|
|
|
123
123
|
使用 `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
|
|
124
124
|
|
|
@@ -127,7 +127,7 @@ agent-infra-internal task-verify {task-id} create-pr.completed --format text
|
|
|
127
127
|
{next-step-commands}
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
`watch-pr` 为主路径;上面的 `complete-task`
|
|
130
|
+
`watch-pr` 为主路径;上面的 `complete-task` 备选块只跳过主动轮询,不跳过全部 checks,也不保证立即归档。
|
|
131
131
|
|
|
132
132
|
## 注意事项
|
|
133
133
|
|
|
@@ -17,7 +17,7 @@ description: >
|
|
|
17
17
|
- Do not perform requirements analysis; analysis is handled separately by `analyze-task`
|
|
18
18
|
- Do not directly implement the requested functionality
|
|
19
19
|
- Do not skip the workflow and jump directly to planning or implementation
|
|
20
|
-
- Only do this: parse the description ->
|
|
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
22
|
|
|
23
23
|
The user's description is a **work item**, not an **instruction to execute immediately**.
|
|
@@ -72,7 +72,7 @@ If the description is unclear, **ask the user to clarify first**.
|
|
|
72
72
|
- `bugfix` -> `bug-fix`
|
|
73
73
|
- `refactor` -> `refactoring`
|
|
74
74
|
|
|
75
|
-
### 2. Create
|
|
75
|
+
### 2. Create an Immutable Candidate
|
|
76
76
|
|
|
77
77
|
Get the current timestamp:
|
|
78
78
|
|
|
@@ -80,14 +80,17 @@ Get the current timestamp:
|
|
|
80
80
|
date +%Y%m%d-%H%M%S
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
- Write the
|
|
83
|
+
- Generate one UUID v4 `idempotencyKey` and write the parsed fields to one JSON file.
|
|
84
|
+
- The candidate follows `TaskCreateCandidateV1`: version, key, standard agent, title, type, unprefixed branch slug, priority, effort, description, and the seven task-input lists.
|
|
85
|
+
- Write it once before the first request. A timeout retry must reuse the same file and let the client generate a new outer request id; do not rerun AI derivation.
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
87
|
+
Invoke the single entry point:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
agent-infra-internal task-create --input "$candidate_file"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The host owns TASK-id/timestamps/version, workflow and branch derivation, template rendering, atomic persistence, short ids, Issue sync, and warnings. The skill must not create task directories, copy templates, allocate short ids, or call platform subcommands directly.
|
|
91
94
|
|
|
92
95
|
Task metadata (`task.md` YAML front matter):
|
|
93
96
|
```yaml
|
|
@@ -109,7 +112,7 @@ assigned_to: {current AI agent}
|
|
|
109
112
|
|
|
110
113
|
priority / effort are required: the AI infers them from the task title and description (candidates in `.agents/rules/issue-fields.md`; normalize localized input). Leave start_date / target_date empty at creation: `start_date` is written by the analyze stage and `target_date` by the complete stage; do not invent dates.
|
|
111
114
|
|
|
112
|
-
### 3.
|
|
115
|
+
### 3. Handle the Structured Result
|
|
113
116
|
|
|
114
117
|
Get the current time:
|
|
115
118
|
|
|
@@ -117,43 +120,25 @@ Get the current time:
|
|
|
117
120
|
date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
|
|
118
121
|
```
|
|
119
122
|
|
|
120
|
-
|
|
121
|
-
- `
|
|
122
|
-
- `
|
|
123
|
-
- `
|
|
124
|
-
- `agent_infra_version`: value from `.agents/rules/version-stamp.md`
|
|
125
|
-
- `## Context` -> `- **Branch**:`: update it to the generated branch name
|
|
126
|
-
- **Append** to `## Activity Log` (do NOT overwrite previous entries):
|
|
127
|
-
```
|
|
128
|
-
- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Create Task** by {agent} — Task created from description
|
|
129
|
-
```
|
|
123
|
+
- `applied` / `no-op`: use the returned task id, short id, and optional Issue identity; do not discover them by scanning directories.
|
|
124
|
+
- `degraded`: the local task is retained; display the returned warning.
|
|
125
|
+
- `blocked`: retain the candidate and retry the same file after the transient problem is fixed.
|
|
126
|
+
- `failed`: report the stable error code. Never modify and retry a candidate under the same idempotency key.
|
|
130
127
|
|
|
131
|
-
### 4.
|
|
128
|
+
### 4. Platform Failure Compatibility
|
|
132
129
|
|
|
133
|
-
|
|
130
|
+
The host service owns platform cascading. The compatibility recovery commands remain visible in the host warning and are not run from the sandbox:
|
|
134
131
|
|
|
135
132
|
```bash
|
|
136
|
-
agent-infra-internal
|
|
137
|
-
agent-infra-internal platform-
|
|
133
|
+
agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "Fix auth/network/template issues and manually retry Issue creation, or create/find an Issue and write issue_number"
|
|
134
|
+
agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}
|
|
138
135
|
```
|
|
139
136
|
|
|
140
|
-
|
|
141
|
-
- Intent created the Issue: `issue_number` was written through the task writer; run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
|
|
142
|
-
- Rule failed (auth / network / template parse / etc.): do not roll back task.md or append an extra Activity Log entry; run `agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "Fix auth/network/template issues and manually retry Issue creation, or create/find an Issue and write issue_number"` to submit a structured warning intent (callers do not allocate ids or edit rows), then follow Scenario C
|
|
143
|
-
- Intent returned no-op/degraded: continue applicable operations without blocking the workflow
|
|
144
|
-
- task.md already has a valid `issue_number`: create validates the binding and returns no-op without creating a duplicate
|
|
137
|
+
The skill only consumes the Issue identity, operations, and warnings returned by the host; it must not repeat platform writes.
|
|
145
138
|
|
|
146
139
|
### 5. Verification Gate
|
|
147
140
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
node .agents/scripts/task-short-id.js alloc "$task_id"
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
If this fails (non-zero exit), follow the message — archive some active tasks or raise `task.shortIdLength` — and do NOT continue.
|
|
155
|
-
|
|
156
|
-
Run the verification gate to confirm the task artifact and sync state are valid:
|
|
141
|
+
The host `task-create` service runs the same typed gate before returning. Consume the returned `task:verify` operation; a branch-only sandbox must not try to read the invisible new task. For direct host diagnostics, run:
|
|
157
142
|
|
|
158
143
|
```bash
|
|
159
144
|
agent-infra-internal task-verify {task-id} create-task.completed --format text
|
|
@@ -244,12 +229,10 @@ For later platform sync: after fixing auth / network / template issues, manually
|
|
|
244
229
|
|
|
245
230
|
## Completion Checklist
|
|
246
231
|
|
|
247
|
-
- [ ]
|
|
232
|
+
- [ ] Wrote one candidate and invoked `agent-infra-internal task-create`
|
|
233
|
+
- [ ] The host created `.agents/workspace/active/{task-id}/task.md`
|
|
248
234
|
- [ ] Wrote and checked `## Task Input` source and state semantics according to `reference/context-capture.md`
|
|
249
|
-
- [ ]
|
|
250
|
-
- [ ] Updated `updated_at` to the current time in task.md
|
|
251
|
-
- [ ] Updated `assigned_to` in task.md
|
|
252
|
-
- [ ] Appended an Activity Log entry to task.md
|
|
235
|
+
- [ ] The returned task id and short id passed completion verification
|
|
253
236
|
- [ ] Tried cascading Issue creation through `.agents/rules/create-issue.md`; if it failed, kept task.md and recorded the reason
|
|
254
237
|
- [ ] Rendered the selected next-step commands through the shared helper
|
|
255
238
|
- [ ] **Did not modify any business code or configuration files**
|