fix(runtime): keep unpriced turns distinguishable from free ones after reload

オープン
#4,683 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@dgageot がすでに取り組んでいます。

2026年10月21日 から。

評価

この issue はまだ評価されていません。

説明

area/api area/runtime area/sessions

Problem

When a model has no known price (not in the models.dev catalogue and no cost: override), the runtime records the turn's cost as $0, with a warning (loop.go). chat.Message.Cost and the compaction item's Cost are plain float64, so the distinction is lost on save.

In memory, hooks, telemetry and the budget tracker already tell the two apart: nil means unpriced, 0 means free (BudgetUsageEvent.Unpriced). After a session is saved and reloaded, every unpriced turn reads as free, and session totals understate the real cost without saying so.

Proposal

  • Persist whether a message's (and a compaction item's) cost is known, additively, e.g. an unpriced flag next to cost in the stored JSON.
  • Surface it in session totals and the API: "$1.23 + unpriced turns" rather than "$1.23".
  • Keep old sessions readable; their missing flag means "priced".

Acceptance criteria

  • An unpriced turn stays unpriced after a SQLite save and reload, and a free one (cost: {}) stays free.
  • Session totals and the API distinguish them.
  • Old sessions load unchanged.

Found while planning #4654.

主要言語
Go
スター
4.7k
フォーク
565
平均マージ
18時間 52分
マージ済み PR(30日)
221

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

docker/docker-agent のほかの issue

docker/docker-agent の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。