Repository navigation
Conversation
| @@ -0,0 +1,1232 @@ | |||
| # Context operations: one object model for the changes plugins make, priced in one place | |||
There was a problem hiding this comment.
title is misleading, there is no concept of "plugins" in context-guru.
The proposal is for a holistic approach for calculating cost and savings of context engineering
There was a problem hiding this comment.
Changed. The title is now "Context operations: counterfactual accounting of cost and savings". The word "plugins" is gone from the document. (47dbe2d)
| **Worked example:** [`2026-10-18-context-operations-example.md`](2026-10-18-context-operations-example.md). | ||
| Read it first. It shows one session from body to dollars. | ||
|
|
||
| ## 0. Base, and the problem |
There was a problem hiding this comment.
this is a very bad way to present the goal and the problem we are trying to solve.
this document should not mention cortex at all.
The problem is that at the moment each component that plays a role in context enigneering is computing its own cost and savings, thus it is hard to maintain and verify.
examples can be extract_llm tail vs cache_aware_summarization.
the problem should also explain why it is hard to calculate things... we need to aggregate over a time period ( which itself needs one definition) and we need to calculate counterfactual alternatives
There was a problem hiding this comment.
Changed. Section 0 is rewritten and does not mention Cortex. It states the problem as you described it: each component computes its own cost and savings, with the extract_llm tail vs cache_aware_summarization example. It also explains why the calculation is hard: aggregation over a period (defined here as the session) and counterfactual alternatives.
| **Paths.** `core/...`, `cmd/agentop` and `pctx` are in `rossoctl/cortex`. `components/...`, | ||
| `apply/...`, `dash` and `ops` are in this repo. | ||
|
|
||
| This design starts from the savings code on the Cortex branch `feat/contextguru-keepalive`, which |
There was a problem hiding this comment.
I think the problem is that the document conflate two things
A. a holistic approach for calculating cost and savings of context engineering
B. the need in cortex for a plugin that does A, and avoiding cortex trying to calculate it or each plugin being responsible for its calcualtion.
for instance, I dont expect to see in this document an explanation of how context-guru plugin will publish events to the cost-ledger plugin. ( btw. do u have a name for that)
this should be part of the cortex documentation and not here.
There was a problem hiding this comment.
Changed. The host wiring (how components publish to the cost ledger, the collector, migration) moved to a separate document: 2026-10-18-context-operations-cortex-wiring.md. It is a draft and can move to the Cortex repo. I have no name for the component that writes to the cost ledger. The wiring document lists it as open.
| inside a request (§4.6). | ||
| - **R6.** An operation has an ID that is unique inside its request. Results, check failures and | ||
| `cacheBreak` attribution refer to it. A reference to a change in another request uses `ChangeID` | ||
| (R22), not the operation ID. |
There was a problem hiding this comment.
this is interesting, if a change has occurred, it may impact the attribution. i.e. expand stops the attribution of reduction + provides penalty.
so a changeID is kind of a chain in the operation
There was a problem hiding this comment.
Not changed in this commit. I did not model expand as a link in a chain of change IDs. I agree an expand ends the attribution of a reduction and adds a penalty. Today it shows as the reduction no longer being reported, plus a cacheBreak. Do you want an explicit link from the penalty to the reduction it ended?
| calls the library once. | ||
| - **R33.** Operations that add tokens are costs: an injected tool declaration, injected text, a | ||
| restore. | ||
| - **R34.** A destination change (inference-router) is a separate kind. Its pricing is out of |
There was a problem hiding this comment.
this means change of model for a session?
this makes sense,
but I think more stuff like this exist... for instance change of relative effort
There was a problem hiding this comment.
Changed. R34 now covers a setting kind: the model, the host, or the effort. Pricing of a setting change is still out of scope, but it is recorded. Model and effort are also on the request facts (R18).
| the same way. It prices `Saved`, `Caused` and `Call.Usage` with one resolver, at one time. So spend | ||
| has the same rates, provenance, currency and billing basis (§7.4) as the savings. | ||
|
|
||
| **What it replaces.** `core/cost/spend` (`Charge`, `CostRecorder`, `RecorderConsumer`) is removed. |
There was a problem hiding this comment.
I dont think we care about it in the document
There was a problem hiding this comment.
Changed. The paragraph about replacing core/cost/spend is removed.
| A `stateChange` operation does not change the content. It changes how the provider bills content | ||
| that is already there. | ||
|
|
||
| | Mechanism | Producer | What changes | Reported on | |
There was a problem hiding this comment.
cant we find a more abstract/ generalize form?
when does a state changes?
- prefix is warmed up
- prefix is protected ( breakpoint)
There was a problem hiding this comment.
Changed. The Mechanism list is replaced by a state diff: a stateChange carries a prefix range and two states. The text names two cases: a prefix is warmed, and a prefix is protected by a breakpoint.
| | `Host`, `Model`, `Usage`, `Status`, `Duration` | `Call` | | ||
| | `At` | `RequestOps.At` | | ||
|
|
||
| ### 4.7 Replays: who remembers past changes |
There was a problem hiding this comment.
a question about performance and implementation, each replay causes a recalculation, I think those should be async and buffered, so for instance if another request comes in within the buffer window it replaces the current request and executes when that original one was in the queue, i.e. it takes its place in the queue ( to avoid starvation)
but what we dont want is to calculate everything all the time, it maybe too much.
There was a problem hiding this comment.
Not changed in the model. I agree: recalculation should be asynchronous and buffered, and a newer request for the same key should replace the queued one and keep its place. I added it as an open design point (section 12, item 7). The queue design is not written.
| Settle->>Store: event.Saving (ping leg) | ||
| ``` | ||
|
|
||
| ## 5. The collector |
There was a problem hiding this comment.
I would like to switch things around, I dont want something collecting, I would prefer us pushing telemetry and if its updating, then its an update.
i.e. think prometheous
There was a problem hiding this comment.
Changed in principle. Section 5 now states the push model: each fact has an identity (name plus labels, as in Prometheus), a push with a known identity is an update, and totals are computed on request. The detailed section is not rewritten yet. Label volume in a long session is an open point (section 12, item 6).
| B* = 0 when the cache expired | ||
| ``` | ||
|
|
||
| The collector keeps a fingerprint of each recent request, for each session: |
There was a problem hiding this comment.
I think the collector should be dumb it shouldnt be keeping anything
There was a problem hiding this comment.
Same as the reply on push telemetry. The principle in section 5 says the receiver keeps no state and prices nothing. The state it still needs is the previous request's hashes for the counterfactual. Where they live is open (section 12, item 5). Do you prefer that they travel in each push, or that the producer keeps them?
boazdavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @boazdavid) | Claude Code 2.1.241, claude-sonnet-5-5 | offload-review skill, @boazdavid's session | fresh | 2 of 2 | 1 of 2 | faa9e48126a4 |
blocking |
Verdict: blocking
Findings
-
counterfactual/compute.go:287 —
restoredcompares cumulative hashes, so it misses a restore when any earlier position differs- What fails:
PosHash.Hashis a chained prefix hash (fingerprint.go:29,47-51).restoredtestsclient.Pos[ci].Hash == fwd.Pos[fi].Hash. This is true only if the whole prefix before the item is equal in both bodies. Take two active in-place rewrites A (messages[2]) and B (messages[5]). The operator of B stops applying B, but A is still applied. The forwarded prefix at messages[5] still holds A's shrunk bytes, so its hash differs from the client hash.restoredreturns false and B is never ended. - Proof:
restored(lines 287-294) has no step that discounts earlier changes.forwardPositions(276) is the only caller that ends an in-place change. The only restore case I found isrewrite-restore-in-place-hot-5m(one change, no earlier change). The single-change case is the only one where the hash test works. - Effect: B stays in
Active.price(742-761) credits B'sSavedon every later request, although the forwarded body no longer has B's saving. Thesumcheck (838-844) will fail, but the check does not stop pricing (result.go). The over-credit stays in the figures. This is the common multi-operator case. - Fix: compare the item's own bytes and hash relative to the prefix. For example, compare
Bytesof the forwarded item withsp.before.Bytes(restored size equals the original size), or build per-item content hashes. Add a test with two active in-place changes where only the later one stops.
- What fails:
-
counterfactual/doc.go:65-70 and counterfactual/compute.go:799-801 — the "Not implemented" text is false for code in this PR
- What fails:
doc.gosays "The split, ttlPremium and ttlRescue effects ... Compute adds no figure for them" and "The order and conservation checks ... are not implemented". Butcompute.goimplements all of these:split(644),headTTL(611) andconservation(777), andcacheEffectscalls them. The comment abovechecks(799) also says conservation is not implemented. The head commit message says it adds "ttl, split and conservation". - Proof:
grep -n "split\|headTTL\|conservation" counterfactual/compute.goshows the three functions called fromcalcandcacheEffects.doc.gois the package contract. A host author who reads it will believeResult.CacheEffectsnever holdsEffectSplit,EffectTTLPremiumorEffectTTLRescue, and thatChecksnever holds"conservation". A host that settles effects by exhaustive switch will then miss them. - Fix: remove the three bullets from "Not implemented" and add the new rules (split, headttl, conservation tolerance of
tol+1, therestoredinference) to "Implementation decisions". Fix the comment abovechecks.
- What fails:
Non-blocking
go.workis committed and the rootgo.modhas norequire/replaceforgithub.com/rossoctl/context-guru/counterfactual.dash/counterfactual_play_test.goimports it. This builds only in workspace mode. WithGOWORK=off, or ingo mod tidyon the root module, the import fails to resolve. Add arequireplusreplace ./counterfactual, or say in the PR that workspace mode is required. TheDockerfileand CI build only non-test code, so they are not affected today.extentwith no candidates callscumBytesinside a loop over all positions (body.go:131). This is O(n²) per call, andComputecalls it twice per request. It is fine for tests. For a 5,000-message thread it is about 25M additions per call. A prefix-sum array inBodywould remove it.- CLAUDE.md asks each feature PR to state its data dependence and update
docs/data-dependence.md. This PR does not change that file. The code uses hashes and byte sizes only, so the entry is likely "metadata only". Please say so in the PR text. Computehas norecover. The doc says a panic leavesThreadStateunchanged, which is true. The host must still wrap the call to fail open. A line indoc.gowould make this clear.
What I checked
- Read all of
counterfactual/*.gonon-test code in full:compute.go,types.go,state.go,body.go,fingerprint.go,result.go,doc.go, andopscases/opscases.go. - Read the test names in
compute_test.go,effects_test.go,state_test.go,review_test.go,opscases_test.go,boundary_test.go, and the head ofdash/counterfactual_play_test.go. - Skimmed
docs/counterfactual/*.mdfor the conservation and end-of-change rules. I did not read every line ofdesign.md(1,714 lines) or the examples. - Checked
go.work, thego.modfiles, theDockerfileandci.yamlfor module wiring. - Traced concurrency:
snapshot/replacegive an optimistic lock, and theComputeloop retries on a version change. This is correct. - Traced empty-body and out-of-range inputs through
flat,mustFlat,position,cumBytes. I found no panic. - I did not open any
.jsonfixture. I did not run Go.
boazdavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @boazdavid) | Claude Code 2.1.241, claude-sonnet-5-5 | offload-review skill, @boazdavid's session | fresh | 1 of 2 | 1 of 2 | faa9e48126a4 |
blocking |
Verdict: blocking
Findings
-
counterfactual/compute.go:287-294 —
restoredcompares cumulative hashes across the client body and the forwarded body, so it misses a restore whenever anything earlier differs- What fails:
PosHash.Hashis cumulative (fingerprint.go:29,NewBody).restoredtestsc.client.Pos[ci].Hash == c.fwd.Pos[fi].Hash. These two hashes are equal only if the whole prefix up to that position is equal in both bodies. Case:maskchanges message 1 andcorefchanges message 3, both in place. On request N,corefstops applying and message 3 is the client's own item again. The forwarded hash at message 3 still differs from the client hash, because message 1 is still masked.restoredreturns false. Thecorefchange stays inActiveand is priced as a saving on every later request. The same happens when the forwarded body differs from the client body intoolsorsystem(for example a deliveredcachesplit). The end rule in design.md §11 question 12 says "same hash as the client item". It describes the same wrong test. - Proof:
fingerprint.go:46-51chainshacross all sections and positions, and never resets it per position.compute.go:293indexesPos[ci]andPos[fi]and compares.Hashonly. No test incounterfactual/*_test.gohas a second in-place change before the restored one. The only restore case isrewrite-restore-in-place-hot-5m, which has one change at message 1. - Fix: Compare an item-local hash. Either add a non-cumulative hash to
PosHash, or compareBytesplus the difference of consecutive cumulative hashes. Add a case with two in-place changes where the later one is restored first. The sum check (§6.5 check 1) may catch the wrong guess after the fact. It does not stop the wrong saving from being booked in the meantime.
- What fails:
-
go.mod:1 — the root module imports
counterfactualbut does not require it; onlygo.workmakes it resolve- What fails:
dash/counterfactual_play_test.go:11-12importsgithub.com/rossoctl/context-guru/counterfactualand.../opscases. The rootgo.modhas norequireand noreplacefor that module.counterfactual/go.modis a separate module. Withgo.workthe build works. WithGOWORK=off, or in any tool that ignores the workspace,go test ./dash/...fails to resolve the import.make fmtrunsgo mod tidy(Makefile:51). I expect it to try a network lookup for the module and fail. I could not run Go here, so this part is a prediction. - Proof:
grep counterfactual go.mod go.sumreturns nothing.go.workis the only link between the two modules. The design doc (D7) says the module path is a placeholder and its home is not decided. The code now depends on that path. - Fix: Pick one. Either keep one module and delete
counterfactual/go.modandgo.work. Or addrequireplusreplace ../counterfactualto the rootgo.mod. Or say in the PR that thego.worksetup is deliberate, and show thatgo mod tidyandGOWORK=off go vet ./...still pass.
- What fails:
-
docs/counterfactual/design.md:229, 763-767, 1679 — the spec says both "decided" and "not defined" for how a change ends
- What fails: §11 question 12 (line 1679) now says "Decided:
Computeinfers the end from the bodies and the splice". D11 (line 229) still says "HowComputefinds the end is not defined (§11, question 12)". §4.5 (lines 763-767) still says "The rule that finds the end is not defined". D14 (line 232) still lists question 12 as open. A reader who follows D11 gets the wrong answer. This spec is the base for theopscasestests. - Proof: grep "not defined" and "questions 11 and 12" in design.md. Compare with line 1679.
- Fix: Update D11, §4.5 and D14 to point at the decided rule (the three end conditions in question 12).
- What fails: §11 question 12 (line 1679) now says "Decided:
Non-blocking
- counterfactual/compute.go:799-801 — the comment on
checkssays "The order, attribution and conservation checks are not implemented".conservationis now implemented (line 777) and called fromcalc. Remove "conservation" from that comment. - counterfactual/state.go:29-49 —
Trackers.mnever evicts a thread. Memory grows with every session and thread for the life of the process. Question 13 covers persistence, but not eviction. Note it as an open item. - counterfactual/compute.go:24-36 —
Computecalled twice on oneRequestprices the second call against the state that the first call stored, and counts the active changes again.Previewis the safe repeat call. Say so in the doc comment, or guard it with a flag. Computedoes norecover. Fail-open (CLAUDE.md) is then the host's job. design.md says the ThreadState stays unchanged on panic. A one-line note indoc.gothat each host must wrap the call would make the contract clear.docs/data-dependence.mdis not changed. This is correct today: the package registers no component and stores only hashes and sizes. If a host wires it into a feature, that PR must add the row.
What I checked
- Read CLAUDE.md and docs/design.md.
- Read all of
counterfactual/*.gothat are not tests:types.go,state.go,body.go,fingerprint.go,result.go,compute.go(every line). - Read
counterfactual/opscases/opscases.goand the start ofopscases_test.go. - Read the call site in
dash/counterfactual_play_test.goand checkedAttributeCachehas the stringcauseargument indash/event.go:1181. - Read
go.work,counterfactual/go.mod, the rootgo.mod, the Makefile, the Dockerfile and the CI workflow for module wiring. - Read the design.md sections for D11, D14, §4.5 and §11 question 12. Did not read all 1,700 lines of design.md or the other docs/counterfactual files line by line. Did not read the test files
compute_test.go,effects_test.go,review_test.go,state_test.goin full. Did not readgen_cases.py. I skipped the JSON fixtures as told. - Traced: phase and B* selection, break rows 1-6, rescue,
headTTL,split, tier pricing, check 1 (sum), check 3 (unique change), conservation,nextState. Found no other defect. - Did not run any Go code (not approved).
|
Round 1 fixes are in commit 5accdd4. Fixed:
Not changed:
Assisted-By: Claude (Anthropic AI) [email protected] |
boazdavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @boazdavid) | Claude Code 2.1.241, claude-sonnet-5-5 | offload-review skill, @boazdavid's session | resumed | 1 of 2 | 2 of 2 | 5accdd466c30 |
approve |
Verdict: approve
Findings
None. All round-1 findings are fixed.
Status of earlier findings:
restoredused cumulative hashes (mine 1, reviewer 2 finding 1): fixed.compute.go:287-306now comparesBytesof the client item and the forwarded item. I tracedTestARestoreIsFoundWhileAnEarlierChangeStaysAppliedby hand. On request 3, opB sits at msg 5. Client size is 3000 and forwarded size is 3000, so it ends. opA sits at msg 2. Forwarded size is 500, so it stays.Activeholds only opA, as the test expects. The author names the limit: another operator that rewrites the item to the client size looks restored. The comment and design.md question 12 state it. I accept this.- Root
go.modlackedrequire(mine 2, reviewer 2 non-blocking): fixed.go.modhasrequire ... v0.0.0andreplace => ./counterfactual. I could not runGOWORK=off go vethere. The author reports that it passes. - design.md said "decided" and "not defined" (mine 3): fixed. D11, D14 and section 4.5 now point at question 12 as decided. My grep for "not defined", "questions 11 and 12" and "same hash" finds only unrelated or correct uses.
doc.goand thecheckscomment said split, headttl and conservation were not implemented (reviewer 2 finding 2): fixed. The three bullets are gone,doc.gohas rule 12, and thecheckscomment is correct.- My non-blocking notes (double
Compute, norecover, no eviction): documented incompute.goandstate.go. - Reviewer 2's O(n²)
extent: the author defers it until a host measures it. I accept this, because the code is correct. docs/data-dependence.md: the author states that no row is needed, because the package stores hashes and sizes only and registers no component. I agree.
Non-blocking
doc.go"Not implemented" now has a sentence aboutrecovermixed into its intro. Move it to its own paragraph or to theComputerule list.- Add a test for the size-collision limit (another operator rewrites the item to the client size), so the known limit has a fixed expected result.
- The inline comments from @amiddavid on the earlier spec path (
docs/superpowers/specs/...) are from before the move todocs/counterfactual/. The author answered each. Two items remain open by the author's own words: theendoperation and the push model. They need no change in this PR.
What I checked
- Last review: round 1, faa9e48, 2026-10-28T11:59:41Z
- New commits read: 1 (5accdd4 fix(counterfactual): Find a restore by size, link the module, update the spec)
- Read in full: 21 reviews (19 empty, 2 reviewer reviews), 1 comment, 20 inline comments (from the three files)
- New items since my last review:
- Author comment of 2026-10-28T13:04:54Z (round 1 fixes): checked each of its 5 fixed items and 2 "not changed" items against the diff. All match.
- Commit 5accdd4: read the full Go diff (
compute.go,compute_test.go,doc.go,state.go,go.mod). Grepped the doc changes indesign.md,cortex-wiring.md,examples.mdandissue_cases.md. - Reviewer 2's round-1 review: all its findings are covered above.
- Did not run Go (not approved). I did not read the doc diffs line by line, only the greps above.
boazdavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @boazdavid) | Claude Code 2.1.241, claude-sonnet-5-5 | offload-review skill, @boazdavid's session | resumed | 2 of 2 | 2 of 2 | 5accdd466c30 |
approve |
Verdict: approve
Findings
None.
Status of earlier findings
- Mine 1 (
restoredused cumulative hashes): fixed.compute.go:287-306now comparesPos[ci].Bytes == Pos[fi].Bytes. Item size does not depend on the prefix. I tracedTestARestoreIsFoundWhileAnEarlierChangeStaysApplied: on request 3, item 5 is back to 3000 bytes (client 3000), so opB ends. Item 2 stays at 500 bytes (client 3000), so opA stays. The old hash test fails on this input, so the test pins the fix. The false positive (another operator rewrites the item to exactly the client size) is stated in the code comment, indoc.gorule 12 and in design.md. I accept it as a known limit. Thesumcheck still catches it after the fact. - Mine 2 (
doc.go"Not implemented" was false): fixed. Split, ttlPremium, ttlRescue and conservation are removed from the list. Rule 12 is added. The comment abovechecksis corrected. - Reviewer 1, finding 1 (same defect as mine 1): fixed, as above.
- Reviewer 1, finding 2 and my non-blocking go.work note: fixed. Root
go.modnow hasrequire .../counterfactual v0.0.0andreplace => ./counterfactual. TheDockerfiledoesCOPY . ., so the replace path exists in the image build. - Reviewer 1, finding 3 (design.md says both "decided" and "not defined"): fixed. D11, D14, §4.5, risk point 3, the config-change paragraph and the memory paragraph now point to the decided rule.
grep "not defined"indocs/counterfactual/*.mdreturns nothing now. - Non-blocking items: the double-
Computenote, the host-wraps-Computenote and the no-eviction note are added to the code comments. TheextentO(n²) anddata-dependence.mdpoints are rejected with reasons (fix when measured; the package stores only hashes and sizes and registers no component). Both reasons are right for a library with no host wiring yet.
Non-blocking
doc.go"Not implemented": the sentence aboutComputenot recovering from a panic sits inside the "not implemented" intro. It is not a missing feature. Move it to the package overview.design.mdD14 still says "A failure or a panic leaves the oldThreadState". This is true. No change needed.
What I checked
- Last review: round 1, faa9e48, 2026-10-28T11:57:42Z
- New commits read: 1
- 5accdd4 fix(counterfactual): Find a restore by size, link the module, update the spec
- Read in full: 40 review entries (2 with bodies: my round 1 and reviewer 1 round 1; the rest are empty inline-review wrappers), 1 comment, 25 inline comments (from the three files, read with the Read tool, no truncation)
- New items since my last review:
- Reviewer 1 round 1 review: checked each finding against the new commit (above).
- Author comment of 2026-10-28T13:04:54Z (five fixes, two "not changed"): checked each claim against the diff. All match.
- No new inline comments after 2026-10-20. No comment from a person that asks for something new.
- Read the full Go diff (
compute.go,compute_test.go,doc.go,state.go,go.mod) and the full docs diff (design.md,cortex-wiring.md,examples.md,issue_cases.md). - Checked the
Dockerfilefor thereplacepath. I did not run Go. I did not open any.jsonfixture.
Root cause 2 (the rate follows "first time", not position): review resultResult: outside The three cases
The components that edit the cached part
The open spec question about where B* is (design §5.1) still matters for |
Root cause 3 (added tokens count as zero, and an ended change still gets credit): review resultResult: cause 3 does not happen in normal use. The request total is correct. Only the split between components is wrong, and a missing break charge on failure paths falls under cause 1. Part 1: an edit that adds tokens (
|
Root cause 4 (a setting change): review resultResult: out of scope for cg today. It is not a gap in cg. It is a feature that the counterfactual library must support, and the library in this PR already has the cases for it. Why it is out of scope for cg now
What this PR must keepThe library must price a setting change correctly. The cases are already in
In A correction to
|
Root cause 5 (keep-alive credit floor): review resultResult: no cg defect. Case 1 is a gap in this PR's test helper. Case 2 is a change to the spec: the owner decided that OpenAI's 30-minute minimum counts as the lifetime. Case 1:
|
Root cause 6 (credits outside the per-component figure): review resultResult: there are two parts. The cachesplit cases show a gap in this PR's test helper. The 1-hour head is a real gap in cg, and this library fills it. We do not fix it in cg: cg adopts the library. Part 1: cachesplit (
|
Root cause 7 (no check for an unreported edit): review resultResult: this is a check the library needs. It is not a gap in cg's proxy. How cg arrives at 1,500 µ$
Why the real proxy is not at risk
Why the library needs the checkA host such as Cortex can let a plugin edit the body without reporting it. The library's The |
Review summary: all 26 cases that differ from cgResult: every case that differs from cg traces to one of the seven root causes in the notes above. No case is left without a cause.
The 26 cases are the full set at the PR head (
Things to know about the table
|
Missing test: two threads in one sessionSummary. No case in this PR has more than one thread. All 59 cases use the thread Why it matters
ProposalAdd a case like
The checks:
Open questionDoes a thread ever share a cached prefix with its parent? A side request often starts with the main thread's system prompt and tools. If yes, a case should show how a parent's change prices on the child's request. |
Two more questions about replacing the dashboard ledgerThese follow from the comment above. The summarizer figure on the dashboard today comes from 1. Does the dashboard's summarizer figure move to this library?
Question: Is it part of this work to take the dashboard's summarizer credit from the library and delete the old ledger? If not, which issue tracks it? 2. Does the library model the compaction the client would have done without us?
Question: Should the library model the client's own compaction point ( |
caed9a9 to
9c13433
Compare
Plays the 63 shared test cases of github.com/rossoctl/accountant (v0.1.0) through dash.Event.Price and compares the result with each case's expected figures. A case that is not in testdata/differences.json must agree to within 1 µ$. A listed case must really differ, and an entry whose case no longer exists fails. What differs is written up in docs/accountant/: 27 of 63 cases (20 differs, 7 notCovered), grouped into eight root causes in cg's logic. The specification, the design and the cases moved to the accountant repository. This change only adds the comparison on the cg side. It reads no stored customer data and registers no component, so data-dependence.md does not change. Refs #633 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
9c13433 to
2705885
Compare
…-savings Signed-off-by: DAVID BOAZ <[email protected]>
Summary
This PR adds a test that compares the shared
accountanttest cases with cg's saving logic. It also adds two reports on what differs.The library, the specification, the design and the 63 cases now live in https://github.com/rossoctl/accountant (v0.1.0). This PR started as that library. It no longer contains it.
What changed
dash/accountant_play_test.go: plays every case throughdash.Event.Price.known-differences.jsonmust agree with cg to within 1 µ$.dash/testdata/accountant/known-differences.json: the 27 known differences (20differs, 7notCovered). Each cites a spec section.dash/testdata/accountant/README.md: says what the file is and how the test uses it.docs/accountant/: two reports, regenerated from the current run.go.mod,go.sum: requiregithub.com/rossoctl/accountantv0.1.0.What we found
ProviderandCacheTTL, and both cases agree.How it was tested
GOWORK=off go test ./dash/ -run TestCasesAgreeWithCurrentLogic: 63 subtests pass.known-differences.jsonto a wrong id and confirmed the test fails.go vet,go build ./...andgo mod tidy -diffare clean.Data dependence
Metadata only. The test reads no stored customer data, writes none and registers no component.
docs/data-dependence.mddoes not change.Open questions
Refs #633
Assisted-By: Claude (Anthropic AI) [email protected]