Skip to content

fix(tags): reject an unknown tags_match instead of widening it to "any" (#5371) - #5653

Merged
nicoloboschi merged 2 commits into
mainfrom
fix/tags-match-strict-ingress
Oct 16, 2026
Merged

nicoloboschi merged 2 commits into
mainfrom
fix/tags-match-strict-ingress

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Fixes #5371.

A mistyped tags_match (e.g. any-strict) on MCP recall/reflect or GET /documents / GET /graph silently ran as any, so untagged memories leaked into a recall meant to stay inside one tag.

  • MCP recall/reflect (both bank-id and session-bank copies) take TagsMatch, so FastMCP rejects unknown modes and the tool schema lists all five. Docstrings name all five.
  • GET /documents and GET /graph take TagsMatch → 422 on unknown modes, same as recall. OpenAPI + clients regenerated; control-plane documents proxy narrows to the new type.
  • _parse_tags_match raises instead of falling back to any, so no future plain-string path can widen silently.

Thanks @JayOfTheKeyboard and @koriyoshi2041 for the report and analysis.

Tests: test_mcp_tools.py::TestRecallReflectTagsMatch, test_graph_filtering.py::test_unknown_tags_match_is_rejected, test_tags_visibility.py::test_parse_tags_match_rejects_unknown_mode.

…y" (#5371)

MCP recall/reflect and GET /documents, /graph took tags_match as a plain
string, and the shared parser fell back to "any" (which admits untagged
rows) for anything it didn't recognise. Type all four MCP signatures and
both routes as TagsMatch, list the five modes in the tool docstrings, and
make the parser raise instead of falling back.
@nicoloboschi
nicoloboschi merged commit 89594d2 into main Oct 16, 2026
349 of 351 checks passed
@nicoloboschi
nicoloboschi deleted the fix/tags-match-strict-ingress branch October 16, 2026 10:42
@nicoloboschi nicoloboschi mentioned this pull request Nov 3, 2026
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.

MCP recall/reflect: a mistyped tags_match silently widens the scope to "any"

1 participant