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

fix(http): HTTP 模式会话成本归零——不落 cost.json/meta、冷加载计数清零、客户端拿不到任何 USD

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

Grep for CostTracker to see how agui_session.rs and the CLI wire it in, then compare the HTTP path in handlers.rs (counters at 1259-1264, init at 467-468) and storage/local.rs save_transcript (64-85), which writes JSONL with no meta or cost. Cold-load restoration sits at http/cold_load.rs:126-127, and per-step Usage events are dropped at handlers.rs:1398-1401. Done means HTTP sessions persist cumulative usage plus model to storage meta, cold loads restore them, and GET /sessions/:id/usage returns cache-split totals with USD.

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

描述

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

基线 origin/main = fc29f3d4。

Summary

  • HTTP 路径只有内存原子计数:handlers.rs:1259-1264 prompt_tokens_arc.fetch_add(...);创建时初始化 0(handlers.rs:467-468)。
  • 落盘只写 JSONL:storage/local.rs:64-85 save_transcript 无 meta、无 cost;HTTP 全程未接 CostTracker(grep 仅 cost.rs/agui_session.rs/CLI)。
  • 重启即归零:http/cold_load.rs:126-127 恢复的 token 计数器硬编码 0(从未存过,无从恢复)。
  • 客户端面全缺:SessionInfo 仅 id/created_at/message_count;RunResponse.usage 无 cache 拆分无 USD;per-step Usage 事件在 SSE 被丢(handlers.rs:1398-1401)。

建议

HTTP 会话接入同源记账(或 teardown 时把累计 usage+模型写存储 meta);提供 GET /sessions/:id/usage(cache 拆分+USD);冷加载从存储回填;加 recursive_cost_usd_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 摘要。