Repository navigation
fix(mcp): unify note writes with typed outcomes - #1521
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b2ecc102d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why
write_noteinferred an existing-note conflict from exception text, then resolved an identifier and attempted a second write. That masked locked-note failures and made moved-note behavior depend on the general link resolver. This consolidates #1525 into one explicit write operation.Fixes #1479. Related to #993.
What Changed
NOTE_PATH_CONFLICTwith its current path.overwrite=Falsecan deliberately create a separate note.Implementation Details
NoteContentMutationService.write_noteowns target selection. Internal frozen dataclasses carry the outcomes;/knowledge/writeserializes them as a Pydantic discriminated union;KnowledgeClientvalidates that response once.The new operation dispatches through public create/update methods so runtime overrides retain their pre-acceptance work. Those methods share actor resolution, transaction ownership, acceptance hooks, cache invalidation and post-commit publication. Existing create/update HTTP contracts and the core accepted-write guards remain intact. Legacy structured service errors are translated once into recoverable outcomes; other refusals retain their status and detail.
Testing
uv run pytest tests/mcp/test_tool_write_note.py tests/mcp/test_tool_write_note_kebab_filenames.py tests/mcp/test_tool_write_note_metadata.py test-int/mcp/test_write_note_integration.py test-int/mcp/test_moved_note_overwrite.py test-int/mcp/test_locked_note_results.py test-int/cli/test_locked_note_refusals.py --no-cov -q— 121 passed.uv run pytest test-int/test_note_write_outcomes.py tests/indexing/test_accepted_note_mutation_runner.py tests/cloud/test_cloud_services.py --no-cov -q— 65 passed before the final runtime-override regression additions.uv run pytest test-int/test_note_write_outcomes.py test-int/mcp/test_moved_note_overwrite.py --no-cov -q— final 9 passed, including runtime override refusals and transaction-hook rollback.BASIC_MEMORY_TEST_POSTGRES=1 uv run pytest test-int/test_note_write_outcomes.py test-int/mcp/test_moved_note_overwrite.py test-int/mcp/test_locked_note_results.py --no-cov -qpassed all 15 final runtime-dispatch cases.uv run pytest tests/mcp/test_tool_write_note.py test-int/test_note_write_outcomes.py test-int/mcp/test_moved_note_overwrite.py test-int/mcp/test_locked_note_results.py --no-cov -qthen passed 81 tests; the added malformed-frontmatter API case passed separately.BASIC_MEMORY_TEST_POSTGRES=1 uv run pytest test-int/mcp/test_moved_note_overwrite.py --no-cov -qpassed all 5 cases.uv run pytest tests/mcp/test_tool_telemetry.py tests/api/v2/test_knowledge_router_telemetry.py test-int/test_note_write_outcomes.py --no-cov -qpassed all 15 cases.just fast-checkandjust doctorpassed.Risks / Follow-ups
Cloud must deploy the Core version containing
/knowledge/writebefore clients using this endpoint are released. Existing HTTP create/update callers remain compatible. This is not a Cloud deployment or a change to the concurrency protocol. PR #1525 is superseded by this implementation and its behavioral tests.