Repository navigation
feat(accountant): Price proxy savings with the accountant library - #768
Merged
Merged
Conversation
Define one object model for the changes Cortex plugins make to a request, and one context-guru library that prices them in tokens for each tier. Cortex converts the tokens to dollars with its own rates. The model supports savings across requests and the payback of a cache break. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Price tokens after the last cache breakpoint as input, and tokens between B* and that breakpoint as cache write at its TTL. Define the counterfactual as "this change was never made". Allow one operation for each change unit, with spans for changes that are not contiguous, and use it for tool-prune. State that saved tokens come from the operation's own size. Shrink PosHash to 12 bytes so the memory estimate holds. Define the missing types and enums, explain the withdrawn R10, describe migration step 2 as new work, and sum the payback table from exact values. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
An operation with spans on both sides of the cache boundary needs a size for each span, or the library cannot price each part at its own tier. Add Before and After to Span, check that they add up to the operation's sizes, and show the sizes in the example. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
The spec moved here from rossoctl/cortex. It names files in both repos, so state which paths are Cortex paths. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Make an exhaustive list of test cases with the current saving computation before the ops module is built. The list states each case's expected tokens, the current figure, and whether the two are the same, differ on purpose, or are not covered. It validates ops, Cortex and the shadow steps. The context-guru proxy also computes its dollar savings from ops. Move the fingerprint comparison into ops so both hosts find B* the same way, and reorder the migration so the proxy switches first. List the current rules the model does not cover as open questions. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Use the thread's cache state (hot, cold, rescued) in every price. Start a cache-break penalty at the read extent, so the breakpoints decide its size. Add stateChange operations for keep-alive, cachesplit and the breakpoint TTL, and a ping operation that shares a change ID with the request it rescued. Let a change name the changes it ends, such as a summary of reduced messages. Put the session and thread IDs on every operation, so a subagent's saving is summed apart. Rewrite the example as one session with a coref break, a rescuing ping, a summary, a cold turn and a subagent. A script checked that each request's operations add up to the bill difference. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
A subscription user pays a fixed price and has a usage limit, so a saving is usage-limit headroom, not money. Keep the operations and the library the same for both plans, and add a Billing fact to each request and a payer to each spend and ping. The host converts tokens to dollars for an API user, and to usage-limit units for a subscription user, with a labelled API-equivalent figure that never enters a money total. Add the subscription case to the example and the test dimensions, and list the usage-limit weights as an open question. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
A spend or ping operation now carries the provider's billed usage of the call, so the host prices spend with the savings in one path. A call during a request travels with that request. A ping or a detached call travels as its own report through a Sink, which keeps the contract that CostRecorder had. Remove SpendID, and plan the removal of core/cost/spend, which today only logs. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
State why each request lists every change again: the producer already re-applies each change, the price depends on this request's position and cache state, and a register kept anywhere else breaks the pure library or fails on a gap. Size is the only cost, and a compact replay can come later without a model change. Make FirstApplied optional. tool-prune keeps no state, so it reports every replay with a ChangeID derived from its config and leaves FirstApplied unset. A config change gives a new ChangeID, and a removal inside the cached prefix is charged to tool-prune as a cache break. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
A change that is not reported on a request saves nothing on it, and each producer's change is measured at its own input, so a summary of reduced messages counts each token once in either pipeline order. The order changes who gets the credit, not the total. Remove Supersedes, Inherited and the supersession check. A report can still find why a change stopped from positions and the summary's span. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
No field refers to an operation in another request: every link across requests uses ChangeID. Say so in R6, and keep the operation ID for results, check failures and break attribution inside one request. A cacheBreak now names its cause by both IDs, so a penalty joins its change's total with no lookup. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
A change the pipeline reverted or the writeback discarded is not in the forwarded body, so it is not reported, as a change that ended. Its model call is still a spend operation. Replace Status with Projected, which observe mode needs, and leave projected operations out of the sum and conservation checks. Remove R13, Reversibility and StashKey. No pricing rule, check or attribution reads them, and cg's component API keeps the stash rule. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
No pricing rule, check or attribution reads them, and both depend on the component only, so a report can map Component to the taxonomy with a table in cg. A restore is now an add with Reverses set, the aggregate keys on Kind, and an unknown Kind is what R19 reports as unpriced. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Split section 4.6 into the two cases that build a RequestOps: the collector assembles one incrementally per request as plugins call pctx.ReportOps, but a ping or a detached call has no open request, so the keeper or engine supplies RequestOps itself from what it knows about the thread -- Session and Thread, nothing else. RequestOps.Billing is read only to price a request's own content changes (reduce, add, stateChange, cacheBreak); a ping or detached spend has none, and prices through its own Call.PaidBy instead. State that Billing is zero-valued and unread in that case, so a ping's reporter does not need to resolve it. Co-Authored-By: Claude Sonnet 5 <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
RequestOps/Operation is in-process input to ops.Price only, for one request, and is discarded once that request's event.Saving is written -- it is never recorded. So its size has no bearing on the session store, :9094, or the archive. Move the size limit and the Aggregate fallback to Saving.Changes/ChangeSaving instead, the only form that reaches those surfaces, where it is already small (one entry per change touched) but still needs a cap for a wide pass. Fix section 7.2's fold to sum over recorded events (Saving, ChangeSaving) rather than PricedOp, which is also in-process-only and not recorded. Co-Authored-By: Claude Sonnet 5 <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Add section 4.8 with three Mermaid sequence diagrams, each participant labeled by repo (Cortex or context-guru): a normal request (plugin reduces a tool output, collector finds no break, settle prices and records), a detached call (summarizer finishes after its request was answered, reports through Sink), and a standalone keep-alive ping (no request open at all, the keeper acts between turns). Co-Authored-By: Claude Sonnet 5 <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
A review checked the model against the real engine, Cortex's cost code and both deployments. Fix what it found: - Report a change the writeback discarded, with Discarded and a count, so issue #32's blind spot does not come back (R44). - Score a gap past a minimum-only TTL (OpenAI) as unknown, not cold, so no saving is invented (R45). - List the dashboard and diagnostic paths this design does not replace, so migration does not remove them. - Key ChangeID on content only, as frozenKey does, so readlifecycle and skeleton keep a stable ID. - Keep the keeper's KeepAliveEmitter instead of adding a Sink, and convert its reports with ops.FromKeepAlive in both hosts. - Take the thread from internal/thread and keep one fingerprint per thread, which also fixes the cachesplit baseline and fork reads. - Return the engine's operations in apply.Result for both hosts, and split the proxy's collector into its own migration step. - Record headttl's premium on every writing request, state coref's batch as one operation, and attribute apply-written changes. - Say that the pricing logic is central and the rates stay host-local. Section 13 records each finding and its fix. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
A case now holds only the input and the expected result. The intended differences move to one file, differences.json. The agreement test computes the current figure each time it runs, so no stored figure can go stale. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Map each question in the issue to the part of the spec that answers it. Add R46 (each saving names the ops rules version) and R47 (a model call by any plugin, such as the ibac judge, is a spend op). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Make the spec a method document with no Cortex content, and move the host wiring to its own document. - Rewrite section 0 as the problem: duplicated rules, figures that cannot be compared, aggregation over a session, counterfactuals. - Rename Projected to try_run and give an example (R12). - Replace reroute with setting (model, host, effort), and add model and effort to the request facts (R18, R34). - Add external operations for changes no producer made, such as the client's own compaction, logged once (R48). - Make a keep-alive ping an ordinary spend operation. - Replace the stateChange mechanism list with a state diff. - Define tier, and say operation type instead of component (R17). - State the push-telemetry principle in section 5, and list the open points in section 12. - Move sections 0.1, 4.6, 4.8, 7.1 to 7.3 and 9 to the wiring document. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
…ield Rework examples 6 to 8 and their diagrams. Remove firstApplied, the subagent example and the field summary. Document cacheBreak.at as the first position that differs. Remove Call.PaidBy and the Payer type; record the payer of a call as the payer of its request as a known limitation. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Remove the summary-ends-changes example and move its cache-break penalty into the summarization example, with a tail. Shorten the titles of examples 4 to 8. Put the tool rewrite before the summarization. Draw each operation as a rounded label in the diagrams. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
A cache change moves a prefix range from one cache state to another. A break (hot to cold) has a Cause and is written by the collector only. A rescue (cold to hot) is written by the keeper or apply. Update the design, the wiring document, the examples and the diagrams. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
An external operation (the client's own compaction) was inferred, never priced, and used by no example. Withdraw R48 and list it as out of scope. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
The operations are already in pipeline order, so the stage number added nothing the order did not say. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Remove ContentKeys, Reverses, Produced, Discarded, Cause and AttributedTo from the model. A break and a spend link to their change through ChangeID. Rename Before/After to SizeBefore/SizeAfter, StateFrom/StateTo to CacheBefore/CacheAfter, Phase to CachePhase and TryRun to DryRun. Add a token diagram to example 1 and trim its text. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Section 5 of the design keeps only the pure comparison (ops.Compare, B*, break classification, tokens per position). The collecting, the thread and the limits move to the wiring document. Fix the contradictions found in review: unique ChangeID, the cause of a break, the author of a rescue, DryRun naming, stale ping terms and the example 7 net. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
…ns design Remove fields no price, check or example reads (Billing.Plan/Account, Call.Status/Duration, RequestOps.Agent, Thread.Source, Size.Bytes, PricedOp.Reason and the session/thread copies), keep Gap/TTL/Lifetime as Compare inputs, merge repeated rules and requirements, delete the tombstones, the review log and the stub sections, and renumber. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
…ns examples Say once, in the setup, that the collector adds each cacheChange. Drop the repeated hot/cold definition, the open point on break rates, the messageSplice detail and the summary of example 2. Fix the expand tool index, the example 7 net, and the claim that examples 6 to 8 are one session. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
…uments Make the collector add every cacheChange, refer to ChangeID in R6, drop Agent and Plan from the requirements, give the break table a precedence, complete Input and Compare (client sizes, operations, ping fact), add the missing terms and open questions, renumber the test list, and remove history phrases. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
Collaborator
Author
Extended review of #768 (after merge)#768 is merged and its reviewer round 4 is already on the head, so this is a comment, not a new round. The findings come from the same extended review as #893 (link: the comment on #893), run against the merge commit
For the full table of issues and the limits of the evidence (synthetic traffic, no real session), see the #893 comment. |
This was referenced Nov 5, 2026
amiddavid
pushed a commit
that referenced
this pull request
Nov 9, 2026
…) with the review fixes (#930) This PR re-lands the accountant pricing of proxy savings (#768). #903 reverted #768. This PR brings it back. It adds the review fixes #906 to #920 and #938 to #940. It speeds up the request path: 2.8 ms and 87 allocations, from 4.8 ms and 4,905, on a 600 KB body. It moves the accountant pin to 5181d50c. Fixed issues: #906 tail breakpoint mark reported as an operation #907 tool-section operations left out of the plausibility bound #908 tool deferral names list reported as an operation #909 cachesplit saving credited on a short conversation #910 kept-wire preference kept off standalone messages #911 measured filter requests and reads kept on priced rows #912 library keep-alive rescue trusted; TTL judged by billed tier #913 request after a manual ping pinned hot; manual figure is an estimate #914 no saved tokens booked on a rejected request #915 no-history estimate held out of the totals #916 since and until exact in the stats cache key #917 state file versioned, synced, de-duplicated #918 panics recovered in ping pricing and in accBegin #919 TTL judged by the billed tier (with #912) #920 first-request pricing pinned in a test #938 cacheinject marks reported to the accountant #939 acc_fallback line says why an event is unpriced #940 replay cap reopens at each close Behavior change: the replay cap reopens after each close (#940). Before, the cap closed once and dropped all later replay credit. Now each close ends the credit of earlier removals. A removal after a close earns credit until the next close. A counterfactual compaction closes the epoch. The assumed summary is 80,000 tokens, or half of C when C is at most 160,000. The new field avoided_compaction_usd is in no total. Known limit: it can over-count when the trimmed transcript is larger than the baseline summary. Not measured on real sessions. Owner's yes, 2026-11-09, in the integrator session: "930 is ready and I want u to merge and start new release immediately" (v0.7.0 holds #930 only). DCO: 12 commits have no Signed-off-by. The owner accepted the risk for #930, 2026-11-09, in the integrator session ("b"). They are 37d4c6e 0206b44 ec660bd b0b7e70 9dc81c7 6c43448 061dfd2 9a972d4 5e47f96 fbf993b b41f5e7 e639b12. Data dependence: metadata only. With storage off, it does not run: it needs the dashboard. At the metadata and everything levels, the new accountant row keeps hashes, sizes and ids, no message text. The dashboard rows add the flags acc_priced and estimate_held and the number estimated_saved_usd. Reviews: 2 offload reviews (claude backend), round 9, both approve at dac0790. CI green at dac0790 (build-test passed on a rerun; the first run failed the timing test TestDashboardAddsNoRequestLatencyWithContentCapture). Signed-off-by: DAVID BOAZ <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]>
This was referenced Nov 9, 2026
amiddavid
added a commit
that referenced
this pull request
Nov 10, 2026
…en the audit window (#491) - dash: Price no longer books a saving at write time (#768). The three warm credit tests now read the legacy row rule (ComponentSavedUSD), which still values a stored row with no priced_by and carries the warm read-rate credit and rewrite charge. - proxy: the model audit waits for the extra question slot (#776). Use a 10 s idle window and a 40 s wait. 3 of 3 runs pass on the box. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
amiddavid
added a commit
that referenced
this pull request
Nov 10, 2026
…en the audit window (#491) - dash: Price no longer books a saving at write time (#768). The three warm credit tests now read the legacy row rule (ComponentSavedUSD), which still values a stored row with no priced_by and carries the warm read-rate credit and rewrite charge. - proxy: the model audit waits for the extra question slot (#776). Use a 10 s idle window and a 40 s wait. 3 of 3 runs pass on the box. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
amiddavid
added a commit
that referenced
this pull request
Nov 10, 2026
…en the audit window (#491) - dash: Price no longer books a saving at write time (#768). The three warm credit tests now read the legacy row rule (ComponentSavedUSD), which still values a stored row with no priced_by and carries the warm read-rate credit and rewrite charge. - proxy: the model audit waits for the extra question slot (#776). Use a 10 s idle window and a 40 s wait. 3 of 3 runs pass on the box. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
amiddavid
pushed a commit
that referenced
this pull request
Nov 16, 2026
…are (#1173) A fallback request (one the accountant library could not price) no longer lowers the Overview saving share, and the Overview says how many requests fell back. Fixes #1004 (B8 of the #768 review). - A new column, requests.acc_fallback, stores the fallback reason; a backfill fills it for older rows. - The hero share and its part cards leave fallback requests out on both sides: their spend and the saving they still book (deferral ledger, filter credit, minus their model calls). "You spent" shows the priced spend. A new line names the fallback requests, their spend and saving. Behavior change: every dashboard viewer whose window has fallback requests (mainly the OpenAI Chat Completions wire, and Responses requests with server-held history). Old: the hero share was saved / (all spend + saved), so each fallback request lowered it. New: fallback requests are left out on both sides. Turn off: in overviewTotals (dash/ui/savings.js), use savedParts(o) and the whole bill again. Owner's yes, 2026-11-16, in the integrator session: "yes" (to the behavior changes of #1150, #1173, #1165, #1139, #1172 and #1140). Data dependence: metadata only (a fallback reason per request row). Row: docs/data-dependence/features/dashboard-database.md. Fixes #1004. Reviews: 4 offload review rounds (Claude backend). Round 4: both approve at dbb8f80, which is the PR head. Rounds 3 and 4 covered the integrator's merges of main: the UI hunks moved into dash/ui/tabs/overview.js after the #1151 split; acc_fallback added after #1150's, #1165's and #1172's fields; a lost SQL placeholder and a dropped fallback-reason test, both found in round 3 and fixed. CI ran the Go checks (the eval box was down). Signed-off-by: DAVID BOAZ <[email protected]> Signed-off-by: DAVID AMID <[email protected]> Assisted-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 24, 2026
amiddavid
added a commit
that referenced
this pull request
Nov 26, 2026
…nual ping's rescue (#1461) fix(accountant): book ping savings without the dashboard and credit a manual ping's rescue A keep-alive ping now books its accountant result (its spend and, on the thread's next real request, the rescue) through an always-on path, with or without the dashboard (#1457). accrec.BookPing prices the ping, stores its facts and books the llm_savings_* counters. The dashboard only stores it. A manual ping now stores its ping facts like a scheduled one, so the accountant credits the rescue on the next real request. The row no longer books the proxy's estimate as ManualSavedUSD, so nothing is counted twice (#1460, #768). The estimate stays for the answer to the press and the status line. fix(accountant): report a manual ping's saving as pending and correct the dashboard-off claims The Ping answer now says saving "pending" and carries no estimate (owner decision). The plugin shows "Saving pending". The keeper drops the estimate. KeepAliveReport.RewriteUSD stays, deprecated, so importers build. Comments and the data-dependence row now say that no ping is sent without the dashboard (the audit-sink rule), so #1457 is prepared and not yet reachable. refactor(keepalive): keep the exported manual-ping estimate symbols, deprecated ManualRequest.RewriteUSD, ManualResult.AvoidedUSD and ManualSavedUSD are exported from a library package. They stay, marked deprecated and unused, so importers still build. fix(plugin): show a pending saving in the Ping toast and pane, and update the docs The mod's Ping toast now reads saving "pending" and shows no estimate. An older server that sends saved_usd keeps the old text. docs/dashboard.md describes the new answer. Tests are renamed and made real. docs(dashboard): say where a manual ping's rescue is counted The manual_pings saved_usd of a new row is the pings' cost as a negative number, and it stays so. The rescue is credited to the thread's next request, in the keep-alive figures, not here. Behavior changes (a manual ping books its saving through the accountant, and the Ping answer says saving pending; scheduled pings book llm_savings_* through the always-on accountant path) approved by the owner in the integrator session: "1461 yes". Merged tree built, vetted and tested (Go and the plugin band test) before the merge. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Data dependence (metadata only)
This PR changes how the proxy prices savings, so it states its data dependence (CLAUDE.md, "Metadata first"). The row is "Accountant savings" in
docs/data-dependence.md.No row has a "Decided by", because nothing here is a content exception.
What it does
Every saving the dashboard stores now comes from the accountant library (rossoctl/accountant). The legacy saving rules are gone from the write path.
Event.Pricestores only the cost, the provider's own cache saving and the accounting fields.saved_first_usd/saved_replay_usdandpriced_by = 'accountant'.toolsandsystemin seven places (toolschema, toolfilter, cachesplit, headttl, the tail mark, expand, adjudicate).envelopeOpsreports each change to the library from a diff of the two bodies, so the sum check holds. An injected declaration is a cost on its own row.keepalive_saved_usdis the library's rescue. The proxy passes each ping's usage, and the library derives what the ping read. A prefix a sibling thread kept warm is not credited (SharedWarm, R54).ended_changerow. A break the client body has too (an edit, an expiry) does not count.An event the library cannot price books no saving and logs
acc_fallbackwith the reason. Before, it kept the legacy figure. Its component rows are stored withpriced_by = 'none', so the read views do not value them with the legacy rule.The library
Imported from rossoctl/accountant, pinned to
583b9f916ea2, the merge commit onmainafter accountant #7 and #8 merged. The two API additions:CacheEffect.InBaseline: marks a break the client body has too.PingFacts.PingUsage/Apply,EntryFacts.PingUsage: the library derivesPingReadfrom the ping's usage.Tests
TestProxyPathMatchesTheAccountantCases: all 66 shared cases pass through the proxy path with no allowed difference.TestEveryPresetIsPricedByAccountant: 20 presets × 4 turns on a Claude-Code-shaped session, no fallback, rows sum to the baseline delta.TestDashboardBooksTheAccountantSaving: a request through the proxy stores a saving withpriced_by = 'accountant'.TestThePingRescueIsCreditedFromTheUsagefails without the usage-derived extent.GOWORK=off go vet ./...,gofmtandgo mod tidy -diffare clean. Failing here and on a cleanorigin/main, not caused by this PR: dashTestTheTimelineBucketsUseAndCarriageByDay,TestCalculatorPricesFromTheRowsModelNotABlend; cmdTestPreflightReadsKeyEnvFromConfigNotComments,TestPreflightResolvesToolsOnTheServicePATH; the installer and golden tests incontext-guru-plugin.A scope review found the change touches only how savings are computed and recorded. It found no change to the forwarded body, headers, keep-alive timing, client responses, config or flags. Its findings (an unbounded per-session thread map, a global lock, stale comments) are fixed in
c365ceaf.Two independent reviews of the whole PR found two more defects. Both are fixed, each with a test that fails without the fix: the cache lifetime was always
unknown, so no keep-alive rescue was credited after a gap past the TTL (the facts now useapply.CacheLifetime); and a fallback row was valued with the legacy rule at read time (it is now markedpriced_by = 'none').Read this before relying on the figures
penalty_unknown, accountant design §6.4). The row stores the flag (price_estimated), and the request detail marks an estimated net saving (c6cff3d6).priced_byempty) keep their legacy figures, and the Components tab, the summarize ledger and the replay cap value them with the legacy rule at read time. A window spanning the switch mixes the two.request_components.saved_first_usd,saved_replay_usdandpriced_by. The components view gainssaved_usd_costs(omitted when 0).History from #592
#592 is closed without merging. Its commits are in this branch.
Assisted-By: Claude (Anthropic AI) [email protected]