Skip to content

fix: return empty status instead of error on cold-start palace (#830)#831

Merged
bensig merged 1 commit intoMemPalace:developfrom
mvalentsev:fix/status-cold-start
Apr 15, 2026
Merged

fix: return empty status instead of error on cold-start palace (#830)#831
bensig merged 1 commit intoMemPalace:developfrom
mvalentsev:fix/status-cold-start

Conversation

@mvalentsev
Copy link
Copy Markdown
Contributor

@mvalentsev mvalentsev commented Apr 13, 2026

Closes #830. Fix suggested by @hkevinchu -- props for the clear diagnosis.

tool_status() called _get_collection() with the default create=False. On a valid palace where init completed but no drawers were added yet, the ChromaDB collection doesn't exist. client.get_collection() throws, the exception is swallowed, and status returns {"error": "No palace found"} with a misleading hint to re-run init.

Fix: _get_collection(create=db_exists) in tool_status(), where db_exists checks whether chroma.sqlite3 is present on disk. This bootstraps the ChromaDB collection on a valid-but-empty palace (init ran, DB file exists, but no drawers yet) without accidentally creating a palace in a non-existent or misconfigured directory. When the palace path is genuinely wrong, _get_client() still fails and _no_palace() fires correctly.

Changes (2 files, +24/-1):

  • mempalace/mcp_server.py: _get_collection() -> _get_collection(create=db_exists) with db_exists = os.path.isfile(...) guard
  • tests/test_mcp_server.py: new test_status_cold_start_no_collection -- calls status without pre-creating the collection, asserts total_drawers: 0 instead of error

@mvalentsev mvalentsev force-pushed the fix/status-cold-start branch 5 times, most recently from f51ada3 to fdbc8e2 Compare April 13, 2026 23:29
@mvalentsev mvalentsev marked this pull request as ready for review April 13, 2026 23:35
@igorls igorls added area/mcp MCP server and tools bug Something isn't working labels Apr 14, 2026
@mvalentsev mvalentsev force-pushed the fix/status-cold-start branch 2 times, most recently from 17d3adc to 318df31 Compare April 14, 2026 11:41
…lace#830)

tool_status() called _get_collection() with the default create=False,
which throws when the ChromaDB collection does not exist yet (valid
palace, zero drawers). The exception was swallowed and status returned
"No palace found" even though init had completed successfully.

Switching to create=True bootstraps an empty collection on first
status call, matching what the write path already does.

Fix suggested by @hkevinchu in the issue.
@mvalentsev mvalentsev force-pushed the fix/status-cold-start branch from 318df31 to 2fc9d7f Compare April 15, 2026 06:03
Copy link
Copy Markdown
Collaborator

@bensig bensig left a comment

Choose a reason for hiding this comment

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

Code reviewed — no issues found. CLAUDE.md compliance verified.

@bensig bensig merged commit 54a386d into MemPalace:develop Apr 15, 2026
6 checks passed
igorls added a commit that referenced this pull request Apr 16, 2026
Advisor caught: initial boundary (962776c..develop) skipped PRs that
landed on develop after v3.3.0 tag but before the sync-back merge.
Adds entries for #871 MEMPAL_VERBOSE, #811 research() local-only
default, #866 init .gitignore, #864 MCP stdout redirect, #863
precompact hook, #865 searcher empty results, #831 cold-start palace,
#862 init help, #815 Slack provenance, #840 save hook auto-mine.
Also drops the awkward caveat on #846 created_at — it's post-v3.3.0.
shafdev pushed a commit to shafdev/mempalace that referenced this pull request Apr 17, 2026
Advisor caught: initial boundary (962776c..develop) skipped PRs that
landed on develop after v3.3.0 tag but before the sync-back merge.
Adds entries for MemPalace#871 MEMPAL_VERBOSE, MemPalace#811 research() local-only
default, MemPalace#866 init .gitignore, MemPalace#864 MCP stdout redirect, MemPalace#863
precompact hook, MemPalace#865 searcher empty results, MemPalace#831 cold-start palace,
MemPalace#862 init help, MemPalace#815 Slack provenance, MemPalace#840 save hook auto-mine.
Also drops the awkward caveat on MemPalace#846 created_at — it's post-v3.3.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/mcp MCP server and tools bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mempalace_status returns "No palace found" on valid but empty palace (cold-start ChromaDB collection)

3 participants