Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng
#114 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
api, backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Rust
Star
4
Fork
0
Merge trung bình
5 giờ 32 phút
Pull request đã merge (30 ngày)
7

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của jeffkit/recursive

Tất cả issue của jeffkit/recursive

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.