Skip to content

fix(graph): scope tunnel reads and deletes to config - #2264

Open
fallenmi wants to merge 1 commit into
MemPalace:developfrom
fallenmi:codex/fix-tunnel-config-isolation
Open

fix(graph): scope tunnel reads and deletes to config#2264
fallenmi wants to merge 1 commit into
MemPalace:developfrom
fallenmi:codex/fix-tunnel-config-isolation

Conversation

@fallenmi

@fallenmi fallenmi commented Aug 15, 2026

Copy link
Copy Markdown

What does this PR do?

  • threads the optional palace config through tunnel list, follow, and delete paths
  • keeps deletion's lock, load, and save on the same selected tunnels.json
  • passes the MCP server's canonical _config through tunnel and adjacent hallway handlers
  • adds same-ID regressions across two palaces, proving reads and deletion cannot cross palace boundaries
  • documents the fix in the changelog

The root cause was an incomplete config-propagation path: create_tunnel(..., config=selected) already wrote to the selected sidecar, but matching readers either ignored or could not accept that config. The hallway MCP handlers had the same adjacent gap. With ambient palace B active and MCP palace A selected, reads could return B's same-ID record and deletion could mutate B while leaving A untouched.

Calls that omit config retain the existing default-palace behavior. This completes the tunnel read/delete side of the palace-isolation work merged in #2018.

Closes #2263

Reproduction and verification

Exact current develop base a9f345cc63254eb4dea7abad36963b85c9f8453a:

  • the two-palace hallway oracle is RED: MCP reads B and deletes B while selected palace A is unchanged

Exact head f16a7dfc04f55bf764fcdd1b8bda7cd3cbdd3f1e:

  • the same oracle is GREEN: MCP reads and deletes only A; B's same-ID record remains intact
  • adjacent production-consumer audit confirms hallway config forwarding throughout
  • relevant suite: 478 passed
  • focused post-commit rerun: 5 passed
  • full suite: 4,591 passed, 32 skipped, with one ambient peer-writer-state failure that passed immediately in isolation
  • Ruff check and format, pre-commit, and git diff --check passed

AI assistance

OpenAI Codex was used to rebase the existing contribution onto current develop, implement the maintainer-requested adjacent hallway fix, run the exact-base RED / exact-head GREEN checks, and execute the test and lint commands recorded above. Igor reviewed the published scope and evidence.

Checklist

  • Tests pass
  • No hardcoded paths
  • Linter passes

@igorls igorls added bug Something isn't working area/kg Knowledge graph needs-rebase PR has merge conflicts with develop and needs rebase labels Aug 24, 2026
@fallenmi
fallenmi force-pushed the codex/fix-tunnel-config-isolation branch from e42e3e7 to 0b05f54 Compare August 26, 2026 17:00
@fallenmi
fallenmi marked this pull request as ready for review August 26, 2026 17:04

@igorls igorls left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tunnel isolation fix is important, but it leaves the adjacent hallway MCP handlers with the same cross-palace mutation bug.

On current develop, list_hallways and delete_hallway already accept an optional config, but tool_list_hallways calls list_hallways(wing) and tool_delete_hallway calls delete_hallway(hallway_id) without forwarding the server _config. I reproduced this with MCP _config selecting palace A and the ambient MempalaceConfig() selecting palace B: both sidecars contained the same hallway ID; tool_delete_hallway returned deleted: true, left A unchanged, and deleted B.

Please extend this contribution to pass config=_config through both hallway handlers and add the same two-palace read/delete regression coverage used for tunnels. The branch also needs rebasing; the current merge conflict is in CHANGELOG.md.

@fallenmi
fallenmi force-pushed the codex/fix-tunnel-config-isolation branch from 0b05f54 to f16a7df Compare August 29, 2026 16:48
@fallenmi

Copy link
Copy Markdown
Author

The requested changes are now on exact head f16a7dfc04f55bf764fcdd1b8bda7cd3cbdd3f1e: rebased onto current develop a9f345cc63254eb4dea7abad36963b85c9f8453a, both hallway MCP handlers forward the server _config, and same-ID two-palace read/delete regressions prove palace B remains untouched. The current-base oracle is RED and the head is GREEN; 478 relevant tests, Ruff/format, pre-commit, and diff checks pass. The full suite had 4,591 passed / 32 skipped plus one ambient peer-writer-state failure that passed immediately in isolation.

The PR body now contains the exact updated evidence. Disclosure: this follow-up and verification were prepared with OpenAI Codex assistance and reviewed before publication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/kg Knowledge graph bug Something isn't working needs-rebase PR has merge conflicts with develop and needs rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tunnel reads and deletes can target the wrong palace

2 participants