





















@@ -194,13 +194,14 @@ describe("session cost usage", () => {
194194});
195195});
196196197-it("preserves an operator-configured zero-cost model as a complete $0, not missing", async () => {
198-const root = await makeSessionCostRoot("cost-intentional-free");
197+it("counts token usage for a configured all-zero model as missing because pricing is still unknown", async () => {
198+const root = await makeSessionCostRoot("cost-configured-zero-unknown");
199199const sessionsDir = path.join(root, "agents", "main", "sessions");
200200await fs.mkdir(sessionsDir, { recursive: true });
201201202-// Same shape of turn, but here the operator deliberately priced the model at 0
203-// (e.g. a local/self-hosted free model). That intentional $0 must be respected.
202+// Same shape of turn, with a configured all-zero cost block. After config defaults,
203+// omitted cost and explicit all-zero cost are indistinguishable, so a zero-rate
204+// token-burning turn is still safer to report as missing than as complete $0 spend.
204205const entry = {
205206type: "message",
206207timestamp: new Date().toISOString(),
@@ -225,8 +226,8 @@ describe("session cost usage", () => {
225226"utf-8",
226227);
227228228-// The operator explicitly configured this model's price as 0 — an intentional
229-// "free" price that must be preserved as complete $0 cost data.
229+// This mirrors normalized config where a model declaration without pricing has
230+// already received default zero rates.
230231const config = {
231232models: {
232233providers: {
@@ -247,8 +248,7 @@ describe("session cost usage", () => {
247248const summary = await loadCostUsageSummary({ days: 30, config });
248249expect(summary.totals.totalTokens).toBe(23287);
249250expect(summary.totals.totalCost).toBe(0);
250-// Operator-configured $0 is intentional and complete — not a missing entry.
251-expect(summary.totals.missingCostEntries).toBe(0);
251+expect(summary.totals.missingCostEntries).toBe(1);
252252});
253253});
254254此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。