fix(routing): route short greetings to simple tier when tools attached#1561
Merged
brunobuddy merged 1 commit intomainfrom Apr 13, 2026
Merged
fix(routing): route short greetings to simple tier when tools attached#1561brunobuddy merged 1 commit intomainfrom
brunobuddy merged 1 commit intomainfrom
Conversation
The scorer's short-message fast path was gated on `!hasTools`, so personal AI agents like OpenClaw (which always send a tools array) skipped it entirely and fell into full scoring. Session momentum could then pull a one-word "hi" up to the complex tier. Drop the gate so short prompts without complex keywords short-circuit to simple regardless of tool presence. Short technical prompts like "Debug this function" still fall through to full scoring thanks to the existing complex-signal check added in #1172.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1561 +/- ##
=======================================
Coverage 97.94% 97.94%
=======================================
Files 118 118
Lines 8614 8614
Branches 3240 3240
=======================================
Hits 8437 8437
Misses 175 175
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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
!hasTools, so personal AI agents like OpenClaw (which always send atoolsarray) skipped it entirely and fell into full scoring.applyMomentumassigns a very high weight to very short messages (~0.56for a 4-char prompt), so any session that recently saw complex traffic pulledhi/holaup to complex.!hasToolsgate lets short, non-technical prompts short-circuit tosimplebefore momentum can inflate them. ThehasComplexSignalcheck added in routing: short non-tool prompts under 50 chars bypass scoring and always route simple #1172 still forces full scoring for short technical prompts likeDebug this function.Test plan
npx jest src/scoring— 268 passednpx jest(full backend unit suite) — 3535 passednpx tsc --noEmit(backend) — cleannpm run test:e2e --workspace=packages/backend— 107 passed (updatedrouting-flow.e2e-spec.tstools-floor case to use a long message so it still exercisesapplyTierFloors)npm test --workspace=packages/frontend— 2110 passednpx tsc --noEmit(frontend) — cleanscoring/index.tsstays at 100% line and branch coverageholathrough OpenClaw in cloud mode, confirm the message log showssimple/short_messageinstead ofcomplex/momentumNotes
packages/backend/src/routing/resolve.service.spec.tsandpackages/backend/test/routing-flow.e2e-spec.tshad tests that explicitly asserted tools force non-simple on a short message. Both were switched to a long message so they still exercise theapplyTierFloorstools-floor branch instead of the fast path.hola,bonjour, etc.) are intentionally not added tosimpleIndicators— the fix here is in the fast-path gate, not the keyword list.codeGeneration/technicalTermskeyword lists are untouched.Summary by cubic
Route short greetings to the simple tier even when tools are attached, preventing momentum from promoting one‑word prompts to complex. Short technical prompts still go through full scoring via the existing complex‑signal check.
!hasToolsgate from the short-message fast path inscoreRequest, so non-technical short prompts short-circuit tosimple.Written for commit 43590ad. Summary will update on new commits.