fix(mcp): preserve agent attribution in mempalace_checkpoint (#2023) - #2034
Merged
igorls merged 2 commits intoJul 16, 2026
Merged
Conversation
…ce#2023) mempalace_checkpoint hard-coded added_by="checkpoint" for every drawer, dropping the filing agent's identity even though it arrives in the same call via diary.agent_name. Add an optional top-level added_by parameter and resolve attribution as explicit > diary agent_name > "checkpoint"; blank/whitespace/non-string values defer to the next source. The value is declared in the tool schema so tools/call admits it on both stdio and HTTP transports. Fixes MemPalace#2023 Co-Authored-By: epinethrone <172391900+epinethrone@users.noreply.github.com>
The new real-Chroma checkpoint test dropped its create-time client with a bare del, leaving the per-path SharedSystemClient's SQLite/HNSW handles open on Windows (MemPalace#1128). Close both clients so the temp palace is released, matching the conftest fixture's close-not-del pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #2023.
mempalace_checkpointhard-codedadded_by="checkpoint"for every drawer it filed, so the originating agent's identity was dropped from drawer metadata (it surfaces in exports and provenance). The agent is already handed to the same call throughdiary.agent_name, so the information was available but discarded.This adds an optional top-level
added_byparameter tomempalace_checkpointand resolves attribution in this order:added_byargument, otherwiseagent_name(the agent filing this session), otherwise"checkpoint"label.A blank, whitespace-only, or non-string value counts as unspecified at each step, so a malformed argument defers to the next source instead of reaching sanitization.
tool_add_draweralready accepts and storesadded_by, so there is no storage change; the parameter is declared in the tool'sinput_schema, so thetools/calldispatch admits it over both the stdio and HTTP transports.Backward compatible: calls that supply neither an explicit
added_bynor a diaryagent_namekeep thecheckpointlabel. The stored value is verbatim (matching every otheradded_bywriter); the diary index continues to lowercaseagent_nameseparately for its case-insensitive reads.How to test
Manual check over the MCP path:
mempalace_checkpointwith one item anddiary.agent_name="DeepSeek", then inspect the filed drawer:added_byisDeepSeek(wascheckpoint).added_by="alice": the drawer recordsaliceregardless of the diary.checkpoint.Checklist
python -m pytest tests/ -v)ruff check .)