🤖 perf: Token Budget rolls over again when a fresh window's own estimate already reaches the hard ceiling
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 66/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start with src/node/services/contextManagement/strategies/tokenBudget.ts, the file named in the issue, and trace how a rollover handles a fresh window whose estimate reaches the hard ceiling. Find the related tests and add coverage for the next send after that rollover. Done means it warns or blocks and does not roll over again.
Written by the indexing model from the issue text.
Description
Split out of #5223 (its "Livelock guard" item). No fix is in the #5223 PR.
Problem
In Token Budget mode, a rollover starts a fresh context window. If that fresh window's own next-request estimate already reaches the hard ceiling, the next send rolls over again, and so does every send after it. Nothing stops the loop.
#5223 states the guard as: "when a fresh window's own estimate already reaches the ceiling, warn and continue or block instead of rolling over again."
Evidence (from #5223)
- Live UAT on a 60k window: one session fell into an 8-rollover livelock. The fresh window's own estimate (51.8k) reached the hard ceiling (51,808), so every send rolled over again.
- On a 200k window the fresh window is about 56k by estimate, so the livelock needs an unusually small window.
- Main has no guard for this today (checked in
src/node/services/contextManagement/strategies/tokenBudget.tsat 8c31fc7ac2).
Options
- Warn and continue: send the request without another rollover and show a warning that the window is too small for the fresh context.
- Block: refuse the send with an error that says the fresh context does not fit this model's window.
Acceptance
- Test: a fresh window whose own estimate reaches the hard ceiling does not roll over again on the next send. It warns or blocks, as chosen.
Refs #5223, #4858.
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $523.18
- Dominant language
- TypeScript
- Stars
- 2.1k
- Forks
- 140
- Avg merge
- 4h 57m
- Merged PRs (30d)
- 946
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/xum
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
🤖 fix: a Daytona connection test started before a settings save can show the old key as connectedOpen
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
Similar issues
-
bug require-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
expressjs/expressjs.com#2549 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
umami-software/umami#4686 · 1 comment ·
Maintainers usually reply within 2 days
-
[Bug]: Device screenshot fails with 500 on iPhone Duo (Xcode 27.2): serve-sim calls simctl without --displayPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
pingdotgg/t3code#24900 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
inu-appcenter/UNIDorm-web#411 ·
Maintainers usually reply within 1 day
-
🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days