@juicesharp/rpiv-workflow 2.11.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/messages.ts +44 -15
  2. package/package.json +5 -5
package/messages.ts CHANGED
@@ -163,22 +163,51 @@ export const FAIL_BACKWARD_JUMP_EXHAUSTED = (info: BackwardJumpHaltInfo): Failur
163
163
  };
164
164
 
165
165
  /**
166
- * A decision edge terminated the chain because no branch matched — `match`
167
- * without a fallback saw an unexpected value (typically a failed verdict on a
168
- * gate whose only routes are pass arms). The run is blocked awaiting
169
- * intervention, not complete; `note` is the edge's own no-match diagnostic
170
- * (the ROUTE_NOTE `match` attaches), so the toast names the value that failed
171
- * to route. The stage's own output (its verdict) holds the findings.
166
+ * The meta unit-graph's non-resumable halt vocabulary (`meta/unit-graph.ts`
167
+ * `decide`): a unit that spent its correction budget (`N/M rounds spent`),
168
+ * early-stopped on an unchanged failure signature (`the same failures survived
169
+ * a correction`), hit an uncorrectable fatal (`<unit> FATAL — …`), or lost its
170
+ * gate record (`integrity stop`). These differ from a `match`-no-fallback stop
171
+ * in one decisive way: the round and generation counters are derived from the
172
+ * persisted trail, and NOTHING in the resume path resets them, so resuming
173
+ * re-reads the spent budget and re-decides the identical stop. A hand-fix
174
+ * cannot change that — the remedy is a fresh run, not `/wf @<runId>`.
172
175
  *
173
- * The toast names `/wf @<runId>` — resume re-runs the halted gate against
174
- * the repaired tree and continues on a pass, reusing every upstream
175
- * artifact; a bare "re-run" reads as "start over" and re-pays the whole
176
- * front-load (observed: full re-runs of research+plan for a one-line fix).
177
- */
178
- export const FAIL_GATE_STOP = (stage: string, note: string, runId: string): FailureText => ({
179
- toast: `✗ workflow stopped at "${stage}" — its routing gate matched no branch (${note}); see the stage's verdict for findings, then fix and resume with /wf @${runId}`,
180
- error: `Routing gate after "${stage}" matched no branch: ${note}`,
181
- });
176
+ * `match`-no-fallback notes (`value "…" matched no branch`) never contain these
177
+ * phrases, so they keep the re-measurable "fix and resume" guidance; build/ship
178
+ * never emit this vocabulary as a route note (grep: `rounds spent` there is a
179
+ * code comment, not a `setRouteNote`).
180
+ */
181
+ const EXHAUSTION_HALT_NOTE = /\bFATAL —|\brounds spent\b|the same failures survived|integrity stop/;
182
+ export const isExhaustionHalt = (note: string | undefined): boolean =>
183
+ note !== undefined && EXHAUSTION_HALT_NOTE.test(note);
184
+
185
+ /**
186
+ * A decision edge terminated the chain. Two shapes reach here:
187
+ *
188
+ * 1. `match` without a fallback saw an unexpected value (typically a failed
189
+ * verdict on a gate whose only routes are pass arms). The run is blocked
190
+ * awaiting intervention, not complete; resume re-runs the halted gate
191
+ * against the repaired tree and continues on a pass, reusing every upstream
192
+ * artifact — so the toast names `/wf @<runId>` ("re-run" read as "start
193
+ * over" and re-paid the whole front-load: full re-runs of research+plan for
194
+ * a one-line fix). `note` is the edge's own no-match diagnostic.
195
+ *
196
+ * 2. A meta unit-graph halt whose correction budget is spent (see
197
+ * `isExhaustionHalt`). Resume re-decides the same stop, so the guidance is
198
+ * "fix, then start a fresh run" — and the toast drops "matched no branch",
199
+ * which is wrong for a halt that DID route (to `stop`) deliberately.
200
+ */
201
+ export const FAIL_GATE_STOP = (stage: string, note: string, runId: string): FailureText =>
202
+ isExhaustionHalt(note)
203
+ ? {
204
+ toast: `✗ workflow halted at "${stage}" — ${note}; see the stage's verdict for findings. The correction budget is spent, so resuming re-decides the same stop — fix the artifact, then start a fresh run.`,
205
+ error: `Workflow halted at "${stage}" (budget exhausted): ${note}`,
206
+ }
207
+ : {
208
+ toast: `✗ workflow stopped at "${stage}" — its routing gate matched no branch (${note}); see the stage's verdict for findings, then fix and resume with /wf @${runId}`,
209
+ error: `Routing gate after "${stage}" matched no branch: ${note}`,
210
+ };
182
211
 
183
212
  /**
184
213
  * A loop produced zero units (push: empty array handled upstream as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-workflow",
3
- "version": "2.11.0",
3
+ "version": "2.13.0",
4
4
  "description": "Pi extension. Chain skills into typed multi-stage workflows with audited JSONL state, predicate routing, and per-stage output validation. Skill-agnostic — bring your own skills.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -112,12 +112,12 @@
112
112
  ]
113
113
  },
114
114
  "dependencies": {
115
- "@juicesharp/rpiv-config": "^2.11.0",
116
- "jiti": "^2.7.0",
117
- "typebox": "^1.1.24"
115
+ "@juicesharp/rpiv-config": "^2.13.0",
116
+ "jiti": "^2.7.0"
118
117
  },
119
118
  "peerDependencies": {
120
119
  "@earendil-works/pi-coding-agent": "*",
121
- "@standard-schema/spec": "*"
120
+ "@standard-schema/spec": "*",
121
+ "typebox": "*"
122
122
  }
123
123
  }