Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Closed
#114 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
api, backend

Research direction

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.

Written by the indexing model from the issue text.

Description

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

Dominant language
Rust
Stars
4
Forks
0
Avg merge
5h 32m
Merged PRs (30d)
7

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jeffkit/recursive

All issues in jeffkit/recursive

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.