You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 13, 2026. It is now read-only.
Repository navigation
Commit 4d24927
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cache): resolve transform/cache-stability council audit (5 real bugs + hardening)
Source-verified the blind Athena council audit of the transform pipeline +
m[0]/m[1] cache-stability system (both harnesses). 5 real fixes + 1 hardening +
docs; each with a cache-stability regression test where applicable.
cortexkit#1 (Pi, High) — memory feature-gate leak. Pi resolved projectIdentity
unconditionally and rendered <project-memory> into m[0]/m[1] even when
memory.enabled=false (OpenCode gates this via projectPath=undefined). Added a
memoryProjectPath() helper that short-circuits all memory reads when disabled;
docs + key-files still render (they key off projectDirectory). Threaded
memoryEnabled through PiInjectionOptions → RunPipelineArgs → injectM0M1Pi state.
+regression test.
cortexkit#2 (Pi) — defer→execute promotion broke boundary-execution parity. Pi force-
promoted schedulerDecision defer→execute when a deferred-execute flag existed,
and ALSO fed the flag into baseShouldApplyPendingOps. OpenCode treats the flag as
drain-on-success ONLY (peekDeferredExecutePending is read solely by the drain);
the idempotent scheduler re-issues execute on the next non-mid-turn pass while
pressure holds. Removed both couplings → exact parity. +regression test.
cortexkit#3 (OpenCode) — history loss on injectM0M1 failure. prepareCompartmentInjection
trims the tail to the latest compartment and caches that new boundary, and the
refresh signal is drained before injectM0M1 runs. If injectM0M1 throws, a later
same-process defer pass reused the cached new boundary while replaying stale m[1]
→ a just-published compartment vanished from both. Now clearInjectionCache() in
the failure catch so the next defer pass cold-rebuilds to the persisted baseline.
+regression test (hazard + fix).
cortexkit#4 (OpenCode) — null-boundary regression in the restart-history fix. The cold-
rebuild trim fell back to the latest-compartment boundary whenever the persisted
baseline was null — but null is also legitimate when m[0] materialized before any
compartment existed (every fresh v2 session), reintroducing the exact loss the
fix prevents. readCachedBaselineState now discriminates on cached_m0_bytes
presence (no-trim on null boundary) vs legacy/never-materialized (latest).
+regression test.
cortexkit#5 (Pi) — soft-refresh boundary/snapshot mismatch. renderM1PiWithMetadata read
compartments live while the boundary advanced from the pre-transaction snapshot;
a concurrent sibling publish left a compartment in m[1] AND the raw tail
(duplication). Threaded compartmentsOverride so both use one set. (Materialize
path already safe: renders inside BEGIN IMMEDIATE with a maxCompartmentSeq
stale-check.)
cortexkit#6 (hardening) — JSON-array CAS (note-nudge/auto-search) used `= ?` with a
coalesced "[]" that never matches a genuinely-NULL row. The NULL case is already
prevented (NOT NULL default + migration v17 heal), but switched to `IS ?` with
the raw stored value for defense-in-depth, matching applyStrippedPlaceholderDelta.
cortexkit#7 (docs) — PARITY.md §12 + AUDIT-KNOWN-ISSUES A30: Pi upgrade_state is now
dynamic (legacy|ready, HARD-bust marker) — parity with OpenCode, no longer a
static constant.
Gate: plugin 1851/0, Pi 413/0 (+2), CLI 146/0; tsc + biome clean across all
three; both dists rebuilt.
Co-authored-by: Alfonso [Magic Context] <[email protected]>
0 commit comments