feat(routing): route harness-protocol turns up, never down; auto-detect claimed-tool-unavailable - #935
Conversation
…ct claimed-tool-unavailable Adds three deterministic turn classifications (harness_meta, sub_agent_harness_meta, recovery) and a post-routing clamp that escalates those turns to claude-opus-5 unless the resolved decision is already a Claude-family TierHigh model. Sub-agent harness turns no longer take the cheap sub-agent hard-pin; usage-bypass, operator hard pins, /force-model pins, and loop escalation all outrank the clamp; kill switch is ROUTER_HARNESS_ESCALATION_ENABLED (default on). The policy sidecar keeps a stable turn-type vocabulary via TurnType.Base() while telemetry records the full new values. Also adds a capture-gated post-stream detector that writes source=auto rating=down router_feedback rows when a response claims a tool is unavailable that the request actually declared - persist-only, LRU-deduped per (session, role, tool). Motivated by a large agentic session where a sub-agent turn "Load EnterPlanMode tool schema" was served by a flash-tier model that could not drive the deferred-tool protocol, silently losing plan mode. Co-Authored-By: Weave Router <router@workweave.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
PR author is not in the allowed authors list. |
|
Claude finished @devin-ai-integration[bot]'s task —— View job
Posted 9 committable comment-length suggestions on PR #935. All are advisory; none block merge. |
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8aad632. Configure here.
|
Claude finished @devin-ai-integration[bot]'s task —— View job Claude finished @devin-ai-integration[bot]'s task — View job
Posted 6 committable comment-length suggestions on PR #935. All are advisory; none block merge. |
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
|
Claude finished @devin-ai-integration[bot]'s task —— View job Claude finished @devin-ai-integration[bot]'s task — View job
Posted 4 committable comment-length suggestions on PR #935. All are advisory; none block merge. |
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
|
Applied the first two rounds of comment-length suggestions (commits 7a42241, 7fa2f2d). Politely declining further rounds: the comments now meet the documented convention (root AGENTS.md — concise, why-only), CI is green, and the advisory check is non-converging by design. Happy to revisit if a human reviewer flags a specific comment. |
|
Claude finished @devin-ai-integration[bot]'s task —— View job Claude finished @devin-ai-integration[bot]'s task — View job
Posted 6 committable comment-length suggestions on PR #935. All are advisory; none block merge. |
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
|
Claude finished @devin-ai-integration[bot]'s task —— View job Claude finished @devin-ai-integration[bot]'s task — View job
Posted 3 committable comment-length suggestions on PR #935. All are advisory; none block merge. |
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
|
Claude finished @devin-ai-integration[bot]'s task —— View job Claude finished @devin-ai-integration[bot]'s task — View job
Posted 4 committable comment-length suggestions on PR #935. All are advisory; none block merge. |
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
|
Claude finished @devin-ai-integration[bot]'s task —— View job
Posted 3 committable comment-length suggestions on PR #935. All are advisory; none block merge. |
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.

Summary
Rewrite of #921 by @makosblade (all credit for the design and implementation to them) — reimplemented on a fresh branch off main to align with internal conventions and fix two bugs found in review.
Behavior (as in the original PR):
HarnessMeta,SubAgentHarnessMeta,Recoveryininternal/router/turntype, withBase()mapping back to the stable policy vocabulary andHarnessEscalation()marking turns that must be served by a strong Claude-family model.applyHarnessEscalationclamps the per-turn decision (runTurnLoop=runTurnLoopInner+ clamp) to Anthropic Opus — per-turn only, never written to session pins. Kill switch:ROUTER_HARNESS_ESCALATION_ENABLED.source="auto"negativeRouterFeedbackEvent(claimed-tool-unavailable:<tool>), deduped per (session, role, tool) via expiring LRU. Persist-only; never influences live routing.catalog.IsClaudeFamily,translate.ClaudeCodeOnlyToolNames(),translate.ReasonHarnessEscalation,RequestEnvelope.LastUserToolResultErrorText.Fixes over #921:
NewServicenow initializesclaimedToolTracker(it only initializedspiralTracker, so the nil guard inmaybeReportClaimedToolUnavailablemade the auto-feedback path dead in production). Regression test constructs viaNewServiceand asserts a row persists.SubAgentHarnessMetais gated ontranslate.FormatAnthropic, mirroring the main-turn gate — OpenAI/Gemini sub-agent dispatches mentioning "plan mode"/"tool schema" now stay on the cheapSubAgentDispatchpath instead of escalating to Opus. Regression tests for all three formats.turntype/AGENTS.mdandCLAUDE.mdkept verbatim-identical.make precommitandmake testpass.Link to Devin session: https://app.devin.ai/sessions/6f4da5e234fd42cb83560f40a52e6a2b
Requested by: @steventohme