Skip to content

fix(cli): report missing notes with a failing exit status - #1508

Merged
phernandez merged 5 commits into
mainfrom
fix/1495-read-note-not-found
Sep 8, 2026
Merged

phernandez merged 5 commits into
mainfrom
fix/1495-read-note-not-found

Conversation

@phernandez

@phernandez phernandez commented Sep 8, 2026

Copy link
Copy Markdown
Member

Why

A read after deleting a note returned null fields and exit status 0, so scripts and agents could not distinguish a missing note from success.

What Changed

Unresolved JSON reads now include error: "NOTE_NOT_FOUND" and an identifier-specific message. The CLI exits 1 in JSON, piped, plain, and Rich modes while retaining related-note suggestions. Missing UUIDs receive the same structured result. Successful reads and ordinary MCP text guidance retain their behavior.

Implementation Details

Only confirmed resolution misses enter title/text fallback. Authorization, timeout, retrieval, and fallback-search failures propagate instead of being classified as absence. A resource 404 behind an existing entity remains a read error. Because a sliced entity GET also returns 404 for an existing non-Markdown entity, that error path confirms absence with an unsliced GET; successful UUID line reads still use one request.

The CLI renders the not-found result in the requested mode before signaling failure, including when --frontmatter is requested. The manual documents the contract.

Testing

  • uv run pytest tests/mcp/test_read_note_request_counts.py tests/mcp/test_tool_read_note.py tests/mcp/test_line_scanning.py test-int/cli/test_cli_tool_json_failure_integration.py test-int/mcp/test_line_scanning_integration.py test-int/mcp/test_read_note_missing_identifier_integration.py -q --no-cov: 98 passed.
  • BASIC_MEMORY_TEST_POSTGRES=1 uv run pytest test-int/cli/test_cli_tool_json_failure_integration.py test-int/mcp/test_read_note_missing_identifier_integration.py -q --no-cov: 14 passed.
  • uv run pytest tests/test_man_pages.py -q --no-cov: 39 passed.
  • just fast-check and just doctor: passed.
  • Tests cover actual write/delete/read operations in four output modes, missing UUIDs, related suggestions, failed resolution/search/content reads, and a real MCP/API read of an unsliceable entity.

Risks / Follow-ups

Scripts that treated missing notes as successful reads now receive exit status 1. JSON retains the existing null fields and adds error/message fields. A failed UUID line read may make one additional request to distinguish a missing entity from missing Markdown content.

Closes #1495.

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez phernandez added this to the v0.24.0 milestone Sep 8, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T04:22:06.167386Z 4293fff Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ade8334968

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/read_note.py
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6979472298

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/read_note.py
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez

Copy link
Copy Markdown
Member Author

Broader verification on 2286800: uv run pytest tests/mcp -q --no-cov passed all 1,371 tests. The full MCP suite found no additional regressions.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2286800a12

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/read_note.py
Comment thread src/basic_memory/mcp/tools/read_note.py
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 534b8acd28

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/read_note.py
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 4293fff1c4

ℹ️ 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".

@phernandez
phernandez merged commit 2da78a7 into main Sep 8, 2026
37 checks passed
@phernandez
phernandez deleted the fix/1495-read-note-not-found branch September 8, 2026 12:59
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.

fix(cli): make read-note return explicit not-found result

1 participant