Skip to content

fix(rfc64): bind SWM retirement to current heads - #2038

Open
branarakic wants to merge 2 commits into
codex/rfc64-m1-edge-always-on-swm-resumefrom
codex/rfc64-m1-swm-retirement-correctness
Open

fix(rfc64): bind SWM retirement to current heads#2038
branarakic wants to merge 2 commits into
codex/rfc64-m1-edge-always-on-swm-resumefrom
codex/rfc64-m1-swm-retirement-correctness

Conversation

@branarakic

Copy link
Copy Markdown
Contributor

User impact

A node no longer hides a current Shared Working Memory (SWM) assertion merely because an older version of the same physical graph was retired. The query path now derives the authoritative SWM metadata graph through one canonical helper and excludes a graph only when the node-local retirement marker matches the highest durable assertion version. Production finalization wiring is also covered directly, so SWM retirement and VM materialization continue to share the Agent's write-lock map.

This is a correctness/hardening change. It does not broaden Edge subscriptions or enable all-CG synchronization.

Before

sequenceDiagram
    participant Q as Query engine
    participant M as SWM metadata
    participant L as Local retirement controls
    Q->>Q: Slice "/_shared_memory" manually
    Q->>M: Read every historical head row
    M-->>Q: v1 and current v2
    Q->>L: Join any matching retirement version
    L-->>Q: v1 is retired
    Q-->>Q: Hide the entire current graph
Loading

After

sequenceDiagram
    participant Q as Query engine
    participant C as Canonical URI helper
    participant M as SWM metadata
    participant L as Local retirement controls
    Q->>C: Map per-KA SWM graph
    C-->>Q: Exact sibling metadata graph
    Q->>M: Select MAX durable assertion version
    M-->>Q: Current v2
    Q->>L: Match retirement marker to v2 only
    L-->>Q: No v2 marker
    Q-->>Q: Keep current SWM visible
Loading

What changed

  • added a single structural SWM assertion-to-metadata URI helper in core
  • changed local retirement discovery to compare markers with the maximum durable assertion version
  • removed manual URI slicing from the query engine
  • added a stale-v1/current-v2 regression test
  • added a real Agent accessor test proving FinalizationHandler receives the exact production write-lock map

Validation

  • Agent build, type tests, and package-root test: pass
  • focused Core + Query + Agent regression lane: 3 files, 170 tests passed
  • Core full lane: 104 files, 1,587 tests passed
  • Storage full lane: 32 files, 472 tests passed, expected skips
  • Query focused file covers its complete 123-test engine suite
  • local full Agent run reached the slow chain-backed publication lane but was manually interrupted; GitHub CI is the authoritative complete lane for this PR

Stacked on #2036. Addresses the remaining SWM retirement/query-wiring feedback from #2031.

Comment thread packages/core/src/constants.ts Outdated
Comment thread packages/agent/test/finalization-write-lock-wiring.test.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants