Repository navigation
feat(proxy): Report the first request after a client compaction (#947) - #1165
Conversation
The thread tracker already gave the compacting thread's id to the first request after the agent's own compaction. It now reports that request (thread.Result.AfterCompaction). - The proxy sends the verdict to the accountant (RequestMeta.Compaction, R55): "unknown", because the wire does not yet tell a manual /compact from an auto compaction. - The dashboard row stores it in a new nullable column, client_compaction: 'unknown', '' for none, NULL for no verdict. - The replay cap closes an epoch on a row's verdict. A row without one (written before this change) keeps the drop detector. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
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, aws/claude-opus-5-5[1m] | offload-review skill, @boazdavid's session | fresh | 2 of 2 | 1 of 2 | c05d161972f6 |
blocking |
Verdict: blocking
Findings
-
docs/data-dependence.md:240 — the generated page is edited by hand. The row file is not changed.
- What fails:
docs/data-dependence/features/thread-tracker.mdstill has only the old text ("It tells the main agent from its subagents. It uses hashes …"). The PR adds the "Since #947 …" text only to the generated page.internal/datadepTestGeneratedPageIsUpToDatecompares the page with the output of the row files, so it fails. The nextgo run ./cmd/gen-datadepalso deletes the new text. - Proof:
git diff --stat a4d43d94..HEADlistsdocs/data-dependence.mdand no file underdocs/data-dependence/.grep -rn "Since #947" docs/data-dependence/gives no result.git log -- docs/data-dependence/features/thread-tracker.mdshows only9966adf0(#1090). The PR body saysgo test ./...passes exceptproxyappandpi-package. That cannot be true forinternal/datadepat this head. - Fix: Put the new sentences in
docs/data-dependence/features/thread-tracker.md. Rungo run ./cmd/gen-datadep. Commit both files.
- What fails:
-
proxy/dashcapture.go:300 — a request that the thread tracker did not see stores
''("no compaction"), not NULL. On such a row the replay cap turns off the drop detector.- What fails:
noteThreadsetscompKnown = truefor everythread.Result. Some results come from paths where the tracker did not run, or could not decide. They haveSource == thread.SourceSession:proxy/thread.go:25-26:session == ""(for example observe mode, whereapplyModereturnsapply.Trace{}, sotr.Sessionis empty).internal/thread/thread.go:253-256:!ok, no message list. For example a Responses request withprevious_response_id(fingerprint, thread.go:550).proxy/thread.go:29-31andapply/opts.go:153-156: a panic in the tracker.
These rows can never getAfterCompaction, but they storeclient_compaction = ''.walkCapConversationthen setscompacted = falseand does not run the drop detector (dash/replaycap.go:373-377). Before this PR the drop detector ran on these rows. Example: a session with an agent compaction request, then a request withprevious_response_idand a lowertokens_before, with no recovery. Before: the epoch closes. After: it stays open, and the cap keeps the replay credit (over-credit).
- This also breaks the contract the PR states.
dash/schema.go:248-250,dash/event.go:14-16and the PR body say NULL is "a request the tracker did not see". The panic case is a fail-open concern too: a tracker failure must leave the row on the old rule (NULL), not write a definite "none". - Proof:
noteThreadatproxy/dashcapture.go:300has no condition onres.Source.compactionVerdictreturns""for every result withoutAfterCompaction. No test covers aSourceSessionresult. - Fix: Set
compKnownonly when the tracker matched by prefix or by header (res.Source != thread.SourceSession). Or add a field tothread.Resultthat says the tracker ran. Add a test: a request with no session id, or withprevious_response_id, stores NULL.
- What fails:
Non-blocking
- The PR body names the behavior change and asks for a human's yes. Keep it at the top. A human developer must confirm it before merge (CLAUDE.md).
- The PR says "A subagent can no longer close an epoch". That holds for header threads (
x-claude-code-agent-id), becauseth.compactingis set only forSourcePrefix. A header-less fork that declares tools and compacts can still getAfterCompactioninnewID. Its row then closes the epoch for the whole (tenant, session, model) conversation. This only removes credit, so the error is conservative. Consider a short note in the docs. - The tracker state is in memory (
staleAfter2 h,maxSessions20000, cleared on restart). The PR names the restart case. Full pruning atmaxSessions(thread.go:509-511) can also drop acompactingflag between the compaction request and the next request. That is rare; no action is needed now. - The code move in
proxy/proxy.go:1553-1564keeps the old logic and order fornoteKeepAlive,predArrivalandClearStaleKeepAliveCandidate. I found no problem there.
What I checked
- The full diff of the one commit
c05d1619(15 files) and the PR body. internal/thread/thread.go:ResolveandnewID.AfterCompactionis true only whensucctakes over a compacting thread. Thecompacted != nilpath (the compaction request) and the header path never set it.proxy/proxy.go: the thread is resolved beforeaccBegin.RequestMeta.CompactiongetscompactionVerdict(th). The block ordering after the move is the same as before.- The accountant module v0.1.1 in the local module cache:
RequestMeta.Compaction,CompactionTriggerandCompactionUnknown = "unknown"exist.calcState.compaction()only records the verdict. It does not change a price. dash: the schema column and the additive migration (nullable, no default). Insert and scan stay aligned: one more column, one more?, one moreScantarget, in the same position ininsertBatch,requestCols/scanRequestandcapSelect/ReplayLedgerForCtx.dash/replaycap.go:walkCapConversationwith verdict rows, NULL rows and mixed rows. A NULL row after a verdict row has the small post-compactionprevBefore, so it does not close a second time.- The new tests in
internal/thread,dashandproxy. They cover the marked request, the empty verdict, the NULL control and the SQL round trip. No test covers aSourceSessionresult (finding 2). docs/data-dependence/row files against the generated page, andinternal/datadep/datadep_test.go(finding 1).- I did not run Go builds or tests. Live tests are not approved, and Go is not installed. CI
build-testwas still pending when I checked.
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, aws/claude-opus-5-5[1m] | offload-review skill, @boazdavid's session | fresh | 1 of 2 | 1 of 2 | c05d161972f6 |
blocking |
Verdict: blocking
Findings
-
docs/data-dependence.md:240 — the generated page is edited by hand. The row file is not changed.
- What fails:
internal/datadepTestGeneratedPageIsUpToDatebuilds the page fromdocs/data-dependence/and compares it with the file. The page now has the new #947 text. The row filedocs/data-dependence/features/thread-tracker.mdstill has only the old two sentences. So the test fails, and the nextgo run ./cmd/gen-datadepdeletes the new text. - Proof:
git diff a4d43d94..HEAD --statlistsdocs/data-dependence.mdand no file underdocs/data-dependence/.docs/data-dependence/features/thread-tracker.mdline 10 is "It tells the main agent from its subagents. It uses hashes to check if a new request continues an earlier one."internal/datadep/datadep_test.go:12-25fails when the page differs fromBuild(repoRoot). The PR body says all other packages pass. That cannot be true forinternal/datadepat this head. - Fix: Move the new sentences into
docs/data-dependence/features/thread-tracker.md. Rungo run ./cmd/gen-datadep. Commit both files.
- What fails:
-
internal/thread/thread.go:337 — a tool-less thread that takes over a compacting tool-less thread is marked
AfterCompaction. This gives false "unknown" verdicts.- What fails: The code itself says that Claude Code's auto-mode classifier thread "can be marked compacting by mistake" (
thread.go:325-327, andTestAToolLessCompactingThreadDoesNotTakeTheMainAgent, "seen live"). The classifier sends the session transcript in one tool-less user message. When that transcript quotes the compaction prompt,isAgentCompactionis true, andResolvesetsth.compactingon the classifier thread (thread.go:296). The next classifier request has a new transcript, so it matches no prefix. It has no tools, sorewrittenTailParentis not tried. It goes tonewID. TherehasTools == th.toolsisfalse == false, sosuccis the classifier thread andnewIDreturns(succ.id, true). The result:- The proxy sends
Compaction: unknownto the accountant for a request that is not after a client compaction. - The row stores
client_compaction = 'unknown'. walkCapConversationcloses the epoch on that row by the verdict alone (replaycap.go:373), with no drop check and no recovery check. If the classifier uses the same model as the main agent, this closes the main conversation's epoch and cuts the replay credit. Before this PR, the drop detector needed a drop that does not recover, so the classifier row did not close it.
- The proxy sends
- Proof: trace above, through
thread.go:262-266(default branch),thread.go:328-337(succ loop),dashcapture.go:300,proxy.go:1586,replaycap.go:373-376. The PR says "a subagent can no longer close an epoch". That holds for header subagents, but not for a tool-less auxiliary thread. No test covers a tool-less compacting thread with the new flag. - Fix: Report
AfterCompactiononly when the successor is the main agent, for examplereturn succ.id, succ.tools. The id hand-over can stay as it is. Add a test: classifier request flagged as a compaction, then a second tool-less classifier request with no match. ExpectAfterCompaction == false.
- What fails: The code itself says that Claude Code's auto-mode classifier thread "can be marked compacting by mistake" (
Non-blocking
proxy/dashcapture.go:300setscompKnown = truefor every result, also forSourceSessionfallbacks: an empty session, no message list (!ok), and the panic recovery inthreadFor. In these cases the tracker could not judge, but the row stores''("no compaction"), and the replay cap then turns off the drop detector for that row.compKnown = res.Source != thread.SourceSessionwould match the comments inevent.go:478andschema.go:247("a request the thread tracker saw").- The PR names a proxy restart as a case the tracker misses. A deployment with more than one proxy replica behind one route has the same gap on every compaction where the compaction request and the next request go to different replicas. Please name that case in the behavior-change note too.
ClientCompactionKnownisjson:"-", andclient_compactionisomitempty. An archive (EncodeArchive/DecodeArchive) therefore loses the difference between''and NULL. No importer reads archives back today, so nothing fails now.- The behavior change is named at the top of the PR. It still needs a human developer's yes before merge, as
CLAUDE.mdsays.
What I checked
- Every changed line of the 15 files in
git diff a4d43d94..HEAD, and the commit message and PR body. internal/thread/thread.go:Resolve,newID,compactionParent, thecompactingflag, and the existing classifier test.proxy/proxy.go:1490-1610: the moved thread block. The move keeps the same inputs (orig,agentCompaction,tr.Session).threadIDis still set beforearriveAt,predRT().arriveandClearStaleKeepAliveCandidate. All paths fromisAgentCompaction(including the oversize bypass) still reach thread resolution.proxy/agentcompaction.go:compactionVerdict. accountant v0.1.1 (module cache) hasRequestMeta.CompactionandCompactionUnknown. The library only records the verdict inResult.Compactionand changes no figure (internal/engine/compute.go:320-333).dash: the schema column and the additive migration, the insert column/placeholder/argument count,requestColsandscanRequestorder,capSelectand its scan order,walkCapSessionandwalkCapConversation.requestshas only one INSERT site.- The new tests in
dash/replaycap_test.go,internal/thread/thread_test.goandproxy/bypasstokens_test.go, by reading. I traced the control case ofTestReplayCapAnEmptyVerdictIsNotACompactionthroughcompactionBetweenandrecovers. - Docs:
docs/dashboard.md,docs/components/extract_llm.md,docs/data-dependence.mdagainst its row file andinternal/datadep. - I did not run Go builds or tests (not approved, and Go is not installed).
…judged Review of #1165, round 1: - Put the data-dependence text in the Thread tracker row file and regenerate docs/data-dependence.md. internal/datadep failed before. - AfterCompaction is set only when the successor is the main agent: the thread that declares tools, or the primary. Claude Code's tool-less classifier thread can be marked compacting by mistake; its next request gave a false "unknown" verdict. - A "session" thread result (no session id, no message list, a recovered panic) stores NULL, not ''. The replay cap then keeps the drop detector for that row, as before this PR. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
|
Replies to round 1. The fixes are in Reviewer 1, finding 1, and reviewer 2, finding 1: the generated data-dependence page was edited by hand. Fixed. The text is now in Reviewer 1, finding 2: a tool-less classifier thread gives a false
Reviewer 2, finding 2, and reviewer 1, non-blocking 1: a Reviewer 1, non-blocking 2 (replicas), and reviewer 2, non-blocking 3 (full prune). Done. The behavior-change note now names a restart, more than one replica, and the full prune at 20,000 sessions. Reviewer 1, non-blocking 3: an archive loses Reviewer 2, non-blocking 2: a header-less fork that declares tools can still be marked. Not changed. A fork that declares tools and compacts is a main-agent-shaped thread, and the tracker cannot tell it from the main agent. As you say, the error only removes credit, so it is conservative. Both: a human developer must confirm the behavior change. Yes. The note stays at the top of the PR. Other test results: every package this PR changes passes. |
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, aws/claude-opus-5-5[1m] | offload-review skill, @boazdavid's session | resumed | 1 of 2 | 2 of 2 | be71e020f79b |
approve |
Verdict: approve
Findings
None. All earlier findings are fixed.
Status of the round-1 findings:
- Reviewer 1, finding 1, and reviewer 2, finding 1 (hand-edited generated page): fixed. The new text is now in
docs/data-dependence/features/thread-tracker.md. The page row atdocs/data-dependence.md:240has the same text, character for character. The front matter (kind and the three levels) does not change, so the data dependence stays "metadata" at every level. - Reviewer 1, finding 2 (false
unknownverdict from a tool-less classifier thread): fixed.internal/thread/thread.go:342now returnssucc.tools || succ.id == Primary. I traced the new testTestAToolLessAuxiliaryThreadAfterACompactionIsNotMarked. The classifier thread hastools == falseand an id that is notPrimary, so the flag is false. The id hand-over does not change. A tool-less thread holdsPrimaryonly while no thread with tools exists in the session (newIDmoves it off when the first tools thread arrives). So thePrimarycase does not bring back the classifier problem.TestAToolLessClientsCompactionIsMarkedcovers the client that never declares tools:conv(...)sends notools, the compaction request extends the primary's prefix, and the next request takesPrimarywith the flag. - Reviewer 2, finding 2, and my non-blocking 1 (
sessionfallback stored''): fixed.proxy/dashcapture.go:302setscompKnownonly whenres.Source != thread.SourceSession. That covers the empty session (proxy/thread.go:25-26), no message list (thread.go:253-256), and both panic recoveries (proxy/thread.go:29-31,apply/opts.go:153-156). All of them returnSourceSession. A header result stores''. That is correct, because a header thread is never a compaction successor.TestNoteThreadStoresAVerdictOnlyWhenTheTrackerJudgedcovers the four cases. - My non-blocking 2 (replicas) and reviewer 2, non-blocking 3 (full prune): done. The behavior-change note in the PR body names a restart, more than one replica, and the prune at 20,000 sessions.
- My non-blocking 3 (archive loses
''against NULL): left as is, with a reason. I accept the reason: nothing reads archives back today. - Reviewer 2, non-blocking 2 (a header-less fork with tools can still be marked): left as is, with a reason. I accept the reason: the tracker cannot tell such a fork from the main agent, and the error only removes credit.
Non-blocking
- The behavior change is still named at the top of the PR. A human developer must confirm it before merge (
CLAUDE.md). An agent's approve does not replace that yes. dash/schema.go:299is one long comment line, longer than the lines around it. This is style only.
What I checked
- Last review: round 1, c05d161, 2026-11-16T13:18:14Z
- New commits read: 1 (
be71e020fix(proxy): Mark only the main agent's compaction; no verdict when unjudged) - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
- New items since my last review:
- Commit
be71e020(8 files): read the whole diff and the code around it (newID,Resolve,noteThread,threadFor,resolveThread). See the status list above. - Comment by boazdavid at 2026-11-16T13:42:53Z (the author's replies to round 1): I checked each reply against the code. The status list above has the result for each one.
- The updated PR body: the behavior-change note now names the restart, replica and prune cases, and the corrected test claim.
- Commit
- I read reviewer 2's round-1 review (posted at 13:17:37Z, before my round-1 review). It had no finding that I had not checked.
- I did not run Go builds or tests. Live tests are not approved, and Go is not installed.
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, aws/claude-opus-5-5[1m] | offload-review skill, @boazdavid's session | resumed | 2 of 2 | 2 of 2 | be71e020f79b |
approve |
Verdict: approve
Findings
None.
Status of the round-1 findings
- Reviewer 2, finding 1, and reviewer 1, finding 1 (hand edit of
docs/data-dependence.md): fixed. The new text is indocs/data-dependence/features/thread-tracker.md. Line 10 of the row file and the body cell of the "Thread tracker" row in the page are the same string (I compared them withdiff). The Kind and the three levels do not change. - Reviewer 2, finding 2 (a
sessionfallback stored''): fixed.proxy/dashcapture.go:302now setscompKnown = res.Source != thread.SourceSession. All the fallbacks I named returnSourceSession:proxy/thread.go:26(no session),proxy/thread.go:31(panic),apply/opts.go:155(panic),internal/thread/thread.go!okand the nil tracker or empty scope. Such a row stores NULL, so the replay cap keeps the drop detector. A header thread with no message list returnsSourceHeaderand stores''. That is correct, because a header thread is a subagent (#585).proxy/compactionverdict_test.gocovers all three sources and the marked case. - Reviewer 1, finding 2 (a tool-less classifier thread got a false
unknown): fixed. I checked it myself.newID(internal/thread/thread.go:342) now returnssucc.tools || succ.id == Primary. The id hand-over does not change. Trace ofTestAToolLessAuxiliaryThreadAfterACompactionIsNotMarked: the first classifier request matches no prefix and has no tools.newIDfinds no compacting thread and gives it a fingerprint id.Resolvesetscompactingon it. The next classifier request goes tonewID,succis the classifier thread (tools == false, id is notPrimary), so the result is(id, false). In Claude Code a tool-less thread holdsPrimaryonly until the first tools thread arrives (newIDmoves it), so thePrimaryterm cannot mark the classifier after the main agent starts.TestAToolLessClientsCompactionIsMarkedcovers a client that never declares tools. - My non-blocking 2 (a header-less fork with tools can be marked): rejected by the author. The reason is right: such a fork has the shape of the main agent, the tracker cannot tell them apart, and the error only removes credit. I accept it.
- My non-blocking 3 (full prune) and reviewer 1, non-blocking 2 (replicas): done. The behavior-change note now names a restart, more than one replica and the full prune.
- Reviewer 1, non-blocking 3 (archive loses
''against NULL): not changed, with a reason. No importer reads archives back. I accept it for this PR.
Non-blocking
- The behavior change is named at the top of the PR. A human developer must still say yes before merge (
CLAUDE.md). An agent's approval does not count for it. dash/schema.go:299is now one long comment line (about 140 characters). This is style only.
What I checked
- Last review: round 1, c05d161, 2026-11-16T13:17:37Z
- New commits read: 1 (
be71e020fix(proxy): Mark only the main agent's compaction; no verdict when unjudged) - Read in full: 2 reviews, 1 comment, 0 inline comments (from
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt) - New items since my last review:
- Reviewer 1's round-1 review (2026-11-16T13:18:14Z). I checked its finding 2 myself (see above) and its non-blocking points.
- The author's reply comment (2026-11-16T13:42:53Z). I checked each reply against the code, as listed under "Status of the round-1 findings".
- The updated PR body. It names the behavior change, the replica and prune cases, and corrects the test claim.
- The full diff
c05d1619..be71e020(8 files) and the code around it:newIDandResolveininternal/thread/thread.go,noteThreadinproxy/dashcapture.go,threadForinproxy/thread.go,resolveThreadinapply/opts.go. - The two new tests in
internal/thread/thread_test.goand the newproxy/compactionverdict_test.go, by reading and by trace. - The comments in
dash/event.goanddash/schema.gonow match the code ("judged", NULL for the session fallback). - I did not run Go builds or tests. Live tests are not approved, and Go is not installed.
…dropped (#1139) When the pipeline's operations are dropped (the accountant's ops_dropped path), apply still reports the tail mark's operation, so the accountant can price it. Behavior change: readers of the central llm.savings.* metrics, for requests with dropped operations and a tail mark. Old: 0 operations, llm.savings.requests{result="skipped"} and a +1 on llm.savings.check_failures{check="sum"}. New: the mark's operation is booked under component="tailbreakpoint" in llm.savings.saved.tokens and llm.savings.added.tokens (and the .usd counters on api billing), with result="priced"; the sum failure is not counted when the mark was the only operation. The thread state that computeSafe keeps also gets the mark's ChangeID, which can change the next request's figure on the thread. 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: none (sizes and a hash of the message, as before). Reviews: 2 offload review rounds (Claude backend). Round 2: both approve at da52ebd, which is the PR head. Signed-off-by: DAVID BOAZ <[email protected]> Assisted-By: Claude Opus 5.5 <[email protected]>
The accountant library now prices the OpenAI Responses wire (/openai/v1/responses). The proxy builds the accountant's view of a Responses body the same way as for the other two wires: a hash and a size per part, no text kept. Behavior change: accounts on /openai/v1/responses. Old: every request on that wire booked $0 saving, with fallback unsupported_wire. New: a request that sends its full history is priced as on the other two wires. A request that leaves part of its prompt on the provider's side (previous_response_id) still books $0, now with fallback server_held_history. 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: unchanged (metadata only). The accountant-savings row says so. Reviews: 2 offload review rounds (Claude backend). Round 2: both approve at ea37791, which is the PR head. After it, main changed only docs/dashboard.md among its files (#1151); the merge is clean. Signed-off-by: DAVID BOAZ <[email protected]> Assisted-By: Claude Opus 5.5 <[email protected]>
On a local proxy, the Overview's Preset card names the preset the proxy runs now, with a note while the window's history says something else. After a switch from off to ultrahigh, the card still said "Preset (off)", because 96% of the window's requests (2,898 of 3,016) ran under off. Behavior change (asked for by a developer): local proxy users of the Overview. Old: the card named the preset most requests in the window ran under. New: it names the running preset (from /api/whoami). A hosted account keeps the old card. 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: none changed. Reviews: 3 offload review rounds (Claude backend). Round 3: both approve at 0fbbe2c, which is the PR head and the integrator's merge of main that moved the change into the split dashboard files (#1151): presetName() and loadOverviewIdentity() into dash/ui/tabs/overview.js, the account.preset lines in dash/ui/app.js, and presetLabel in dash/ui/savings.js with a forTests entry. CI ran the Go checks (the eval box was down; owner: merge on CI and reviews until it is back). Signed-off-by: DAVID AMID <[email protected]> Assisted-By: Claude Opus 5.5 <[email protected]>
…tartup (#1172) The reprice pass (#1002) also prices a row's compaction call. A row written in the first seconds after a start, before the price map loads, for a request that also made compaction calls, stayed partial at $0 for good: neither cost_usd nor cg_llm_cost_usd was priced. Behavior change: those dashboard rows. Old: partial at $0 for good. New: once the map loads, the reprice pass prices both halves, marks the row complete, and adds both halves to tenant_spend. Turn it off: no separate switch; Options.Prices = nil turns off the whole reprice pass, as before. 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: unchanged (metadata only). Row: docs/data-dependence/features/dashboard-database.md. Reviews: 2 offload review rounds (Claude backend). Round 2: both approve at df9c251, which is the PR head. CI passed on a fresh merge with main after #1150 and #1165 (the eval box was down; owner: merge on CI and reviews until it is back). Signed-off-by: DAVID BOAZ <[email protected]> Assisted-By: Claude Opus 5.5 <[email protected]>
…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]>
Behavior change (needs a human developer's yes before merge).
tokens_beforeafter the agent's compaction request.Data dependence: metadata only, unchanged in kind. One short label per request (
unknownor empty), no text. The Thread tracker row indocs/data-dependence.mdis updated.Summary
Part of #947 (steps 1 and 2). The proxy now reports a client compaction to the accountant and stores it on the dashboard row. The replay cap reads the boundary from the row instead of guessing it.
What changed
thread.Result.AfterCompactionis true on the request that takes over the compacting thread's id (newID), when that thread is the main agent's: it declares tools, or it is the primary. The tracker already handed the id over; it now reports it.accBegin.RequestMeta.Compactionisunknownon that request, empty on others (accountant R55, in v0.1.1).client_compaction:'unknown',''for none, NULL for no verdict (every earlier row, and a request the tracker could not judge: itssessionfallback).docs/dashboard.md,docs/components/extract_llm.md,docs/data-dependence.md.How it was tested
internal/thread: only the request after the compaction is marked; a control with no compaction is not.dash: a verdict closes the epoch where the drop detector would not; an empty verdict does not close where the drop detector would; rows without a verdict still use the drop detector; NULL and''are stored apart and read back through SQL.proxy: four requests through the handler; only the third row carriesunknown. The test fails with the verdict turned off.internal/threadalso: a tool-less classifier thread marked compacting by mistake hands its id over without the mark; a tool-less client's primary thread keeps the mark.proxyalso: asessionfallback result stores no verdict.go vetandgofmtclean.go test ./...: every package this PR changes passes,internal/datadepincluded. These fail the same way on the base commita4d43d94, so this PR does not cause them:bob-plugin(Python suites),context-guru-plugin(save-moregoldens, install tests, then a 10-minute timeout),internal/modelinfo(TestRateFillTableAndPrice, float rounding),pi-package(Python tests),proxyapp(2 install-script preflight tests).Open questions
/compactfrom an auto compaction on the wire. Until then the verdict is alwaysunknown.Result.Compactionfrom the accountant is not read back yet. The dashboard reads the proxy's own verdict, which is the same value the accountant echoes.Assisted-By: Claude (Anthropic AI) [email protected]