feat(router): make requiresSearch authoritative over TaskType default - #45
Merged
Merged
Conversation
Add src/matrices/search-policy.ts as the canonical home for search-task policy: isSearchTask(type) preserves the legacy per-TaskType default, and requiresSearchProvider(task) lets an explicit TaskDescriptor.requiresSearch override it. resolveRoute now selects the search provider via requiresSearchProvider, closing the leak where choosing a research-flavoured TaskType (e.g. MARKET_RESEARCH) implied a provider even when the caller already had normalized evidence and set requiresSearch:false. perplexity-matrix.ts now sources isSearchTask from search-policy and re-exports it for backward compatibility. Both predicates are exported from the package root. Adds tests/search-policy.test.ts covering the routing matrix. Bumps the coordinated runtime version 1.1.1 -> 1.1.3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0113q8LZSPWWX8NAKpBzHzsw
|
18 tasks
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
Make an explicit
TaskDescriptor.requiresSearchauthoritative over the legacy per-TaskTypesearch default, so callers with normalized evidence can opt out of the search provider.Type of Change
What changed
src/matrices/search-policy.ts:isSearchTask(type)— preserves the legacy per-TaskTypedefault verbatim (backward compatible).requiresSearchProvider(task)— explicit capability wins:requiresSearch === true → search,=== false → general reasoning,undefined → legacy default.resolveRoutenow selects the search provider viarequiresSearchProvider(task)instead ofisSearchTask(task.type). This closes the leak where choosing a research-flavouredTaskType(e.g.MARKET_RESEARCH) implied Perplexity even when the caller already had evidence and setrequiresSearch: false.perplexity-matrix.tsnow sourcesisSearchTaskfromsearch-policy.tsand re-exports it (single source of truth, no consumer breakage). Both predicates are exported from the package root.tests/search-policy.test.tscovers the routing matrix:TaskType+ no flag → searchTaskType+requiresSearch:true→ searchTaskType+requiresSearch:false→ generalCONTENT_GENERATION+requiresSearch:false→ generaltrueoverriding a non-search default1.1.1 → 1.1.3for the coordinated runtime rollout (Website-Bot + SEO-Bot pin this exact version).Verification
search-policy.ts,perplexity-matrix.ts,types.ts) typecheck clean understrict+verbatimModuleSyntax.requiresSearch, and the oneMARKET_RESEARCHtest omits it → still routes to Perplexity (unchanged).vitestsuite runs in CI (blocked in the authoring sandbox only by the private@quantum-l9/graphiti-memory-clientregistry dependency).Governance Checklist
isSearchTaskpreservedBreaking Change
Additive. Behavior only changes for callers that explicitly set
requiresSearch, which is the intended fix; theundefinedpath is identical to today.Rollback Plan
Revert this PR.
resolveRoutereturns toisSearchTask(task.type);search-policy.tsis self-contained and its removal has no other consumers beyond the re-export inperplexity-matrix.ts.Related Issues
Part of the l9.website-intelligence/v1 seam (LLM-Router explicit-search semantics). Paired with Website-Bot and SEO-Bot PRs on the same branch.
🤖 Generated with Claude Code
https://claude.ai/code/session_0113q8LZSPWWX8NAKpBzHzsw
Generated by Claude Code