fix(mcp): accept a single conversation file as a convos mine source - #2282
Open
rubicon wants to merge 3 commits into
Open
fix(mcp): accept a single conversation file as a convos mine source#2282rubicon wants to merge 3 commits into
rubicon wants to merge 3 commits into
Conversation
cli.py documents the mine source as "Directory to mine, or one conversation file with --mode convos", and hooks_cli._ingest_transcript submits exactly one .jsonl -- it returns early unless path.is_file(). The MCP tool validated os.path.isdir unconditionally, and cmd_mine forwards to the hub whenever one is registered and healthy, so the documented single-file form was unreachable in the configuration most users run and every Stop and PreCompact transcript ingest failed with "source directory not found". The failure was silent: hook_precompact returns the same empty object on the success path, so a compaction that captured nothing looked exactly like one that captured everything. The only trace was a stderr line in hook.log. convos now accepts a file or a directory. The tree-walking modes keep the directory requirement, and a test pins that so the relaxation cannot widen into "any mode, any path". Closes MemPalace#2281
The tool schema and the generated reference both still described mempalace_mine.source as a directory only, which stopped being true for mode='convos'. The implementation was right and the published contract was stale, so a caller reading either would not know the single-file form exists. Covers the MCP tool description and its source parameter, the website MCP tools reference, and the openclaw skill listing.
Only CHANGELOG.md conflicted. v3.8.0 was tagged while this branch was open, so the MemPalace#2281 entry no longer belongs in the 3.8.0 section it was originally written into. It moves verbatim into a new [Unreleased] section above it, restoring the layout ebebb2b removed at the 3.8.0 promotion. The nine 3.8.0 Bug Fixes entries that develop added are kept unchanged. mcp_server.py, integrations/openclaw/SKILL.md and website/reference/mcp-tools.md merged cleanly and still carry the fix and its documentation. Full suite: 4470 passed, 31 skipped. ruff check and ruff format --check both clean.
Member
|
Thanks for this contribution! Enabling single conversation file ingest via MCP matches the CLI behavior and is very helpful for transcript hooks. There are currently merge conflicts with the latest |
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.
Closes #2281
What was wrong
cli.pydocuments the mine source as:mcp_server.tool_minevalidatedos.path.isdir(src)regardless of mode. Sincecmd_mineforwards to the hub whenever one is registered and healthy, the documented single-file form was unreachable in the configuration most users run.hooks_cli._ingest_transcriptsubmits exactly one.jsonl— it returns early unlesspath.is_file()— so with a hub live, every Stop and every PreCompact transcript ingest failed withsource directory not found.Why it went unnoticed
hook_precompactreturns_output({})on the success path and on this path alike. A compaction that captured nothing is indistinguishable from one that captured everything; the only evidence is a stderr line inhook_state/hook.log. On the machine where this was found, the newest mined chunk for a session file predated the running hub by five days, across continuous use.The change
convosaccepts a file or a directory. The tree-walking modes keep the directory requirement. The error string no longer asserts "directory" for a mode where a file is valid.Tests
Two added to
tests/test_mcp_mine.py:test_convos_mode_accepts_a_single_file— mines one file and asserts drawers actually land, rather than asserting the call merely returned success.test_projects_mode_still_rejects_a_file— pins the other side, so the relaxation cannot widen into "any mode, any path".Both were confirmed non-vacuous by mutation rather than by inspection:
os.path.isdir(src)test_convos_mode_accepts_a_single_filefailsisdir(src) or isfile(src)for every modetest_projects_mode_still_rejects_a_filefailsEach mutation is killed by the test whose name describes it, and neither test passes on the mutated code it exists to catch.
Full suite: 4302 passed, 31 skipped.
Not in scope
The palace write lock held by a long-lived MCP server (#2024, #1924, #2172) blocks the diary checkpoint on the same hook runs. That is a separate failure with a separate cause; this precondition fails before any lock is taken.