[Improve] Re-land the router lookup gate (gate only, no model changes)#728
Draft
daniel-lxs wants to merge 4 commits into
Draft
[Improve] Re-land the router lookup gate (gate only, no model changes)#728daniel-lxs wants to merge 4 commits into
daniel-lxs wants to merge 4 commits into
Conversation
Re-lands #716's two-step gate (precheck without tools; fetch linked-issue context only on needsExternalLookup=true) after the #726 revert. The routing model is now resolved as context.routingModel -> R_ROUTER_MODEL -> undefined, deferring to the deployment small-model resolution. No model id is hardcoded: the correct id depends on the deployment's provider configuration (openrouter/google/... via OpenRouter vs google/... direct), which is what broke routing in production — google/gemini-3.6-flash resolved to the unauthenticated direct Google provider and every routing call fell back to the manual picker. The routing decision's model field reports the resolved id when an override is set and the roomote-small-model label otherwise. Verified through the real routeTask against the production provider path (scripts/verify-reland.ts): default -> routed on the deployment small model; R_ROUTER_MODEL=openrouter/google/gemini-3.6-flash -> routed on Gemini with the id in debug output; the incident's message routes to the right environment in both. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
2 issues outstanding. See task
Reviewed 0d07fb4 |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per review: the router model stays exactly as on develop (context.routingModel -> deployment small model). types.ts and router-service.ts are now zero-diff against develop; the PR touches only mcp-gather.ts (the two-step gate), its tests, and the verify-reland script. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Re-lands the two-step lookup gate from #716 (reverted in #726) with all model-resolution changes stripped per review.
types.tsandrouter-service.tsare zero-diff againstdevelop— the router model remains exactly what it is today (context.routingModel→ deploymentR_SMALL_MODEL), for every routing call including the gate's precheck and the informed re-route.What this PR is now
One behavior change, in
mcp-gather.tsonly: routing runs a tool-free precheck first, and the linked-issue fetch from #693 (up to 8s) executes only when that precheck returnsneedsExternalLookup=trueand URL parsing finds a fetchable issue link. When context is fetched, routing runs once more with the issue as untrusted reference material (phase: 'mcp'); every degraded case — no lookup requested, no links, integration down, deadline expired — ships the precheck decision (phase: 'direct'), preserving fail-open.Incident linkage
The 2026-07-23 routing outage was caused solely by #716's hardcoded
google/gemini-3.6-flashdefault resolving to the unauthenticated direct-Google provider (ProviderAuthError→ fallback picker on every message). The gate was never implicated — the throw happened before gate code ran. This PR contains no model ids and no model logic.Verification
pnpm knip,tsc --noEmit,format:checkclean.routeTask+ OpenCode provider path (scripts/verify-reland.ts): the incident's exact message ("Review the README in the Roomote repo") routes to theRoomoteenvironment, confidence 0.99,model="roomote-small-model",phase: 'direct', zero fetches.Related
🤖 Generated with Claude Code