Repository navigation
fix(query): strip a trailing question mark before capping the core subject - #1363
Merged
iliaal merged 2 commits intoNov 3, 2026
Merged
Conversation
Contributor
[Medium impact] The PR appears safe to merge; no actionable new issues were found. Summary
Reviews (2) · Last reviewed commit: "test: isolate doctor retry sleep from su..." · Reviewed by Greptile |
Collaborator
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.
Summary
query.extract_core_subject()only removed a trailing?/!/.on the path withoutmax_words, and only at the very end. So every caller that passesmax_words(the X adaptersbird_xandxquik,threads,planner,pipeline) kept the question mark, and the last word of a question never matched a noise word or a suffix:For X the core subject goes into a literal keyword search, so
code?ends up as a search term. The fix strips the closing punctuation once, right after lowercasing and before the prefix/suffix/noise phases. The existing finalrstripis unchanged, and an input that is only punctuation still falls back to itself.Testing
uv run pytestTwo tests in
tests/test_query.py(TestMaxWords):test_max_words_strips_trailing_punctuationandtest_trailing_punctuation_does_not_hide_last_noise_word. Both fail onmain('claude code?','claude code practices?') and pass with the fix. Full suite:uv run pytest -n 4gives 6952 passed, 19 skipped.Changelog
If this change should appear in the next release notes, add a fragment under
changelog.d/(seechangelog.d/README.mdand CONTRIBUTING.md). Do not editCHANGELOG.mdor bump version/manifest files in this PR.changelog.d/<pr-or-issue>.<type>.md(types:added,changed,fixed,removed,deprecated,security)skip-changeloglabel)Added
changelog.d/+core-subject-trailing-punctuation.fixed.md.Agent disclosure
I used an AI assistant while preparing this change; I reviewed the code and ran the tests above.
AI review
Checked that the change only touches trailing
?/!/.(inner punctuation such asnext.jsorc++is untouched), that the existingtest_query.py/test_query_v3.pyexpectations still hold (including the all-noise fallback and the "only the first prefix is stripped" case), and that a punctuation-only topic still returns non-empty text. Nothing else was flagged.Security
N/A
Notes
None.
Relationship to this change
Related issues
N/A