Repository navigation
feat(tools): add opt-in literal keyword discovery - #6659
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the stated contract and includes focused regression coverage.
0 open findings
What changed in this PR
Adds opt-in literal keyword discovery for deferred MCP tools while preserving existing regex and exact-selection behavior.
Changes:
- Implements bounded, case-insensitive keyword ranking.
- Adds regression coverage for ranking, limits, Unicode, and promotion.
- Synchronizes user and contributor documentation.
| File | Description |
|---|---|
README.md |
Documents keyword query semantics. |
backend/tests/test_deferred_keyword_search.py |
Covers keyword discovery behavior. |
backend/packages/harness/deerflow/tools/builtins/tool_search.py |
Implements literal keyword ranking. |
backend/packages/harness/deerflow/tools/AGENTS.md |
Records the query contract. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
WillemJiang
approved these changes
Oct 11, 2026
1 task done
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.
Related to #6658
Why
Deferred discovery treats
notebook jupyteras a regex, so it missesjupyter_notebookdespite both terms being present. Its tool description also incorrectly labels a bare phrase as keyword search.What changed
Add
keywords:for case-insensitive literal substring matching across names and descriptions in any term order. Rank by distinct term coverage, then name hits, with stable catalog ties and a five-tool cap. Process at most 256 characters after the prefix and 16 unique whitespace-separated terms; punctuation remains literal.Bare regex queries,
+required, exact uncappedselect:, and schema promotion remain unchanged. Align the English tool description, README, and tools AGENTS guidance, and add regression tests.Surface area
frontend/backend/applanggraph.json, or prompt changedocker/or sandboxed executionskills/backend/pyproject.tomlorfrontend/package.json(say what it buys us)Screenshots / Recording
Not applicable; no UI changes.
Validation
On Windows with Python 3.12 and
PYTHONPATH=.:uv run --no-sync ruff check .anduv run --no-sync ruff format --check .inbackend/: passed.uv run --no-sync pytest tests/test_deferred_keyword_search.py tests/test_deferred_catalog.py tests/test_deferred_setup.py tests/test_tool_search.py tests/test_deferred_filter_middleware.py tests/test_thread_state_promoted.py -qwith a temporary cache directory: 57 passed.python scripts/check_agent_guidance.py --base-ref origin/main --head-ref HEAD: 0 errors, 0 warnings.make testarguments all finished with exit code 1: 28,217 passed, 96 failed, 1,070 skipped, and 5 errors in total. Failures span existing channel, extension, shell, sandbox, file-reading, and web-extraction tests; no deferred-search test is listed among the failures. Observed errors include missing files (WinError 2), provider initialization failures (WinError 10106), and environment variables exceeding 32,767 characters. This is not a passing local full-suite result.python -m pytest tests/blocking_io -q --tb=short: 240 passed, 2 failed, 4 skipped. Failures: factory heartbeat assertion intest_agent_factory_construction.pyand memory timeout intest_dynamic_context_middleware.py.50cf8456: all eight runs across the implementation and CI branches completed successfully. On the CI branch, backend unit tests executed and passed all four shards and default-install collection; blocking IO, lint and agent guidance, frontend unit tests, and both replay layers executed and passed. These Linux CI results are separate from the failing Windows full-suite results above.AI assistance
Tool(s) used: Codex.
How you used it: Inspected the catalog and repository guidance, implemented the query mode and regression tests, synchronized documentation, and ran validation.