Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#115 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
28/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

场景 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。

主要语言
Rust
星标
4
派生
0
平均合并
5 小时 32 分钟
30 天内合并 PR
7

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jeffkit/recursive 的其他 Issue

查看 jeffkit/recursive 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。