pi-goal-list-loop-audit 0.39.68 → 0.40.1
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/CHANGELOG.md +80 -0
- package/docs/DESIGN-long-running-supervision.md +38 -18
- package/docs/INDEX.md +6 -2
- package/docs/RECOVERY.md +19 -1
- package/docs/RUNTIME-INVENTORY.md +9 -9
- package/docs/UI-STATUS.md +2 -2
- package/extensions/auditor-lane.ts +87 -0
- package/extensions/card-sections.ts +117 -0
- package/extensions/completion-summary.ts +519 -136
- package/extensions/finding-lead.ts +13 -1
- package/extensions/gate-receipts.ts +276 -0
- package/extensions/goal-loop-auditor-process.ts +37 -9
- package/extensions/goal-loop-auditor.ts +10 -3
- package/extensions/goal-loop-core.ts +181 -1
- package/extensions/goal-loop-display.ts +27 -4
- package/extensions/goal-loop-shield.ts +235 -40
- package/extensions/goal-loop.ts +20 -4
- package/extensions/human-handoff.ts +28 -11
- package/extensions/loops/goal-activation.ts +53 -7
- package/extensions/loops/goal-auditor-hooks.ts +117 -6
- package/extensions/loops/goal-orchestrator.ts +8 -2
- package/extensions/loops/goal-tools.ts +101 -48
- package/extensions/loops/goal-ui.ts +1 -0
- package/extensions/main-model-recovery.ts +6 -1
- package/extensions/quota-retry.ts +37 -1
- package/extensions/summary-renderer.ts +69 -25
- package/extensions/ui-status.ts +8 -0
- package/package.json +1 -1
- package/prompts/goal-loop-continuation.md +2 -25
- package/schemas/goal.schema.json +41 -4
- package/scripts/auditor-round-prompts.d.mts +1 -0
- package/scripts/auditor-round-prompts.mjs +21 -1
- package/scripts/summary-readability-capture.ts +30 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,86 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.40.1 — status cards and an honest "waiting for the conversation" state (2026-11-13)
|
|
6
|
+
|
|
7
|
+
### Status cards: one place for the version, and an honest "waiting for the conversation" state (2026-11-13)
|
|
8
|
+
|
|
9
|
+
- **The version always folds onto the card's final row.** It folded only when that row already read `└─`; a card whose last row was still `├─` (the closer is fixed up afterwards) got a separate `└─ v0.40.0` row instead, so the same fact sat in two different places on two cards. Any final tree row now takes it.
|
|
10
|
+
- **A compact card trimmed to its row budget keeps the version.** The fold rode the closer that the trim then dropped, leaving `└─ more: /glla status` with no version; the footer now re-attaches any folded fact (version, supervisor pause, queue depth) no kept row still shows.
|
|
11
|
+
- **A fresh pi with no conversation loaded says so.** GLLA deliberately waits for the transcript before resuming, and the notice said exactly that — but the card under it projected the previous session's state: `EXECUTION UNCONFIRMED`, the durable-vs-defer plaques of a decision already made, and `next: /glla status to inspect execution`. The status projection now has a `loadPending` input: the card reads `BLOCKED`, `next: Load or resume the conversation in pi, or run /glla resume`, `why: Waiting for pi to load the conversation`. Because that is a user action, the compact card hides the plaques (existing rule), and the paused-lifecycle row no longer offers a competing `next: retry scheduled (unconfirmed)` for a retry that cannot run until the conversation loads.
|
|
12
|
+
- Coverage: `tests/status-card-consistency.test.ts`.
|
|
13
|
+
|
|
14
|
+
## 0.40.0 — completion reports, faster audits, and leaner prompts (2026-11-13)
|
|
15
|
+
|
|
16
|
+
### Second re-audit: honest turn counts, stopped-goal cards, observed gate runs, leaner prompts (2026-11-13)
|
|
17
|
+
|
|
18
|
+
Measured against the local record (1,740 continuation sends, 483 audit verdicts, the 40 most recent archives, the registered tool definitions).
|
|
19
|
+
|
|
20
|
+
- **Turns count model turns.** Turn telemetry incremented on `agent_end` — once per whole agent run — and a continuation queued into a running agent never ends that run: 11 of 14 archived records said "0 turns" beside 15–283 bash calls. It now counts on `turn_end`. The light-audit ceiling (150 turns) and `/glla stats` both mean model turns, so expect more full-tier audits on long goals.
|
|
21
|
+
- **A goal that stops without a claim gets a real card.** The recorded-facts recap never said why the goal stopped, called an aborted goal "completed without a recorded completion review", listed absolute paths behind "file-write signal(s)", and offered "review the durable record" as the only next step. It now leads with the cause in plain words (`Aborted — The model's plan or quota ran out`), names the change set as a diff stat since the goal started with repo-relative files, says how many tasks were done and which is next, and gives one action that moves it forward (restore model access, or nothing — it stopped on request). The machine counters stay in the verbatim machine record, the receipt line says "stopped before completion; no completion review" once, and legacy recaps are still recognized on replay.
|
|
22
|
+
- **The executor's own gate run can stand in for the pre-audit re-run.** The executor usually runs the contract gate right before claiming, and the pre-audit then ran it again (about 14 minutes here). Pi's bash tool result carries the exit code and wall time in `structuredContent`; when the command is *exactly* a contract step (a pipeline hides the real exit code and never counts; a step with its own `cd` is left to the pre-audit) and it exited 0, GLLA records an observed receipt fenced to the working-tree fingerprint (`Goal.observedGateReceipts`, ledger `gate_receipt_observed`). If every contract step is covered for the identical tree when the claim arrives, the pre-audit reuses them (`gate_receipts_reused_observed`); any edit since falls through to the normal re-run. The brief and the card say "observed" (`PASS: GLLA saw it pass — exit 0 in 14m02s`), never "ran".
|
|
23
|
+
- **The tree fingerprint ignores `.pi-glla/`.** GLLA's own runtime state changes on every event; in a project that does not gitignore it, every receipt went stale within seconds.
|
|
24
|
+
- **The continuation template is 3.8 KB smaller and no longer contradicts the card.** Its completion-communication section still said gate tables are archive-only and that chat shows verification only after `showVerification` — the opposite of the shipped report card. It is now a short paragraph pointing at `complete_goal`'s REPORT SHAPE. The commit-rewrite section is generic: no single operator's daemon name or config keys ship to every rig. Each full continuation is about 950 tokens lighter.
|
|
25
|
+
- **Leaner tool definitions on every request.** `complete_goal`'s schema dropped version stamps, document pointers and implementation notes (8.1k → 5.1k characters) while keeping every rule, and the seven project-builder tools are active only while a `/loop respec` build runs (each answered "No active respec project builder" otherwise) — about 1.6k fewer tokens per request in total. An explicit per-tool `allow` override still wins.
|
|
26
|
+
- **The card names the changed files when the claim has no area groups.** Only 5 of the 40 most recent claims supplied `findingGroups`; without them the card now lists the five largest changed files under the change line. With groups, the areas say what changed and the list is omitted.
|
|
27
|
+
- Coverage: `tests/reaudit-round2.test.ts`; `tests/context-checkpoint.test.ts` and `tests/prompt-daemon-investigation.test.ts` re-pinned to the smaller template.
|
|
28
|
+
|
|
29
|
+
### The final audit stops re-running gates GLLA already ran, and the card reads like a report (2026-11-12)
|
|
30
|
+
|
|
31
|
+
Measured against the local record of 483 audit verdicts and 257 tier decisions: median audit 4.1 min, p90 22 min, audits that ended in an error a median 25 min. 282 of 483 reports re-ran a full-suite command (164 named `npm run release:check`), and the most common audit error was an approval refused because that re-run was cancelled at the 300 s per-tool budget. Only 18 of 257 tier decisions were light.
|
|
32
|
+
|
|
33
|
+
- **Gate receipts.** The deterministic pre-audit already ran every mechanical contract command before the auditor started, and a *passing* run was discarded. `runMechanicalPreAuditChecks` now returns one receipt per passing step (command, exit 0, wall time, bounded output tail, cwd, retry flag). The receipts ride the claim (`pendingCompletion.gateReceipts`, sanitized and capped at the state boundary), fenced to a working-tree content fingerprint (`gateTreeFingerprint`: `git write-tree` over a throwaway index seeded from the real one, so the user's index is never touched and auto-commits of the same bytes do not invalidate it). A stored-claim retry reuses them only while the tree is byte-identical. New leaf module `extensions/gate-receipts.ts`.
|
|
34
|
+
- **The auditor quotes receipts instead of re-running them.** The brief carries an escaped `<gate_receipts>` block and says not to re-run those commands or the full suite; the regression shield accepts a receipt for the contract item that names its command (an `<evidence>` block is still required, and prose items still need the auditor's own evidence).
|
|
35
|
+
- **The challenge round is bounded on first rounds too.** The rework-only "do not re-run the full suite" rule now has a first-round counterpart (`FIRST_ROUND_CHALLENGE_SCOPE_RULES`): falsify the first-pass report's cited claims with the narrowest check, never re-run a receipt. This is where audits stalled on a full-suite call past the budget.
|
|
36
|
+
- **Independent read-only checks may run together.** The brief no longer asks for "one tool call at a time" — that line guarded output length, not tool parallelism. Long or heavy commands still run one at a time.
|
|
37
|
+
- **The per-tool budget is never below a gate GLLA watched take longer** (1.5× the longest receipt, bounded by the existing ceiling) on both dispatch paths.
|
|
38
|
+
- **Light-tier audits are reachable again.** The high-stakes scan ignores code spans, fenced blocks, `npm|bun|… run <script>` and `script:name` tokens, so a contract that names its own `release:check` gate is no longer "release" language; real deploy/publish objectives still escalate. Ceilings move from 12 writes / 20 bash / 80 turns to 25 / 60 / 150; the 10% spot-check still calibrates them.
|
|
39
|
+
- **A spent plan under a 429 is an account wall.** `Token Plan usage limit reached: Upgrade your Token Plan or purchase Credits` was retried once a minute against the same dead model (16 attempts in 13 minutes, then 45 idle minutes until a person switched model). "Upgrade your plan / purchase credits" with **no** reset or retry-after hint now classifies `plan-quota` (an account quota wall, not request rate): a supervised goal rotates to a permitted backup promptly as quota-class walls do (`billing` would first spend the same-model retry budget on a plan that cannot heal), it never enters the eager 5 s window, and the unsupervised lane refuses with one "switch model or top up" notice instead of retrying the same model. A message that also names a reset stays a rate limit; concurrency walls keep their own lane.
|
|
40
|
+
- **The card shows what GLLA ran.** A receipt backs the agent's gate row for the same command (`PASS: GLLA ran it — exit 0 in 14m02s · <notes>`) or adds its own `Contract gate` row; status for those rows comes from the receipt, not from parsing the agent's notes.
|
|
41
|
+
- **"N files changed, +A −R" since the goal started.** Goals record `startTree` (the same content snapshot) at creation; the card shows a one-line diff stat under the lede and the archive's repository section lists the largest changes. `git status` alone read "clean" seconds after every edit in an auto-committing repo.
|
|
42
|
+
- **Section spacing reads the right way round.** Each card block is its own Markdown component and Pi trims a component's trailing blank, so there was a gap under every heading and none between sections. The renderer now separates blocks with one blank row, and a `What changed · <area>` label displays as the bold area name directly above its bullets (durable content, the collapsed projection and the archive keep the full label).
|
|
43
|
+
- **A trailing `path:line` no longer strands its preposition** ("…an audit log for · path"): when the pointer ended the sentence, the dangling `for/in/at/see/…` is dropped with it; mid-sentence pointers and plain prose are untouched.
|
|
44
|
+
- **A clean tree no longer reads "Tree state unreadable".** `buildFinalRepoStateLines` collapsed empty `git status` output into the failure value, so the "Tree clean" branch was unreachable.
|
|
45
|
+
- Coverage: `tests/gate-receipts.test.ts`, `tests/report-polish.test.ts`.
|
|
46
|
+
|
|
47
|
+
### The completion summary is an end-of-task report, not an audit log (2026-11-11)
|
|
48
|
+
|
|
49
|
+
- Operator report: "i am not loving the goal completion summary, that should be more like how opencode does the summary upon task completion." The card had grown one section per internal contract — `Summary`, `What Changed`, `Remaining`, `Verification Evidence`, `Next`, `Final Repository State` — opened with a verdict banner above a second request-echo headline, and closed with four `•` trailer bullets that restated the verdict three times in three voices. A finished goal read as audit bookkeeping attached to a report.
|
|
50
|
+
|
|
51
|
+
- **One report replaces the section stack.** The card is now `## Done — <result>` headline, prose lede (the rest of the Outcome sentence), `## Summary` carrying the structured Outcome body and one `What changed · <area>` subsection per `findingGroups` entry, `## Verification`, `## Follow-up items` (`Unresolved` plus the deliberate `leftOut`, with a resolving action inline as `→ Next:`), `## Next steps`, the archive-only `Final Repository State`, and ONE closing receipt line (`completion audit approved (N reviews) · record: <path>`). The full report order is what the operator confirmed during drafting.
|
|
52
|
+
|
|
53
|
+
- **The headline is a title, never a truncation.** The first clause (em-dash break, sentence end, or the last clause break that fits) becomes the headline and the remainder becomes the lede with only its first letter capitalized — no ellipsis, no dropped words, no second headline echoing the objective.
|
|
54
|
+
|
|
55
|
+
- **The gate inventory is part of the report.** Verification used to be archive-only unless the agent passed `showVerification` after an explicit user request; the reading a person actually got said nothing about what was checked. Chat now renders the compact `Gate | Command | Result` shape and the archive keeps the wide `Quality Gate | Command | Scope | Status | Notes` inventory with its review row. Status stays DERIVED from the notes: `PASS` only on a complete pass parse with zero failures, `FAIL` on any failure evidence, otherwise the row keeps its honest wording instead of borrowing a status word.
|
|
56
|
+
|
|
57
|
+
- **Narrow terminals get bullets, not broken pipes.** Pi prints a Markdown table's raw pipe rows when the width cannot fit it. Below the table threshold the verification section renders `- <gate> — <command> — <result>` bullets instead, and the capture script now fails if a narrow capture contains a raw pipe row.
|
|
58
|
+
|
|
59
|
+
- **Every goal-event receipt adopts the vocabulary** — detached-auditor approval, no-audit / user-choice completion, aborted and paused archives, and renders replayed from the durable outbox. An audit entry with no verdict (provider wall, auth abort) still never reads as a reviewed completion.
|
|
60
|
+
|
|
61
|
+
- **One leaf module owns the section names.** `extensions/card-sections.ts` (no imports) feeds the composer, the collapsed receipt projection and the terminal renderer; putting the vocabulary in `completion-summary.ts` would have closed the cycle `human-handoff → completion-summary → goal-loop-display → human-handoff`. Legacy names (`What Changed`, `Remaining`, `Next`, `Verification Evidence`) stay recognized forever, so a receipt queued by an older build still collapses, colors and keeps its review qualification and record link; its durable text is never rewritten.
|
|
62
|
+
|
|
63
|
+
- **The claim guidance asks for the report's material.** `complete_goal`'s description and the shared human-handoff guidance now ask for a plain-sentence Outcome, per-area `findingGroups`, and the real `gateRows` with counts, instead of a compact recap whose shape the renderer had to rescue.
|
|
64
|
+
|
|
65
|
+
- Coverage moved with the shape rather than away from it: the migrated pins keep their original subjects (evidence tokens and derived status, pipe escaping, review qualifications and record links, stale-Next filtering, sanitize bounds, narrow-width fit, no ANSI or control bytes) in the new vocabulary, and `tests/report-card-shape.test.ts` pins the report order, the always-on inventory, the narrow fallback, the legacy replay path and the leaf module's acyclic position. Captures under `audit/summary-captures/` were regenerated from the production renderer at 40 and 120 columns in dark and light.
|
|
66
|
+
|
|
67
|
+
## 0.39.69 — the audit lane waits for a quoted reset, uses a fallback, and stops when it stops progressing (2026-11-10)
|
|
68
|
+
|
|
69
|
+
### "If the model runs out then the audit never completes"
|
|
70
|
+
|
|
71
|
+
- Operator report with a screenshot: a list item at `paused by GLLA · EXECUTION UNCONFIRMED · age 4h 24m`, the transcript repeating `Auditor still failing — next auto-retry in 5m` and `Auditor provider retry is due`, and `next: /glla status to inspect execution`. The plan quota was gone for good. Three separate defects produced that shape.
|
|
72
|
+
|
|
73
|
+
- **The audit lane ignored the provider's quoted reset.** The main lane has honoured `resets <ISO>` since v0.38.69 — a weekly wall sleeps the per-attempt envelope and re-evaluates — but the audit lane re-armed a flat five minutes at *every* attempt, twelve times an hour, for the whole outage. A plan that said "resets in five hours" was hammered sixty times instead of waited for. The retry plan now takes the reset wait (even a week out, bounded by the shared per-attempt envelope) and treats an explicit reset as exempt from the fifteen-minute per-attempt cap, because undercutting the provider's own deadline is exactly the churn this fixes.
|
|
74
|
+
|
|
75
|
+
- **There was no no-progress stop at all.** `unbounded` held at attempt 501: a wall with no reset hint repeated forever and never asked the operator anything. The dispatch path now consults a durable episode stamp (`auditorNoProgressSince`, written once per no-verdict episode and carried across every later attempt and every candidate reseed) and stops automatic retries after six hours with a decision card naming the two likely causes — a plan quota exhausted for good, or a retired model — with the auditor-model / fresh-window / cancel options. Six hours is deliberate: a five-hour plan quota can legitimately swallow a whole audit and must be waited out, not escalated; a quoted reset suspends the escalation entirely, because that wait is scheduled rather than stalled.
|
|
76
|
+
|
|
77
|
+
- **A model that no longer resolves escalates on a thirty-minute grace** instead of burning six hours of launches. Waiting cannot produce a model the provider no longer serves; the short grace still absorbs a transient catalogue hiccup.
|
|
78
|
+
|
|
79
|
+
- **The five-minute retry re-walked the burned cursor**, so the model that was out of quota (or retired) was retried by name even when a configured fallback existed — the operator's rule is "if we have a fallback model we should be using that too". The `provider-retry` origin now takes a cursor-only reseed: candidates are re-resolved (so a newly configured fallback is used) while the episode clock, the attempt count and the quoted-reset diagnostic survive. Evicted refs stay evicted — a retired model must not come back just because the cursor was reseeded.
|
|
80
|
+
|
|
81
|
+
- Recorded in `audit/audit-no-progress-2026-11-10/README.md`.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
5
85
|
## 0.39.68 — the audit lane reads the recorded failure class, not the raw text (2026-11-10)
|
|
6
86
|
|
|
7
87
|
### The class the auditor already recorded decided the wrong thing
|
|
@@ -119,28 +119,48 @@ Executors should supply a full objective-level recap on each corrected claim,
|
|
|
119
119
|
not depend on a rejected predecessor to fill in omitted work.
|
|
120
120
|
The human layer follows two different purposes:
|
|
121
121
|
|
|
122
|
-
- Chat and
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
- Chat, transcript and archive all read as **one end-of-task report**
|
|
123
|
+
(field 2026-11-11 — "more like opencode's end-of-task summary"):
|
|
124
|
+
`## Done — <result>` headline, a prose lede carrying the rest of the
|
|
125
|
+
`Outcome` sentence, `## Summary` with the structured Outcome body and one
|
|
126
|
+
`What changed · <area>` subsection per `findingGroups` entry, an
|
|
127
|
+
always-visible `## Verification` gate inventory (chat compact
|
|
128
|
+
`Gate | Command | Result`, archive wide
|
|
129
|
+
`Quality Gate | Command | Scope | Status | Notes` plus its review row),
|
|
130
|
+
`## Follow-up items` (`Unresolved` and the deliberate `leftOut`, with a
|
|
131
|
+
resolving action inline as `→ Next:`), `## Next steps` (standalone actions),
|
|
132
|
+
the archive-only `Final Repository State`, and ONE closing receipt line
|
|
133
|
+
(`completion audit approved (N reviews) · record: <path>`).
|
|
134
|
+
Status words in the inventory are derived from the gate notes, never claimed:
|
|
135
|
+
`PASS` only on a complete pass parse with zero failures, `FAIL` on any
|
|
136
|
+
failure evidence, otherwise the row keeps its honest `REPORTED` shape.
|
|
137
|
+
- Chat headings are depth 2 (the Pi TUI renders them without the `##`
|
|
138
|
+
prefix); the archived markdown keeps `###`/`####`. Below the narrow-table
|
|
139
|
+
threshold the chat verification section renders as
|
|
140
|
+
`- <gate> — <command> — <result>` bullets, because Pi prints a Markdown
|
|
141
|
+
table's raw pipe rows when the width cannot fit it.
|
|
142
|
+
- The section vocabulary lives in one leaf module (`extensions/card-sections.ts`)
|
|
143
|
+
consumed by the composer, the collapsed receipt projection and the terminal
|
|
144
|
+
renderer. Legacy section names (`What Changed`, `Remaining`, `Next`,
|
|
145
|
+
`Verification Evidence`) stay recognized so a receipt queued by an older
|
|
146
|
+
build still collapses, colors, and keeps its review qualification and record
|
|
147
|
+
link; their durable text is never rewritten.
|
|
148
|
+
- The default terminal view previews structured results and a few primary
|
|
149
|
+
changes; expansion retains the complete saved message. Required actions,
|
|
150
|
+
follow-up limitations, review qualifications and the saved record link are
|
|
151
|
+
not lost to that preview. Evidence-only recap fields are not reclassified as
|
|
152
|
+
changes. Legacy incomplete recaps may supply useful human fields, but a
|
|
153
|
+
missing result stays explicitly missing: telemetry is not a substitute for
|
|
154
|
+
an explanation.
|
|
135
155
|
- The archive's `## Terminal summary` remains forensic and complete: detailed
|
|
136
156
|
findings grouped or tabulated at 4+ groups, per-finding proof, the full
|
|
137
|
-
Verification
|
|
138
|
-
|
|
157
|
+
Verification table (Quality Gate | Command | Scope | Status | Notes when
|
|
158
|
+
supplied), and Final Repository State.
|
|
139
159
|
|
|
140
160
|
Both surfaces retain the independent completion review and access to the full
|
|
141
|
-
six-label machine recap in the saved record.
|
|
142
|
-
|
|
143
|
-
|
|
161
|
+
six-label machine recap in the saved record. The verdict is stated once, in
|
|
162
|
+
that closing receipt line, rather than as an archive banner above a second
|
|
163
|
+
headline. Goal-approval external notifications use the short human outcome,
|
|
144
164
|
not telemetry or a projection of every machine label.
|
|
145
165
|
Every terminal goal notification, including version-bearing already-shipped
|
|
146
166
|
claims and explicit cancellation, carries the change-first human view or the
|
package/docs/INDEX.md
CHANGED
|
@@ -34,8 +34,12 @@
|
|
|
34
34
|
## Versions and shipped content
|
|
35
35
|
|
|
36
36
|
[CHANGELOG.md](../CHANGELOG.md) records the full release history from
|
|
37
|
-
v0.1.0-alpha.1 (2026-07-19) through v0.
|
|
38
|
-
|
|
37
|
+
v0.1.0-alpha.1 (2026-07-19) through v0.40.1 (2026-11-13), including an audit
|
|
38
|
+
lane that waits for the provider's quoted reset (even a weekly one) instead of
|
|
39
|
+
re-arming a five-minute timer, uses a configured fallback model instead of
|
|
40
|
+
re-walking the failed one, and stops to ask after six hours without a verdict
|
|
41
|
+
instead of retrying an exhausted quota forever — and the final-audit lane
|
|
42
|
+
reading the failure class the auditor already recorded — an
|
|
39
43
|
auditor-owned crash keeps the bounded ladder, the slowdown marker and the
|
|
40
44
|
horizon instead of being handed to the provider lane's unbounded five-minute
|
|
41
45
|
cadence — every provider error keeping retry authority — a concurrency wall arriving as HTTP 400 retries promptly instead of parking, and its `resets <ISO>` deadline is honoured as an upper bound — saved goal records that stop pretending to be live work (`/goal recover` classifies every projection and previews a round-trip-checked restore-as-new recipe) and a parked completion audit that names its real cause instead of blaming the auditor, the release gate judging only text it can prove is new, multi-area completion claims that are refused until they can be read rather than shipped as one opaque bullet, dropped connections, timeouts and 429s sharing one aggressive durable retry, tweak cards as labelled quote blocks, and an auditor switch that is now global-only — one switch for every project, where session inheritance follows each session's live model and thinking — and approval through the Confirm gate instead of a typed tweak, an operator-surface pass that stopped asking the user to act on finished work — a terminal goal retires its main-model recovery marker, a clean list completion starts the next item on its own, `/glla wipe` went from 912 ms to 71 ms by not rescanning 280 MB of history, the tweak confirmation shows the exact objective pair with the rationale behind a toggle, the audit card names the model that actually ran, and a stale loaded build warns instead of silently explaining the wrong source — a `/glla` settings surface that keeps its promises — a reachable Version indicator row, and a postaudit editor that no longer forgets an option an earlier edit saved — a release gate that no longer reports a busy machine as a broken one, interrupted audits that never claim the operator aborted them, a version indicator that is a choice of one surface, declared Pi 1.x support, auditor liveness that survives an unavailable identity probe, one-surface card rendering, a readable task-amendment dialog and system-wide draft auto-accept, authenticated auditor verdicts, fail-closed crash recovery, session inheritance and ten-slot role fallbacks, clearer
|
package/docs/RECOVERY.md
CHANGED
|
@@ -188,7 +188,6 @@ session changed. A cold load holds for an explicit decision and says so.
|
|
|
188
188
|
**The recorded failure class decides how it comes back.** The audit lane
|
|
189
189
|
records what kind of failure it was, and that class — not the error text —
|
|
190
190
|
picks the lane:
|
|
191
|
-
|
|
192
191
|
| The failure was | The claim comes back | Why |
|
|
193
192
|
| --- | --- | --- |
|
|
194
193
|
| the auditor's own (`no-verdict`, `context-exhausted`) | the auditor's ladder: an eager first retry, then a slower probe, and a visible "N identical failures" slowdown marker if it keeps failing | an identical retry reproduces the same wall |
|
|
@@ -199,6 +198,25 @@ had. A deliberate stop — "automatic recovery is off", "the recovery horizon wa
|
|
|
199
198
|
reached", "the cursor could not be persisted" — is never resumed by automation:
|
|
200
199
|
those are decisions, not outages.
|
|
201
200
|
|
|
201
|
+
**A quoted reset is waited for, and a stall is not.** When the provider names a
|
|
202
|
+
deadline (`resets <ISO>`, even a week away) the audit waits for it instead of
|
|
203
|
+
re-arming a five-minute timer for the whole outage. When it names nothing, the
|
|
204
|
+
lane retries on its durable cadence and then stops and asks:
|
|
205
|
+
|
|
206
|
+
| The audit has produced no verdict for | What happens |
|
|
207
|
+
| --- | --- |
|
|
208
|
+
| less than 6 hours, and no reset was quoted | it keeps retrying |
|
|
209
|
+
| 6 hours, and no reset was quoted | a decision card: pick another auditor model, start a fresh bounded window, or cancel |
|
|
210
|
+
| 30 minutes, and the model no longer resolves | a decision card — a retired model cannot be waited for |
|
|
211
|
+
|
|
212
|
+
A quoted reset suspends that bound entirely: the wait is scheduled, not
|
|
213
|
+
stalled. Before v0.39.69 there was no stop at all, so a plan quota that was
|
|
214
|
+
exhausted for good produced "still failing — next auto-retry in 5m" forever.
|
|
215
|
+
|
|
216
|
+
If a fallback auditor model is configured, it is used: the five-minute retry
|
|
217
|
+
re-resolves candidates from the top of the chain instead of re-walking the
|
|
218
|
+
model that just failed. A model proven unresolvable stays excluded.
|
|
219
|
+
|
|
202
220
|
## Saved records that disagree with live state
|
|
203
221
|
|
|
204
222
|
Live state, not a markdown file, decides what is running. `.pi-glla/goals/<id>.md`
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Generated by `node scripts/generate-inventory.mjs`. Run with `--check` to detect drift. Counts describe files and literal registrations, not executed coverage.
|
|
4
4
|
|
|
5
|
-
- Extension/script files:
|
|
6
|
-
- Extension/script lines:
|
|
7
|
-
- Top-level test files:
|
|
5
|
+
- Extension/script files: 154
|
|
6
|
+
- Extension/script lines: 80552
|
|
7
|
+
- Top-level test files: 499
|
|
8
8
|
- Ambient bridge names: 176 (audit baseline: 176)
|
|
9
9
|
- Commands: `/glla`, `/goal`, `/list`, `/loop`, `/review`
|
|
10
10
|
- Tools: `audit_project_increment`, `block_project_requirement`, `claim_project_task`, `complete_goal`, `complete_task`, `list_activate`, `list_add`, `list_status`, `pause_goal`, `plan_project_increment`, `propose_goal_draft`, `propose_loop_draft`, `propose_loop_refine`, `propose_project_refinement`, `propose_project_requirements`, `propose_task_list`, `propose_tweak`, `record_goal_judgment`, `resume_goal`, `unblock_project_requirement`, `update_task_batch`, `update_task_status`, `wait_for_background`
|
|
@@ -13,13 +13,13 @@ Generated by `node scripts/generate-inventory.mjs`. Run with `--check` to detect
|
|
|
13
13
|
|
|
14
14
|
| Module | Lines |
|
|
15
15
|
|---|---:|
|
|
16
|
-
| [extensions/goal-loop-core.ts](../extensions/goal-loop-core.ts) |
|
|
17
|
-
| [extensions/loops/goal-tools.ts](../extensions/loops/goal-tools.ts) |
|
|
18
|
-
| [extensions/loops/goal-activation.ts](../extensions/loops/goal-activation.ts) |
|
|
16
|
+
| [extensions/goal-loop-core.ts](../extensions/goal-loop-core.ts) | 6039 |
|
|
17
|
+
| [extensions/loops/goal-tools.ts](../extensions/loops/goal-tools.ts) | 4871 |
|
|
18
|
+
| [extensions/loops/goal-activation.ts](../extensions/loops/goal-activation.ts) | 4248 |
|
|
19
19
|
| [extensions/goal-commands.ts](../extensions/goal-commands.ts) | 3975 |
|
|
20
|
-
| [extensions/goal-loop-display.ts](../extensions/goal-loop-display.ts) |
|
|
21
|
-
| [extensions/goal-loop-auditor-process.ts](../extensions/goal-loop-auditor-process.ts) |
|
|
22
|
-
| [extensions/loops/goal-auditor-hooks.ts](../extensions/loops/goal-auditor-hooks.ts) |
|
|
20
|
+
| [extensions/goal-loop-display.ts](../extensions/goal-loop-display.ts) | 3756 |
|
|
21
|
+
| [extensions/goal-loop-auditor-process.ts](../extensions/goal-loop-auditor-process.ts) | 3232 |
|
|
22
|
+
| [extensions/loops/goal-auditor-hooks.ts](../extensions/loops/goal-auditor-hooks.ts) | 3136 |
|
|
23
23
|
| [extensions/loops/goal-settings-ui.ts](../extensions/loops/goal-settings-ui.ts) | 2329 |
|
|
24
24
|
| [extensions/goal-recovery.ts](../extensions/goal-recovery.ts) | 2327 |
|
|
25
25
|
| [extensions/goal-continuation.ts](../extensions/goal-continuation.ts) | 2207 |
|
package/docs/UI-STATUS.md
CHANGED
|
@@ -44,7 +44,7 @@ See [external-check recovery](RECOVERY.md#checking-authorized-external-work) and
|
|
|
44
44
|
- `extensions/goal-loop-display.ts`: compact/detailed cards and footer, including project-builder branch.
|
|
45
45
|
- `extensions/loops/goal-ui.ts`: production compact-card caller, runtime evidence adapter and notifications.
|
|
46
46
|
- `extensions/goal-commands.ts`: goal/glla shared status projection and on-demand read-only fleet command integration.
|
|
47
|
-
- `extensions/completion-summary.ts`:
|
|
47
|
+
- `extensions/completion-summary.ts`: the end-of-task report card (headline, prose lede, per-area `What changed` subsections, always-on verification, follow-ups, next steps, one receipt line) versus the complete durable archive. Section vocabulary is shared through the leaf module `extensions/card-sections.ts`, which also owns the narrow-width table-to-bullet fallback.
|
|
48
48
|
- `extensions/goal-recovery.ts`: recovery evidence and ownership fencing; preserve retry policy and permission gates.
|
|
49
49
|
|
|
50
50
|
## Glance contract
|
|
@@ -89,6 +89,6 @@ Surfaces: all modes, compact and detailed cards, footer, status, notifications,
|
|
|
89
89
|
|
|
90
90
|
Fleet: configured-root limits, symlinks, malformed and oversized journals, partial results, closed versus unconfirmed sessions, immutable sibling artifacts and zero dispatch.
|
|
91
91
|
|
|
92
|
-
Summary:
|
|
92
|
+
Summary: the completion report opens with a short result headline over its prose lede, groups the changes by work area, always states the derived verification inventory (bullets when the width cannot hold the table), carries one instance of each limitation and one next action, and closes with a single receipt line; the archive keeps the wide evidence and truthful audit/challenge caveats.
|
|
93
93
|
|
|
94
94
|
Captures: reproducible actual terminal renderer output for running, quota recovery, workflow rejection, user-blocked, dormant/unconfirmed audit, settling and completed summary at narrow/wide widths. See [native capture inspection](https://github.com/DraconDev/pi-goal-list-loop-audit/blob/main/audit/UI-CAPTURE-INSPECTION.md) for reproduction commands, real private-xterm screenshots and the disposition of the user's older/newer style comparison. These fixtures demonstrate production rendering, not live session execution; final integration gates remain open in the implementation register.
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
42
|
import { isRecoverableProviderError } from "./main-model-recovery.js";
|
|
43
|
+
import { classifyMainModelFailure, quotaResetSleepMs } from "./main-model-recovery.js";
|
|
44
|
+
import { isUnresolvableAuditorModelRefError } from "./goal-loop-core.js";
|
|
43
45
|
|
|
44
46
|
/** The classes the auditor owns outright: a retry reproduces the same wall.
|
|
45
47
|
* `no-verdict` — the auditor produced nothing (crash, exit code, no output).
|
|
@@ -92,3 +94,88 @@ const AUDIT_PARK_PAUSE_REASON =
|
|
|
92
94
|
export function isAuditParkPauseReason(reason: string | undefined): boolean {
|
|
93
95
|
return AUDIT_PARK_PAUSE_REASON.test((reason ?? "").trim());
|
|
94
96
|
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* How long the provider told us to wait, if it said anything at all.
|
|
100
|
+
*
|
|
101
|
+
* v0.39.69 (field 2026-11-10): the audit lane ignored the reset hint
|
|
102
|
+
* entirely — it re-armed a flat five minutes at every attempt, so a plan
|
|
103
|
+
* that had quoted `resets <ISO>` hours or a week away was hammered twelve
|
|
104
|
+
* times an hour for the whole outage, with the card repeating "Auditor still
|
|
105
|
+
* failing — next auto-retry in 5m". The main lane has honoured the hint
|
|
106
|
+
* since v0.38.69. Returns `undefined` when the provider quoted nothing, which
|
|
107
|
+
* is the case the operator escalates instead of waiting forever.
|
|
108
|
+
*/
|
|
109
|
+
export function auditResetWaitMs(
|
|
110
|
+
claim: { providerErrorDiagnostic?: string } | undefined | null,
|
|
111
|
+
nowMs = Date.now(),
|
|
112
|
+
): number | undefined {
|
|
113
|
+
const raw = claim?.providerErrorDiagnostic;
|
|
114
|
+
if (typeof raw !== "string" || !raw.trim()) return undefined;
|
|
115
|
+
return quotaResetSleepMs(classifyMainModelFailure(raw), nowMs);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** A no-verdict audit episode older than this stops retrying by itself and
|
|
119
|
+
* asks the operator.
|
|
120
|
+
*
|
|
121
|
+
* Deliberately longer than every quota window a single audit can legitimately
|
|
122
|
+
* eat (a five-hour plan quota straddling an audit start must be waited out,
|
|
123
|
+
* not escalated), and deliberately shorter than a day, because the field
|
|
124
|
+
* shape that motivated it sat 4h24m repeating "still failing" with no
|
|
125
|
+
* actionable line. A quoted reset always outranks this bound: while the
|
|
126
|
+
* provider has told us when it will answer, waiting is correct and the
|
|
127
|
+
* escalation does not fire. */
|
|
128
|
+
export const AUDIT_NO_PROGRESS_ESCALATE_MS = 6 * 60 * 60_000;
|
|
129
|
+
|
|
130
|
+
/** A model that no longer resolves cannot be waited for: the pin names a
|
|
131
|
+
* model the provider no longer serves (a retired model, a revoked auth). A
|
|
132
|
+
* short grace still absorbs a transient catalogue hiccup, then the operator is
|
|
133
|
+
* asked rather than burning a launch every five minutes. */
|
|
134
|
+
export const AUDIT_DEAD_MODEL_ESCALATE_MS = 30 * 60_000;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Has this parked audit used up its automatic patience?
|
|
138
|
+
*
|
|
139
|
+
* Returns the escalation reason, or `undefined` while automatic retries are
|
|
140
|
+
* still the right answer. The two exemptions are deliberate:
|
|
141
|
+
*
|
|
142
|
+
* - **A quoted reset is being waited on.** The provider said when it will
|
|
143
|
+
* answer (even "next week"), so retrying is not a dead end — it is a
|
|
144
|
+
* scheduled wait. `resetAt`/`resetMs` are reported so the caller can say
|
|
145
|
+
* *when*, instead of "still failing".
|
|
146
|
+
* - **The episode is younger than {@link AUDIT_NO_PROGRESS_ESCALATE_MS}.**
|
|
147
|
+
*
|
|
148
|
+
* `noProgressSince` must survive a cursor reseed: it is the age of the
|
|
149
|
+
* *episode*, not of the current candidate chain. A claim with no recorded
|
|
150
|
+
* start falls back to its first retry timestamp and then to `recoveryAt`.
|
|
151
|
+
*/
|
|
152
|
+
export function auditNoProgressEscalation(
|
|
153
|
+
claim: {
|
|
154
|
+
providerErrorDiagnostic?: string;
|
|
155
|
+
auditorNoProgressSince?: string;
|
|
156
|
+
retryFirstAt?: string;
|
|
157
|
+
recoveryAt?: string;
|
|
158
|
+
auditorFailureClass?: string;
|
|
159
|
+
} | undefined | null,
|
|
160
|
+
nowMs = Date.now(),
|
|
161
|
+
): { reason: "waiting"; resetMs: number; resetAt: string } | { reason: "no-progress"; sinceMs: number; hours: number } | { reason: "dead-model"; sinceMs: number; hours: number } | undefined {
|
|
162
|
+
if (!claim) return undefined;
|
|
163
|
+
const resetMs = auditResetWaitMs(claim, nowMs);
|
|
164
|
+
if (resetMs !== undefined) {
|
|
165
|
+
return { reason: "waiting", resetMs, resetAt: new Date(nowMs + resetMs).toISOString() };
|
|
166
|
+
}
|
|
167
|
+
const since = [claim.auditorNoProgressSince, claim.retryFirstAt, claim.recoveryAt]
|
|
168
|
+
.map((value) => (typeof value === "string" ? Date.parse(value) : Number.NaN))
|
|
169
|
+
.find((value) => Number.isFinite(value));
|
|
170
|
+
if (!Number.isFinite(since)) return undefined;
|
|
171
|
+
const elapsed = nowMs - since!;
|
|
172
|
+
const hours = Math.round(elapsed / 3_600_000);
|
|
173
|
+
// A ref the provider does not serve needs a person, not a timer. Checked
|
|
174
|
+
// before the long bound so a retired model does not burn six hours of
|
|
175
|
+
// launches that cannot possibly resolve it.
|
|
176
|
+
if (isUnresolvableAuditorModelRefError(claim.providerErrorDiagnostic) && elapsed >= AUDIT_DEAD_MODEL_ESCALATE_MS) {
|
|
177
|
+
return { reason: "dead-model", sinceMs: since!, hours };
|
|
178
|
+
}
|
|
179
|
+
if (elapsed < AUDIT_NO_PROGRESS_ESCALATE_MS) return undefined;
|
|
180
|
+
return { reason: "no-progress", sinceMs: since!, hours };
|
|
181
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// pi-goal-list-loop-audit — the end-of-task report vocabulary.
|
|
2
|
+
//
|
|
3
|
+
// Field 2026-11-11 ("i am not loving the goal completion summary, that should
|
|
4
|
+
// be more like how opencode does the summary upon task completion"): the card
|
|
5
|
+
// grew one section per internal contract (Summary / What Changed / Remaining /
|
|
6
|
+
// Verification Evidence / Next / Final Repository State) and closed with four
|
|
7
|
+
// `•` trailer bullets, so a finished goal read as an audit log rather than a
|
|
8
|
+
// report of what was done.
|
|
9
|
+
//
|
|
10
|
+
// The section names live here, in a LEAF module with no imports, because every
|
|
11
|
+
// surface that has to agree about them already sits on a different branch of
|
|
12
|
+
// the import graph: the composer (extensions/completion-summary.ts), the
|
|
13
|
+
// collapsed chat receipt (extensions/human-handoff.ts, which
|
|
14
|
+
// goal-loop-display.ts already imports) and the terminal renderer
|
|
15
|
+
// (extensions/summary-renderer.ts). Putting them in completion-summary.ts
|
|
16
|
+
// instead would close the cycle
|
|
17
|
+
// human-handoff → completion-summary → goal-loop-display → human-handoff,
|
|
18
|
+
// which breaks at module init.
|
|
19
|
+
|
|
20
|
+
/** Section headings the report card composes. `<name> · <area>` is the
|
|
21
|
+
* grouped-change shape used for multi-area work. */
|
|
22
|
+
export const CARD_SECTION = {
|
|
23
|
+
summary: "Summary",
|
|
24
|
+
whatChanged: "What changed",
|
|
25
|
+
verification: "Verification",
|
|
26
|
+
followUp: "Follow-up items",
|
|
27
|
+
nextSteps: "Next steps",
|
|
28
|
+
repo: "Final Repository State",
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
/** Section names that must stay recognized after an upgrade: a terminal
|
|
32
|
+
* render queued by an older build lives in the durable outbox and may be
|
|
33
|
+
* replayed months later. Its text is never rewritten, so the recognizer
|
|
34
|
+
* accepts both vocabularies forever. */
|
|
35
|
+
export const LEGACY_CARD_SECTIONS = [
|
|
36
|
+
"What Changed",
|
|
37
|
+
"Remaining",
|
|
38
|
+
"Next",
|
|
39
|
+
"Verification Evidence",
|
|
40
|
+
"Verification Summary",
|
|
41
|
+
] as const;
|
|
42
|
+
|
|
43
|
+
/** The pre-report chat trailer shape (`• completion audit approved …`,
|
|
44
|
+
* `• record: …`). A receipt persisted by an older build collapses and colors
|
|
45
|
+
* on those lines too, so the collapsed projection can still tell them apart
|
|
46
|
+
* from body prose. */
|
|
47
|
+
export const LEGACY_TRAILER_PREFIX = "\u2022 " as const;
|
|
48
|
+
|
|
49
|
+
/** Width at which the Markdown gate table is abandoned for bullets. Pi's
|
|
50
|
+
* Markdown renders a table only when the border overhead (3n + 1 for n
|
|
51
|
+
* columns) leaves room for one character per cell; below this a three-column
|
|
52
|
+
* table prints its raw pipe rows instead, which reads as broken output. */
|
|
53
|
+
export const NARROW_TABLE_COLUMNS = 50;
|
|
54
|
+
|
|
55
|
+
const KNOWN_SECTIONS: readonly string[] = [...Object.values(CARD_SECTION), ...LEGACY_CARD_SECTIONS];
|
|
56
|
+
|
|
57
|
+
/** The canonical section a heading belongs to, or null when the heading is
|
|
58
|
+
* authored prose rather than a card section. Accepts `###` prefixes, bold
|
|
59
|
+
* wrappers and the `· <area>` suffix the grouped shape adds. */
|
|
60
|
+
export function cardSectionName(heading: string): string | null {
|
|
61
|
+
const bare = heading
|
|
62
|
+
.replace(/^\s*#{1,6}\s+/, "")
|
|
63
|
+
.replace(/^\*\*(.*?)\*\*$/, "$1");
|
|
64
|
+
const name = bare.split(/\s*\u00b7\s*/)[0]?.trim() ?? "";
|
|
65
|
+
const canonical = CANONICAL_ALIASES[name];
|
|
66
|
+
if (canonical) return canonical;
|
|
67
|
+
return KNOWN_SECTIONS.includes(name) ? name : null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Legacy names map onto the section they now stand for, so one recognizer
|
|
71
|
+
* answers for both vocabularies (e.g. a queued `Remaining` block still reads
|
|
72
|
+
* as the follow-up section it became). */
|
|
73
|
+
const CANONICAL_ALIASES: Record<string, string> = {
|
|
74
|
+
"What Changed": CARD_SECTION.whatChanged,
|
|
75
|
+
Remaining: CARD_SECTION.followUp,
|
|
76
|
+
Next: CARD_SECTION.nextSteps,
|
|
77
|
+
"Verification Evidence": CARD_SECTION.verification,
|
|
78
|
+
"Verification Summary": CARD_SECTION.verification,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** Turn a Markdown table into `- <first cell> — <remaining cells>` bullets.
|
|
82
|
+
*
|
|
83
|
+
* Pi's Markdown prints a table's RAW pipe rows when the width cannot fit the
|
|
84
|
+
* border overhead and one character per cell, so a three-column gate table in
|
|
85
|
+
* a narrow terminal reads as broken output. The narrow receipt therefore
|
|
86
|
+
* states the same facts as bullets: the gate name first (that is what a reader
|
|
87
|
+
* scans for), then the command and the result.
|
|
88
|
+
*
|
|
89
|
+
* Non-table lines pass through untouched, and a table with no body rows (a
|
|
90
|
+
* header-only table) yields nothing rather than a stray bullet. */
|
|
91
|
+
export function tableAsBullets(markdown: string): string[] {
|
|
92
|
+
const out: string[] = [];
|
|
93
|
+
let headerPending = false;
|
|
94
|
+
for (const line of markdown.split("\n")) {
|
|
95
|
+
const trimmed = line.trim();
|
|
96
|
+
if (!trimmed.startsWith("|")) {
|
|
97
|
+
headerPending = false;
|
|
98
|
+
out.push(line);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
// The first pipe row of a table block is its header; the separator row
|
|
102
|
+
// (if the table carries one) has no cells to report either.
|
|
103
|
+
if (!headerPending) {
|
|
104
|
+
headerPending = true;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (/^\|(?:\s*:?-{2,}:?\s*\|)+$/u.test(trimmed)) continue;
|
|
108
|
+
const cells = trimmed
|
|
109
|
+
.replace(/^\|/, "")
|
|
110
|
+
.replace(/\|$/, "")
|
|
111
|
+
.split("|")
|
|
112
|
+
.map((cell) => cell.trim())
|
|
113
|
+
.filter((cell) => cell.length > 0 && cell !== "\u2014");
|
|
114
|
+
if (cells.length > 0) out.push(`- ${cells.join(" \u2014 ")}`);
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|