Repository navigation
v0.21.7 — Revert + corrected output-error catch
v0.21.7 — Revert + corrected output-error catch
Hotfix — reverts the Phase H.1 regression introduced in v0.21.5/v0.21.6
v0.21.5 and v0.21.6 are DEPRECATED. Upgrade to v0.21.7.
Bug
Phase H.1 (v0.21.6) added a guard in context-handler.ts that called piCompactWouldNoop(ctx) — the predicate for pi's durable ctx.compact() path — before evaluateGate consumed the forceCompactNextGate flag. When the session was small (the exact scenario Phase H targeted: a 32k-context model truncating below the input threshold), piCompactWouldNoop returned true, so the guard cleared the flag and returned early, suppressing the live-trim pipeline entirely. The default compaction path (buildLiveTrimView in liveTrim.ts) never calls ctx.compact(), so the durable-path predicate was irrelevant — it guarded nothing it needed to and broke the one thing Phase H was built to fix.
Result: small-context models entered an infinite truncation loop ("compact never").
Fix
- Full revert of the v0.21.5/v0.21.6 sprint to the v0.21.4 baseline (
39584739). - Cherry-picked the audit-verified correct phases (A–G + H) back, without the H.1 guard.
- The Phase H output-error catch trips compaction on
stopReason: "length"via a one-shotforceCompactNextGateflag consumed bygateCheck.ts evaluateGate— the correct and sufficient mechanism. - Safety valves already in place (live-trim null-cut return, thrashGuard, 2s debounce, fallbackCompaction) handle every edge the H.1 guard tried (and failed) to cover.
Threshold normalization (Phases A–G, kept)
- A:
COMPACT_TIERSfolded to a fraction map (low 0.5 / medium 0.6 / high 0.7 / ultra 0.7 / mega 0.75) - B:
DEFAULT_CONTEXT_WINDOWnamed constant (envMEGACOMPACT_DEFAULT_CONTEXT_WINDOW, 200_000, display-seed only) - C: umbrella-OFF
DEFERnow also returns+Infinitywhen the window is unknown (LTS correctness) - D:
autoCompactChecktakes a required threshold param (footgun closure) - E:
DEFAULT_SAVED_GOALseeds the saved goal - F:
DEFAULT_FAST_GATE_PCT_CUSTOM = 70(pure refactor) - G: test rewrites for the new tier map
Dashboard rule compliance
MEGACOMPACT_OUTPUT_ERROR_COMPACTadded to the Settings → Compaction group (default ON)MEGACOMPACT_DEFAULT_CONTEXT_WINDOWadded toEXCLUDED_SETTINGS(display-seed only, never a firing gate)
Cross-system impact
git diff 39584739..HEAD -- src/vector-cortex/ src/memory.ts src/recall.ts src/engine.ts src/store/ → 0 lines. No vector-cortex, memory, recall, engine, or store code was touched.
Device-side verify
pi update --extensions
# open a 32k-context model session, drive to ~77% context, trigger output truncation
# compaction should fire on the NEXT context event; no "Nothing to compact" error