Skip to content

fix(dash): seed the billed cache tier after a restart - #958

Merged
amiddavid merged 2 commits into
mainfrom
fix/ttl-seed-tier
Nov 8, 2026
Merged

amiddavid merged 2 commits into
mainfrom
fix/ttl-seed-tier

Conversation

@amiddavid

@amiddavid amiddavid commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Behavior change — needs a human developer's yes

  • Who: 1h-TTL threads on Anthropic, Bedrock and Vertex, across a proxy restart.
  • Old: the first miss after a restart, 5 to 60 minutes after the last request, got ttl_expiry.
  • New: the label follows the billed tier of the thread's last successful cache write before the restart. A 1h thread is no longer ttl_expiry in that window.
  • Switch: none. It is a label fix with no setting.

Stacked on #943. Retarget this PR to main after #943 merges.

Closes #956

Summary

  • SeedSessions now reloads the billed cache tier of each thread.
  • A restart no longer resets a 1h thread to the 5-minute limit.

What changed

  • A second query in SeedSessions reads the thread's latest non-ping, 2xx row with cache_write > 0. Recency and tail still come from the latest row.
  • Rule: cache_write_1h >= cache_write. It is the rule of FactsOf.
  • A failed request or a full hit does not erase the tier of the earlier write.
  • The tier goes into a new Recorder.seedTier map, with the per-thread key. It ages out with lastSeen and clears in the wholesale reset.
  • ObservePrefix returns the seeded tier for the first request after a restart, while the thread has no facts. If that request wrote nothing, it also commits the tier, like fix(proxy): label a 1h thread's miss by its billed TTL, not 5m #943 does for a read-only turn.
  • A thread with no successful write in the window has no known tier. It keeps the 5-minute limit.

How it was tested

  • TestSeededTierAfterARestart (restart = new Recorder and SeedSessions on the same DB; miss after 20 min with a changed prefix). Cases: 1h, 5m, mixed write, only read rows, full-hit last row, failed last row, failed 1h write, later 5m write, read-only first turn.
  • Mutation checks: delete the NoWrite branch: the read-only case fails. Drop the status and write filters: the "only read rows" and "failed 1h write" cases fail. Remove the seeding: the 1h case fails.
  • On the shared box: go test -race ./dash/... ok, go test -race ./proxy/... ok, go vet, gofmt clean.

Data dependence

Metadata only (token counts). No change at any storage level. docs/data-dependence.md needs no update.

Out of scope (known limits)

  • The seed is per thread, not per model. A /model switch across a restart borrows the other model's tier. The first request per model reads cold_start anyway.
  • A new fork thread after a restart does not inherit the parent's seeded tier.

@amiddavid amiddavid 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 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 offload-review skill, @amiddavid's session fresh 2 of 2 1 of 2 71ffd91dbdf1 blocking

Verdict: blocking

Findings

  1. dash/capture.go:759 — a failed last request erases a known 1h tier, so the miss is still mislabeled ttl_expiry

    • What fails: a thread writes a whole 1h entry, its next request fails (upstream 5xx, row recorded with keepalive = 0, status = 500, cache_write = 0), the proxy restarts. SeedSessions picks that failed row as the thread's latest. write = 0 leaves the tier unknown, so seedTier stays empty. The first same-model miss 5 to 60 minutes later (model already seen by another request) gets ttl_expiry again — the exact label this PR exists to remove.
    • Proof: the query has no status filter (dash/capture.go:759-762), unlike SeedGraceSessions, which filters status >= 200 AND status < 300 because "a failed request wrote no cache entry" (dash/capture.go:821-823). The live rule agrees: only a 2xx request commits facts and can set the tier (dash/prefixcause.go:81-83, proxy/dashcapture.go:662-663). Failed requests are recorded as rows: proxy/proxy.go:1941-1943 names "an upstream failure" as a path that emits the row. So the seeded row can be a failed one. Money follows the label: causedWriteUSD charges $0 for ttl_expiry but the write for prefix_change (dash/compactepisode.go:1017-1024), so the mislabel understates the debit — the flattering direction this repo treats as the worse one.
    • Fix: add AND r.status >= 200 AND r.status < 300 to the seeding query. Better: seed from the thread's latest 2xx row with cache_write > 0 (one query, same shape), which also fixes the successful full-hit case noted under Non-blocking.
  2. dash/prefixcause.go:122-123 — the new cur.NoWrite && seededTier branch has no test

    • What fails: nothing today, but the branch is new behavior in this diff and no test runs it. TestSeededTierAfterARestart always gives the post-restart turn a write (ttlTurn(..., 0, 50_000, 50_000)), so NoWrite is false on every committed turn. A regression in this branch (a read-only first turn on a seeded 1h thread losing the tier, mislabeling the next miss) would pass the suite.
    • Proof: the only restart test is TestSeededTierAfterARestart (dash/prefixcause_test.go:552-586); its miss turn passes write = 50_000. TestTTLTierSurvivesAReadOnlyTurn (line 477) covers the same branch only.
    • Fix: add one case — a seeded 1h thread whose first post-restart request is read-only (read > 0, write = 0), then a miss 20 minutes later must not read ttl_expiry.

Non-blocking

  • Full-hit last row keeps 5m (documented). A 2xx read-only last row (cache_write = 0, a full cache hit) also leaves the tier unknown, so a 1h thread is mislabeled ttl_expiry after a restart. Issue #956 and the PR state this limit, and the test pins it ("latest row wrote nothing seeds 5m"). The latest-writing-row query from finding 1 fixes this case too, at no extra cost.
  • Seed is thread-keyed, not per model. seedTier is keyed by thread alone (dash/capture.go:196), while the live tier belongs to a (thread, model) entry. A multi-model thread whose last row is a helper request on another model seeds that model's tier for every model. Mostly benign while the 1h beta is set per client (all models in a thread then write 1h), but it diverges from the per-model live rule.
  • The 20,000-entry fallback prune misses seedTier (dash/capture.go:726-730). It empties lastSeen, lastTail, lastFacts and graceSeen, but not seedTier; and after lastSeen is emptied, the age-based prune can no longer delete seedTier entries either, because it iterates lastSeen (dash/capture.go:705-710). A stale startup tier can then reach the NoWrite commit branch for a thread whose live tier has since changed. Edge case: it needs more than 20,000 live sessions.
  • Fork threads do not inherit a seeded tier. When hasFrom is set and the parent also has no facts, seededTier reads the fork's key only (dash/prefixcause.go:107), so a brand-new fork after a restart gets 5m. The PR lists this as out of scope.

What I checked

  • The full diff (one commit) and the code around every change: dash/capture.go (SeedSessions, pruneSessionsLocked, observe, ObserveThread), dash/prefixcause.go (ObservePrefix, FactsOf), dash/prefixcause_test.go.
  • The consumers of the returned prevOneHour: proxy/dashcapture.go:662-680 (cacheAttributionTTLMs, AttributeCache) and the label's money paths in dash/compactepisode.go (causedWriteUSD, coldCreationUSD).
  • Schema: cache_write and cache_write_1h are INTEGER NOT NULL DEFAULT 0 in requests (dash/schema.go:118, dash/schema.go:154, migration at dash/schema.go:762), so the added Scan targets cannot be NULL.
  • Concurrency: seedTier is written under r.mu in SeedSessions and read under r.mu in ObservePrefix; SeedSessions runs once at startup (cmd/context-guru-proxy/main.go:428) and never overwrites a thread this process has observed.
  • Key consistency: SeedSessions and ObservePrefix both key on thread.Key(session, thread); the test's keys line up with the seeded rows.
  • Test logic: traced all four cases of TestSeededTierAfterARestart through restartedWith → SeedSessions → ttlTurn → AttributeCache; the expected labels follow. The polling loop in restartedWith has a 3-second deadline and fails loudly, so it cannot pass silently on a stalled flush.
  • Data dependence: the change reads existing token-count columns only; no new stored data, so docs/data-dependence.md needs no row.
  • Behavior-change rule: the PR names the change at the top, with who it affects and the old and new behavior, and flags that a human developer must approve.
  • I did not run builds or tests (not approved for this review); all verification is by reading the code.

@amiddavid amiddavid 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 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 offload-review skill, @amiddavid's session fresh 1 of 2 1 of 2 71ffd91dbdf1 blocking

Verdict: blocking

Findings

  1. dash/prefixcause.go:122-123 — the seeded read-only branch has no test
    • What fails: the new else if cur.NoWrite && seededTier path is never run by any test. TestSeededTierAfterARestart always observes a writing turn (write=50_000), so the branch could be deleted and every test would still pass. The production path it guards is real: a restart during an active 1h thread, the first post-restart turn hits the cache (writes nothing), a miss 20 minutes later with a changed prefix. With the branch the label is prefix_change; without it the committed facts carry OneHour=false, the next turn reads the 5-minute limit, and the label is ttl_expiry — the exact mislabel this PR removes. The label also routes money: ttl_expiry pays ColdCreditUSD while prefix_change pays nothing (dash/compactepisode.go:858-868).
    • Proof: ttlTurn in dash/prefixcause_test.go:433 sets f.NoWrite from FactsOf, and the new test's only observed turn passes write=50_000 (prefixcause_test.go:576). TestTTLTierSurvivesAReadOnlyTurn (prefixcause_test.go:477) covers only the same variant of the inheritance, not the seeded variant. grep over dash/*_test.go shows no other test sets seedTier or seeds a 1h thread and then runs a read-only turn.
    • Fix: add one case to TestSeededTierAfterARestart (or a sibling test): seed a 1h thread, run a read-only first turn ttlTurn(r, t0+2*min, base(), 50_000, 0, 0), then the 20-minute miss with a changed prefix must not read ttl_expiry. A mutation check (delete the else if) should fail it.

Non-blocking

  • dash/capture.go:726-730 — the wholesale reset does not clear seedTier. The PR body says the tier "ages out with lastSeen". The by-age prune does delete it (capture.go:709), but the >20,000-sessions fallback empties lastSeen, lastTail, lastFacts and graceSeen and leaves seedTier alone. The effect is benign: a thread with no lastSeen entry reads cold_start before the TTL test (event.go:1210), so the orphaned tier is never used, and the entries self-heal on the next by-age prune. One line, r.seedTier = map[string]bool{}, would make the claim hold.
  • The seed is per thread, not per model. prevOneHour should describe the same-model entry (prefixcause.go:66), but the seed comes from the thread's latest row on any model. A /model switch that spans a restart borrows the other model's tier. The window is narrow — the seed is read only on the thread's first post-restart request, and the first request per (tenant, model) reads cold_start anyway because seenModel is not seeded. Worth a line in the PR or a follow-up.
  • A latest row that wrote nothing loses the thread's earlier 1h tier. The seed reads one row per thread; the in-memory path inherits the tier across a read-only turn. The PR names the 5-minute fallback as out of scope, so this is a recorded limit, not a defect. A follow-up could seed from the thread's last row with cache_write > 0.
  • PR body wording. "ObservePrefix uses it only when the thread has no facts and the request wrote nothing" is not exact: the returned tier (prefixcause.go:138) applies to any first post-restart request, writing or not. The code is right; the sentence is not.

What I checked

  • The full diff (dash/capture.go, dash/prefixcause.go, dash/prefixcause_test.go) and the code around each change.
  • The seed rule write > 0 && write1h >= write against FactsOf (prefixcause.go:50) — identical.
  • Keying: SeedSessions and ObservePrefix both use thread.Key(session_id, thread_id) from the same columns, matching the existing lastSeen seeding. Tenant scoping is the same pre-existing approximation as lastSeen.
  • Locking: seedTier is written under r.mu in SeedSessions, read under r.mu in ObservePrefix, deleted under r.mu in pruneSessionsLocked. Nil-map reads are safe.
  • Schema: cache_write and cache_write_1h are INTEGER NOT NULL DEFAULT 0 (schema.go:118, 154) with an additive migration, so the 6-column scan cannot fail on old rows. Startup order in cmd/context-guru-proxy/main.go runs migrations before SeedSessions.
  • The caller chain: proxy/dashcapture.go:662-680, cacheAttributionTTLMs, and AttributeCache's case order (hit, cold start, TTL, unknown, prefix change). seededTier only lengthens the TTL; a false positive cold_start still masks it.
  • The guard !same && !hadAny: live facts and inherited parent facts always win over the seed; the seed is read only while the thread has no facts at all.
  • Traced TestSeededTierAfterARestart by hand through restartedWith, ObserveThread (model-seen workaround) and ttlTurn for all four cases; the expectations match the code. The poll-then-SeedSessions helper fails loudly if the row never lands.
  • Existing SeedSessions tests (cachecost_test.go, grace_test.go, thread_test.go) still fit the widened query.
  • Data dependence: metadata only (token counts already stored); no new columns, no storage-level change. The PR states this.
  • Behavior change: named at the top of the PR body, per RELEASING.md. It is a dashboard label fix with no switch, closing #956.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Round 1 replies. Fixed in the new head.

Reviewer 2

  1. Failed last row erases the tier: accepted. The tier now comes from the latest 2xx, non-ping row with cache_write > 0 (second query, same shape as the first). Tests: failed last row, failed 1h write, later 5m write.
  2. No test for cur.NoWrite && seededTier: accepted. New case "read-only first turn keeps the seeded 1h tier". Deleting the else if makes it fail.
  • Full-hit last row: fixed by finding 1. Test added.
  • Per-thread seed, not per model: not changed. Listed under Out of scope.
  • Wholesale reset: seedTier is now cleared there.
  • Forks: not changed. Listed under Out of scope.

Reviewer 1

  1. Same as Reviewer 2 finding 2. Fixed.
  • Wholesale reset: fixed.
  • Per-thread seed: listed under Out of scope.
  • Latest row wrote nothing: fixed, same query change as above.
  • PR body wording: rewritten.

Tests on the box: go test -race ./dash/... and ./proxy/... pass, vet and gofmt clean.

@amiddavid amiddavid 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 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 offload-review skill, @amiddavid's session resumed 2 of 2 2 of 2 7d0914add53d approve

Verdict: approve

Findings

None. Both round-1 findings are fixed and tested. I found no defect in the new commit.

Round-1 findings

  1. Failed last request erased a known 1h tier — fixed. The tier now comes from seedOneHourTiers (dash/capture.go:822-845), a second query that picks each thread's latest non-ping, 2xx row with cache_write > 0. I checked the query against the live rule: only a 2xx request commits facts (dash/prefixcause.go:81-83), and a read-only turn keeps the earlier tier, so the latest writing 2xx row is the right source. The rule write1h >= write with write > 0 in the WHERE matches FactsOf. Tests "failed last row keeps the earlier 1h tier" and "failed 1h write does not seed 1h" pin both directions.
  2. No test for the cur.NoWrite && seededTier branch — fixed. The new case "read-only first turn keeps the seeded 1h tier" runs a read-only turn at t0+2min and a miss at t0+22min. I traced it: the read-only turn commits OneHour = true through the branch (dash/prefixcause.go:122-123), so the miss reads a 20-minute gap under a 1-hour TTL and stays off ttl_expiry. Delete the branch and the committed facts carry OneHour = false, the miss reads ttl_expiry, and the case fails.

Non-blocking from round 1

  • Full-hit last row: fixed by the same query. Test "full-hit last row keeps the earlier 1h tier" pins it.
  • Wholesale reset: fixed. pruneSessionsLocked now clears seedTier (dash/capture.go:729).
  • Per-thread seed, not per model: rejected as out of scope, now documented in the PR body under "Out of scope (known limits)". I accept the reason: seenModel is not seeded, so the first post-restart request on a model reads cold_start regardless, and the seed only matters once another request on the same model has run in the new process. The limit is now stated where a reader will find it.
  • Fork threads: rejected as out of scope, documented in the same list. Accepted for the same reason.

New commit reviewed

  • I read the whole diff of 7d0914add53d and the code around it. Checks beyond the findings above:
    • The first query is back to four columns; recency and the tail still come from the latest non-ping row, unchanged.
    • seedOneHourTiers runs before r.mu is taken and builds a local map, so no lock is held across the query. A query error fails SeedSessions as a whole, the same startup-only failure class as before; the proxy itself is unaffected.
    • Every thread in the tier query's result also has a latest non-ping row inside the window (its writing row is one), so the merge loop at dash/capture.go:797-811 cannot orphan a tier entry, and the lastSeen guard still stops the seed from overwriting a thread this process has observed.
    • A thread whose only writing rows are older than the two-hour window seeds no tier, which is correct: no provider entry outlives that window.
    • /compact and observe-mode rows cannot distort the tier seed: /compact writes no cache (cache_write = 0, excluded), and the empty-session key is the same pre-existing approximation the recency seed has always had.
    • The nine test cases: I traced each through restartedWith → SeedSessions → ttlTurn → AttributeCache. The expectations match the code, including "later 5m write replaces an earlier 1h write" and "only read rows: tier unknown, 5m", which pin the live rule in both directions.
    • The PR body now describes the return and commit paths of the seeded tier exactly (reviewer 1's wording point).

What I checked

  • Last review: round 1, 71ffd91, 2026-11-08T15:33:40Z.
  • New commits read: 1 (7d0914ad — "fix(dash): seed the tier from the latest successful write").
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files; the inline file is empty).
  • New items since my last review: the commit above; the author's round-1 reply comment (2026-11-08T15:58:52Z), which I checked item by item above; the updated PR body, which I read against the code. Reviewer 1's round-1 review I read in full this round; their finding matches my finding 2 and their non-blocking items match mine — all checked, no new proof to add.
  • I did not run builds or tests (not approved for this review); all verification is by reading the code.

@amiddavid amiddavid 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 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 offload-review skill, @amiddavid's session resumed 1 of 2 2 of 2 7d0914add53d approve

Verdict: approve

Findings

None.

Earlier findings

  • My finding 1 (no test for cur.NoWrite && seededTier): fixed. The new case "read-only first turn keeps the seeded 1h tier" (dash/prefixcause_test.go:593) seeds a 1h thread, runs a read-only first turn (ttlTurn(r, t0+2*min, base(), 50_000, 0, 0)), then a miss 20 minutes later. I traced it: the read-only turn hits, commits facts with OneHour=true through the branch, and the next turn reads the 1h limit, so the miss is prefix_change. Delete the else if and the committed tier is false, the limit is 5m, and the case fails. The author's mutation check matches my trace.
  • Reviewer 2, finding 1 (failed last row erases the tier): fixed. I checked it myself. The tier now comes from seedOneHourTiers (dash/capture.go:822-845), a second query that takes each thread's latest non-ping, 2xx row with cache_write > 0. The failed row can no longer be the tier source. Test "failed last row keeps the earlier 1h tier" covers it.
  • Reviewer 2, finding 2: fixed, same as my finding 1.
  • My non-blocking items: all addressed. Wholesale reset now clears seedTier (dash/capture.go:729). "Latest row wrote nothing" is fixed by the same query change — the tier now comes from the last row that wrote, not the last row. The PR body wording is rewritten and now matches the code. Per-thread, not per model, and fork inheritance stay as out-of-scope limits, now listed in the PR body. I accept both: the first request per (tenant, model) after a restart reads cold_start anyway, and forks were out of scope from the start.
  • Reviewer 2's non-blocking items: full-hit last row — fixed, with test; wholesale reset — fixed; per-model and forks — out of scope, as above.

Non-blocking

  • The tier row can be older than the recency row, and recency still comes from any status. A 1h write at T0, a failed request at T0+50m, a restart, a miss at T0+70m: the seed measures the age from the failed row (20m, not expiry), while the live path measures from the last committed request (70m, expiry). Which is right depends on whether the failed request read the cache before it failed — unknowable from metadata. The miss-label direction is the under-claim, the one this repo treats as safe. Recency from a non-2xx row is a pre-existing SeedSessions rule; the new tier only inherits the ambiguity.
  • seedOneHourTiers returns threads that cannot be in seeded never: a 2xx writing row inside the window implies the thread's latest non-ping row is at least as recent, so it is inside the window too. The merge loop reads oneHour[id] for seeded ids only. No spurious entries. (Checked, not a defect.)

What I checked

  • Last review: round 1, 71ffd91dbdf1592193ffbd29d007eb79ef65bdf6, 2026-11-08T15:34:26Z.
  • New commits read: 1 — 7d0914ad "fix(dash): seed the tier from the latest successful write".
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files in my folder).
  • New items since my last review: the author's comment at 2026-11-08T15:58:52Z, which replies to both round-1 reviews. I checked every reply against the code, as the section above shows.
  • The full round-2 diff (git diff 71ffd91d..HEAD) and the code around each change: SeedSessions, the new seedOneHourTiers, pruneSessionsLocked, and the reworked test.
  • The new query: outer and inner predicates match, so the outer row is the inner-selected latest qualifying row per thread. write > 0 comes from the WHERE, so write1h >= write is the FactsOf rule. Both queries share the now - staleSession window.
  • Concurrency: seedOneHourTiers runs before r.mu.Lock() and touches only r.db.sql; the pool allows 100 open connections (dash/store.go:281), so the second query while the first result set is open is safe. Startup order in main.go is unchanged.
  • pruneSessionsLocked: the by-age prune still deletes seedTier with lastSeen (capture.go:709), and the wholesale reset now clears it too (capture.go:729), so the PR body's claim holds on both paths.
  • Traced all nine cases of TestSeededTierAfterARestart by hand through restartedWith (multi-row threads, status on every row, seed time from the last row), ObserveThread, ttlTurn and AttributeCache. The expected labels follow in every case, including the two-row cases where the tier source and the recency source differ.
  • The test helper fails loudly if the rows do not land (poll with a 3-second deadline, then SeedSessions must return 1).
  • prefixcause.go is unchanged in this round; the seededTier guard and the NoWrite branch are as reviewed in round 1.
  • The updated PR body: every claim in "What changed" matches the code, the out-of-scope list names the two accepted limits, and the behavior-change banner is still at the top.
  • Data dependence: unchanged, metadata only (token counts). No storage-level change.
  • I did not run builds or tests (not approved); all verification is by reading the code.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Behavior change approved by a human developer.

The repo owner (@amiddavid) approved the behavior change of #943 and #958 in the authoring session on 2026-11-08, in these words: "I approve the behavior change on both".

SeedSessions reloaded recency and tail hash, not the billed tier that
PR #943 added. After a restart, the first miss of a 1h thread fell back
to the 5-minute limit and got ttl_expiry although the entry was alive.

SeedSessions now reads cache_write and cache_write_1h from the latest
non-ping row of each thread. It applies the FactsOf rule. ObservePrefix
uses the seeded tier only while the thread has no facts, and only for a
request that wrote nothing, like the read-only inheritance of #943.

Closes #956

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Review round 1 found that the latest row of a thread can be a failed
request or a full hit. Both wrote nothing, so the seeded tier was lost.

SeedSessions now takes the tier from the thread's latest 2xx, non-ping
row with cache_write > 0, in a second query. Recency and tail still
come from the latest row. The wholesale reset also clears seedTier.

Tests: failed last row, full-hit last row, failed 1h write, later 5m
write, and the read-only first turn after a restart.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid
amiddavid changed the base branch from fix/ttl-expiry-1h to main November 8, 2026 16:07

@amiddavid amiddavid 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 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 offload-review skill, @amiddavid's session resumed 2 of 2 3 of 3 b9695d66cbe1 approve

Verdict: approve

Findings

None. The PR content is unchanged from the head both reviewers approved in round 2. The only change is where the branch sits.

What changed since round 2

  • Retarget and rebase, no content change. The PR moved from base 84997131 to base 48d54447 (current main), and the two PR commits got new SHAs (b9282ecc, b9695d66). I compared the PR's dash/ diff against the old base with the one against the new base: byte-identical. So the code I verified line by line in rounds 1 and 2 is exactly what this PR now proposes.
  • The rebase absorbed eight main commits (#945, #950, #946, #954, #951, #943, #937, #944). They are not this PR's changes. Only two of them touch dash/ at all: #937 edits dash/keepalive.go and adds dash/write1hfrac_test.go; #943 is the PR this one was stacked on, and its content was already the old base. Neither overlaps dash/capture.go, dash/prefixcause.go or dash/prefixcause_test.go. The byte-identical diff confirms no interaction.
  • The human approval for the behavior change is on the PR (comment at 2026-11-08T16:04:52Z): the repo owner approved the behavior change of #943 and #958 on 2026-11-08. That closes the gate CLAUDE.md and RELEASING.md set for a behavior change.
  • Reviewer 1's round-2 review (16:02:46Z): approve. I read it in full. Their non-blocking note — recency can come from a non-2xx row while the tier comes from the last write, so the seeded age can read shorter than the live path would — is correct, pre-existing for recency, and safe in direction. Nothing to add.

What I checked

  • Last review: round 2, 7d0914a, 2026-11-08T16:01:40Z.
  • New commits read: the range 7d0914ad..HEAD holds 10 commits. Two are the rebased PR commits (b9282ecc "seed the billed cache tier after a restart", b9695d66 "seed the tier from the latest successful write"); I verified their combined dash/ diff is byte-identical to the approved 84997131..7d0914ad diff. The other eight are main merges absorbed by the rebase; I read their stats and confirmed none touch this PR's three files.
  • Read in full: 4 reviews, 2 comments, 0 inline comments (from the three saved files; the inline file is empty).
  • New items since my last review: the rebase and retarget (checked for content change, none); reviewer 1's round-2 review (read, agreed); the owner's behavior-change approval comment (checked against the PR's banner, satisfied).
  • The PR body against the code once more: the "What changed" and "Out of scope" sections still match, now against the new base.
  • I did not run builds or tests (not approved for this review); all verification is by reading the code and the diffs.

@amiddavid amiddavid 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 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 offload-review skill, @amiddavid's session resumed 1 of 2 3 of 3 b9695d66cbe1 approve

Verdict: approve

Findings

None. The code is byte-identical to the head I approved in round 2. Only the base moved.

What changed since round 2

  • The retarget. The PR moved from the #943 stack to main at 48d54447. git range-diff reports both patches unchanged (71ffd91d = b9282ecc, 7d0914ad = b9695d66), and the cumulative diff against the new base is identical, byte for byte, to the diff I approved in round 2. The PR body asked for this retarget after #943 merged; #943 is in the new base as e5fe606d.
  • The new base. Eight upstream commits landed between the old and the new base. I checked each for interaction with this PR. Only #937 touches the same area: it changes 1h-write pricing (Price.CacheWrite1hFor, Resolved) in dash/keepalive.go, internal/modelinfo and kvcache. modelinfo.CacheLifetime lives in internal/modelinfo/cachelifetime.go and is untouched, and no base commit touches dash/capture.go, dash/prefixcause.go, dash/prefixcause_test.go or proxy/dashcapture.go. The other commits (#944, #945, #946, #950, #951, #954) touch docs, CI and scripts only.
  • The behavior change has the owner's yes. The comment at 2026-11-08T16:04:52Z records the owner's approval in their words, with the date. This closes the one open condition from the PR's own banner.
  • Reviewer 2's round-2 review (2026-11-08T16:01:40Z, approve) matches my round-2 result. I read it in full; I have no new proof to add and no disagreement.

What I checked

  • Last review: round 2, 7d0914add53dcc6c5e56d30fa81800003032db8b, 2026-11-08T16:02:46Z.
  • New commits read: the two PR commits rebased (b9282ecc "seed the billed cache tier after a restart", b9695d66 "seed the tier from the latest successful write") — both verified identical to the reviewed patches — plus the eight base commits, read as a diff against the PR's touch points.
  • Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files in my folder).
  • New items since my last review: reviewer 2's round-2 review (read, agreed); the author's comment recording the owner's behavior-change approval (checked against the PR banner); the retarget to main (verified with git range-diff and a byte-compare of the cumulative diffs).
  • The PR body: still matches the code; the base is now main, as the body itself instructed.
  • My round-2 approval stands for the code: the seeding, the NoWrite commit branch, the prune paths, the locking, and the nine traced test cases.
  • I did not run builds or tests (not approved); all verification is by reading the code.

@amiddavid
amiddavid merged commit 01fa0e9 into main Nov 8, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Seed the billed cache tier after a restart, so a 1h thread's first miss is not ttl_expiry

1 participant