Skip to content

fix: scope derived graph state to explicit palace - #2018

Merged
igorls merged 2 commits into
developfrom
agent/fix-explicit-palace-graph-scope
Jul 14, 2026
Merged

fix: scope derived graph state to explicit palace#2018
igorls merged 2 commits into
developfrom
agent/fix-explicit-palace-graph-scope

Conversation

@igorls

@igorls igorls commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

  • make MempalaceConfig accept an explicit palace-path override that outranks ambient environment and file config
  • thread the selected palace through hallway and topic/entity tunnel persistence
  • cover project, conversation, and format miners so every --palace mining mode keeps derived graph state beside the selected palace
  • add regression tests proving selected and default palace sidecars stay isolated

Why

A real local CLI smoke test for the 3.6.0 maintenance work found that:

mempalace --palace /tmp/example/palace mine ...

stored drawers in /tmp/example/palace, but hallway/entity-tunnel derivation instantiated a fresh ambient MempalaceConfig() and wrote into the user's default ~/.mempalace sidecars. This could silently mix graph relationships between palaces.

Validation

  • uv run pytest tests/ -q --ignore=tests/benchmarks — 3286 passed, 31 skipped
  • uv run ruff check .
  • uv run ruff format --check .
  • real macOS CLI isolation smoke: mined 3 documentation files / 28 drawers into a disposable explicit palace; 2 hallways landed in its sibling hallways.json, its tunnel file remained isolated, and SHA checks confirmed the default hallway and tunnel files were unchanged

Release context

Discovered while testing the proposed 3.6.0 maintenance fixes on an actual local MemPalace installation. This should land before the release because the bug can contaminate a user's default graph merely by testing another palace with --palace.

@igorls
igorls marked this pull request as ready for review July 14, 2026 22:32
@igorls
igorls requested a review from milla-jovovich as a code owner July 14, 2026 22:32
Copilot AI review requested due to automatic review settings July 14, 2026 22:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a palace-isolation bug where derived graph sidecars (hallways / tunnels) could be persisted to the ambient default palace even when the CLI was run with an explicit --palace, by introducing an explicit palace_path override in MempalaceConfig and threading that selected config through miners and graph persistence helpers.

Changes:

  • Add MempalaceConfig(palace_path=...) override that takes precedence over env/file config, and use it to derive palace-scoped hallway_file / tunnel_file.
  • Thread the selected palace config through mining flows and graph derivation (hallways + topic/entity tunnels) so persistence lands beside the chosen palace.
  • Add/extend regression tests ensuring explicit and default palaces’ sidecars stay isolated.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_palace_graph_tunnels.py Adds regression coverage that topic tunnel persistence is scoped by explicit config/palace.
tests/test_miner.py Updates miner integration tests to assert derived graph computations receive the selected palace config.
tests/test_hallways.py Adds regression coverage that hallways persistence/listing is scoped by explicit config/palace.
tests/test_format_miner.py Ensures format miner threads palace config into topic tunnel computation and supports palace override in the fake config.
tests/test_config.py Adds coverage that explicit palace_path overrides env + file config and yields correct sidecar paths.
mempalace/palace_graph.py Adds optional config threading for tunnel creation and derived tunnel computation paths.
mempalace/miner.py Constructs a palace-scoped config for derived graph writes and threads it through topic/entity tunnel + hallway computation.
mempalace/hallways.py Adds config plumbing to hallways compute + list APIs (but see review comment about deletion).
mempalace/format_miner.py Uses palace-scoped config when mining formats and when computing topic tunnels.
mempalace/convo_miner.py Uses palace-scoped config and threads it into hallway computation after convo mining.
mempalace/config.py Extends MempalaceConfig with explicit palace_path override precedence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mempalace/hallways.py
@igorls
igorls merged commit 68edb11 into develop Jul 14, 2026
8 checks passed
@igorls
igorls deleted the agent/fix-explicit-palace-graph-scope branch July 14, 2026 23:28
@igorls igorls mentioned this pull request Jul 14, 2026
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