pi-dev-flow 0.83.0 → 0.83.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 +7 -0
- package/extensions/dev-flow.ts +20 -7
- package/package.json +1 -1
- package/skills/dev-flow/references/implement.md +4 -1
- package/src/core.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.83.1] - 2026-11-05
|
|
8
|
+
|
|
9
|
+
**A worker whose model is down is reported as down, not nudged as a stall.**
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **A worker whose model is failing is reported as such, not nudged as a stall** (fixes #173). A review worker's turns all ended in `stopReason: "error"` ("Request timed out.", after pi's own retries). `flow_stage` spent both nudges on it, which only bought two more retry storms, and then printed `ended without REPORT after 2 nudge(s)` with empty last words. The driver read that as a stall, re-briefed the slice and lost the review. Now when the newest turn ended in a model error, the worker stops at once: no nudges, no salvage prompt. The result says `model failed: stopReason=error "<message>" (N consecutive error turn(s)) — not a stall` and tells the driver to take the work inline or retry later. The pi-web Agents row records the same error.
|
|
13
|
+
|
|
7
14
|
## [0.83.0] - 2026-11-05
|
|
8
15
|
|
|
9
16
|
**`flow finish` reflects before it cleans up, so a session's review can no longer be lost.**
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -139,6 +139,7 @@ import {
|
|
|
139
139
|
buildWorkerBrief,
|
|
140
140
|
clampBudgetMin,
|
|
141
141
|
parseWorkerReport,
|
|
142
|
+
workerTurnError,
|
|
142
143
|
workerOpError,
|
|
143
144
|
WORKER_NUDGE,
|
|
144
145
|
WORKER_NUDGES,
|
|
@@ -2687,6 +2688,8 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2687
2688
|
let crash: string | null = null;
|
|
2688
2689
|
let nudges = 0;
|
|
2689
2690
|
let report = parseWorkerReport("");
|
|
2691
|
+
let modelError: ReturnType<typeof workerTurnError> = null;
|
|
2692
|
+
const turnError = () => workerTurnError((child as { messages?: unknown[] } | undefined)?.messages ?? []);
|
|
2690
2693
|
const abortChild = () => void Promise.resolve(child?.abort()).catch(() => {});
|
|
2691
2694
|
const hardMs = workerTiming.hardMs ?? budgetMin * 60_000;
|
|
2692
2695
|
// grace before the cliff (gh#142): steered at 75% to wrap up, so a long run hands back a REPORT
|
|
@@ -2714,15 +2717,18 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2714
2717
|
});
|
|
2715
2718
|
await child.prompt(brief);
|
|
2716
2719
|
report = parseWorkerReport(child.getLastAssistantText() ?? "");
|
|
2717
|
-
|
|
2718
|
-
|
|
2720
|
+
if (!report.found) modelError = turnError();
|
|
2721
|
+
// a turn that ends in prose ("now let me write D4…") ends the session: tell it to keep going —
|
|
2722
|
+
// but never a turn that ended in a model error: pi already retried it, a nudge buys one more storm (gh#173)
|
|
2723
|
+
while (!report.found && !modelError && !timedOut && !signal?.aborted && nudges < WORKER_NUDGES) {
|
|
2719
2724
|
nudges++;
|
|
2720
2725
|
await child.prompt(wop === "implement" ? WORKER_NUDGE : WORKER_NUDGE_READONLY);
|
|
2721
2726
|
report = parseWorkerReport(child.getLastAssistantText() ?? "");
|
|
2727
|
+
if (!report.found) modelError = turnError();
|
|
2722
2728
|
}
|
|
2723
2729
|
// cut at the budget without a REPORT: one short, tool-less turn to hand back what it found —
|
|
2724
2730
|
// an aborted reflection otherwise loses every finding it had already made
|
|
2725
|
-
if (!report.found && timedOut && !signal?.aborted) {
|
|
2731
|
+
if (!report.found && !modelError && timedOut && !signal?.aborted) {
|
|
2726
2732
|
salvaged = true;
|
|
2727
2733
|
const grace = setTimeout(abortChild, workerTiming.graceMs ?? WORKER_SALVAGE_MS);
|
|
2728
2734
|
try {
|
|
@@ -2747,9 +2753,12 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2747
2753
|
const headAfter = (await git("git rev-parse HEAD")).trim();
|
|
2748
2754
|
const newCommits = headBefore && headAfter && headBefore !== headAfter ? await git(`git log --oneline ${sq(headBefore)}..HEAD`) : "";
|
|
2749
2755
|
const dirty = (await git("git status --short")).trim();
|
|
2756
|
+
const modelLine = modelError ? `model failed: stopReason=${modelError.reason} ${JSON.stringify(modelError.message)} (${modelError.streak} consecutive error turn(s)) — not a stall, ${nudges ? `stopped after ${nudges} nudge(s)` : "nudges skipped"}` : "";
|
|
2750
2757
|
const outcome = crash
|
|
2751
2758
|
? `crashed: ${crash}`
|
|
2752
|
-
:
|
|
2759
|
+
: modelError
|
|
2760
|
+
? modelLine
|
|
2761
|
+
: timedOut
|
|
2753
2762
|
? `interrupted at the ${budgetMin}-min budget${steered ? " (steered to wrap up at " + Math.round(WORKER_STEER_AT * 100) + "%)" : ""}${report.found ? " — REPORT salvaged after the cut, treat it as partial" : salvaged ? " — the salvage prompt got no REPORT either" : ""}`
|
|
2754
2763
|
: report.found
|
|
2755
2764
|
? `reported${steered ? " (after the wrap-up steer)" : ""}`
|
|
@@ -2760,7 +2769,9 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2760
2769
|
const doneAt = now();
|
|
2761
2770
|
const final = crash
|
|
2762
2771
|
? { version: 1, status: "failed", completedAt: doneAt, error: crash }
|
|
2763
|
-
:
|
|
2772
|
+
: modelError
|
|
2773
|
+
? { version: 1, status: "failed", completedAt: doneAt, error: modelLine }
|
|
2774
|
+
: signal?.aborted || (timedOut && !report.found)
|
|
2764
2775
|
? { version: 1, status: "aborted", completedAt: doneAt }
|
|
2765
2776
|
: report.found
|
|
2766
2777
|
? { version: 1, status: "completed", completedAt: doneAt, result: report.body }
|
|
@@ -2772,12 +2783,14 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2772
2783
|
releaseLive("failed"); // idempotent guard: a throw between claim and result must not leave a live row
|
|
2773
2784
|
try { if (child) workerSessions.delete(child.sessionManager.getSessionId()); } catch { /* id-less session: nothing was registered */ }
|
|
2774
2785
|
try { child?.setSessionName(`${report.found && !crash && !signal?.aborted ? (timedOut ? "◐" : "✓") : "✗"} ${name}${report.verdict ? ` · ${report.verdict}` : ""}`); } catch { /* visibility only */ }
|
|
2786
|
+
// a dead model is a different failure from a stall, with a different remedy: say which (gh#173)
|
|
2787
|
+
const deadModelNote = `no REPORT — the worker's model was failing (${modelError?.message ?? ""}), not stalled: no ${wop === "implement" ? "slice was finished" : wop === "review" ? "review happened" : "reflection happened"}. Take it inline, or retry the delegation later (check the provider) — re-briefing it now hits the same failure.`;
|
|
2775
2788
|
const parts = [`${glyph} ${wop} worker ${outcome} (${Math.round((Date.now() - started) / 60_000)} min)`];
|
|
2776
2789
|
let reflected: ReturnType<typeof parseReflectReport> | null = null;
|
|
2777
2790
|
if (wop === "reflect") {
|
|
2778
2791
|
reflected = report.found ? parseReflectReport(report.body) : null;
|
|
2779
2792
|
const rows = reflected && (reflected.findings.length || reflected.open.length || /^\s*F0\b/m.test(report.body)) ? renderReflectFindings(reflected, selfRepo) : null;
|
|
2780
|
-
parts.push(rows ? rows.join("\n") : report.found ? `REPORT (rows did not parse — read them yourself):\n${report.body.slice(0, 6000)}` : `no REPORT — last words:\n${report.body}`);
|
|
2793
|
+
parts.push(rows ? rows.join("\n") : report.found ? `REPORT (rows did not parse — read them yourself):\n${report.body.slice(0, 6000)}` : modelError ? deadModelNote : `no REPORT — last words:\n${report.body}`);
|
|
2781
2794
|
if (report.found) {
|
|
2782
2795
|
// the record finish reads: a reflection ran for this flow, so finish goes on to its cleanup
|
|
2783
2796
|
const cur = readState(root, st.slug);
|
|
@@ -2796,7 +2809,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
2796
2809
|
return { content: [{ type: "text", text: parts.join("\n\n") }], details: { op: wop, outcome, verdict: null, commits: 0, findings: reflected?.findings.length ?? 0, recorded: report.found } };
|
|
2797
2810
|
}
|
|
2798
2811
|
parts.push(
|
|
2799
|
-
report.found ? `REPORT:\n${report.body.slice(0, 6000)}` : `no REPORT — last words:\n${report.body}`,
|
|
2812
|
+
report.found ? `REPORT:\n${report.body.slice(0, 6000)}` : modelError ? deadModelNote : `no REPORT — last words:\n${report.body}`,
|
|
2800
2813
|
`new commits:\n${newCommits.trim() || "(none)"}`,
|
|
2801
2814
|
`uncommitted: ${dirty ? `\n${dirty}` : "clean"}`,
|
|
2802
2815
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.83.
|
|
3
|
+
"version": "0.83.1",
|
|
4
4
|
"description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -101,7 +101,10 @@ resending the same note.
|
|
|
101
101
|
adds the facts itself: the absolute plan path, the branch's commits, the
|
|
102
102
|
uncommitted paths and the project checks. Your `note` is just the slice, plus
|
|
103
103
|
any operator answers the worker cannot see. A worker whose turn ends in prose
|
|
104
|
-
is nudged to continue, up to twice.
|
|
104
|
+
is nudged to continue, up to twice. A turn that ended in a **model error**
|
|
105
|
+
(`model failed: stopReason=error …`) is not nudged: pi already retried it, so
|
|
106
|
+
the model is down, not slow. Take the slice or review inline, or retry the
|
|
107
|
+
delegation once the provider answers again. On return the tool reruns `flow check` and
|
|
105
108
|
lists the new commits and anything uncommitted.
|
|
106
109
|
- `flow_stage({ op: "review", note })` — a fresh **read-only** reviewer (at
|
|
107
110
|
implement or pre-release): findings plus `verdict: PASS|FAIL`. It is advisory:
|
package/src/core.ts
CHANGED
|
@@ -2286,6 +2286,18 @@ export function buildWorkerBrief(o: WorkerBriefInput): string {
|
|
|
2286
2286
|
return [...head, ...contract].join("\n");
|
|
2287
2287
|
}
|
|
2288
2288
|
|
|
2289
|
+
/** A worker turn that ended in a model error (gh#173): the newest assistant message has stopReason
|
|
2290
|
+
* "error". pi has already auto-retried inside the prompt by then, so this is a dead model, not a stall —
|
|
2291
|
+
* nudging it only buys another retry storm. `streak` counts the consecutive trailing error turns. */
|
|
2292
|
+
export function workerTurnError(messages: readonly unknown[]): { reason: string; message: string; streak: number } | null {
|
|
2293
|
+
const turns = messages.filter((m): m is { role: string; stopReason?: string; errorMessage?: string } => !!m && typeof m === "object" && (m as { role?: unknown }).role === "assistant");
|
|
2294
|
+
const last = turns.at(-1);
|
|
2295
|
+
if (!last || last.stopReason !== "error") return null;
|
|
2296
|
+
let streak = 0;
|
|
2297
|
+
for (let i = turns.length - 1; i >= 0 && turns[i].stopReason === "error"; i--) streak++;
|
|
2298
|
+
return { reason: last.stopReason, message: String(last.errorMessage ?? "").trim() || "(no error message)", streak };
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2289
2301
|
/** The REPORT section of a worker's final message: everything after the last `REPORT` heading line. */
|
|
2290
2302
|
export function parseWorkerReport(text: string): { found: boolean; body: string; verdict: "PASS" | "FAIL" | null } {
|
|
2291
2303
|
const lines = (text ?? "").split("\n");
|