fix(headroom): clarify token diagnostics vs provider billing

Distinguish Headroom-reported token deltas from outbound payload size,
scrub credentials in logs, and warn on phantom savings when compressed
JSON barely shrinks. Refs #1998

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Sutarto Jordan Chrisfivo
2026-06-26 11:08:33 +07:00
committed by decolua
parent c7933de79c
commit fb543a1f39
4 changed files with 401 additions and 25 deletions

View File

@@ -66,8 +66,8 @@ describe("compressWithHeadroom", () => {
});
describe("formatHeadroomLog", () => {
it("formats savings", () => {
it("formats reported token deltas without implying provider billing savings", () => {
expect(formatHeadroomLog({ tokens_before: 100, tokens_after: 25, tokens_saved: 75 }))
.toBe("saved 75 tokens / 100 (75.0%) after=25");
.toBe("reported token delta=75 before=100 after=25 (75.0%)");
});
});