Skip to content

fix(dispatch): refuse a prompt too large for the seat's known TPM ceiling - #107

Merged
fnnzzz merged 1 commit into
mainfrom
fix/dispatch-oversized-prompt-guard
Sep 9, 2026
Merged

fnnzzz merged 1 commit into
mainfrom
fix/dispatch-oversized-prompt-guard

Conversation

@fnnzzz

@fnnzzz fnnzzz commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

  • pick --prompt-bytes has refused to seat an oversized prompt since the registry gained token_limits, but dispatch — reachable directly by naming an agent id, which by definition skips pick — never checked the same ceiling before sending. Two live HTTP 413s on groq-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 same effectiveTokenCeiling check pick already 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.
  • New: inheritedTokenLimits(registry, entry) in lib/pick.js, extracted from pickAgents' 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 fail
  • New unit tests: lib/dispatch.prompt-size.test.js, lib/pick.inherited-limits.test.js
  • Manual smoke test against the live pool: oversized prompt to groq-gpt-oss-120b refuses cleanly (exit 4, no network call); --allow-oversized-prompt bypasses and dispatches for real

🤖 Generated with Claude Code

…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.
@fnnzzz
fnnzzz merged commit bc49f99 into main Sep 9, 2026
2 checks passed
@fnnzzz fnnzzz mentioned this pull request Sep 10, 2026
1 of 3 tasks
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