fix: bound tool results and escalate the completion budget #100
No reviewers
Labels
No labels
move-to-repo
coilyco-bridge-deploy
move-to-repo
coilyco-flight-deck-agent-compose
move-to-repo
coilyco-gaming-eco-app
move-to-repo
coilysiren-inbox
move-to-repo
unknown
🔒⚠️📦⚠️🔒 SANDBOXED 🔒⚠️📦⚠️🔒
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
c#
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
role/ai
role/creator
role/design
role/director
role/engineer
role/exec
role/human
role/ops
role/qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-gaming/sirens-echo!100
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/tool-inflated-completion-budget"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the 20% turn failure rate reported at #86.
The chain
Tool results re-inject into the next request, which took a 6k prompt past 47k on four parallel Eco calls. The model then spent the whole fixed 900-token completion budget on
reasoning_contentand returned empty content withfinish_reason: length. The single repair retried at the same budget and hit the same wall.The trigger was never question difficulty. It was whether the turn reached for a tool, which is why the failure rate was worst on ordinary member questions and zero on trivial and identity checks.
Why nothing reported it
A truncated completion is a valid response at the transport layer, so Agent Proxy and LiteLLM both logged
outcome=ok.Worse, the runtime could not see it either:
finish_reasonwas not captured from the response at all, so a truncated completion was indistinguishable from a finished one that happened to be empty. Capturing it is the smallest part of this change and the one that makes the rest possible.Two bounds, because cause and symptom differ
Tool results are capped before re-injection. Only the copy entering the prompt is bounded, and the model sees a truncation marker. The full result is kept for grounding validation, so bounding cannot make the runtime accept an action claim it should reject.
The completion budget escalates on a completion that is both truncated and empty, from 900 to a cap of 3600 across two raises, then fails with an error naming the truncation rather than a generic contract failure.
Raising alone would treat the symptom, since a larger prompt finds the new ceiling too. Bounding alone leaves any turn that still overruns failing at a fixed wall.
Truncated output that is not empty is a usable answer and does not raise. That case is tested.
Negative-tested
Disabling the escalation fails both budget tests. Disabling the bound fails the tool-result test. Verified in both directions rather than assumed.
Timing
Worth landing before the composed role bundle from #98, since a role identity makes the system prompt materially larger and pushes directly into this failure.
Not addressed here
The issue also notes latency degrading under 4-way concurrency, p95 25.85s and max 43.44s. That is a separate concern from the failure rate and wants its own measurement against current main.
Verification
pre-commit run --all-filesexit 0,go vet, andgo test -count=1 -race ./...all pass.