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

🤖 perf: the chat-input handoff countdown uses provider usage while Token Budget stages open on the request estimate

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend, desktop

Research direction

Start with src/common/utils/compaction/autoCompactionCheck.ts and src/browser/components/CompactionWarning/CompactionWarning.tsx, then read tests/ipc/tokenBudgetStages.fixture.integration.test.ts and the referenced changes in #7214 and #7332. Trace how the request estimate reaches the renderer and how the countdown is shown. Done when Token Budget mode never displays a handoff countdown after the handoff row has been delivered.

Written by the indexing model from the issue text.

Description

Found by the Codex review of #7332 (thread PRRT_kwDOPxxmWM6vk5R2). The problem already exists on main. No fix is in #7332.

Problem

In Token Budget mode, the chat-input bar counts down with "Handoff target in N% usage". It computes N from provider-reported usage (checkAutoCompaction in src/common/utils/compaction/autoCompactionCheck.ts, rendered by src/browser/components/CompactionWarning/CompactionWarning.tsx). The handoff and final stages open on the request estimate instead:

  1. Since #7214, the turn start opens a stage when the built request's estimate reaches its point.
  2. #7332 makes settlement use the same next-request estimate.

The estimate runs above provider usage (OpenAI about 1.3–1.6 times, Claude about 1.04–1.36 times, see #5223). So the handoff row can already be delivered while the bar still shows "Handoff target in N% usage". At a 70% target and 1.3–1.6 times, the handoff comes at about 44–54% provider usage. The bar stays hidden until 60%.

Evidence

  • On main, the fixture test "estimate-only crossing (R2a)" in tests/ipc/tokenBudgetStages.fixture.integration.test.ts delivers a handoff while saved usage stays far below every stage point.
  • CompactionWarning.tsx builds the countdown text from usagePercentage only.

Options

  1. Show the request estimate in the bar: send the last request estimate to the renderer and count down from it.
  2. Drop the countdown in Token Budget mode: show only "Past the handoff target" after the handoff row exists, and no percentage before.

Acceptance

  • In Token Budget mode, the bar never shows a countdown to a handoff that the window already received.

Refs #5223, #7214, #7332.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $527.71

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.