Skip to content

[Improve] Gate the linked-issue fetch on the routing precheck; default routing to Gemini 3.6 Flash#716

Merged
daniel-lxs merged 2 commits into
developfrom
feature/router-lookup-gate
Jul 23, 2026
Merged

[Improve] Gate the linked-issue fetch on the routing precheck; default routing to Gemini 3.6 Flash#716
daniel-lxs merged 2 commits into
developfrom
feature/router-lookup-gate

Conversation

@daniel-lxs

Copy link
Copy Markdown
Member

What changed

Follow-up to #693.

Two-step gate. gatherContextFromConfiguredMcps now runs a tool-free routing precheck first and only calls gatherExternalIssueContext when the precheck returns needsExternalLookup=true — finally wiring the signal that has been telemetry-only since the old two-step design. When context is fetched, routing runs once more with the issue as untrusted reference material and reports phase: 'mcp' with the tools used. Fail-open is unchanged: an unavailable integration, inaccessible issue, or empty fetch keeps the precheck decision (phase: 'direct').

Routing model default. Workspace routing (Slack/Linear/Discord/etc. and GitHub paths) now resolves its model as context.routingModel → new R_ROUTER_MODEL deployment override → google/gemini-3.6-flash, instead of falling through to the deployment-wide small model. The decision's debug model field now reports the actual resolved model instead of the roomote-small-model placeholder.

Why

#693 paid the issue-fetch deadline (up to 8s) on every routing call containing a pasted GitHub/Linear issue link, even when the message alone already routed. In the router external-lookup gate eval (24 labeled cases × 4 repetitions × 5 candidate models, run against the production routing prompt), roughly two-thirds of link-bearing messages routed correctly with no fetch — and Gemini 3.6 Flash was the only stable gate: 0% false lookups and 100% lookup recall in every repetition, at ~4.5s p50 per call. Fetched issue context took genuinely ambiguous links from ~50% blind accuracy to 100% for every model, so the fetch stays — it just only runs when it can change the decision.

Trade-off: when a lookup is needed, routing now costs two model calls plus the fetch (one extra call vs #693). The eval says that's the minority of link-bearing tasks.

Tests

  • Reworked the [Improve] Route tasks using linked issue context #693 routing test for the gated flow (precheck asks → fetch → informed re-route, phase: 'mcp').
  • New: precheck routes without external context → no MCP call, single model call, phase: 'direct'.
  • New: precheck asks but fetch fails → precheck decision stands, fail-open.
  • vitest run src/server/router: 12 files, 94 tests green; slack router-debug/auto-route consumers green; tsc --noEmit clean.

🤖 Generated with Claude Code

…ault routing to Gemini 3.6 Flash

The external issue fetch added in #693 ran before every routing call
with a pasted GitHub/Linear issue link, paying up to the 8s lookup
deadline even when the message alone already routed. Routing now runs a
tool-free precheck first and only fetches when it returns
needsExternalLookup=true, then re-routes with the issue as untrusted
context. Fail-open behavior is unchanged: an unavailable integration or
empty fetch keeps the precheck decision.

Routing inference now resolves context.routingModel, then the new
R_ROUTER_MODEL deployment override, then defaults to
google/gemini-3.6-flash instead of falling through to the deployment
small model. In the router external-lookup gate eval (4 repetitions,
5 candidates), Gemini 3.6 Flash was the only stable gate: it asked for
the issue exactly when the message alone couldn't route (0% false
lookups, 100% recall) at ~4.5s per call.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roomote-roomote

roomote-roomote Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

1 issue outstanding. See task

  • packages/cloud-agents/src/server/router/types.ts:29 The hard-coded google/gemini-3.6-flash bypasses the deployment-selected model and is passed directly to the OpenCode SDK. Deployments configured with OpenRouter, Bedrock, etc. but no GEMINI_API_KEY will now fail every Slack/Linear/Discord/GitHub routing call and fall back. Resolve this default through the configured provider or retain the deployment small-model fallback when no router override is set.

Reviewed 65087fd

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@daniel-lxs
daniel-lxs merged commit a3d7978 into develop Jul 23, 2026
16 checks passed
@daniel-lxs
daniel-lxs deleted the feature/router-lookup-gate branch July 23, 2026 14:43
daniel-lxs added a commit that referenced this pull request Jul 23, 2026
…; default routing to Gemini 3.6 Flash (#716)" (#726)

This reverts commit a3d7978.
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.

1 participant