Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

🤖 perf: Token Budget rolls over again when a fresh window's own estimate already reaches the hard ceiling

Open
#7,331 0 comments 0 reactions 0 assignees View on GitHub

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.ts at 8c31fc7ac2).

Options

  1. Warn and continue: send the request without another rollover and show a warning that the window is too small for the fresh context.
  2. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coder/xum

All issues in coder/xum

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.