pi-spine 2.27.0 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/spine-batch.mjs +46 -4
- package/bin/spine-tasks.mjs +1 -0
- package/bin/spine-worker-runner.mjs +17 -3
- package/package.json +1 -1
- package/skills/create-spine-tasks/SKILL.md +60 -33
- package/skills/create-spine-tasks/references/authoring-evidence.md +58 -0
- package/skills/create-spine-tasks/references/contract-template.md +52 -7
- package/skills/create-spine-tasks/references/prompt-template.md +77 -8
- package/skills/spine-release-operator/SKILL.md +43 -52
- package/skills/spine-release-operator/references/issue-intake-checklist.md +3 -1
- package/skills/spine-release-operator/references/pi-async-orchestration.md +13 -9
- package/skills/spine-release-operator/references/post-integrate-regression-gate.md +8 -1
- package/skills/spine-release-operator/references/publish-recovery.md +62 -0
- package/src/batch/contract-task-start.mjs +23 -1
- package/src/batch/diagnosis-alternatives.mjs +16 -1
- package/src/batch/diagnosis-handoff-packet.mjs +18 -0
- package/src/batch/diagnosis-pending-lane.mjs +18 -0
- package/src/batch/diagnosis-review-infra.mjs +144 -0
- package/src/batch/diagnosis-suggested-command.mjs +9 -0
- package/src/batch/diagnosis.mjs +19 -20
- package/src/batch/engine-lanes/merge.mjs +0 -8
- package/src/batch/engine-lanes/quota-fallback-run.mjs +11 -0
- package/src/batch/engine-lanes/quota-fallback-state.mjs +155 -8
- package/src/batch/engine-lanes/review-code.mjs +20 -0
- package/src/batch/engine-lanes/review-final.mjs +10 -2
- package/src/batch/engine-lanes/review-poll.mjs +37 -1
- package/src/batch/engine-lanes/task-agent-profile.mjs +324 -0
- package/src/batch/engine-lanes.mjs +18 -18
- package/src/batch/gate-posture-approve.mjs +154 -15
- package/src/batch/integrate-path-delete.mjs +85 -0
- package/src/batch/integrate-worktree.mjs +20 -27
- package/src/batch/journal.mjs +5 -3
- package/src/batch/metrics-rollup.mjs +98 -4
- package/src/batch/metrics.mjs +134 -9
- package/src/batch/provider-quota.mjs +156 -7
- package/src/batch/quota-fallback.mjs +87 -6
- package/src/batch/reconcile-diagnosis.mjs +24 -77
- package/src/batch/resume-lane-reviews.mjs +11 -10
- package/src/batch/retry-profile.mjs +77 -0
- package/src/batch/retry.mjs +32 -1
- package/src/batch/review-artifacts.mjs +3 -2
- package/src/batch/review-level-effective.mjs +19 -0
- package/src/batch/review-spawn.mjs +12 -1
- package/src/batch/review-step-run.mjs +18 -2
- package/src/batch/review-step.mjs +1 -0
- package/src/batch/reviewer-provider-error.mjs +153 -0
- package/src/batch/worker-heartbeat.mjs +10 -2
- package/src/batch/worker-host.mjs +1 -1
- package/src/batch/worker-prompt.mjs +9 -7
- package/src/cli/deps.mjs +3 -2
- package/src/config/agent-model-resolve.mjs +144 -8
- package/src/config/cursor-rules/discover.mjs +38 -1
- package/src/config/model-family.mjs +60 -0
- package/src/config/preflight/discovery.mjs +1 -0
- package/src/config/settings-fields.mjs +11 -0
- package/src/config/spine-config-schema.mjs +87 -0
- package/src/doctor/agent-model-inherit.mjs +78 -1
- package/src/doctor/pi-extension-hooks.mjs +322 -0
- package/src/doctor/run-doctor-checks.mjs +18 -2
- package/src/metrics/quota-cli.mjs +16 -0
- package/src/metrics/quota-probes.mjs +228 -31
- package/src/metrics/quota-snapshot.mjs +21 -2
- package/src/planner/graph.mjs +7 -5
- package/src/planner/pending.mjs +2 -2
- package/src/planner/scope.mjs +3 -3
- package/src/tasks/packet/parse-prompt.mjs +47 -0
- package/src/tasks/packet/validate-prompt.mjs +167 -2
- package/src/tasks/validate-contract-warn.mjs +16 -0
- package/templates/agents/reviewer.md +3 -1
- package/templates/agents/worker.md +15 -19
- package/templates/spine-config.json +1 -1
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Copy this template when creating a new task. Replace all `[bracketed]` fields.
|
|
4
4
|
|
|
5
|
-
**Before creating:** Verify you have scored complexity and assigned Review Level.
|
|
6
|
-
|
|
5
|
+
**Before creating:** Verify you have chosen the task type (SKILL Step 2a), scored complexity, and assigned Review Level.
|
|
6
|
+
Code tasks default to Level 1; Level 0 is for `Type: execute`, docs-only, and trivial config; Level 2 only for security, data-model, or hot shared modules.
|
|
7
|
+
Deterministic commands use the [execute-task variant](#execute-task-variant) instead of this LLM template.
|
|
7
8
|
|
|
8
9
|
---
|
|
9
10
|
|
|
@@ -12,8 +13,14 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
|
|
|
12
13
|
|
|
13
14
|
**Created:** [YYYY-MM-DD]
|
|
14
15
|
**Size:** [S | M | L]
|
|
16
|
+
**Type:** [llm | execute]
|
|
17
|
+
**Profile:** [optional — worker profile name from `agents.profiles`]
|
|
18
|
+
**Thinking:** [optional — off | minimal | low | medium | high | xhigh]
|
|
19
|
+
**Reviewer Profile:** [optional — profile from `agents.profiles` whose `reviewer` block judges this task]
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
> **Agent header fields (#355):** All three are optional; omit them to use `agents.activeProfile`. Names allow `A-Z a-z 0-9 . _ -`. Engine reviews resolve the reviewer per task: `**Reviewer Profile:**` → `agents.profiles.<worker profile>.reviewerProfile` → `agents.reviewerProfile` → `agents.reviewer`, skipping any reviewer in the same model family as the worker. When no cross-family reviewer remains, the task fails with `review_blocked` before any reviewer spawns. `**Profile:**` feeds that resolution today; the worker spawn does not yet apply `**Profile:**` or `**Thinking:**`. See the operator runbook, "Reviewer profiles".
|
|
22
|
+
|
|
23
|
+
## Review Level: [0-2] ([None | Plan Only | Plan and Code])
|
|
17
24
|
|
|
18
25
|
**Risk:** [1-2 sentences: severity/blast radius — what breaks and how far the change reaches]
|
|
19
26
|
**Score:** [N]/8 — Blast radius: [N], Pattern novelty: [N], Security: [N], Reversibility: [N]
|
|
@@ -76,6 +83,7 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
|
|
|
76
83
|
| Field | Value |
|
|
77
84
|
|-------|-------|
|
|
78
85
|
| testCommand | `[shell command in backticks, or \`true\` for docs-only S tasks]` |
|
|
86
|
+
| runCommand | `[execute tasks only: the job command; testCommand then proves the result]` |
|
|
79
87
|
| fileScopeMustChange | `[optional: comma-separated paths/globs that must change]` |
|
|
80
88
|
| fileScopeMustNotChange | `[optional: comma-separated paths/globs that must not change]` |
|
|
81
89
|
| minLineCoverage | `[optional: integer 0–100; use 77 for code tasks]` |
|
|
@@ -117,11 +125,13 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
|
|
|
117
125
|
> Operator post-integrate `npm run release:check` owns the whole-repo gate (typecheck → lint → full tests → coverage).
|
|
118
126
|
>
|
|
119
127
|
> **Code tasks** (File Scope touches `src/`, `bin/`, `tests/`, or `scripts/`): include `npm run lint` in Contract `testCommand` and mirror it here.
|
|
120
|
-
> **Docs-only tasks:** keep this step; run the
|
|
128
|
+
> **Docs-only tasks:** keep this step; run only tests that reference the changed docs (`rg -l '<doc path>' tests/`). If there are no hits, record "no tests reference this doc". Post-integrate `release:check` owns the full suite. Omit lint and coverage checkboxes when no application code changes.
|
|
129
|
+
>
|
|
130
|
+
> Use `--test-reporter=dot` on `node --test` so passing tests do not flood the worker context.
|
|
121
131
|
|
|
122
132
|
- [ ] Run lint (code tasks only): `npm run lint` — or project analyze command when present
|
|
123
|
-
- [ ] Run Contract `testCommand`: `[exact command from ## Contract — typically lint && typecheck && scoped node --test]`
|
|
124
|
-
- [ ] Run coverage gate (
|
|
133
|
+
- [ ] Run Contract `testCommand`: `[exact command from ## Contract — typically lint && typecheck && scoped node --test --test-reporter=dot]`
|
|
134
|
+
- [ ] Run coverage gate (Size L, or when Contract sets `minLineCoverage`): `[testWithCoverage command, e.g. npm run coverage:check]` — **≥77% line coverage** on in-scope changed code
|
|
125
135
|
- [ ] Run integration tests (if applicable)
|
|
126
136
|
- [ ] Fix all failures
|
|
127
137
|
|
|
@@ -195,6 +205,65 @@ Use unambiguous field names: `**Risk:**` for severity/blast (pairs with **Score*
|
|
|
195
205
|
|
|
196
206
|
---
|
|
197
207
|
|
|
208
|
+
## Execute-task variant
|
|
209
|
+
|
|
210
|
+
Use for deterministic commands (generators, smoke runs, evidence collection, deploys). The engine runs `runCommand` in the lane worktree with **no LLM worker**, then verifies the Contract. `validatePrompt` still requires the standard sections and a Testing step; keep them short — the engine does not execute steps. Add a `## Matrix` table to fan out across targets (see [contract-template.md](contract-template.md#execute-matrix-task)).
|
|
211
|
+
|
|
212
|
+
````markdown
|
|
213
|
+
# Task: [PREFIX-###] — [Name]
|
|
214
|
+
|
|
215
|
+
**Created:** [YYYY-MM-DD]
|
|
216
|
+
**Size:** S
|
|
217
|
+
**Type:** execute
|
|
218
|
+
|
|
219
|
+
## Review Level: 0 (None)
|
|
220
|
+
|
|
221
|
+
**Risk:** [What the command touches; deterministic, no code authored]
|
|
222
|
+
**Score:** 0/8 — Blast radius: 0, Pattern novelty: 0, Security: 0, Reversibility: 0
|
|
223
|
+
|
|
224
|
+
## Mission
|
|
225
|
+
|
|
226
|
+
[Closes #N | Partial #N] — Run `[script]` to produce `[artifact]` for [purpose].
|
|
227
|
+
|
|
228
|
+
## Dependencies
|
|
229
|
+
|
|
230
|
+
- **Task:** [PREFIX-###] ([LLM task that authored the script, when split])
|
|
231
|
+
|
|
232
|
+
## File Scope
|
|
233
|
+
|
|
234
|
+
- `[out/report.json]`
|
|
235
|
+
|
|
236
|
+
## Contract
|
|
237
|
+
|
|
238
|
+
| Field | Value |
|
|
239
|
+
|-------|-------|
|
|
240
|
+
| runCommand | `[sh scripts/collect.sh]` |
|
|
241
|
+
| testCommand | `[test -f out/report.json]` |
|
|
242
|
+
| fileScopeMustChange | `[out/report.json]` |
|
|
243
|
+
|
|
244
|
+
## Steps
|
|
245
|
+
|
|
246
|
+
### Step 0: Run command
|
|
247
|
+
|
|
248
|
+
- [ ] Engine runs Contract `runCommand`
|
|
249
|
+
|
|
250
|
+
### Step 1: Testing & Verification
|
|
251
|
+
|
|
252
|
+
- [ ] Contract `testCommand` passes (artifact exists)
|
|
253
|
+
|
|
254
|
+
## Completion Criteria
|
|
255
|
+
|
|
256
|
+
- [ ] `runCommand` exit 0 and Contract verified
|
|
257
|
+
|
|
258
|
+
## Do NOT
|
|
259
|
+
|
|
260
|
+
- Modify `.spine/`, `AGENTS.md`, `CLAUDE.md`, or `.gitnexus/` ([#149](https://github.com/beettlle/pi-spine/issues/149))
|
|
261
|
+
````
|
|
262
|
+
|
|
263
|
+
Keep `testCommand` cheap — it re-runs at contract verify. Omitting `runCommand` makes the engine run `testCommand` as the job **and** again at verify.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
198
267
|
# STATUS.md Template
|
|
199
268
|
|
|
200
269
|
Create alongside PROMPT.md. If omitted, the execution engine may auto-generate
|
|
@@ -206,7 +275,7 @@ this from PROMPT.md.
|
|
|
206
275
|
**Current Step:** Not Started
|
|
207
276
|
**Status:** 🔵 Ready for Execution
|
|
208
277
|
**Last Updated:** [YYYY-MM-DD]
|
|
209
|
-
**Review Level:** [0-
|
|
278
|
+
**Review Level:** [0-2]
|
|
210
279
|
**Review Counter:** 0
|
|
211
280
|
**Iteration:** 0
|
|
212
281
|
**Size:** [S | M | L]
|
|
@@ -242,7 +311,7 @@ this from PROMPT.md.
|
|
|
242
311
|
### Step [N-1]: Testing & Verification
|
|
243
312
|
**Status:** ⬜ Not Started
|
|
244
313
|
|
|
245
|
-
- [ ]
|
|
314
|
+
- [ ] Contract `testCommand` passing (full suite runs at post-integrate `release:check`)
|
|
246
315
|
- [ ] Coverage gate passes (≥77% line coverage on in-scope code, when applicable)
|
|
247
316
|
- [ ] Integration tests (if applicable)
|
|
248
317
|
- [ ] All failures fixed
|
|
@@ -10,6 +10,16 @@ You are the **pi-spine release operator**. Drive a **curated release cycle** fro
|
|
|
10
10
|
|
|
11
11
|
Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle for v1.5.1".
|
|
12
12
|
|
|
13
|
+
## Spine CLI binary (repo checkout inside pi-spine only)
|
|
14
|
+
|
|
15
|
+
Every `spine …` command in this skill means the CLI from **this pi-spine checkout**, not the global install. The release cycle is the dogfood run for unreleased `main`; the global `spine` (npm `-g`, `pi install npm:pi-spine`) stays on the last published release because `main` can be unstable between releases. Other projects keep using the published global.
|
|
16
|
+
|
|
17
|
+
- Run `node bin/spine.mjs <args>` from the pi-spine repo root (batch start/resume/retry, wait, gate, integrate, doctor, preflight, plan, tasks validate, status).
|
|
18
|
+
- The engine resolves its worker runner and reviewer code from the package that launched it (`PACKAGE_ROOT`), so the binary you start a batch with decides which engine code runs.
|
|
19
|
+
- After each integrate, `npm install` on `main` (already required) keeps the checkout runnable; the next batch picks up the new engine automatically.
|
|
20
|
+
- Verify after a detached start: `ps -o command= -p <enginePid>` must show `<repo>/bin/spine.mjs`, not `/opt/homebrew/...` or `node_modules/pi-spine`.
|
|
21
|
+
- Never `npm link` the checkout or point the global at it; do not reinstall the global mid-release. Upgrade the global only after publish (Phase 6).
|
|
22
|
+
|
|
13
23
|
**Not** for executing all pending tasks — use `spine-autonomous-operator` for that. This skill selects a **subset** fitting the release profile.
|
|
14
24
|
|
|
15
25
|
## Skill boundaries
|
|
@@ -25,6 +35,7 @@ Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle
|
|
|
25
35
|
| Manifest format | [references/release-manifest-template.md](references/release-manifest-template.md) |
|
|
26
36
|
| Post-integrate regression gate | [references/post-integrate-regression-gate.md](references/post-integrate-regression-gate.md) |
|
|
27
37
|
| npm publish mechanics | `docs/release/npm-publish.md` |
|
|
38
|
+
| Publish failure / smoke recovery | [references/publish-recovery.md](references/publish-recovery.md) |
|
|
28
39
|
| Upstream bug filing | [references/issue-template.md](references/issue-template.md) |
|
|
29
40
|
|
|
30
41
|
## Success criteria
|
|
@@ -61,7 +72,7 @@ Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle
|
|
|
61
72
|
- **Do not** execute tasks outside the approved manifest scope
|
|
62
73
|
- **Never** start Phase 4 (execute) without **recorded scope approval** — the release manifest must show `Operator approved scope: yes` from the Phase 2 gate. Refuse the first wave when approval is missing or `no` (F1, [#249](https://github.com/beettlle/pi-spine/issues/249))
|
|
63
74
|
- **Never** mid-release-edit `.spine/spine-config.json` agent pins (`agents.worker.model` / `agents.reviewer.model`) while a batch is running or integrated work is still unpublished. Pin **one worker** per release; escalate models **only** on content/contract failure — never on quota/403 or launch storms, which make releases worse (F7, [#248](https://github.com/beettlle/pi-spine/issues/248)). To override mid-release, first record the reason and date in the release manifest
|
|
64
|
-
- **Distinguish quota fallback from escalation** ([#329](https://github.com/beettlle/pi-spine/issues/329), v2.27.0): `agents.quotaFallbackProfile` is **provider failover, not escalation** — it switches the batch to a fallback profile on a **different provider pool**, not to a stronger model. It is single-hop
|
|
75
|
+
- **Distinguish quota fallback from escalation** ([#329](https://github.com/beettlle/pi-spine/issues/329), v2.27.0): `agents.quotaFallbackProfile` is **provider failover, not escalation** — it switches the batch to a fallback profile on a **different provider pool**, not to a stronger model. It is single-hop, sticky once applied until it expires after the primary pool's parsed reset time or you run `spine batch quota-fallback clear` ([#350](https://github.com/beettlle/pi-spine/issues/350); journaled `batch.quota_fallback_cleared`), journaled (`batch.quota_fallback_applied`), and never edits `.spine/spine-config.json`. Because it changes pool, not model strength, it is **allowed mid-release** and does not violate the #248 rule above — that rule still bans escalating models on quota/403 or launch storms. After a fallback fires, paste the `Agent pin override: yes (<date>, auto quota fallback <pool> -> <profile>, batch <id>)` line shown by `spine status --diagnose` into the release manifest (the override record the #248 rule requires)
|
|
65
76
|
- **Heed** the doctor/preflight **quota-risk advisory** ([#251](https://github.com/beettlle/pi-spine/issues/251)): `spine doctor` surfaces `ok: true, warning: true` when escalate/hard worker pins target quota-constrained pools without headroom evidence, or recent run-metrics show launch-storm / quota-abort patterns. It is advisory only — never fails preflight — and does not change the mid-release pin-thrash ban above
|
|
66
77
|
- **Always** push/sync `main` to `origin` after each land loop once the post-integrate regression gate is green — do not let `main` drift far ahead of `origin` during a release (F8, [#249](https://github.com/beettlle/pi-spine/issues/249))
|
|
67
78
|
- **Always** close GitHub issues linked as `Closes #NNN` / `Closes: #NNN` **as soon as that task's work is on `main`** (after integrate + post-integrate `release:check` green) — do **not** defer closing until Phase 6 publish. Leave `Partial #NNN` / `Partial: #NNN` open. Phase 6 is only a final sweep for any still-open `Closes` links (v2.15.0 left #257–#261, #263 open after ship — avoid that)
|
|
@@ -141,11 +152,17 @@ skills/spine-release-operator/scripts/collect-release-intake.sh {TARGET}
|
|
|
141
152
|
|
|
142
153
|
```bash
|
|
143
154
|
gh issue list --repo beettlle/pi-spine --state open --limit 100 \
|
|
144
|
-
--json number,title,labels
|
|
155
|
+
--json number,title,labels
|
|
145
156
|
gh issue list --repo beettlle/pi-spine --state open --label documentation --json number,title,labels
|
|
146
157
|
gh issue list --repo beettlle/pi-spine --state open --label bug --json number,title,labels
|
|
147
158
|
```
|
|
148
159
|
|
|
160
|
+
Do **not** pull `body` for the whole backlog — 100 issue bodies cost more context than the rest of intake combined. Shortlist by title and labels, then read bodies only for candidates:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
gh issue view NNN --repo beettlle/pi-spine --json number,title,labels,body
|
|
164
|
+
```
|
|
165
|
+
|
|
149
166
|
**Pending tasks:**
|
|
150
167
|
|
|
151
168
|
```bash
|
|
@@ -253,6 +270,12 @@ For every task in manifest scope:
|
|
|
253
270
|
- [ ] Same-wave tasks have disjoint `fileScopeMustChange`
|
|
254
271
|
- [ ] Code tasks: Contract `testCommand` prefixes project lint/analyze (`npm run lint &&` for pi-spine) — see [contract-template.md](../../create-spine-tasks/references/contract-template.md)
|
|
255
272
|
|
|
273
|
+
**Cost hygiene** (see create-spine-tasks [Cost-aware authoring](../create-spine-tasks/SKILL.md#cost-aware-authoring)):
|
|
274
|
+
- [ ] Deterministic steps (smoke runs, generators, evidence collection) are `Type: execute` tasks, not LLM steps — no LLM worker supervises a long-running command ([#276](https://github.com/beettlle/pi-spine/issues/276))
|
|
275
|
+
- [ ] Review Level: 1 for code, 0 for execute/docs-only; Level 2 only for security, data-model, or hot shared modules
|
|
276
|
+
- [ ] Testing steps are scoped (`node --test --test-reporter=dot <files>`; docs-only runs `rg -l` hits) — no full-suite run in S/M packets; §4.3a `release:check` owns the full suite
|
|
277
|
+
- [ ] File Scope lists concrete paths (directory globs pull extra rule packs into every worker turn)
|
|
278
|
+
|
|
256
279
|
```bash
|
|
257
280
|
spine tasks validate <release-scope>
|
|
258
281
|
spine tasks analyze <release-scope>
|
|
@@ -276,7 +299,9 @@ Before the first wave, confirm the release manifest records **`Operator approved
|
|
|
276
299
|
|
|
277
300
|
**Model pin:** one worker pin for the release — do not mid-release-edit `.spine/spine-config.json` agent pins. Escalate models only on content/contract failure, never quota/403 or launch storms (F7, [#248](https://github.com/beettlle/pi-spine/issues/248)). A doctor/preflight quota-risk escalate signal is intentionally **out of scope** for this release — deferred to a later release ([#248](https://github.com/beettlle/pi-spine/issues/248) optional AC).
|
|
278
301
|
|
|
279
|
-
**
|
|
302
|
+
**Reviewer isolation:** reviewers no longer load user extensions — they spawn with `pi -ne` by default (v2.27.1, [#334](https://github.com/beettlle/pi-spine/issues/334)), so extension overrides matter only when `agents.reviewer.loadUserExtensions` is `true`. If a review spawn or provider failure hits a task whose `.DONE` is already in the lane, recover by re-review (`spine batch retry <taskId>` → `spine batch resume`), not salvage — salvage lands unreviewed work and is a last resort.
|
|
303
|
+
|
|
304
|
+
**Quota fallback is provider failover, not escalation** ([#329](https://github.com/beettlle/pi-spine/issues/329), v2.27.0): when `agents.quotaFallbackProfile` names a profile on a different provider pool, the engine moves the batch to that pool automatically — once per batch, sticky until the primary pool's reset time passes or `spine batch quota-fallback clear` runs (#350), journaled, without editing `.spine/spine-config.json` — and retries each quota-exhausted task once in its lane worktree. This is the sanctioned mid-release response to quota exhaustion; it does not count as a pin override under the rule above. When it fires, record it in the release manifest by pasting the `Agent pin override: yes (<date>, auto quota fallback <pool> -> <profile>, batch <id>)` line from `spine status --diagnose`.
|
|
280
305
|
|
|
281
306
|
**Detached-first:** See [agent-shell-batch-policy.md](../spine-autonomous-operator/references/agent-shell-batch-policy.md). Omit `--attached` for release waves unless the operator shell is a persistent interactive terminal that blocks until batch completion.
|
|
282
307
|
|
|
@@ -300,7 +325,7 @@ MonitorCreate:
|
|
|
300
325
|
command: spine batch start <release-scope> --wave N # detached — omit --attached (#163)
|
|
301
326
|
description: Release wave N
|
|
302
327
|
timeout: 0
|
|
303
|
-
onDone: spine status --diagnose → §4.3 land loop or §4.4 recovery
|
|
328
|
+
onDone: spine status --diagnose → read evidence/summary.md → §4.3 land loop or §4.4 recovery
|
|
304
329
|
```
|
|
305
330
|
|
|
306
331
|
**Blocking fallback** (Cursor Agent, non-pi, or after MonitorCreate orphan — see [agent-shell-batch-policy.md](../spine-autonomous-operator/references/agent-shell-batch-policy.md)):
|
|
@@ -308,7 +333,13 @@ MonitorCreate:
|
|
|
308
333
|
```bash
|
|
309
334
|
spine batch start <release-scope> --wave N
|
|
310
335
|
spine status --diagnose
|
|
311
|
-
spine wait --until completed,failed,needs_integrate,needs_retry,aborted --timeout 4h
|
|
336
|
+
spine wait --until completed,failed,needs_integrate,needs_retry,aborted --timeout 4h --interval 60
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Context discipline:** one blocking `spine wait` (or one Monitor wake) per wave — not repeated `spine status` polls. On wake, read `.spine/runtime/<batchId>/evidence/summary.md` (~2 KB). Never read `evidence/test-output.txt` (~240 KB) in full; extract the result lines:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
rg -n '^ℹ (tests|pass|fail)|^not ok' .spine/runtime/<batchId>/evidence/test-output.txt
|
|
312
343
|
```
|
|
313
344
|
|
|
314
345
|
**Foreground `--attached`** (persistent interactive human terminal only):
|
|
@@ -322,10 +353,10 @@ spine batch start <release-scope> --wave N --attached
|
|
|
322
353
|
```bash
|
|
323
354
|
spine status --diagnose
|
|
324
355
|
# or block:
|
|
325
|
-
spine wait --until completed,failed,needs_integrate,needs_retry,aborted --timeout 2h
|
|
356
|
+
spine wait --until completed,failed,needs_integrate,needs_retry,aborted --timeout 2h --interval 60
|
|
326
357
|
```
|
|
327
358
|
|
|
328
|
-
Optional pi watchdog: `LoopCreate` every
|
|
359
|
+
Optional pi watchdog: `LoopCreate` **only** when no MonitorCreate covers the batch — every 15m, `readOnly: true`, `maxFires: 8` — see pi-async-orchestration. Each fire is a full agent turn; a 2-minute loop over a 4-hour wave costs up to 120 turns of nothing.
|
|
329
360
|
|
|
330
361
|
> **Wait progress (SP-754):** human-mode `spine wait` is not silent until exit — it prints a start banner, a `Wait progress:` line per poll (diagnosis, phase, wave, elapsed), and a terminal `Wait matched:` (stdout) or `Wait timed out` (stderr) headline. Quiet output between progress lines means the wait is between polls, not hung. Use `--json` when a machine parses the result.
|
|
331
362
|
|
|
@@ -439,7 +470,7 @@ spine preflight
|
|
|
439
470
|
git status
|
|
440
471
|
```
|
|
441
472
|
|
|
442
|
-
**pi async (preferred):** `MonitorCreate` with `npm run release:check 2>&1 | tee /tmp/pi-spine-release-check.log`, `timeout: 900000`, `onDone` to
|
|
473
|
+
**pi async (preferred):** `MonitorCreate` with `npm run release:check 2>&1 | tee /tmp/pi-spine-release-check.log`, `timeout: 900000`, `onDone` to verify exit 0 from monitor metadata — not log tail alone. On failure, extract failures with `rg -n '^not ok|^ℹ fail|Error' /tmp/pi-spine-release-check.log` instead of reading the whole log into context.
|
|
443
474
|
|
|
444
475
|
**Foreground fallback:**
|
|
445
476
|
|
|
@@ -567,52 +598,11 @@ Tag push + green **CI** (`ci.yml`) alone is **not** enough — `ci.yml` does not
|
|
|
567
598
|
|
|
568
599
|
### Publish failure recovery (HARD STOP — do not retag)
|
|
569
600
|
|
|
570
|
-
When `release.yml` fails
|
|
571
|
-
|
|
572
|
-
```bash
|
|
573
|
-
gh run view <run-id> --log-failed
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
| Symptom | Meaning | Action |
|
|
577
|
-
|---------|---------|--------|
|
|
578
|
-
| OIDC / trusted publisher mismatch / `ENEEDAUTH` | Trusted Publisher config wrong (workflow name, Environment name set while job has none, stage permission missing) | Fix npm Trusted Publisher; re-dispatch same tag — do **not** `npm version` again |
|
|
579
|
-
| Legacy `E404` on PUT with `NPMSECRET` | Old token path still in use or secret bad | Prefer OIDC; emergency: rotate `NPMSECRET` only if workflow still uses token |
|
|
580
|
-
| Validation steps failed (typecheck / lint / coverage / CLI smoke) | Tagged commit not release-safe | Fix on `main`, create a **new** patch version + tag; do not force-publish a broken tag |
|
|
581
|
-
| CI gate failed for tagged commit | Pre-tag CI was red or missing | Fix `main` / re-run `ci.yml`; new tag if the old tag pointed at a bad commit |
|
|
582
|
-
| Stage green but install missing version | Not approved yet | Approve with 2FA; do not retag |
|
|
583
|
-
| GitHub Release step failed after stage succeeded | Notes/release page only | Create release manually; do not double-stage the same version without rejecting the prior stage first |
|
|
601
|
+
When `release.yml` fails: `gh run view <run-id> --log-failed`, then follow the symptom table in [references/publish-recovery.md](references/publish-recovery.md). Auth/OIDC failures → fix Trusted Publisher and `gh workflow run release.yml -f tag=v{VERSION}` on the **existing** tag; never `npm version` or retag for auth-only failures.
|
|
584
602
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
```bash
|
|
588
|
-
# Tag must already exist; this re-runs checkout → gate → stage → gh release
|
|
589
|
-
# workflow_dispatch uses the workflow file from the branch you select (usually main)
|
|
590
|
-
gh workflow run release.yml -f tag=v{VERSION}
|
|
591
|
-
gh run list --workflow release.yml --limit 3
|
|
592
|
-
gh run watch --exit-status <new-run-id>
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
UI equivalent: **Actions → Release → Run workflow** → enter `v{VERSION}`.
|
|
596
|
-
|
|
597
|
-
**Do not** delete/retag/`npm version` again when the only failure was auth/OIDC — package.json and the `v*` tag are already correct.
|
|
598
|
-
|
|
599
|
-
Distinguish **stage auth failures** (table above) from **post-approve install E404/ETARGET** (registry lag F9 — smoke section below) and from **pre-approve missing version** (approve pending).
|
|
600
|
-
|
|
601
|
-
Post-publish smoke per `docs/release/npm-publish.md` — **only after stage success and 2FA approve**. **Retry on registry lag (F9, [#247](https://github.com/beettlle/pi-spine/issues/247)):** the first `npm install -g` right after approve can fail with `ETARGET` / "No matching version found" while the registry propagates, even when `npm view` already lists the version. Prefer the bounded wrapper:
|
|
602
|
-
|
|
603
|
-
```bash
|
|
604
|
-
scripts/post-publish-smoke.sh <version>
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
Manual equivalent (bounded retries on `ETARGET`/404-class errors only — 5s/10s/20s backoff capped at 60s, max 6 attempts; non-lag install errors fail immediately and exhausted retries fail closed, never masked as lag):
|
|
608
|
-
|
|
609
|
-
```bash
|
|
610
|
-
npm install -g pi-spine@<version>
|
|
611
|
-
spine version
|
|
612
|
-
spine doctor
|
|
613
|
-
```
|
|
603
|
+
Post-publish smoke (**only after stage success and 2FA approve**): `scripts/post-publish-smoke.sh <version>` — bounded retry on registry lag (F9, [#247](https://github.com/beettlle/pi-spine/issues/247)). If retries exhaust, **STOP** and investigate; manual steps in [references/publish-recovery.md](references/publish-recovery.md#post-publish-smoke).
|
|
614
604
|
|
|
615
|
-
|
|
605
|
+
After smoke passes, upgrade the machine's global install to the new release (the only point the global changes): `npm install -g pi-spine@<version>`, then `spine --version` must print `<version>`. If pi loads the extension via `npm:pi-spine`, run `pi update` as well.
|
|
616
606
|
|
|
617
607
|
Update `spine-tasks/CONTEXT.md` release note (version + date).
|
|
618
608
|
|
|
@@ -644,6 +634,7 @@ Include the published version/tag in the close comment when closing at Phase 6 (
|
|
|
644
634
|
8. **Verification** — paste `spine preflight` tail, **`npm run release:check` output** (or log path), test/coverage output
|
|
645
635
|
9. **Publish** — version bumped (Y/N), tag pushed (Y/N), `release.yml` URL + conclusion, stage approved (Y/N), `npm view pi-spine version`, or "awaiting operator approval" / "blocked on Trusted Publisher" / "awaiting stage approve"
|
|
646
636
|
10. **Issue tracker hygiene** — confirm every release-scoped `Closes #NNN` is CLOSED (paste `gh issue view` states or list)
|
|
637
|
+
11. **Spend** — per wave from `spine metrics show --batch <batchId>`: tasks, attempts (retries), failed-attempt wall time, reviewer-infrastructure failures, quota fallbacks. Include token/cost totals once populated ([#338](https://github.com/beettlle/pi-spine/issues/338)); until then write "tokens: not recorded"
|
|
647
638
|
|
|
648
639
|
---
|
|
649
640
|
|
|
@@ -8,7 +8,7 @@ Repo: `beettlle/pi-spine`
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
gh issue list --repo beettlle/pi-spine --state open --limit 100 \
|
|
11
|
-
--json number,title,labels
|
|
11
|
+
--json number,title,labels
|
|
12
12
|
|
|
13
13
|
gh issue list --repo beettlle/pi-spine --state open --label documentation \
|
|
14
14
|
--json number,title,labels
|
|
@@ -20,6 +20,8 @@ gh issue list --repo beettlle/pi-spine --state open --label enhancement \
|
|
|
20
20
|
--json number,title,labels
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
Read bodies only for shortlisted candidates: `gh issue view NNN --repo beettlle/pi-spine --json number,title,labels,body`.
|
|
24
|
+
|
|
23
25
|
## Label taxonomy
|
|
24
26
|
|
|
25
27
|
| Label | Release bucket | Priority notes |
|
|
@@ -20,9 +20,12 @@ Use in **pi sessions** when long-running shell work would waste the agent contex
|
|
|
20
20
|
|
|
21
21
|
```text
|
|
22
22
|
Monitor for wave N completed. Run spine status --diagnose.
|
|
23
|
-
- needs_integrate:
|
|
23
|
+
- needs_integrate: read .spine/runtime/<batchId>/evidence/summary.md (~2 KB) and
|
|
24
|
+
rg -n '^ℹ (tests|pass|fail)|^not ok' .spine/runtime/<batchId>/evidence/test-output.txt
|
|
25
|
+
→ gate approve → integrate → npm install → batch complete.
|
|
26
|
+
Never read test-output.txt or coverage-output.txt in full (hundreds of KB).
|
|
24
27
|
- needs_retry / failed / aborted: follow recovery table; do not start next wave.
|
|
25
|
-
- running:
|
|
28
|
+
- running: one blocking `spine wait --until … --interval 60`; LoopCreate watchdog only if no Monitor covers the batch.
|
|
26
29
|
Paste diagnosis headline and exit evidence. Do not claim success without CLI output.
|
|
27
30
|
```
|
|
28
31
|
|
|
@@ -30,29 +33,30 @@ Paste diagnosis headline and exit evidence. Do not claim success without CLI out
|
|
|
30
33
|
|
|
31
34
|
```text
|
|
32
35
|
release:check monitor completed. Verify exit code from monitor metadata (not log tail alone).
|
|
33
|
-
Read /tmp/pi-spine-release-check.log for failure details when exit is non-zero.
|
|
34
36
|
If exit 0: present pre-publish checklist from docs/release/npm-publish.md.
|
|
35
|
-
If non-zero:
|
|
37
|
+
If non-zero: rg -n '^not ok|^ℹ fail|Error' /tmp/pi-spine-release-check.log — read only those
|
|
38
|
+
hits plus surrounding lines (rg -C 5) for the first failure; do not load the whole log.
|
|
39
|
+
STOP; summarize first failing step; do not bump version.
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
---
|
|
39
43
|
|
|
40
44
|
## When to use LoopCreate (watchdog only)
|
|
41
45
|
|
|
42
|
-
Use when MonitorCreate
|
|
46
|
+
Use **only** when no MonitorCreate covers the command (for example, a batch started from another shell). Every fire is a full agent turn, so a fast loop over a multi-hour wave spends tokens on "still running".
|
|
43
47
|
|
|
44
48
|
```text
|
|
45
49
|
LoopCreate:
|
|
46
|
-
trigger: "
|
|
50
|
+
trigger: "15m"
|
|
47
51
|
readOnly: true
|
|
48
|
-
maxFires:
|
|
52
|
+
maxFires: 8
|
|
49
53
|
prompt: |
|
|
50
54
|
Check spine status --diagnose for batch <batchId>.
|
|
51
55
|
If diagnosis is terminal (needs_integrate, failed, aborted, needs_retry): LoopDelete this loop and run onDone actions.
|
|
52
|
-
If still running: do
|
|
56
|
+
If still running: reply "running" only — do not read logs or evidence.
|
|
53
57
|
```
|
|
54
58
|
|
|
55
|
-
|
|
59
|
+
`maxFires: 8` × 15m covers a 2-hour wave; recreate the loop if the wave runs longer. When MonitorCreate already wraps the command, its completion wake replaces the loop — do not run both.
|
|
56
60
|
|
|
57
61
|
---
|
|
58
62
|
|
|
@@ -34,7 +34,14 @@ npm run release:check
|
|
|
34
34
|
echo "release:check exit: $?"
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
**If exit is non-zero:** STOP.
|
|
37
|
+
**If exit is non-zero:** STOP. Find the failures without loading the whole log (the full-suite log is hundreds of KB):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
rg -n '^not ok|^ℹ fail|Error' /tmp/pi-spine-post-integrate-wave-${WAVE:-main}.log
|
|
41
|
+
rg -n -C 5 '^not ok' /tmp/pi-spine-post-integrate-wave-${WAVE:-main}.log # context for the first failures
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Fix on `main`, commit, re-run gate. Do not start the next wave, push, or tag.
|
|
38
45
|
|
|
39
46
|
---
|
|
40
47
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Publish failure recovery and post-publish smoke
|
|
2
|
+
|
|
3
|
+
Read this only when `release.yml` fails or post-approve smoke fails. The happy path lives in [SKILL.md](../SKILL.md) Phase 6.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Publish failure recovery (HARD STOP — do not retag)
|
|
8
|
+
|
|
9
|
+
When `release.yml` fails, diagnose with the failed job log before any recovery:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
gh run view <run-id> --log-failed
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
| Symptom | Meaning | Action |
|
|
16
|
+
|---------|---------|--------|
|
|
17
|
+
| OIDC / trusted publisher mismatch / `ENEEDAUTH` | Trusted Publisher config wrong (workflow name, Environment name set while job has none, stage permission missing) | Fix npm Trusted Publisher; re-dispatch same tag — do **not** `npm version` again |
|
|
18
|
+
| Legacy `E404` on PUT with `NPMSECRET` | Old token path still in use or secret bad | Prefer OIDC; emergency: rotate `NPMSECRET` only if workflow still uses token |
|
|
19
|
+
| Validation steps failed (typecheck / lint / coverage / CLI smoke) | Tagged commit not release-safe | Fix on `main`, create a **new** patch version + tag; do not force-publish a broken tag |
|
|
20
|
+
| CI gate failed for tagged commit | Pre-tag CI was red or missing | Fix `main` / re-run `ci.yml`; new tag if the old tag pointed at a bad commit |
|
|
21
|
+
| Stage green but install missing version | Not approved yet | Approve with 2FA; do not retag |
|
|
22
|
+
| GitHub Release step failed after stage succeeded | Notes/release page only | Create release manually; do not double-stage the same version without rejecting the prior stage first |
|
|
23
|
+
|
|
24
|
+
### Re-dispatch existing tag
|
|
25
|
+
|
|
26
|
+
After a Trusted Publisher or transient registry fix:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Tag must already exist; this re-runs checkout → gate → stage → gh release
|
|
30
|
+
# workflow_dispatch uses the workflow file from the branch you select (usually main)
|
|
31
|
+
gh workflow run release.yml -f tag=v{VERSION}
|
|
32
|
+
gh run list --workflow release.yml --limit 3
|
|
33
|
+
gh run watch --exit-status <new-run-id>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
UI equivalent: **Actions → Release → Run workflow** → enter `v{VERSION}`.
|
|
37
|
+
|
|
38
|
+
**Do not** delete/retag/`npm version` again when the only failure was auth/OIDC — `package.json` and the `v*` tag are already correct.
|
|
39
|
+
|
|
40
|
+
Distinguish **stage auth failures** (table above) from **post-approve install E404/ETARGET** (registry lag F9 — below) and from **pre-approve missing version** (approve pending).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Post-publish smoke
|
|
45
|
+
|
|
46
|
+
Run per `docs/release/npm-publish.md` — **only after stage success and 2FA approve**.
|
|
47
|
+
|
|
48
|
+
**Retry on registry lag (F9, [#247](https://github.com/beettlle/pi-spine/issues/247)):** the first `npm install -g` right after approve can fail with `ETARGET` / "No matching version found" while the registry propagates, even when `npm view` already lists the version. Prefer the bounded wrapper:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
scripts/post-publish-smoke.sh <version>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Manual equivalent (bounded retries on `ETARGET`/404-class errors only — 5s/10s/20s backoff capped at 60s, max 6 attempts; non-lag install errors fail immediately and exhausted retries fail closed, never masked as lag):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install -g pi-spine@<version>
|
|
58
|
+
spine version
|
|
59
|
+
spine doctor
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
If retries exhaust, **STOP** — treat it as a real missing-version failure and investigate the publish; do not keep waiting silently.
|
|
@@ -5,6 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
import { execFileSync } from "node:child_process";
|
|
7
7
|
|
|
8
|
+
const COMMIT_SHA_PATTERN = /^[0-9a-f]{7,40}$/i;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Hex-only commit SHA check (7-40 chars). Rejects option-like values (leading `-`)
|
|
12
|
+
* before they reach git argv or reviewer prompts (#313, #343).
|
|
13
|
+
*
|
|
14
|
+
* @param {unknown} value
|
|
15
|
+
* @returns {value is string}
|
|
16
|
+
*/
|
|
17
|
+
export function isValidCommitSha(value) {
|
|
18
|
+
return typeof value === "string" && COMMIT_SHA_PATTERN.test(value);
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
const PAYLOAD_COMMIT_KEYS = ["taskStartCommit", "startCommit", "commitSha", "headCommit", "laneBranchHead"];
|
|
9
22
|
|
|
10
23
|
/**
|
|
@@ -178,7 +191,16 @@ function findFirstTaskStarted(journal, taskId, laneId, batchId) {
|
|
|
178
191
|
* @param {{ journal: object[], taskId: string, laneId?: string|null, batchId?: string|null, worktreePath?: string|null }} options
|
|
179
192
|
* @returns {string|null}
|
|
180
193
|
*/
|
|
181
|
-
export function resolveTaskStartCommit(
|
|
194
|
+
export function resolveTaskStartCommit(options) {
|
|
195
|
+
const commit = resolveRawTaskStartCommit(options);
|
|
196
|
+
return isValidCommitSha(commit) ? commit : null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @param {{ journal: object[], taskId: string, laneId?: string|null, batchId?: string|null, worktreePath?: string|null }} options
|
|
201
|
+
* @returns {string|null}
|
|
202
|
+
*/
|
|
203
|
+
function resolveRawTaskStartCommit({ journal, taskId, laneId, batchId, worktreePath }) {
|
|
182
204
|
if (!Array.isArray(journal) || !taskId) {
|
|
183
205
|
return null;
|
|
184
206
|
}
|
|
@@ -2,18 +2,25 @@
|
|
|
2
2
|
* Alternative operator commands per diagnosis (extracted for module size budget).
|
|
3
3
|
*/
|
|
4
4
|
import { buildWorkerDoneMissingAlternatives } from "./diagnosis-worker-done-missing.mjs";
|
|
5
|
+
import { isReviewInfraExitReason } from "./diagnosis-review-infra.mjs";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @param {string} diagnosis
|
|
8
9
|
* @param {object} [ctx]
|
|
9
10
|
* @param {string|null} [ctx.failedTaskId]
|
|
10
11
|
* @param {string|null} [ctx.batchId]
|
|
12
|
+
* @param {string|null} [ctx.exitReason]
|
|
11
13
|
* @param {object[]} [ctx.pendingLaneLandTasks]
|
|
12
14
|
*/
|
|
13
15
|
export function buildAlternatives(diagnosis, ctx = {}) {
|
|
14
16
|
const common = ["spine status --diagnose"];
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
// SP-821 / #334: needs_retry caused by a review-infrastructure exit reason
|
|
19
|
+
// must take the labeled salvage-dry-run path below, even when the task also
|
|
20
|
+
// sits in the pending-lane set — salvage --integrate stays forbidden there.
|
|
21
|
+
const reviewInfraNeedsRetry = diagnosis === "needs_retry" && isReviewInfraExitReason(ctx.exitReason);
|
|
22
|
+
|
|
23
|
+
if ((ctx.pendingLaneLandTasks?.length ?? 0) > 0 && !reviewInfraNeedsRetry) {
|
|
17
24
|
return [
|
|
18
25
|
ctx.batchId
|
|
19
26
|
? `spine batch salvage --batch ${ctx.batchId} --dry-run`
|
|
@@ -43,6 +50,14 @@ export function buildAlternatives(diagnosis, ctx = {}) {
|
|
|
43
50
|
case "integrate_isolated_ok":
|
|
44
51
|
return ["git pull", "spine batch complete", ...common];
|
|
45
52
|
case "needs_retry":
|
|
53
|
+
if (isReviewInfraExitReason(ctx.exitReason)) {
|
|
54
|
+
// SP-821 / #334: salvage stays available as a dry-run inspection only,
|
|
55
|
+
// explicitly labeled as landing unreviewed work.
|
|
56
|
+
const salvageDryRun = ctx.batchId
|
|
57
|
+
? `spine batch salvage --batch ${ctx.batchId} --dry-run (lands unreviewed work)`
|
|
58
|
+
: "spine batch salvage --batch <batchId> --dry-run (lands unreviewed work)";
|
|
59
|
+
return [salvageDryRun, "spine batch abort", ...common];
|
|
60
|
+
}
|
|
46
61
|
return ["spine batch abort", "/spine-skip-task", "/spine-resume --force", ...common];
|
|
47
62
|
case "worker_orphaned":
|
|
48
63
|
return ["spine batch abort", "spine batch resume --force", ...common];
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Kept out of diagnosis.mjs so the parent stays under the phase23 LOC cap.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { QUOTA_FALLBACK_EXPIRY_GRACE_MS } from "./quota-fallback.mjs";
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* True when the latest quota-exhaustion journal payload came from
|
|
9
11
|
* `batch.quota_fallback_exhausted` — the parallel arrays are unique to that
|
|
@@ -87,6 +89,22 @@ export function buildBackground(diagnosis, ctx = {}) {
|
|
|
87
89
|
fallback.exhaustedPool ?? "?"
|
|
88
90
|
} -> ${fallback.toProfile}, batch ${ctx.batchId ?? "?"})`,
|
|
89
91
|
);
|
|
92
|
+
// SP-843 (#350): the hop is sticky until its reset time passes or the operator
|
|
93
|
+
// clears it — show which, and name the clear command once the fallback pool died too.
|
|
94
|
+
const expiresAtMs =
|
|
95
|
+
typeof fallback.resetAt === "number" && Number.isFinite(fallback.resetAt)
|
|
96
|
+
? fallback.resetAt + QUOTA_FALLBACK_EXPIRY_GRACE_MS
|
|
97
|
+
: null;
|
|
98
|
+
facts.push(
|
|
99
|
+
expiresAtMs !== null
|
|
100
|
+
? `Quota fallback expires ${new Date(expiresAtMs).toISOString()}`
|
|
101
|
+
: "Quota fallback has no parsable reset time (no automatic expiry)",
|
|
102
|
+
);
|
|
103
|
+
if (isFallbackChainExhausted(ctx.lastQuotaExhausted)) {
|
|
104
|
+
facts.push(
|
|
105
|
+
"Fallback pool is also exhausted: after the primary pool resets, run `spine batch quota-fallback clear` (paused/failed batch), then `spine batch retry <taskId>` / `spine batch resume`",
|
|
106
|
+
);
|
|
107
|
+
}
|
|
90
108
|
}
|
|
91
109
|
if (ctx.launchFailureKind) {
|
|
92
110
|
facts.push(`Launch failure kind: ${ctx.launchFailureKind}`);
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import { isEngineProcessAlive } from "../process/liveness.mjs";
|
|
7
7
|
import { readBatchEnginePid, readBatchEngineStartedAt } from "./state-guards.mjs";
|
|
8
|
+
import {
|
|
9
|
+
REVIEW_INFRASTRUCTURE_EXIT_REASONS,
|
|
10
|
+
resolveTaskPrimaryFailureExitReason,
|
|
11
|
+
} from "./diagnosis-review-infra.mjs";
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Tasks with lane `.DONE` but not on main — lane commits never landed (#201 / SP-645).
|
|
@@ -54,6 +58,20 @@ export function shouldDiagnosePendingLaneLand(signals, deps = {}) {
|
|
|
54
58
|
if (isLiveEngineMidTask(signals?.raw, deps)) return false;
|
|
55
59
|
const pending = findPendingLaneLandTasks(signals.tasks);
|
|
56
60
|
if (pending.length === 0) return false;
|
|
61
|
+
// SP-821 / #334: when every pending-lane task's primary failure exit reason
|
|
62
|
+
// is a review-infrastructure reason (spawn failure / timeout / provider
|
|
63
|
+
// error), no verdict was ever produced. Re-run the review — never
|
|
64
|
+
// salvage-integrate unreviewed code. Any other reason (or no failure at
|
|
65
|
+
// all) keeps today's salvage guidance.
|
|
66
|
+
if (
|
|
67
|
+
pending.every((task) =>
|
|
68
|
+
REVIEW_INFRASTRUCTURE_EXIT_REASONS.has(
|
|
69
|
+
String(resolveTaskPrimaryFailureExitReason(task, signals) ?? ""),
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
57
75
|
// Only when orch already appears merged — otherwise healthy pre-integrate
|
|
58
76
|
// waves (doneInLane, awaiting integrate) must stay needs_integrate / settled.
|
|
59
77
|
if (signals.git?.orchMergedToBase !== true) return false;
|