Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#7,337 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend, desktop

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
2.1k
Fork
140
Merge trung bình
3 giờ 23 phút
Pull request đã merge (30 ngày)
953

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của coder/xum

Tất cả issue của coder/xum

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.