🤖 fix: Token Budget stage Continues ignore turns whose end an outside client owns (ACP, xum run)

Đang mở
#7,235 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
3-5 ngày
Mức phù hợp với người mới
34/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Start by reading TokenBudgetStrategy.onContextBudgetStepSettled and enqueueContinuation in src/node/services/contextManagement/, then compare the externally owned turn checks in StopContinuationProvenance and AgentSession. Decide how warn and rollover stages should behave when an outside client owns turn completion; done means both paths avoid running an unobserved Continue. The issue says this work belongs to the #5286 lane.

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

Mô tả

Found during review of #7231 (Codex thread PRRT_kwDOPxxmWM6vYpvt). This gap exists on main.

Problem

A Token Budget stage that comes due when a step settles stops the turn and queues a "Continue" (TokenBudgetStrategy.onContextBudgetStepSettled → enqueueContinuation). Nothing in src/node/services/contextManagement/ checks whether a client outside the session owns the turn's end. That client is an ACP prompt, whose prompt() resolves on the stream-end, or a callerOwnsTurnEnd session such as xum run. For such a turn, the client takes the stopped turn's stream-end as completion and can exit. The Continue, and the work after it, then run without that client observing them. enqueueContextContinuation also strips the ACP correlation fields.

The turn.stop hook continuations already gate on this (StopContinuationProvenance.externallyOwnedTurn, AgentSession.isExternallyOwnedTurn). #7231 gates its new refusal-fallback handover the same way, with AgentSession.isExternallyOwnedSend.

Proposed fix

Decide what a budget stage does for an externally owned turn. Option A: do not stop for a warn stage (keep working, and leave the warning for the next send). Option B: keep the stop, but end the turn without a Continue. A rollover stop needs the same decision.

Trigger

The next change to Token Budget settlement. Owner: the #5286 lane.


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

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

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.