fix(cost): 失败 turn 与 compaction 摘要的 token 从不入账——账目系统性偏低(与 #94 死字段叠加=预算治理双重失效)
维护者通常 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-418provider.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 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
jeffkit/recursive 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 66/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
jeffkit/recursive#134 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
jeffkit/recursive#131 · 1 条评论 ·
维护者通常 1 天内回复
查看 jeffkit/recursive 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
zcashlabs/thus-spoke-zakura#153 ·
维护者通常 1 天内回复
-
app bug windows-os
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
editor good first issue
难度 2/5 1-3 小时 新手友好度 65/100
funnyboy-roks/inq#54 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
[Bug]: Bedrock request metadata forwarding does not work for /embeddings可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug llm translation
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复