Skip to content

feat(proxy): Report the first request after a client compaction (#947) - #1165

Merged
amiddavid merged 2 commits into
mainfrom
feat/compaction-verdict
Nov 16, 2026
Merged

amiddavid merged 2 commits into
mainfrom
feat/compaction-verdict

Conversation

@boazdavid

@boazdavid boazdavid commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Behavior change (needs a human developer's yes before merge).

  • Who: dashboard users, through the replay-cap savings figures.
  • Old: the replay cap guessed a client compaction from a drop in tokens_before after the agent's compaction request.
  • New: on rows written from now on, an epoch closes only where the thread tracker marked the first request after a compaction. A header subagent or a tool-less auxiliary thread can no longer close an epoch (dash: the replay-cap fallback for rows with no verdict is not thread-aware #585). A compaction the tracker misses no longer closes one. The tracker keeps its state in memory, per process, so it misses a compaction when the compaction request and the next request do not reach the same live tracker: a proxy restart between them, more than one proxy replica behind one route, or the tracker's full prune at 20,000 sessions. A request the tracker could not judge (no session id, no message list) stores no verdict and keeps the old rule.
  • Turn off: no switch. Rows written before this change keep the old rule.

Data dependence: metadata only, unchanged in kind. One short label per request (unknown or empty), no text. The Thread tracker row in docs/data-dependence.md is 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

  1. Thread tracker. thread.Result.AfterCompaction is 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.
  2. Proxy. The thread is resolved before accBegin. RequestMeta.Compaction is unknown on that request, empty on others (accountant R55, in v0.1.1).
  3. Dashboard row. New nullable column client_compaction: 'unknown', '' for none, NULL for no verdict (every earlier row, and a request the tracker could not judge: its session fallback).
  4. Replay cap. A row with a verdict closes the epoch by the verdict alone. A row with NULL keeps the drop detector.
  5. Docs: 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 carries unknown. The test fails with the verdict turned off.
  • internal/thread also: 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. proxy also: a session fallback result stores no verdict.
  • go vet and gofmt clean. go test ./...: every package this PR changes passes, internal/datadep included. These fail the same way on the base commit a4d43d94, so this PR does not cause them: bob-plugin (Python suites), context-guru-plugin (save-more goldens, install tests, then a 10-minute timeout), internal/modelinfo (TestRateFillTableAndPrice, float rounding), pi-package (Python tests), proxyapp (2 install-script preflight tests).

Open questions

Assisted-By: Claude (Anthropic AI) [email protected]

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 boazdavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. 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.md still 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/datadep TestGeneratedPageIsUpToDate compares the page with the output of the row files, so it fails. The next go run ./cmd/gen-datadep also deletes the new text.
    • Proof: git diff --stat a4d43d94..HEAD lists docs/data-dependence.md and no file under docs/data-dependence/. grep -rn "Since #947" docs/data-dependence/ gives no result. git log -- docs/data-dependence/features/thread-tracker.md shows only 9966adf0 (#1090). The PR body says go test ./... passes except proxyapp and pi-package. That cannot be true for internal/datadep at this head.
    • Fix: Put the new sentences in docs/data-dependence/features/thread-tracker.md. Run go run ./cmd/gen-datadep. Commit both files.
  2. 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: noteThread sets compKnown = true for every thread.Result. Some results come from paths where the tracker did not run, or could not decide. They have Source == thread.SourceSession:
      • proxy/thread.go:25-26: session == "" (for example observe mode, where applyMode returns apply.Trace{}, so tr.Session is empty).
      • internal/thread/thread.go:253-256: !ok, no message list. For example a Responses request with previous_response_id (fingerprint, thread.go:550).
      • proxy/thread.go:29-31 and apply/opts.go:153-156: a panic in the tracker.
        These rows can never get AfterCompaction, but they store client_compaction = ''. walkCapConversation then sets compacted = false and 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 with previous_response_id and a lower tokens_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-16 and 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: noteThread at proxy/dashcapture.go:300 has no condition on res.Source. compactionVerdict returns "" for every result without AfterCompaction. No test covers a SourceSession result.
    • Fix: Set compKnown only when the tracker matched by prefix or by header (res.Source != thread.SourceSession). Or add a field to thread.Result that says the tracker ran. Add a test: a request with no session id, or with previous_response_id, stores NULL.

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), because th.compacting is set only for SourcePrefix. A header-less fork that declares tools and compacts can still get AfterCompaction in newID. 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 (staleAfter 2 h, maxSessions 20000, cleared on restart). The PR names the restart case. Full pruning at maxSessions (thread.go:509-511) can also drop a compacting flag between the compaction request and the next request. That is rare; no action is needed now.
  • The code move in proxy/proxy.go:1553-1564 keeps the old logic and order for noteKeepAlive, predArrival and ClearStaleKeepAliveCandidate. 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: Resolve and newID. AfterCompaction is true only when succ takes over a compacting thread. The compacted != nil path (the compaction request) and the header path never set it.
  • proxy/proxy.go: the thread is resolved before accBegin. RequestMeta.Compaction gets compactionVerdict(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, CompactionTrigger and CompactionUnknown = "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 more Scan target, in the same position in insertBatch, requestCols/scanRequest and capSelect/ReplayLedgerForCtx.
  • dash/replaycap.go: walkCapConversation with verdict rows, NULL rows and mixed rows. A NULL row after a verdict row has the small post-compaction prevBefore, so it does not close a second time.
  • The new tests in internal/thread, dash and proxy. They cover the marked request, the empty verdict, the NULL control and the SQL round trip. No test covers a SourceSession result (finding 2).
  • docs/data-dependence/ row files against the generated page, and internal/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-test was still pending when I checked.

@boazdavid boazdavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. docs/data-dependence.md:240 — the generated page is edited by hand. The row file is not changed.

    • What fails: internal/datadep TestGeneratedPageIsUpToDate builds the page from docs/data-dependence/ and compares it with the file. The page now has the new #947 text. The row file docs/data-dependence/features/thread-tracker.md still has only the old two sentences. So the test fails, and the next go run ./cmd/gen-datadep deletes the new text.
    • Proof: git diff a4d43d94..HEAD --stat lists docs/data-dependence.md and no file under docs/data-dependence/. docs/data-dependence/features/thread-tracker.md line 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-25 fails when the page differs from Build(repoRoot). The PR body says all other packages pass. That cannot be true for internal/datadep at this head.
    • Fix: Move the new sentences into docs/data-dependence/features/thread-tracker.md. Run go run ./cmd/gen-datadep. Commit both files.
  2. 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, and TestAToolLessCompactingThreadDoesNotTakeTheMainAgent, "seen live"). The classifier sends the session transcript in one tool-less user message. When that transcript quotes the compaction prompt, isAgentCompaction is true, and Resolve sets th.compacting on the classifier thread (thread.go:296). The next classifier request has a new transcript, so it matches no prefix. It has no tools, so rewrittenTailParent is not tried. It goes to newID. There hasTools == th.tools is false == false, so succ is the classifier thread and newID returns (succ.id, true). The result:
      • The proxy sends Compaction: unknown to the accountant for a request that is not after a client compaction.
      • The row stores client_compaction = 'unknown'.
      • walkCapConversation closes 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.
    • 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 AfterCompaction only when the successor is the main agent, for example return 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. Expect AfterCompaction == false.

Non-blocking

  • proxy/dashcapture.go:300 sets compKnown = true for every result, also for SourceSession fallbacks: an empty session, no message list (!ok), and the panic recovery in threadFor. 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.SourceSession would match the comments in event.go:478 and schema.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.
  • ClientCompactionKnown is json:"-", and client_compaction is omitempty. 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.md says.

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, the compacting flag, and the existing classifier test.
  • proxy/proxy.go:1490-1610: the moved thread block. The move keeps the same inputs (orig, agentCompaction, tr.Session). threadID is still set before arriveAt, predRT().arrive and ClearStaleKeepAliveCandidate. All paths from isAgentCompaction (including the oversize bypass) still reach thread resolution.
  • proxy/agentcompaction.go: compactionVerdict. accountant v0.1.1 (module cache) has RequestMeta.Compaction and CompactionUnknown. The library only records the verdict in Result.Compaction and changes no figure (internal/engine/compute.go:320-333).
  • dash: the schema column and the additive migration, the insert column/placeholder/argument count, requestCols and scanRequest order, capSelect and its scan order, walkCapSession and walkCapConversation. requests has only one INSERT site.
  • The new tests in dash/replaycap_test.go, internal/thread/thread_test.go and proxy/bypasstokens_test.go, by reading. I traced the control case of TestReplayCapAnEmptyVerdictIsNotACompaction through compactionBetween and recovers.
  • Docs: docs/dashboard.md, docs/components/extract_llm.md, docs/data-dependence.md against its row file and internal/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]>
@boazdavid

Copy link
Copy Markdown
Collaborator Author

Replies to round 1. The fixes are in be71e020.

Reviewer 1, finding 1, and reviewer 2, finding 1: the generated data-dependence page was edited by hand. Fixed. The text is now in docs/data-dependence/features/thread-tracker.md, and go run ./cmd/gen-datadep regenerated the page. internal/datadep passes. My full test run was made before the docs edit, so the PR body's test claim was wrong. I corrected it.

Reviewer 1, finding 2: a tool-less classifier thread gives a false unknown verdict. Fixed. newID still hands the id over, but it reports AfterCompaction only when the successor is the main agent: succ.tools || succ.id == Primary. The primary case keeps a client that never declares tools covered. New tests:

  • TestAToolLessAuxiliaryThreadAfterACompactionIsNotMarked: your scenario. It failed before the fix.
  • TestAToolLessClientsCompactionIsMarked: a tool-less client's primary thread is still marked.

Reviewer 2, finding 2, and reviewer 1, non-blocking 1: a session fallback result stored '', not NULL. Fixed. noteThread sets compKnown only when res.Source != thread.SourceSession. Such a row stores NULL, so the replay cap keeps the drop detector for it. New test: TestNoteThreadStoresAVerdictOnlyWhenTheTrackerJudged. It failed before the fix. The comments in dash/event.go and dash/schema.go now say "judged".

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 '' against NULL. Not changed. No importer reads archives back, as you say. If one does later, the archive must carry ClientCompactionKnown. I keep this out of this PR.

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. bob-plugin, context-guru-plugin, internal/modelinfo, pi-package and proxyapp fail the same tests on the base commit a4d43d94, so this PR does not cause them.

@boazdavid boazdavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 at docs/data-dependence.md:240 has 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 unknown verdict from a tool-less classifier thread): fixed. internal/thread/thread.go:342 now returns succ.tools || succ.id == Primary. I traced the new test TestAToolLessAuxiliaryThreadAfterACompactionIsNotMarked. The classifier thread has tools == false and an id that is not Primary, so the flag is false. The id hand-over does not change. A tool-less thread holds Primary only while no thread with tools exists in the session (newID moves it off when the first tools thread arrives). So the Primary case does not bring back the classifier problem. TestAToolLessClientsCompactionIsMarked covers the client that never declares tools: conv(...) sends no tools, the compaction request extends the primary's prefix, and the next request takes Primary with the flag.
  • Reviewer 2, finding 2, and my non-blocking 1 (session fallback stored ''): fixed. proxy/dashcapture.go:302 sets compKnown only when res.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 return SourceSession. A header result stores ''. That is correct, because a header thread is never a compaction successor. TestNoteThreadStoresAVerdictOnlyWhenTheTrackerJudged covers 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:299 is 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 (be71e020 fix(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.
  • 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 boazdavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in docs/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 with diff). The Kind and the three levels do not change.
  • Reviewer 2, finding 2 (a session fallback stored ''): fixed. proxy/dashcapture.go:302 now sets compKnown = res.Source != thread.SourceSession. All the fallbacks I named return SourceSession: proxy/thread.go:26 (no session), proxy/thread.go:31 (panic), apply/opts.go:155 (panic), internal/thread/thread.go !ok and 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 returns SourceHeader and stores ''. That is correct, because a header thread is a subagent (#585). proxy/compactionverdict_test.go covers 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 returns succ.tools || succ.id == Primary. The id hand-over does not change. Trace of TestAToolLessAuxiliaryThreadAfterACompactionIsNotMarked: the first classifier request matches no prefix and has no tools. newID finds no compacting thread and gives it a fingerprint id. Resolve sets compacting on it. The next classifier request goes to newID, succ is the classifier thread (tools == false, id is not Primary), so the result is (id, false). In Claude Code a tool-less thread holds Primary only until the first tools thread arrives (newID moves it), so the Primary term cannot mark the classifier after the main agent starts. TestAToolLessClientsCompactionIsMarked covers 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:299 is 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 (be71e020 fix(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: newID and Resolve in internal/thread/thread.go, noteThread in proxy/dashcapture.go, threadFor in proxy/thread.go, resolveThread in apply/opts.go.
  • The two new tests in internal/thread/thread_test.go and the new proxy/compactionverdict_test.go, by reading and by trace.
  • The comments in dash/event.go and dash/schema.go now 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.

@boazdavid boazdavid added the ready-to-merge Program PR approved by the reviewer, CI green; needs maintainer approval label Nov 16, 2026
amiddavid pushed a commit that referenced this pull request Nov 16, 2026
…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]>
amiddavid pushed a commit that referenced this pull request Nov 16, 2026
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]>
@amiddavid amiddavid closed this Nov 16, 2026
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 16, 2026
@amiddavid amiddavid reopened this Nov 16, 2026
@amiddavid
amiddavid merged commit c5e1323 into main Nov 16, 2026
16 checks passed
amiddavid added a commit that referenced this pull request Nov 16, 2026
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]>
amiddavid pushed a commit that referenced this pull request Nov 16, 2026
…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]>
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Program PR approved by the reviewer, CI green; needs maintainer approval

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants