Skip to content

fix(graph): keep orphan edges out of the runtime graph#70

Merged
CodeAbra merged 4 commits into
CodeAbra:mainfrom
Marsu6996:pr/filter-runtime-graph-orphan-edges
Jul 13, 2026
Merged

fix(graph): keep orphan edges out of the runtime graph#70
CodeAbra merged 4 commits into
CodeAbra:mainfrom
Marsu6996:pr/filter-runtime-graph-orphan-edges

Conversation

@Marsu6996

@Marsu6996 Marsu6996 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Draft / stacked PR

Do not merge before #67, #68, and #69. This branch is stacked on those fixes, so the GitHub diff includes dependency commits until they land. It will then be rebased onto main to leave only the runtime-graph integrity change.

Problem

Storage edges can temporarily outlive deleted records until the maintenance
sweep runs. Runtime graph construction streams active records first and then
all stored edges; MemoryGraph.add_edge creates missing endpoints, so an
orphan edge could recreate a deleted record as a payload-less graph node. A
persisted assignment or rich-club cache computed from that polluted graph could
also survive the code fix.

Solution

  • replay an edge only when both endpoints already exist as active runtime
    graph nodes;
  • route both full and incremental rebuilds through the same guard;
  • bump the runtime graph cache version once so old assignments and rich-club
    results are rebuilt from the corrected node set.

Guarantees and scope

The read path does not mutate or delete stored edges; the existing maintenance
sweep remains responsible for storage cleanup. Every active-to-active edge is
preserved, while missing endpoints can no longer inflate topology or recall
state.

Validation

  • full and incremental rebuilds are compared over the same corpus with an
    injected orphan edge and must retain exactly the active node set;
  • cache-version, legacy-cache, edge-stream, and orphan-sweep tests pass;
  • a large encrypted-store rehearsal confirmed that runtime node count matches
    active record count after the guard.

Designed by Marsu — Refined by Codex.

Public CI result

The cumulative macOS correctness gate is fully green: 5,126 passed, 113 skipped, 107 deselected, and 4 xfailed. The universal2 wheel and secret scan also pass.

Marsu6996 and others added 4 commits July 13, 2026 01:25
Warm the dispatch surface once, keep a timed-out background warmup alive explicitly, and release async-write and lifecycle resources safely when startup cancellation escapes the inner run loop.

Designed by Marsu — Refined by Codex.

Co-Authored-By: Codex <codex@openai.com>
Remove workstation-only and process-history assumptions, keep version checks source-aware, use the standard library for plist parsing, and preserve correctness signals without unstable global monkeypatches or hard timing gates.

Designed by Marsu — Refined by Codex.

Co-Authored-By: Codex <codex@openai.com>
Recognize exact iai_mcp and iai-mcp path components while preserving Desktop precedence and rejecting substring lookalikes.

Designed by Marsu — Refined by Codex.

Co-Authored-By: Codex <codex@openai.com>
Replay an edge only when both endpoints are active graph nodes, so stale storage edges cannot recreate deleted records or inflate topology work in either full or incremental rebuilds. Bump the graph-cache version once so polluted assignments and rich-club data cannot survive the fix.

Designed by Marsu — Refined by Codex.

Co-Authored-By: Codex <codex@openai.com>
@Marsu6996 Marsu6996 force-pushed the pr/filter-runtime-graph-orphan-edges branch from 53df1bd to 1b00956 Compare July 12, 2026 23:32
@CodeAbra CodeAbra marked this pull request as ready for review July 13, 2026 03:10
@CodeAbra CodeAbra merged commit e43904c into CodeAbra:main Jul 13, 2026
2 checks passed
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