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

fix(cost): 失败 turn 与 compaction 摘要的 token 从不入账——账目系统性偏低(与 #94 死字段叠加=预算治理双重失效)

Đã đóng
#115 3 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
28/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ệ
rust
Lĩnh vực
ai-infra-agents

Hướng nghiên cứu

Start at the error return in src/run_core.rs:1373-1397, where a non-Cancelled/WallClock failure drops the accumulated total_usage instead of carrying it in make_outcome; trace how handlers.rs:317-321 and 1253-1256 consume failures, since those branches only call record_run_failed. Then read src/compact/mod.rs:413-418, where provider.complete's completion.usage is discarded, plus the CompactionBoundary paths at runtime.rs:458-475 and 620-627 that report stale or zero counts. Done means the diff threads partial usage through error and compaction paths and routes it into turn cost accounting.

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

Mô tả

场景 gap 单(okguitar 提报)· 优先级 P1 · 依赖:无 · 验收:代码 diff 逐点核对;运行时可见性另需 Langfuse(#124)

基线 origin/main = fc29f3d4。

Summary

  • src/run_core.rs:1373-1397:非 Cancelled/WallClock 错误走 Err(e) => return Err(e)——本 turn 已烧的 total_usage 随栈销毁;消费端确认丢弃(handlers.rs:317-321/1253-1256 失败分支只 record_run_failed 不接受 usage;CLI/AG-UI 的 record_usage 只在成功路径)。
  • compaction 整单丢失:src/compact/mod.rs:413-418 provider.complete(...) 只取 completion.content,completion.usage 被丢;CompactionBoundary 事件带的是上一轮 turn 的 cache 计数(runtime.rs:458-475);runtime.rs:620-627 另一路径写死 0。

影响

一次 compaction = 整段历史重发,是最贵单笔调用之一,却与"50 步后 provider 500"一样全记 0——配额/预算校准系统性乐观。

建议

错误路径回传 partial usage(kernel 已累计,Err 分支也 make_outcome 携带);compaction usage 累加进 turn/成本;单列 tokens_wasted_on_failure_total。

Ngôn ngữ chính
Rust
Star
4
Fork
0
Merge trung bình
5 giờ 32 phút
Pull request đã merge (30 ngày)
7

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 jeffkit/recursive

Tất cả issue của jeffkit/recursive

Issue tương tự

Thêm issue về Rust

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.