fix(http): HTTP 模式会话成本归零——不落 cost.json/meta、冷加载计数清零、客户端拿不到任何 USD
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
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-1264prompt_tokens_arc.fetch_add(...);创建时初始化 0(handlers.rs:467-468)。 - 落盘只写 JSONL:
storage/local.rs:64-85save_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-stepUsage事件在 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jeffkit/recursive
-
Difficulty 3/5 Half a day Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
jeffkit/recursive#141 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
jeffkit/recursive#138 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
jeffkit/recursive#134 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 1 day
All issues in jeffkit/recursive
Similar issues
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 90/100
fastrevmd-lab/rustmistmcp#161 ·
-
arch-audit refactor
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
SocketDev/socket-patch#1011 ·
Maintainers usually reply within 1 day
-
bug user-priority/P2
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
opencode: an unanswered --version probe launches opencode 2 without per-session service isolationOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
security-advisory
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MinBZK/regelrecht#1686 ·
Maintainers usually reply within 1 day