Repository navigation
fix(dispatch): refuse a prompt too large for the seat's known TPM ceiling - #107
Merged
Merged
Conversation
…ling pick has refused to SEAT an oversized prompt since token_limits landed (#51), but dispatch — reachable directly by any caller naming an agent id, skipping pick entirely — never checked the same ceiling before sending. Two live 413s on groq-gpt-oss-120b (2026-09-08/09) requested 17124 and 22583 tokens against an observed ceiling of 8000 that had not moved in days: the ceiling was known, nothing had consulted it. runAny now runs the same effectiveTokenCeiling check pick already uses (declared token_limits, inherited from a same-voice sibling when the entry declares none, or the fresher observed ceiling) right after assembling the full prompt, and refuses before dispatching — same precheck/recordFailure/throw shape as the existing transport refusal. --allow-oversized-prompt (CLI) / allow_oversized_prompt (MCP) opts out deliberately, mirroring --require-base's opt-in-only shape.
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
pick --prompt-byteshas refused to seat an oversized prompt since the registry gainedtoken_limits, butdispatch— reachable directly by naming an agent id, which by definition skipspick— never checked the same ceiling before sending. Two live HTTP 413s ongroq-gpt-oss-120b(2026-09-08/09) requested 17124 and 22583 tokens against an observed ceiling of 8000 that hadn't moved in days: the ceiling was already known and correct, nothing had consulted it.runAny()now runs the sameeffectiveTokenCeilingcheckpickalready uses, right after the full prompt is assembled, and refuses (same precheck/recordFailure/throw shape as the existing transport refusal) unless the caller opts out.--allow-oversized-prompt(CLI) /allow_oversized_prompt(MCP) is the deliberate override, mirroring--require-base's opt-in-only shape.inheritedTokenLimits(registry, entry)inlib/pick.js, extracted frompickAgents' existing same-voice-sibling lookup, so a single dispatch can ask the same question pick already answers for a whole candidate list.Review
Consensus panel (4/4 seated, 4/4 responded, 4 distinct voices, round 1): unanimous APPROVE, 0 critical issues. Recommendations were all either already addressed in this diff (help text for the new flag, both surfaces) or informational (the 4:1 byte estimate is deliberately crude, matching pick's own).
Test plan
node --test lib/*.test.js→ 502 pass, 1 skipped (pre-existing), 0 faillib/dispatch.prompt-size.test.js,lib/pick.inherited-limits.test.jsgroq-gpt-oss-120brefuses cleanly (exit 4, no network call);--allow-oversized-promptbypasses and dispatches for real🤖 Generated with Claude Code