pi-goal-list-loop-audit 0.39.13 → 0.39.16
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 +41 -0
- package/docs/DESIGN-long-running-supervision.md +7 -1
- package/docs/INDEX.md +1 -1
- package/docs/RECOVERY.md +6 -0
- package/docs/RUNTIME-INVENTORY.md +7 -7
- package/extensions/completion-summary.ts +15 -20
- package/extensions/context-pressure-attempt.ts +153 -0
- package/extensions/context-pressure-recovery.ts +28 -0
- package/extensions/goal-compactor.ts +8 -1
- package/extensions/goal-continuation.ts +47 -10
- package/extensions/goal-loop-auditor-process.ts +12 -2
- package/extensions/goal-loop-core.ts +4 -4
- package/extensions/goal-loop.ts +6 -0
- package/extensions/loops/goal-activation.ts +36 -14
- package/extensions/loops/goal-auditor-hooks.ts +2 -4
- package/extensions/loops/goal-orchestrator.ts +79 -2
- package/extensions/loops/goal-tools.ts +28 -8
- package/extensions/main-model-recovery.ts +42 -8
- package/extensions/reviewer.ts +44 -18
- package/extensions/state-root-owner.ts +14 -4
- package/package.json +1 -1
- package/scripts/run-tests.mjs +13 -1
- package/scripts/test-failure-diagnostics.d.mts +40 -0
- package/scripts/test-failure-diagnostics.mjs +43 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.39.16 — safe compaction and reliable continuation recovery (2026-10-07)
|
|
6
|
+
|
|
7
|
+
### Compaction and context-pressure recovery
|
|
8
|
+
|
|
9
|
+
- Preventive compaction checks safe idle dispatch boundaries for goals, lists
|
|
10
|
+
and loops, preserving the configured 200k target as opportunistic rather
|
|
11
|
+
than interrupting healthy tools.
|
|
12
|
+
- Explicit input overflow and measured context pressure attempt one bounded
|
|
13
|
+
compact-first recovery before fallback. Generic low-context provider errors
|
|
14
|
+
retain ordinary fallback; policy and cancellation exclusions apply to both
|
|
15
|
+
preventive and emergency admission.
|
|
16
|
+
- Recovery coalesces host events and callbacks, preserves completed tool
|
|
17
|
+
results and primary-model preference, and fences stale sessions and manual
|
|
18
|
+
cancellation. Shared durable attempt budgets prevent compaction/retry loops.
|
|
19
|
+
- Recovery deadlines park work safely; storage failures retain a process-local
|
|
20
|
+
dispatch hold and notify the operator. Idle admission tolerates stale probes.
|
|
21
|
+
|
|
22
|
+
### Reliability and audit safeguards
|
|
23
|
+
|
|
24
|
+
- Continuation self-healing retains settled dispatch identity and supports
|
|
25
|
+
loop recovery without blocking manual resume or compaction resynchronization.
|
|
26
|
+
- Task milestone verification cannot overwrite replacement goals or changed
|
|
27
|
+
task lists; owner takeover retries are bounded.
|
|
28
|
+
- Reviewer extraction preserves outside-scope boundaries, deduplicates findings
|
|
29
|
+
within their scope, and reports actual queue admissions.
|
|
30
|
+
- Completion recaps retain the latest claim. Auditor process handling and test
|
|
31
|
+
failure diagnostics preserve bounded, actionable evidence.
|
|
32
|
+
- Compaction loop-resumption regressions observe bounded behavioral outcomes
|
|
33
|
+
rather than assuming nested timers finish within a fixed sleep.
|
|
34
|
+
|
|
35
|
+
## 0.39.15 — reliable failure classification and exhausted fallback retries (2026-10-06)
|
|
36
|
+
|
|
37
|
+
- Ordinary requests whose fallback chain is exhausted enter retry backoff
|
|
38
|
+
instead of treating a passive recovery record as another successful model
|
|
39
|
+
switch. Delayed retries retain the original request and respect freezes.
|
|
40
|
+
|
|
41
|
+
- Provider failure classification ignores opaque request metadata and requires
|
|
42
|
+
actual HTTP status context for numeric codes. Original diagnostics remain
|
|
43
|
+
intact; request IDs cannot falsely trigger authentication, timeout, context
|
|
44
|
+
or prompt-policy routing.
|
|
45
|
+
|
|
5
46
|
## 0.39.13 — continue repair work and model handoffs (2026-10-06)
|
|
6
47
|
|
|
7
48
|
### Project repair and blocker recovery
|
|
@@ -111,7 +111,13 @@ path. It says `not recorded` when a changed-file manifest or test result is not
|
|
|
111
111
|
available. It never infers a passing test or invents a commit.
|
|
112
112
|
|
|
113
113
|
The full six-label recap lives verbatim in the archive (`## Completion summary`)
|
|
114
|
-
and the status/history surfaces.
|
|
114
|
+
and the status/history surfaces. After a rejected claim is corrected, the latest
|
|
115
|
+
approved claim alone supplies the final headline, structured Summary and change
|
|
116
|
+
details. Earlier claim text remains verbatim in the forensic archive/history;
|
|
117
|
+
it must not override corrected counts or be concatenated into the human recap.
|
|
118
|
+
Executors should supply a full objective-level recap on each corrected claim,
|
|
119
|
+
not depend on a rejected predecessor to fill in omitted work.
|
|
120
|
+
The human layer follows two different purposes:
|
|
115
121
|
|
|
116
122
|
- Chat and transcript explain **what happened**: outcome first, then a
|
|
117
123
|
change-first `What Changed` account grouped by area, followed by material
|
package/docs/INDEX.md
CHANGED
|
@@ -13,7 +13,7 @@ Ordered by reading path, not alphabetically.
|
|
|
13
13
|
- [Delegation skill](../skills/glla-delegate/SKILL.md): normal-chat goal/list
|
|
14
14
|
delegation and confirmation.
|
|
15
15
|
- [Changelog](../CHANGELOG.md): changes shipped in each release. The history
|
|
16
|
-
spans v0.35.14–v0.39.
|
|
16
|
+
spans v0.35.14–v0.39.16; `/glla version` shows the installed version and the
|
|
17
17
|
registry comparison command. A checkout can contain unpublished changes.
|
|
18
18
|
|
|
19
19
|
## Architecture
|
package/docs/RECOVERY.md
CHANGED
|
@@ -112,6 +112,12 @@ and one-off blocker reviews, GLLA requests one continuation after the failed run
|
|
|
112
112
|
has settled, with a bounded excerpt of the original request and instructions to
|
|
113
113
|
use existing successful tool results. The complete conversation remains authoritative.
|
|
114
114
|
|
|
115
|
+
Once the ordinary request exhausts its configured fallback candidates, subsequent
|
|
116
|
+
recoverable failures use ordinary retry backoff. A passive record of the selected
|
|
117
|
+
model is not a fresh switch or a scheduled recovery owner. Delayed retries carry
|
|
118
|
+
the original request as well, while credential and deterministic failures retain
|
|
119
|
+
their manual-action rules.
|
|
120
|
+
|
|
115
121
|
A successful core retry consumes this handoff; repeated settlement cannot duplicate
|
|
116
122
|
it. Running or queued turns, explicit aborts, supervisor pauses and recovery waits
|
|
117
123
|
prevent automatic sends. A send failure retains the pending handoff and reports
|
|
@@ -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: 101
|
|
6
|
+
- Extension/script lines: 65894
|
|
7
|
+
- Top-level test files: 354
|
|
8
8
|
- Ambient bridge names: 179 (audit baseline: 183)
|
|
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`, `record_goal_judgment`, `resume_goal`, `unblock_project_requirement`, `update_task_batch`, `update_task_status`
|
|
@@ -14,12 +14,12 @@ Generated by `node scripts/generate-inventory.mjs`. Run with `--check` to detect
|
|
|
14
14
|
| Module | Lines |
|
|
15
15
|
|---|---:|
|
|
16
16
|
| [extensions/goal-loop-core.ts](../extensions/goal-loop-core.ts) | 4969 |
|
|
17
|
-
| [extensions/loops/goal-tools.ts](../extensions/loops/goal-tools.ts) |
|
|
18
|
-
| [extensions/loops/goal-activation.ts](../extensions/loops/goal-activation.ts) |
|
|
17
|
+
| [extensions/loops/goal-tools.ts](../extensions/loops/goal-tools.ts) | 4192 |
|
|
18
|
+
| [extensions/loops/goal-activation.ts](../extensions/loops/goal-activation.ts) | 3835 |
|
|
19
19
|
| [extensions/goal-commands.ts](../extensions/goal-commands.ts) | 3559 |
|
|
20
20
|
| [extensions/goal-loop-display.ts](../extensions/goal-loop-display.ts) | 2749 |
|
|
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) |
|
|
21
|
+
| [extensions/goal-loop-auditor-process.ts](../extensions/goal-loop-auditor-process.ts) | 2685 |
|
|
22
|
+
| [extensions/loops/goal-auditor-hooks.ts](../extensions/loops/goal-auditor-hooks.ts) | 2654 |
|
|
23
23
|
| [extensions/goal-heartbeat.ts](../extensions/goal-heartbeat.ts) | 2098 |
|
|
24
24
|
| [extensions/loops/goal-session.ts](../extensions/loops/goal-session.ts) | 2062 |
|
|
25
25
|
| [extensions/loops/goal-settings-ui.ts](../extensions/loops/goal-settings-ui.ts) | 2045 |
|
|
@@ -173,23 +173,21 @@ export function humanCompletionBrief(
|
|
|
173
173
|
text: string | undefined,
|
|
174
174
|
outcomeBudget = 140,
|
|
175
175
|
valueBudget = 120,
|
|
176
|
-
|
|
176
|
+
// Retained for API compatibility. Historical claims belong in the
|
|
177
|
+
// forensic archive, never in the latest approved human projection.
|
|
178
|
+
_priorWholeWork?: string,
|
|
177
179
|
includeTests = false,
|
|
178
180
|
): HumanCompletionBrief {
|
|
179
181
|
const lines = completionSummaryLines(text, Math.max(outcomeBudget, valueBudget), undefined, includeTests);
|
|
180
182
|
const rawOutcome = (lines[0] ?? "").replace(/^Outcome:\s*/, "");
|
|
181
|
-
//
|
|
182
|
-
//
|
|
183
|
-
|
|
184
|
-
const priorLines = priorWholeWork ? completionSummaryLines(priorWholeWork, Math.max(outcomeBudget, valueBudget), undefined, includeTests) : [];
|
|
185
|
-
const priorDetails = priorLines ? priorLines.slice(1) : [];
|
|
186
|
-
const mergedDetails = [...priorDetails, ...lines.slice(1)];
|
|
187
|
-
const outcomeSource = priorLines[0]?.replace(/^Outcome:\s*/, "") ?? rawOutcome;
|
|
183
|
+
// A corrected claim replaces its rejected predecessor. Merging the
|
|
184
|
+
// first claim here would restore stale counts and duplicate details.
|
|
185
|
+
const outcomeSource = rawOutcome;
|
|
188
186
|
// 2026-09-16 field shots: the headline echo must summarize the ask, not
|
|
189
187
|
// flatten section-structured Outcome markdown into one clipped line. The
|
|
190
188
|
// lead paragraph (text before the first section header) is the human
|
|
191
189
|
// summary; headers ride only in the ### Summary section.
|
|
192
|
-
const structured = structuredSummaryLines(
|
|
190
|
+
const structured = structuredSummaryLines(text);
|
|
193
191
|
const lead = structured
|
|
194
192
|
? (structured.join("\n").split(/\n(?=#{2,4}\s)/)[0] ?? "")
|
|
195
193
|
.split("\n")
|
|
@@ -199,7 +197,7 @@ export function humanCompletionBrief(
|
|
|
199
197
|
// D8: no invented "done" — an empty outcome says so honestly.
|
|
200
198
|
const outcome = clipSummaryValue(briefValueContent(lead || outcomeSource) ?? "(outcome not recorded)", outcomeBudget);
|
|
201
199
|
const details: string[] = [];
|
|
202
|
-
for (const line of
|
|
200
|
+
for (const line of lines.slice(1)) {
|
|
203
201
|
const separator = line.indexOf(":");
|
|
204
202
|
if (separator < 0) continue;
|
|
205
203
|
const content = briefValueContent(line.slice(separator + 1));
|
|
@@ -1102,13 +1100,12 @@ export function composeRichTerminalLines(parts: RichTerminalParts): string[] {
|
|
|
1102
1100
|
export function buildRichArchiveSection(goal: Goal, status: Status, archivePath: string, findingGroups?: FindingGroup[], gateRows?: GateRow[], priorWholeWorkOverride?: string): string[] {
|
|
1103
1101
|
const facts: CompletionSummaryFacts = { goal, status, archivePath };
|
|
1104
1102
|
const summary = resolveCompletionSummary(facts, goal.completionSummary).summary;
|
|
1105
|
-
//
|
|
1106
|
-
// card
|
|
1107
|
-
// captures
|
|
1108
|
-
// cleared; the goal-field fallback covers direct callers.
|
|
1103
|
+
// Preserve the original claim verbatim for forensic history only. The
|
|
1104
|
+
// final card must use the corrected terminal recap, not a rejected one.
|
|
1105
|
+
// archiveCurrentGoal captures history before pendingCompletion clears.
|
|
1109
1106
|
const priorWholeWork = priorWholeWorkOverride ?? goal.pendingCompletion?.priorCompletionSummary;
|
|
1110
1107
|
const brief = humanCompletionBrief(summary, 140, RICH_FULL_VALUE_BUDGET, priorWholeWork, true);
|
|
1111
|
-
const structured = structuredSummaryLines(
|
|
1108
|
+
const structured = structuredSummaryLines(summary);
|
|
1112
1109
|
const history = goal.auditHistory ?? [];
|
|
1113
1110
|
const latest = history[history.length - 1];
|
|
1114
1111
|
const approval = latest
|
|
@@ -1261,10 +1258,8 @@ export interface TerminalApprovalRenderInput {
|
|
|
1261
1258
|
* buildFinalRepoStateLines(cwd). Absent keeps the section out.
|
|
1262
1259
|
*/
|
|
1263
1260
|
repoState?: string[];
|
|
1264
|
-
/**
|
|
1265
|
-
*
|
|
1266
|
-
* note, the render leads with the whole work instead (headline, Summary
|
|
1267
|
-
* section, and the flat findings fallback); absent stays absent. */
|
|
1261
|
+
/** Original claim retained for compatibility and forensic history.
|
|
1262
|
+
* It must not override or merge into the latest approved human recap. */
|
|
1268
1263
|
priorCompletionSummary?: string;
|
|
1269
1264
|
}
|
|
1270
1265
|
|
|
@@ -1315,7 +1310,7 @@ export function buildTerminalApprovalRender(input: TerminalApprovalRenderInput):
|
|
|
1315
1310
|
// archive human layer). Headline echo, verification, Next, recap, and
|
|
1316
1311
|
// every recycled payload keep their bounds.
|
|
1317
1312
|
const resolvedSummary = resolveCompletionSummary(facts, candidate).summary;
|
|
1318
|
-
const structured = structuredSummaryLines(
|
|
1313
|
+
const structured = structuredSummaryLines(resolvedSummary);
|
|
1319
1314
|
// v0.38.37 (audit 2026-09-08): the deliberate non-do comes from the
|
|
1320
1315
|
// agent's complete_goal leftOut claim — never invented. Filler ("none")
|
|
1321
1316
|
// drops via the same briefValueContent filter; absent stays absent.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { ExtensionContext } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import type { MainModelFailure } from './main-model-recovery.js';
|
|
3
|
+
import * as fs from 'node:fs';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
|
|
6
|
+
type PressureContext = Pick<ExtensionContext, 'sessionManager' | 'isIdle' | 'hasPendingMessages' | 'compact' | 'abort'>;
|
|
7
|
+
let pressureTimeoutMs = 120_000;
|
|
8
|
+
export function __testOnlySetPressureTimeout(ms?: number): void { pressureTimeoutMs = ms ?? 120_000; }
|
|
9
|
+
export type PressurePhase = 'queued' | 'compacting' | 'held' | 'spent';
|
|
10
|
+
interface Attempt {
|
|
11
|
+
phase: PressurePhase;
|
|
12
|
+
failure: MainModelFailure;
|
|
13
|
+
valid(): boolean;
|
|
14
|
+
fallback(failure: MainModelFailure): void;
|
|
15
|
+
record(event: string): void;
|
|
16
|
+
timeout(): boolean | void;
|
|
17
|
+
budget?: { file: string; key: string };
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
timer?: ReturnType<typeof setTimeout>;
|
|
20
|
+
admissionTimer?: ReturnType<typeof setInterval>;
|
|
21
|
+
}
|
|
22
|
+
// Owner identity is shared by event contexts, not by cwd: callbacks from an
|
|
23
|
+
// old session must never settle a successor's attempt.
|
|
24
|
+
const attempts = new WeakMap<object, Attempt>();
|
|
25
|
+
const exclusions = new WeakSet<object>();
|
|
26
|
+
type PressureOwner = { sessionManager?: object };
|
|
27
|
+
function owner(ctx: PressureOwner): object { return ctx.sessionManager ?? ctx; }
|
|
28
|
+
|
|
29
|
+
export function setPressureExclusion(ctx: PressureOwner, excluded: boolean): void {
|
|
30
|
+
if (excluded) exclusions.add(owner(ctx)); else exclusions.delete(owner(ctx));
|
|
31
|
+
}
|
|
32
|
+
export function pressureExcluded(ctx: PressureOwner): boolean { return exclusions.has(owner(ctx)); }
|
|
33
|
+
|
|
34
|
+
/** A compaction success does NOT reset this one-attempt budget. Only a healthy
|
|
35
|
+
* work turn/new request may do that, otherwise a failed retry can compact forever. */
|
|
36
|
+
export function claimPressureAttempt(ctx: PressureContext, options: Omit<Attempt, 'phase' | 'timer'>): boolean {
|
|
37
|
+
const key = owner(ctx);
|
|
38
|
+
const existing = attempts.get(key);
|
|
39
|
+
if (existing) {
|
|
40
|
+
if (existing.valid()) return existing.phase !== 'spent';
|
|
41
|
+
clearPressureAttempt(ctx);
|
|
42
|
+
}
|
|
43
|
+
if (options.budget) {
|
|
44
|
+
try {
|
|
45
|
+
if (fs.existsSync(options.budget.file)) {
|
|
46
|
+
const saved = JSON.parse(fs.readFileSync(options.budget.file, 'utf8'));
|
|
47
|
+
if (saved.key === options.budget.key) return false;
|
|
48
|
+
}
|
|
49
|
+
fs.mkdirSync(path.dirname(options.budget.file), { recursive: true });
|
|
50
|
+
fs.writeFileSync(options.budget.file, JSON.stringify({ key: options.budget.key, claimedAt: new Date().toISOString() }), { mode: 0o600 });
|
|
51
|
+
} catch { return false; } // Without a durable claim, use ordinary fallback.
|
|
52
|
+
}
|
|
53
|
+
const attempt: Attempt = { ...options, phase: 'queued' };
|
|
54
|
+
attempts.set(key, attempt);
|
|
55
|
+
attempt.record('queued');
|
|
56
|
+
// The deadline owns the entire episode, including waiting for idle. Do not
|
|
57
|
+
// extend it on repeated settled contacts or host-owned retry notifications.
|
|
58
|
+
attempt.timer = setTimeout(() => {
|
|
59
|
+
if (attempts.get(key) !== attempt || attempt.phase === 'spent' || !attempt.valid()) return;
|
|
60
|
+
const cancelCompactor = attempt.phase === 'compacting';
|
|
61
|
+
attempt.phase = 'held'; // Claim the terminal hold before callbacks can re-enter.
|
|
62
|
+
if (attempt.admissionTimer) clearInterval(attempt.admissionTimer);
|
|
63
|
+
attempt.record('timeout');
|
|
64
|
+
try { if (attempt.timeout() !== false) attempt.phase = 'spent'; }
|
|
65
|
+
catch { /* Failed parking retains the process-local terminal hold. */ }
|
|
66
|
+
if (cancelCompactor) try { ctx.abort(); } catch { /* timeout hold remains */ }
|
|
67
|
+
}, options.timeoutMs ?? pressureTimeoutMs);
|
|
68
|
+
attempt.timer.unref?.();
|
|
69
|
+
// Older hosts need not emit agent_settled. A bounded idle probe is a safe
|
|
70
|
+
// admission backstop, not a second recovery owner or a provider retry.
|
|
71
|
+
attempt.admissionTimer = setInterval(() => {
|
|
72
|
+
if (attempts.get(key) !== attempt) { if (attempt.admissionTimer) clearInterval(attempt.admissionTimer); return; }
|
|
73
|
+
if (!attempt.valid()) { clearPressureAttempt(ctx); return; }
|
|
74
|
+
if (attempt.phase === 'queued') {
|
|
75
|
+
try { flushPressureAttempt(ctx, { compactionInFlight: false }); }
|
|
76
|
+
catch { /* Stale host probes defer safely until invalidation/deadline. */ }
|
|
77
|
+
}
|
|
78
|
+
}, 50);
|
|
79
|
+
attempt.admissionTimer.unref?.();
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
export function pressureBudgetClaimed(file: string, key: string): boolean {
|
|
83
|
+
try { return JSON.parse(fs.readFileSync(file, 'utf8')).key === key; }
|
|
84
|
+
catch { return false; }
|
|
85
|
+
}
|
|
86
|
+
export function resetPressureBudget(file: string, key: string): void {
|
|
87
|
+
try {
|
|
88
|
+
const saved = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
89
|
+
if (saved.key === key) fs.rmSync(file, { force: true });
|
|
90
|
+
} catch { /* Conservative on unreadable storage. */ }
|
|
91
|
+
}
|
|
92
|
+
export function pressureAttemptPending(ctx: PressureContext): boolean {
|
|
93
|
+
const attempt = attempts.get(owner(ctx));
|
|
94
|
+
return !!attempt && attempt.phase !== 'spent' && attempt.valid();
|
|
95
|
+
}
|
|
96
|
+
export function retireSettledPressureAttempt(ctx: PressureContext): boolean {
|
|
97
|
+
if (attempts.get(owner(ctx))?.phase !== 'spent') return false;
|
|
98
|
+
clearPressureAttempt(ctx);
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
export function clearPressureAttempt(ctx: PressureContext, resetBudget = false): void {
|
|
102
|
+
const key = owner(ctx), attempt = attempts.get(key);
|
|
103
|
+
exclusions.delete(key);
|
|
104
|
+
if (attempt?.timer) clearTimeout(attempt.timer);
|
|
105
|
+
if (attempt?.admissionTimer) clearInterval(attempt.admissionTimer);
|
|
106
|
+
if (resetBudget && attempt?.budget) {
|
|
107
|
+
try {
|
|
108
|
+
const saved = JSON.parse(fs.readFileSync(attempt.budget.file, 'utf8'));
|
|
109
|
+
if (saved.key === attempt.budget.key) fs.rmSync(attempt.budget.file, { force: true });
|
|
110
|
+
} catch { /* A missing or unreadable budget stays conservative. */ }
|
|
111
|
+
}
|
|
112
|
+
attempts.delete(key);
|
|
113
|
+
}
|
|
114
|
+
export function settlePressureAttempt(ctx: PressureContext, outcome: 'success' | 'failure' | 'aborted' | 'retry-owned'): boolean {
|
|
115
|
+
const attempt = attempts.get(owner(ctx));
|
|
116
|
+
if (!attempt || attempt.phase === 'queued') return false;
|
|
117
|
+
if (attempt.phase === 'spent' || attempt.phase === 'held') return true; // callback + event share ownership
|
|
118
|
+
if (outcome === 'retry-owned') return true;
|
|
119
|
+
if (attempt.timer) clearTimeout(attempt.timer);
|
|
120
|
+
if (attempt.admissionTimer) clearInterval(attempt.admissionTimer);
|
|
121
|
+
attempt.phase = 'spent';
|
|
122
|
+
if (!attempt.valid()) return true;
|
|
123
|
+
attempt.record(outcome);
|
|
124
|
+
if (outcome === 'failure') attempt.fallback(attempt.failure);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Launch only after the failed request is idle. Never abort a healthy tool to
|
|
129
|
+
* obtain idle, never contend with host-owned compaction, never send on success:
|
|
130
|
+
* GLLA's session_compact resume debt owns that continuation. */
|
|
131
|
+
export function flushPressureAttempt(ctx: PressureContext, options: { compactionInFlight: boolean }): boolean {
|
|
132
|
+
const key = owner(ctx), attempt = attempts.get(key);
|
|
133
|
+
if (!attempt || attempt.phase === 'spent') return false;
|
|
134
|
+
if (!attempt.valid()) { clearPressureAttempt(ctx); return false; }
|
|
135
|
+
if (attempt.phase === 'compacting' || attempt.phase === 'held') return true;
|
|
136
|
+
if (!options.compactionInFlight && (!ctx.isIdle() || ctx.hasPendingMessages())) return true;
|
|
137
|
+
attempt.phase = 'compacting';
|
|
138
|
+
if (attempt.admissionTimer) clearInterval(attempt.admissionTimer);
|
|
139
|
+
attempt.record(options.compactionInFlight ? 'adopted' : 'started');
|
|
140
|
+
if (options.compactionInFlight) return true;
|
|
141
|
+
const settle = (outcome: 'success' | 'failure') => {
|
|
142
|
+
if (attempts.get(key) === attempt) settlePressureAttempt(ctx, outcome);
|
|
143
|
+
};
|
|
144
|
+
if (typeof ctx.compact !== 'function') { settle('failure'); return true; }
|
|
145
|
+
try { ctx.compact({
|
|
146
|
+
// The callback alone cannot discharge resume debt. Keep dispatch blocked
|
|
147
|
+
// until the authoritative session_compact event has been admitted.
|
|
148
|
+
onComplete: () => { if (attempts.get(key) === attempt && attempt.phase === 'compacting' && attempt.valid()) attempt.record('callback-complete'); },
|
|
149
|
+
onError: () => settle('failure'),
|
|
150
|
+
}); }
|
|
151
|
+
catch { settle('failure'); }
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { MainModelFailure } from './main-model-recovery.js';
|
|
2
|
+
|
|
3
|
+
// Relative pressure is deliberately independent of the opportunistic absolute
|
|
4
|
+
// token target: even a small-window model can overflow below 200k tokens.
|
|
5
|
+
export const CONTEXT_PRESSURE_RATIO = 0.9;
|
|
6
|
+
export interface PressureUsage { tokens?: number | null; contextWindow?: number; percent?: number | null }
|
|
7
|
+
|
|
8
|
+
/** Explicit prompt overflow only. Output-cap errors and incidental uses of
|
|
9
|
+
* "context" are not evidence that the input transcript needs compaction. */
|
|
10
|
+
export function isExplicitPromptOverflow(raw: string): boolean {
|
|
11
|
+
return /maximum context (?:length|window)(?:\s+(?:is|was))?\s*(?:exceeded|reached)|context[_ -](?:length|window)[_ -]exceeded|(?:input|prompt|context)\s+(?:is\s+)?too (?:large|long)|too many (?:input|prompt) tokens|exceeds? (?:the )?(?:maximum |model.s )?context (?:length|window)/i.test(raw);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function compactFirstEligible(failure: MainModelFailure): boolean {
|
|
15
|
+
return failure.nonRecoverableReason !== 'prompt-policy'
|
|
16
|
+
&& !/user (?:interrupt|abort)|cancelled by user|content policy violation/i.test(failure.raw);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function shouldRecoverContextPressure(failure: MainModelFailure, usage?: PressureUsage): boolean {
|
|
20
|
+
if (!compactFirstEligible(failure)) return false;
|
|
21
|
+
if (isExplicitPromptOverflow(failure.raw)) return true;
|
|
22
|
+
// A credential or deterministic refusal is not healed by a smaller prompt.
|
|
23
|
+
if (failure.kind !== 'unknown' && failure.kind !== 'transient') return false;
|
|
24
|
+
const tokens = usage?.tokens, window = usage?.contextWindow;
|
|
25
|
+
if (typeof tokens !== 'number' || !Number.isFinite(tokens) || tokens <= 0
|
|
26
|
+
|| typeof window !== 'number' || !Number.isFinite(window) || window <= 0) return false;
|
|
27
|
+
return tokens / window >= CONTEXT_PRESSURE_RATIO;
|
|
28
|
+
}
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
} from "./goal-loop-core.js";
|
|
29
29
|
import { loadGlobalSettings, type Settings } from "./goal-settings.js";
|
|
30
30
|
import { PLAN_B_MAX_ATTEMPTS, resolveCompactorModel } from "./compactor-model.js";
|
|
31
|
+
import { pressureBudgetClaimed, pressureExcluded } from './context-pressure-attempt.js';
|
|
31
32
|
import { respecBuilderAuditInFlight } from "./respec-builder-runtime.js";
|
|
32
33
|
|
|
33
34
|
/** Hard cap on the persisted brief: a handoff, not a transcript. */
|
|
@@ -140,8 +141,14 @@ export function maybeCompactTranscriptAtBoundary(
|
|
|
140
141
|
flags: { supervising: boolean; auditInFlight: boolean; paused: boolean },
|
|
141
142
|
onFailure?: () => void,
|
|
142
143
|
): boolean {
|
|
143
|
-
if (!flags.supervising || flags.auditInFlight || flags.paused) return false;
|
|
144
|
+
if (!flags.supervising || flags.auditInFlight || flags.paused || pressureExcluded(ctx)) return false;
|
|
144
145
|
if (respecBuilderAuditInFlight(ctx.cwd)) return false;
|
|
146
|
+
// Pressure recovery and preventive compaction share one per-work budget.
|
|
147
|
+
// A failed compact-first episode must not re-enter via the optional path
|
|
148
|
+
// before a healthy retry has reset the claim.
|
|
149
|
+
const work = readState(ctx.cwd);
|
|
150
|
+
const pressureKey = work.loop?.active ? `loop:${work.loop.startedAt}` : `goal:${work.goal?.id}`;
|
|
151
|
+
if (pressureBudgetClaimed(path.join(piGlaDir(ctx.cwd), 'context-pressure-budget.json'), pressureKey)) return false;
|
|
145
152
|
let idle = false;
|
|
146
153
|
let pending = true;
|
|
147
154
|
try {
|
|
@@ -83,9 +83,10 @@ const MONITOR_CHECK_INTERVAL_MS = Number.isFinite(configuredMonitorIntervalMs) &
|
|
|
83
83
|
: DEFAULT_MONITOR_CHECK_INTERVAL_MS;
|
|
84
84
|
void MONITOR_CHECK_INTERVAL_MS; // deprecated throttle — scheduling is now event-driven
|
|
85
85
|
import { VISION_ASSIST_GUIDANCE } from "./vision-assist.js";
|
|
86
|
+
import { pressureAttemptPending, flushPressureAttempt } from './context-pressure-attempt.js';
|
|
86
87
|
import { maybeCompactTranscriptAtBoundary, readHandoffBriefExcerpt } from "./goal-compactor.js";
|
|
87
88
|
import { loadSettings } from "./goal-settings.js";
|
|
88
|
-
import { clearLoopTimer, isLoopActive } from "./goal-loop.js";
|
|
89
|
+
import { clearLoopTimer, isLoopActive, scheduleLoopTick } from "./goal-loop.js";
|
|
89
90
|
import { attemptFreshSessionRecovery, mainModelRecoveryActive, recoverMainModelFromSendStorm } from "./goal-recovery.js";
|
|
90
91
|
import { isCompactionInFlightSince, sendStormEscalateMs } from "./main-model-recovery.js";
|
|
91
92
|
import {
|
|
@@ -248,6 +249,9 @@ export function __testOnlySetContinuationRetryBackoff(backoffMs: number | null):
|
|
|
248
249
|
/* ------------------------------------------------------------------ */
|
|
249
250
|
|
|
250
251
|
let pendingContinuationDispatch: ContinuationDispatch | null = null;
|
|
252
|
+
// Settled recovery debt is not an in-flight dispatch. Keeping it separate
|
|
253
|
+
// lets explicit resume and compaction release the normal queue guards.
|
|
254
|
+
let settledSelfHealDispatch: ContinuationDispatch | null = null;
|
|
251
255
|
let continuationStartTimer: NodeJS.Timeout | null = null;
|
|
252
256
|
// v0.38.104 (field: neonbreak 20260928 174457 — "continuation was accepted,
|
|
253
257
|
// but pi did not start a turn … automatic re-sends are stopped · /list resume
|
|
@@ -520,6 +524,7 @@ export function clearContinuationStartWatchdog(): void {
|
|
|
520
524
|
clearRecoveryRearms(pendingContinuationDispatch.id);
|
|
521
525
|
}
|
|
522
526
|
pendingContinuationDispatch = null;
|
|
527
|
+
settledSelfHealDispatch = null;
|
|
523
528
|
lastContinuationSentAt = 0;
|
|
524
529
|
lastContinuationSentPayload = null;
|
|
525
530
|
}
|
|
@@ -600,6 +605,7 @@ export function dispatchPrepare(
|
|
|
600
605
|
ctx.ui.notify("glla: could not persist the continuation dispatch record, so no automatic turn was sent. Fix .pi-glla storage, then resume explicitly.", "error");
|
|
601
606
|
return null;
|
|
602
607
|
}
|
|
608
|
+
settledSelfHealDispatch = null;
|
|
603
609
|
pendingContinuationDispatch = record;
|
|
604
610
|
const repairGoal = state.goal;
|
|
605
611
|
const repairTarget = record.kind === "goal" && repairGoal && repairGoal.id === record.goalId
|
|
@@ -819,9 +825,9 @@ function dispatchStartUnacknowledged(ctx: ExtensionContext, record: Continuation
|
|
|
819
825
|
resetRepairReplanBootstrap(ctx, "start-unacknowledged");
|
|
820
826
|
// v0.38.104: warn AND keep going. The one-automatic-retry cap still stops a
|
|
821
827
|
// blind queue storm; it no longer decides the lane's fate.
|
|
822
|
-
armContinuationStartSelfHeal(ctx,
|
|
823
|
-
const selfHeal = continuationStartSelfHealDelayMs(continuationStartSelfHealProbes);
|
|
824
|
-
const msg = `glla: pi accepted the ${dispatchLabel(record)} continuation, but no observable turn-start event arrived within ${Math.round((Date.now() - record.sentAt) / 1000)}s despite one automatic retry. Automatic re-sends are paused to avoid a blind queue storm; the lane re-probes itself in ${Math.round(selfHeal / 1000)}s and keeps doing so on a slowing cadence, so nothing is needed if the host recovers. The work is safe in .pi-glla — use ${activeGoalSurfaceCommand("resume")} to retry immediately, or start a fresh session.`;
|
|
828
|
+
armContinuationStartSelfHeal(ctx, unacknowledged);
|
|
829
|
+
const selfHeal = continuationStartSelfHealDelayOverrideMs ?? continuationStartSelfHealDelayMs(continuationStartSelfHealProbes);
|
|
830
|
+
const msg = `glla: pi accepted the ${dispatchLabel(record)} continuation, but no observable turn-start event arrived within ${Math.round((Date.now() - record.sentAt) / 1000)}s despite one automatic retry. Automatic re-sends are paused to avoid a blind queue storm; the lane re-probes itself in ${Math.round(selfHeal / 1000)}s and keeps doing so on a slowing cadence, so nothing is needed if the host recovers. The work is safe in .pi-glla — use ${record.kind === "loop" ? "/loop resume" : activeGoalSurfaceCommand("resume")} to retry immediately, or start a fresh session.`;
|
|
825
831
|
ctx.ui.notify(msg, "warning");
|
|
826
832
|
notifyExternal(ctx, sanitizeDisplayText(msg));
|
|
827
833
|
refreshUI(ctx);
|
|
@@ -848,29 +854,43 @@ export function clearContinuationStartSelfHeal(): void {
|
|
|
848
854
|
continuationStartSelfHealTimer = null;
|
|
849
855
|
}
|
|
850
856
|
continuationStartSelfHealProbes = 0;
|
|
857
|
+
settledSelfHealDispatch = null;
|
|
851
858
|
}
|
|
852
859
|
|
|
853
860
|
export function __testOnlySetContinuationStartSelfHealMaxProbes(value: number): void {
|
|
854
861
|
continuationStartSelfHealMaxProbes = Math.max(1, Math.floor(value));
|
|
855
862
|
}
|
|
856
863
|
let continuationStartSelfHealMaxProbes = CONTINUATION_START_SELF_HEAL_MAX_PROBES;
|
|
864
|
+
let continuationStartSelfHealDelayOverrideMs: number | null = null;
|
|
865
|
+
export function __testOnlySetContinuationStartSelfHealDelay(value: number | null): void {
|
|
866
|
+
continuationStartSelfHealDelayOverrideMs = value === null ? null : Math.max(1, value);
|
|
867
|
+
}
|
|
857
868
|
|
|
858
869
|
/** Arm (or re-arm) the self-heal for a settled unacknowledged dispatch. The
|
|
859
870
|
* timer is generation-fenced and self-cancelling: any newer dispatch, any
|
|
860
871
|
* turn-start proof, or any pause clears it, so it can only ever help the lane
|
|
861
872
|
* that is actually stuck. */
|
|
862
873
|
function armContinuationStartSelfHeal(ctx: ExtensionContext, record: ContinuationDispatch): void {
|
|
874
|
+
settledSelfHealDispatch = record;
|
|
863
875
|
if (continuationStartSelfHealTimer) clearTimeout(continuationStartSelfHealTimer);
|
|
864
876
|
const dispatchId = record.id;
|
|
865
877
|
const generation = record.generation;
|
|
866
|
-
const
|
|
878
|
+
const parkedLoop = record.kind === "loop" ? state.loop : undefined;
|
|
879
|
+
const lengthGoal = record.kind === "length" ? state.goal : undefined;
|
|
880
|
+
const delayMs = continuationStartSelfHealDelayOverrideMs ?? continuationStartSelfHealDelayMs(continuationStartSelfHealProbes);
|
|
867
881
|
const timer = scheduleSessionTimeout(() => {
|
|
868
882
|
if (continuationStartSelfHealTimer !== timer) return;
|
|
869
883
|
continuationStartSelfHealTimer = null;
|
|
870
884
|
const live = freshCtxForGeneration(generation);
|
|
871
885
|
if (!live) return;
|
|
872
|
-
const settled =
|
|
873
|
-
|
|
886
|
+
const settled = settledSelfHealDispatch;
|
|
887
|
+
const sameLane = record.kind === "loop"
|
|
888
|
+
? !!parkedLoop && state.loop?.startedAt === parkedLoop.startedAt &&
|
|
889
|
+
state.loop.iteration === parkedLoop.iteration && !state.loop.active &&
|
|
890
|
+
state.loop.stopReason === parkedLoop.stopReason && !!parkedLoop.stopReason?.includes(dispatchId)
|
|
891
|
+
: record.kind === "length" ? state.goal === lengthGoal
|
|
892
|
+
: state.goal?.id === record.goalId && state.goal?.status === "active";
|
|
893
|
+
if (!settled || pendingContinuationDispatch || settled.id !== dispatchId || settled.phase !== "unacknowledged" || !sameLane || supervisorPaused(state)) {
|
|
874
894
|
// The lane moved on (a turn started, a resume re-dispatched, or another
|
|
875
895
|
// lane settled it). Self-heal is no longer this record's job.
|
|
876
896
|
appendLedger(live.cwd, "continuation_start_self_heal_cancelled", { id: dispatchId, reason: "no longer the settled dispatch" });
|
|
@@ -879,20 +899,31 @@ function armContinuationStartSelfHeal(ctx: ExtensionContext, record: Continuatio
|
|
|
879
899
|
const probe = continuationStartSelfHealProbes + 1;
|
|
880
900
|
if (probe > continuationStartSelfHealMaxProbes) {
|
|
881
901
|
appendLedger(live.cwd, "continuation_start_self_heal_exhausted", { id: dispatchId, probes: continuationStartSelfHealProbes });
|
|
882
|
-
const msg = `glla: the continuation lane spent its self-heal budget (${continuationStartSelfHealMaxProbes} bounded re-probes) without a turn start. The work is safe in .pi-glla; ${activeGoalSurfaceCommand("resume")} retries it explicitly, or start a fresh session.`;
|
|
902
|
+
const msg = `glla: the continuation lane spent its self-heal budget (${continuationStartSelfHealMaxProbes} bounded re-probes) without a turn start. The work is safe in .pi-glla; ${record.kind === "loop" ? "/loop resume" : activeGoalSurfaceCommand("resume")} retries it explicitly, or start a fresh session.`;
|
|
883
903
|
ctx.ui.notify(msg, "warning");
|
|
884
904
|
notifyExternal(ctx, sanitizeDisplayText(msg));
|
|
885
905
|
return;
|
|
886
906
|
}
|
|
887
907
|
continuationStartSelfHealProbes = probe;
|
|
888
|
-
appendLedger(live.cwd, "continuation_start_self_heal_fired", { id: dispatchId, probe, delayMs
|
|
908
|
+
appendLedger(live.cwd, "continuation_start_self_heal_fired", { id: dispatchId, probe, delayMs });
|
|
889
909
|
// A fresh, fully guarded dispatch beats a blind re-send: it re-runs every
|
|
890
910
|
// goal/loop guard, re-resolves the model chain, and gets its own start
|
|
891
911
|
// watchdog. The stand-down is released for this one dispatch only; if it
|
|
892
912
|
// misses again, dispatchStartUnacknowledged re-arms the next probe.
|
|
893
913
|
clearContinuationStartWatchdog();
|
|
894
914
|
releaseContinuationDispatchStandDown();
|
|
895
|
-
|
|
915
|
+
if (record.kind === "loop") {
|
|
916
|
+
// Only undo this dispatch's own acknowledgement-timeout park, never
|
|
917
|
+
// a user stop or a replacement loop. The normal loop scheduler keeps
|
|
918
|
+
// cadence, model recovery and compaction admission guards intact.
|
|
919
|
+
state.loop = { ...state.loop!, active: true, stopReason: undefined };
|
|
920
|
+
persistState(live);
|
|
921
|
+
scheduleLoopTick(live);
|
|
922
|
+
} else if (record.kind === "length") {
|
|
923
|
+
sendLengthContinue(live, 1);
|
|
924
|
+
} else {
|
|
925
|
+
scheduleContinuation(live, true, 0);
|
|
926
|
+
}
|
|
896
927
|
}, delayMs);
|
|
897
928
|
continuationStartSelfHealTimer = timer;
|
|
898
929
|
}
|
|
@@ -1276,6 +1307,7 @@ export function scheduleContinuation(ctx: ExtensionContext, force = false, delay
|
|
|
1276
1307
|
// `/glla resume` is the only way back. Manual sends (user-typed prompts)
|
|
1277
1308
|
// are unaffected: they never pass through here.
|
|
1278
1309
|
if (supervisorPaused(state)) return;
|
|
1310
|
+
if (pressureAttemptPending(ctx)) return;
|
|
1279
1311
|
if (mainModelRecoveryActive()) return;
|
|
1280
1312
|
if (flags.sessionHandoffPending || flags.initialSessionLoadPending || flags.extensionApiStale || flags.staleTerminalDone || flags.zombieStoodDown) return;
|
|
1281
1313
|
if (pendingContinuationDispatch) return;
|
|
@@ -1439,6 +1471,11 @@ export function sendContinuation(goalId: string): void {
|
|
|
1439
1471
|
if (flags.sessionHandoffPending || flags.initialSessionLoadPending || flags.extensionApiStale || flags.staleTerminalDone || flags.zombieStoodDown || continuationDispatchStoodDown || pendingContinuationDispatch || flags.abortedStandDown) return;
|
|
1440
1472
|
continuationTimer = null;
|
|
1441
1473
|
continuationScheduledFor = null;
|
|
1474
|
+
const pressureCtx = freshCtx();
|
|
1475
|
+
if (pressureCtx && pressureAttemptPending(pressureCtx)) {
|
|
1476
|
+
flushPressureAttempt(pressureCtx, { compactionInFlight: isCompactionInFlightSince(flags.compactionInFlightSince) });
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1442
1479
|
if (!state.goal || state.goal.id !== goalId) {
|
|
1443
1480
|
const stale = freshCtx();
|
|
1444
1481
|
if (stale) appendLedger(stale.cwd, "faulty_objective_stale_attempt_fence", { expectedGoalId: goalId, currentGoalId: state.goal?.id ?? null, where: "sendContinuation" });
|
|
@@ -253,6 +253,11 @@ export interface AuditorProgress {
|
|
|
253
253
|
/** v0.34.56: the toolCallId of the open start (undefined when the start
|
|
254
254
|
* event carried none — the missing-toolCallId shape). */
|
|
255
255
|
currentToolId?: string;
|
|
256
|
+
/** Test-only: the audit-jobs/<attemptId> directory the snapshot came
|
|
257
|
+
* from. Surfaced so handshake fixtures can stage their result without
|
|
258
|
+
* exposing it before the parent observes the granted tool. Absent on
|
|
259
|
+
* production progress callbacks. */
|
|
260
|
+
jobDir?: string;
|
|
256
261
|
toolCalls: Array<{ name: string; argsPrefix: string; finishedAt: number }>;
|
|
257
262
|
/** v0.34.56: explicitly unmatched tool starts/ends — see
|
|
258
263
|
* applyToolExecutionEvent (goal-loop-auditor.ts) and the worker's mirror
|
|
@@ -1471,6 +1476,11 @@ interface AuditorResultFile {
|
|
|
1471
1476
|
}
|
|
1472
1477
|
|
|
1473
1478
|
interface AuditorProgressFile {
|
|
1479
|
+
/** Job directory (audit-jobs/<attemptId>) the worker is reporting from,
|
|
1480
|
+
* surfaced to test progress callbacks so handshake fixtures can stage
|
|
1481
|
+
* their result without exposing it before the parent observes the
|
|
1482
|
+
* granted tool. Absent on production (tests use it to release publication). */
|
|
1483
|
+
jobDir?: string;
|
|
1474
1484
|
/** Persistent verification pass, independent of thinking/tool/report phase. */
|
|
1475
1485
|
round?: 1 | 2;
|
|
1476
1486
|
protocolVersion: number;
|
|
@@ -1785,7 +1795,7 @@ function asProgress(file: AuditorProgressFile, startedAt: number): AuditorProgre
|
|
|
1785
1795
|
? { currentToolTimeoutMs: Math.floor(file.currentToolTimeoutMs) }
|
|
1786
1796
|
: {}),
|
|
1787
1797
|
...(file.sessionPath ? { sessionPath: file.sessionPath } : {}),
|
|
1788
|
-
...(file.
|
|
1798
|
+
...(file.jobDir ? { jobDir: file.jobDir } : {}),
|
|
1789
1799
|
...(file.unmatchedToolEnds ? { unmatchedToolEnds: file.unmatchedToolEnds } : {}),
|
|
1790
1800
|
cost: snapshotCost(file),
|
|
1791
1801
|
};
|
|
@@ -2365,7 +2375,7 @@ async function runDetachedGoalCompletionAuditorInner(args: {
|
|
|
2365
2375
|
const serialized = stableJson(progress);
|
|
2366
2376
|
if (serialized !== lastProgressSerialized) {
|
|
2367
2377
|
lastProgressSerialized = serialized;
|
|
2368
|
-
args.onProgress?.(asProgress(progress, startedAt));
|
|
2378
|
+
args.onProgress?.(asProgress({ ...progress, jobDir }, startedAt));
|
|
2369
2379
|
}
|
|
2370
2380
|
} catch (error) {
|
|
2371
2381
|
// v0.38.99: progress.json is TELEMETRY, not the verdict — the
|
|
@@ -610,10 +610,10 @@ gateRows?: GateRow[];
|
|
|
610
610
|
automaticRecoveryAttempts?: number;
|
|
611
611
|
automaticRecoveryFirstAt?: string;
|
|
612
612
|
automaticRecoveryUntil?: string;
|
|
613
|
-
/**
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
*
|
|
613
|
+
/** Original completionSummary in this terminal episode, captured when
|
|
614
|
+
* a repair claim follows disapproval. Retained verbatim for forensic
|
|
615
|
+
* history only; never overrides/merges into the latest approved recap.
|
|
616
|
+
* Absent on first claims and legacy files (absent stays absent). */
|
|
617
617
|
priorCompletionSummary?: string;
|
|
618
618
|
/** v0.36.1: bounded detached-auditor candidate cursor. Refs are model
|
|
619
619
|
* identifiers only — never model objects or credentials. The current ref
|