Repository navigation
feat(sweep): sweep v3, rules and one big cut on the warm path - #763
Conversation
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | c7df5ddf8706 |
blocking |
Verdict: blocking
Findings
- components/offload/extract_sweep_ping.go:497 — the v3 protections and gates do not cover the keep-alive ping question, so a protected output can still be dropped and
selector: rulestill pays model calls- What fails: the operator sets
warm: true,selector: ruleandprotect_tools: [TodoWrite]. The thread goes idle. The keep-alive fires a ping.SweepPingSubstitute(called bykeepalive/substitute.go:398for any registered thread, with no v3 check) collects candidates. Incollect, the v3 plan runs only whencand.warmis true (if cand.warm && e.v3, line 497). A ping candidate haswarm: false, so:- the judge is asked a model question, although the doc for
selector: rulesays "No model call." (docs/components/advanced-offload.md:667); - the judge is offered the
TodoWriteoutput, although the doc says such outputs are "Never dropped, by rule or by judge" (docs/components/advanced-offload.md:677); - the answer is written to the Store, and the next cold request applies it through
coldStep→applyHeld→storeHeld(extract_sweep.go:600, extract_sweep_apply.go:784), a path that has no v3 gate and no protection filter. The drop happens.
- the judge is asked a model question, although the doc for
- Proof: trace the code paths.
registerPing(extract_sweep_ping.go:258) registers a candidate on every request when v3 is on; nothing disables ping questions whenwarm: trueor when v3 is on — the warm path and the ping path coexist by design (the latch inrunWarmQuestiononly stops a ping that fires after a warm question).v3Dispatch's cold branch (extract_sweep_v3.go:497-508) reads only the in-memory answer (in.hasHeldist.held != nil); the ping's Store answer is applied bycoldStep, which never consultse.v3. - Fix: pick one and make code and docs agree. Either (a) apply the v3 plan in
collectfor ping candidates too, filter protected ids when a stored answer is applied, and refuse the ping question outright whenselector: rule; or (b) keep the ping path as it is and scope every v3 promise indocs/components/advanced-offload.mdto the warm path ("no model call on the warm path", "never dropped by a v3 cut"). Add a test for whichever behavior is chosen.
- What fails: the operator sets
Non-blocking
extract_sweep_v3.go:809—var _ = thread.Keyexists only to keep an unused import. Remove the import and the line.extract_sweep_v3.go:543—if in.cold { return nil, 0 }insidev3Stepis dead:v3Dispatchroutes every cold request away beforev3Stepruns.extract_sweep_v3.go:409-410—newV3HeldwritesTokens: h.saves.heldOutput.Tokensmeans the output's own size (extract_sweep_hold.go:47-49). No reader uses it today, so nothing breaks, but the field carries a wrong value for the next reader.extract_sweep_v3.go:549-560— thecut_point_unknownandnot_in_sweet_spotrefusals are counted on every warm request once v3 is on, before any pace gate, and a thread's first request (P = 0) counts ascut_point_unknown. On a deployment without an exact window this fillsrefusedwith noise and hides the real reasons.extract_sweep_v3.go:603-611—v3Askedstays true after an answer that was applied and refused, so a carried set that later expires makes the hybrid rules-only branch fire and counthybrid_rules_only("the judge gave no answer") although the judge did answer. The rules still pass the same gates, so the cut itself stays safe; only the counter and the label are wrong.extract_sweep_v3.go:656-663— a changed-prefix apply of a v3 answer skips the v3 gate (it is warm-gated only), so it drops outputs without counting a cut or starting the growth wait. The next attempt finds markers, so nothing is dropped twice; only the ledger under-counts.
What I checked
- The full diff of
6298673..c7df5ddfand the code around each change:extract_sweep_v3.goin full,warmStep/warmGate/carryRefused/warmHold/memHeldinextract_sweep_warm.go,applyHeldFrom/recheckHeld/heldAnswerinextract_sweep_apply.goandextract_sweep_recheck.go,collectand the ping registry inextract_sweep_ping.go,Offload's cold/warm ordering inextract_sweep.go,keeper.go's stats wiring. - The v3 gates against the doc: sweet spot (
v3Fill), one cut per round (v3Baseline/v3Await, shrink ends the wait), meaningful drop (gate 3 inv3Gate), payback (the #720 gate, unchanged). All four match the doc. - The rule engine:
file_rereadandbuild_rerunconditions, marker and expanded exclusions,protect_last_n/protect_tools/protect_paths(glob semantics viaglobRegexp, test table covers the tricky cases), rule precedence over judge verdicts incombine, judge-only carrying incarryRefused. - Config parsing: v3 off by default,
selector: judgealone does not switch it on, settings withoutwarm: trueare accepted and do nothing, out-of-range values fall back to the defaults, unknown selector is an error. The testTestV3IsOffByDefaultAndTheSettingsAreCheckedcovers this. - Fail-open and reversibility: v3 runs inside
warmStep's recover; every drop goes throughapplyHeldFrom(marker + stash + drop record, panic restore); the default config is byte-identical to the old warm path (tested). - The data-dependence row and its update: rules read tool names, paths and commands in flight, store nothing new; per-thread state is two flags and one number. The row's "Decided by" (David Amid) is also the PR author, so the confirmation requirement is satisfied by the PR itself.
keepalive/keeper.go:V3is an additive, nil-when-empty field;/statsstays append-only.- I did not run the tests: live tests are not approved and Go is not installed on this machine.
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | c7df5ddf8706 |
blocking |
Verdict: blocking
Findings
- components/offload/extract_sweep_ping.go:497 — sweep v3 does not govern the keep-alive ping question, so protected outputs are still dropped and
selector: rulestill pays model calls.- What fails: an operator sets
warm: trueplusprotect_tools: [todo](orprotect_paths,protect_last_n) orselector: rule. The thread goes idle. The keep-alive ping fires the sweep question instead of a plain ping.collectbuilds the v3 plan only whencand.warmis true, so the ping judge is offered every protected output. The judge's drop verdict goes to the Store (putHeld, extract_sweep_ping.go:675). The next cold request applies it throughcoldStep→applyHeld(extract_sweep_apply.go:612) with no v3 filter and no gate. Two documented contracts break: "Never dropped, by rule or judge" (docs/components/advanced-offload.md:677) and "rule: rules only. No model call." (docs/components/advanced-offload.md:667). - Proof: trace, all in the PR head.
Offloadregisters a ping candidate on every request (extract_sweep.go:573,registerPinghas no warm or v3 condition). The keeper callsSweepPingSubstituteon every due ping (keepalive/keeper.go:2050,fireSweepSubstitute; no warm or v3 condition there either).SweepPingSubstitute→cand.collect(extract_sweep_ping.go:434) withcand.warm == false(onlyrunWarmQuestionsetswarm: true, extract_sweep_warm.go:1110-1111). Line 497 then skipsv3Plan, sov3p.protectedandv3p.ruleIdxare empty and lines 511-518 pass protected outputs to the judge. Inrulemode nothing stops the ping question, so the model call the selector forbids is still paid. The stored answer applies cold with no protection check. - Fix: build the v3 plan in
collectwhenevere.v3is on, not only for warm questions. Forselector: rule, refuse the ping question (count it, as other refusals are). Or filter protected outputs from a Store-held answer before the cold apply. Add a test that runs a ping question under v3 and proves a protected output survives andrulemakes no call. No test in extract_sweep_v3_test.go covers the ping path or the v3 cold branch.
- What fails: an operator sets
Non-blocking
- extract_sweep_v3.go:81 — the comment on
parseSweepV3says "A v3 setting without warm: true is an error". The code silently turns v3 off (lines 99-102), and TestV3IsOffByDefaultAndTheSettingsAreChecked pins that. The PR text also says "does nothing". Fix the comment; it states the opposite of the behavior. - extract_sweep_v3.go:409-410 —
newV3HeldwritesTokens: h.saves. The field is documented as "the output's own size" (extract_sweep_hold.go:49). Nothing readsTokenson this path today, so it is latent, but a future reader will misprice it. Write the output's token count. - extract_sweep_v3.go:543-545 —
if in.cold { return nil, 0 }inv3Stepis dead code.v3Dispatchroutes every cold request to the apply path at lines 494-495, sov3Stepnever seesin.cold. - extract_sweep_v3.go:497-507 — the cold apply of a waiting judge answer does not clear
t.v3Askedand does not armv3Await. Later, one spurioushybrid_rules_onlyattempt can fire. All v3 gates still check it, so the outcome stays safe. - extract_sweep.go:1313 — the
fill_smallhint says onlyfill_small,fill_largeandmin_drop_fracswitch v3 on.protect_tools,protect_pathsandprotect_last_nalso do (extract_sweep_v3.go:92-95). The doc page and the v3 file header list all of them; make the hint agree. - extract_sweep_v3.go:809 and extract_sweep_v3_test.go:597-598 —
var _ = thread.Keyand the test equivalents are unused-import shims. Remove them and the imports.
What I checked
- The full diff 6298673..c7df5dd: extract_sweep_v3.go (all 809 lines), the warm, ping, apply and hold changes, the keeper stats wiring, both docs pages, and the new test file (all 598 lines).
- The machinery v3 plugs into, read in full:
warmStep,warmGate,applyHeldFrom,recheckHeld,carryRefused,memHeld/warmHold/mergeHeld,registerPing,SweepPingSubstitute,collect,ask,buildHeld/putHeld,changePoint, marker generation (markToken,commitMark),warmForeviction,FillDenominator,PrevBilledInputThread. - Gate arithmetic: sweet spot, one-cut-per-round baseline and shrink reset, drop_too_small on both the rule pre-check and the apply gate, payback hand-off to #720's gate. Traced the hybrid one-cut ordering (waiting answer, rules-only fallback, ask) against the tests.
- Reversibility and fail-open: every v3 drop goes through
applySweepDrop, so a<<cg:HASH>>marker and a Store stash back it. Panics recover per request. Rule drops are content-deterministic markers, so a concurrent double apply writes the same bytes. - Config parsing: defaults, out-of-range clamps, glob translation (traced each test case), selector validation, the "v3 off unless a setting is written" rule, and the settings-registry declarations against
components/registry.go. - Data dependence: docs/data-dependence.md row updated; the PR states the owner approved it on 2026-10-28; nothing new is written to the Store.
- I did not run builds or tests (not approved). Claims above come from reading the code, not from executing it.
) Review round 1 on #763. - the ping question builds the v3 plan: no protected output is offered, and in hybrid no rule-decided output - selector rule refuses the ping question (ping_refused_rule) - a Store answer applied cold skips protected outputs - a cold or changed-prefix apply counts as a cut and starts the wait - rule drops record their own token count - refusals not_in_sweet_spot and cut_point_unknown count once per warm_every_n; a request with no billed size counts nothing - hybrid_rules_only counts only a real "no answer" - remove dead code and unused imports; fix comments and hints Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
|
Round 1 fixes are in at the head below. Verified on eval box 1: Blocking: v3 did not cover the ping question. Fixed (option a).
Non-blocking, all fixed
New mutations, all killed: ping plan only when warm; ping rule not refused; hybrid ping offers rule-decided; cold apply unfiltered; cold cut not counted; |
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | 8637651b1970 |
approve |
Verdict: approve
Earlier findings, dispositions
- Reviewer 2, round 1, finding 1 (blocking): v3 did not cover the ping question. — Fixed. The author chose option (a), commit
8637651b. I checked each part:collectbuilds the v3 plan whenever v3 is on, not only for warm questions (extract_sweep_ping.go:504). The ping judge never sees a protected output (line 518) and, inhybrid, never a rule-decided one (line 522).selector: rulerefuses the ping question before the collection slot and before the asked check (extract_sweep_ping.go:411-413).SweepReasonV3Rulemakes the keeper send a plain ping (it logs the reason and returns false), so the path fails open.ping_refused_ruleis counted.- A Store answer applied cold goes through
v3Filtered(extract_sweep_apply.go:786-789). It removes protected ids from the answer (extract_sweep_v3.go:853-869) and countscold_protected_filtered. So an answer stored before a config change cannot drop a protected output. - Tests cover each part:
TestV3PingQuestionNeverOffersAProtectedOutput,TestV3RuleSelectorMakesNoModelCallAtThePing,TestV3HybridPingDoesNotOfferRuleDecidedOutputs,TestV3ColdApplyOfAStoredAnswerSkipsProtectedOutputs(extract_sweep_v3_test.go:598, 607, 624, 640).
- Reviewer 1, round 1, finding 1 (blocking): the same ping-path gap. — Fixed by the same change. I checked it myself, as above. We found it independently in round 1.
- Round 1 non-blocking items (both reviewers, same set): all fixed.
parseSweepV3comment now says "does nothing" and matches the code. Fixed.newV3Heldwrites the output's own token count toTokens(extract_sweep_v3.go:410).TestV3RuleDropsRecordTheirOwnTokenCountpins it. Fixed.- The dead
if in.coldblock is gone fromv3Step. Fixed. - The unused-import shims (
var _ = thread.Keyand the test equivalents) are gone. Fixed. - The
fill_smallhint now lists every setting that switches v3 on. Fixed. v3Askedis cleared when an answer is used, applied or refused (extract_sweep_v3.go:673-680), andv3CutDoneclears it on every counted cut (line 697). A later expiry can no longer count a falsehybrid_rules_only. Fixed.- The
cut_point_unknownandnot_in_sweet_spotrefusals count once perwarm_every_nwarm requests (extract_sweep_v3.go:545-571), and a request with no billed size counts nothing. Fixed. - A cold or changed-prefix apply counts as a cut and starts the growth wait (extract_sweep_apply.go:791-798, extract_sweep_v3.go:509-513 and 682-689). Fixed.
No finding was rejected by the author. Every round-1 finding is fixed.
Findings
None. The fix commit introduces no defect I could prove.
Non-blocking
- extract_sweep_apply.go:787-789 —
applyHeldbuilds the v3 plan on every request when v3 is on, before it knows whether the Store holds an answer for the thread. Underruleorhybridthe plan runs the full rules over the conversation. Most requests have no stored answer, soapplyHeldFromreturns at the firstgetmiss and the plan work is wasted. Consider checking for an answer first, then building the filter. - extract_sweep_apply.go:793 and extract_sweep_v3.go:511 — the cut records of a cold apply label every drop a judge drop (
judge: changed). The warm gate splits rule drops from judge drops throughruleOf(extract_sweep_v3.go:732-738); the cold paths do not. Underhybrid, an in-memory answer can carry rule verdicts, sorule_dropsunder-counts on a cold apply. Ledger labels only; the cut itself is correct. - extract_sweep_ping.go:411 — under
selector: ruleevery due ping is refused at the substitute, butregisterPingstill keeps a full conversation snapshot per thread and the keeper still calls it. The snapshot is never read. Consider skipping registration when v3 andruleare both on.
What I checked
- Last review: round 1, sha
c7df5ddf870681dc60044d1408fe85e6b6b904ab, submitted 2026-10-28T11:05:19Z. - New commits read: 1 —
8637651b"fix(sweep): cover the ping question and the cold apply in sweep v3 (#491)" (7 files, +220 −25). Read the fullgit diff c7df5ddf..8637651band the code around every hunk. - Read in full from the saved lists: 2 reviews (my round 1, reviewer 1's round 1), 1 comment (the author's fix summary, 2026-10-28T11:29:10Z), 0 inline comments (the file is empty).
- New items since my last review, with dispositions: the fix commit, read as a first review — approve with 3 non-blocking notes; the author's comment — claims the tests ran on eval box 1 with
-raceand the mutations were killed. I cannot run Go on this machine, so I verified the fixes by reading the code and the tests, not by running them. - The fix against each promise in the docs: the ping question under
judgeandhybridnever offers a protected output; underrulethe ping stays plain; a cold apply skips protected ids; a cold apply counts as a cut; refusals are paced. All confirmed in docs/components/advanced-offload.md and the code. - The new
SweepReasonV3Ruleagainst the keeper:fireSweepSubstitutelogs the reason string and returns false, so a plain ping goes out. No keeper change was needed. Confirmed. - The pacing arithmetic:
warmEveryNis clamped to at least 1, sot.v3Reqs % e.warmEveryNcannot divide by zero.v3Reqscounts only warm requests, becausev3Dispatchroutes cold requests away fromv3Step. Confirmed. v3Filteredagainst the apply machinery:getstrips without counting,claimstrips and counts, socold_protected_filteredfires only when an apply proceeds. The panic put-back writes the stripped answer, which is safe: a protected output must never be dropped anyway. A fully protected answer is spent without effect, which is the intended read-once behavior. Confirmed.- The new tests: read all 7 (extract_sweep_v3_test.go:598-707). Each names the behavior it pins, and each matches the code paths I traced by hand.
- I did not run the tests: live tests are not approved and Go is not installed on this machine.
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | 8637651b1970 |
approve |
Verdict: approve. The blocking finding is fixed and tested. Two small items stay, both non-blocking.
What I checked
- Last review (round 1, c7df5dd, 2026-10-28T11:07:29Z)
- New commits read: 1 (8637651 fix(sweep): cover the ping question and the cold apply in sweep v3 (#491))
- Read in full: 2 reviews, 1 comment, 0 inline comments
- Each new item since my last review, and what I did about it:
- Commit 8637651 — read the full diff and the code around each change in all 7 files. Results below.
- Author comment (2026-10-28T11:29:10Z) — checked every claim against the code. All 4 blocking-fix claims hold; all 8 non-blocking claims hold (one only in part, see finding 2).
- Reviewer 2's round-1 review — read in full. The main finding matches mine; I checked its 3 unique non-blocking items myself before agreeing (all fixed, one in part).
- No new inline comments, no other comments.
Earlier findings
Finding 1 (blocking, mine; reviewer 2's finding 1 is the same — I agree, I checked it myself): v3 did not govern the ping question or the cold apply. FIXED.
I traced each half of the fix:
collectbuilds the plan whenever v3 is on (if e.v3, extract_sweep_ping.go:504). A ping candidate no longer skipsv3Plan. Protected outputs are not offered. Inhybrid, rule-decided outputs are not offered either (ruleIdx, same loop). Verified againstTestV3HybridPingDoesNotOfferRuleDecidedOutputs: 8 outputs, 3 rule-decided and 1 protected leave 4 offered.selector: rulerefuses the ping before the asked latch, the slot and the model call (extract_sweep_ping.go:410-413). It returnsSweepReasonV3Ruleand countsping_refused_rule. The keeper sees the same shape as every other refusal, so the ping stays plain. No asker call:TestV3RuleSelectorMakesNoModelCallAtThePingpinsasker.calls == 0.- The cold apply filters the Store answer:
applyHeldwrapsstoreHeldinv3Filteredwhen v3 is on (extract_sweep_apply.go:786-789).stripremoves every protected id. It countscold_protected_filteredonclaimonly, not onget, so one apply counts once. The stripped answer is still spent — the safe direction: a lost removal, never a dropped protected output. - A stored answer made before a config change cannot drop a now-protected output.
TestV3ColdApplyOfAStoredAnswerSkipsProtectedOutputsmodels exactly that: an answer stored by a non-v3 sweep, applied under v3 withprotect_last_n: 1.
The two doc promises hold again: "No model call" (advanced-offload.md:667) and "Never dropped, by rule or judge" (:677). The doc states the new ping and cold-apply behavior (:671-674) and the two new refusal reasons.
My non-blocking items:
parseSweepV3comment — fixed. It now says "does nothing" (extract_sweep_v3.go:79), which is what the code and the test pin.Tokens: h.saves— fixed.v3Hitcarriestokens(the output's ownTextTokens), andnewV3Heldwrites it (extract_sweep_v3.go:362, 410).TestV3RuleDropsRecordTheirOwnTokenCountpinsTokensaboveSaves.- Dead
if in.coldinv3Step— fixed. Removed. - Cold apply of a waiting answer leaves
v3Askedset — fixed in part. When the apply changes something,v3CutDoneclearsv3Askedand armsv3Await. When it changes nothing, see finding 2 below. fill_smallhint — fixed. It lists all seven settings that switch v3 on (extract_sweep.go:1313).var _ = thread.Keyshims — fixed. Gone from the code and the test, with the imports.
Reviewer 2's unique non-blocking items (I checked each myself):
- Refusal noise — fixed.
t.v3Reqspacesnot_in_sweet_spotandcut_point_unknownat one perwarm_every_nwarm requests;P <= 0counts nothing (extract_sweep_v3.go:545-573).warmEveryNcannot be 0: the config clamps<= 0to the default and the registry declaresMin: 1, so the modulo is safe.TestV3PacedRefusalsAreCountedOncePerQuestionIntervalpins both halves. hybrid_rules_onlymislabel — fixed on the warm path.v3Applyclearsv3Askedwhenever a mem answer is used, applied or refused (extract_sweep_v3.go:673-680). The cold-apply residual is finding 2 below.- Changed-prefix apply uncounted — fixed.
wn > 0with!cut.setbooks a cut withp,c,pShareCand starts the growth wait (extract_sweep_v3.go:682-689). Cold applies book it too, inapplyHeldand inv3Dispatch's cold branch.
New findings (this commit), both non-blocking
- extract_sweep_apply.go:786-789 —
applyHeldrunsv3Planon every cold request when v3 is on, before it knows a held answer exists.applyHeldFromreturns at its firstsrc.getwhen there is no answer, but the plan is built first. Inhybridandrulemode that is the full rule scan (file evidence plus command matching) on every cold request of every thread.coldStepalready scans the conversation twice, so this is one more O(n) pass, not a new order of cost. Build the filtered source only whengetHeldfinds an answer, or lazily insidev3Filtered. Perf only; nothing is wrong in behavior. - extract_sweep_v3.go:507-515 — a cold apply of a waiting hybrid answer that changes nothing still leaves
v3Askedset. Thev3Dispatchcold branch claims the mem answer, so it is gone either way. Whenwn == 0(the recheck threw out every verdict) the branch skipsv3CutDone, sov3Askedstays true. A later warm request then meets line 621 (!in.hasHeld && !in.busy && asked) and counts onehybrid_rules_onlyalthough the judge did answer. The rules still run through the same gates, so the cut itself stays safe; only the counter and the label are wrong, on a narrow path. Move thesrc.useMemclear fromv3Applyinto a place the cold branch reaches too.
What else I checked in the new commit
- Fail-open and reversibility: the new code adds no drop path. Every drop still goes through
applyHeldFrom(marker, stash, drop record, panic restore).v3Filteredonly removes outputs from an answer. - The default path is untouched: every new branch is behind
e.v3(applyHeld,collect,SweepPingSubstitute,v3Step). With v3 off the behavior is byte-identical. - Two answers, one request: a store answer (coldStep) and a mem answer (
v3Dispatch's cold branch) can both apply on one cold request. Each books its own cut. Overlapping outputs are safe: the marker key is content-deterministic, so the second apply finds the marker and skips. v3Apply's changed-prefix cut divides byConly afterv3Step'sC <= 0return, andapplyHeldguards its own division withif C > 0. No division by zero.- The doc changes match the code: the ping and cold-apply paragraph, the paced counters line, and the two new refusal reasons in the counter list.
- I did not run builds or tests (not approved). The author reports
-raceruns on the eval box; my claims come from reading the code.
|
Round 3 notes are fixed in one push. Verified on eval box 1:
|
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 3 of 3 | 775e5d70b60f |
approve |
Verdict: approve
Earlier findings, dispositions
- My round-2 note 1 and reviewer 1's round-2 finding 1 (the same):
applyHeldbuilt the v3 plan on every request, answer or not. — Fixed. The plan is now built lazily, insidev3Filtered.strip, on the first stored answer that has an output (extract_sweep_v3.go:866-880).stripreturns early when the answer is missing or empty, so a cold request with no stored answer builds no plan. The closure memoizes the result.TestV3AColdRequestWithNoStoredAnswerBuildsNoPlancounts plan builds: 0 without an answer, 1 with one. Verified in the code and the test. - Reviewer 1's round-2 finding 2: a cold apply of a waiting hybrid answer that changed nothing left
v3Askedset. — Fixed. The cold branch ofv3Dispatchclearst.v3Askedbefore the apply, applied or not (extract_sweep_v3.go:519-524). The clear cannot fire while a question is still pending: the branch runs only whenin.hasHeld && !in.heldTried(line 509), andhasHeldmeans an answer is there to claim.TestV3AColdApplyThatChangesNothingStillClearsTheHybridQuestionpins it with an answer whose only output is gone, sochanged = 0. I checked the trace myself. - My round-2 note 2: cold-apply cut records labeled every drop a judge drop. — Fixed.
v3ColdCut(extract_sweep_v3.go:906-926) splits throughruleOf, as the warm gate does. It counts only ids that were claimed drops and whose message carries a marker after the apply that it did not carry before, so a pre-marked or not-applied id counts nothing.v3Dispatch's cold branch passes the mem answer'sruleOf;applyHeldpasses nil, which is right: a Store answer never holds a rule verdict, becausecollectnever offers a rule-decided output to a hybrid question (extract_sweep_ping.go:522).TestV3ColdCutSplitsRuleDropsFromJudgeDropscovers all four cases (rule, judge, marked-before, never-marked). - My round-2 note 3:
registerPingkept a conversation copy per thread underselector: rule. — Fixed.registerPingreturns at once when v3 andruleare both on (extract_sweep_ping.go:261-264). The refusal inSweepPingSubstitutestays as a second guard for a candidate left by a config change. Both are pinned:TestV3RuleSelectorMakesNoModelCallAtThePingAndKeepsNoCopy(no copy kept, no call) andTestV3RuleSelectorRefusesARegisteredPingCandidate(a leftover candidate is still refused). Verified.
No finding was rejected by the author. Every round-2 finding and note is fixed.
Findings
None. The fix commit introduces no defect I could prove.
Non-blocking
- docs/components/advanced-offload.md:671-672 — the doc says the
ruleping is "counted asping_refused_rule". After this commit, a steadyruledeployment keeps no ping candidate, so the keeper sees no candidate andping_refused_rulestays 0; the keeper countssweep_no_candidateinstead. Only a candidate left by a config change reaches the refusal. The behavior is right; update the doc sentence so an operator readingrefuseddoes not expect that counter. - extract_sweep_apply.go:797 —
before := v3MarkedIDs(req)runs on every request when v3 is on, even with no stored answer. It is one O(conversation) text scan, lighter than the plan but the same shape of waste the lazy plan removed. It could be tied to the answer's presence, as the plan now is. - extract_sweep_v3.go:912 and 932 — the marker test is
strings.Contains(text, "<<cg:"), not the strictcarriesRealMarkerused elsewhere. A tool output that quotes the marker literal (a grep over a transcript, say) reads as already marked, so its drop is under-counted in the ledger. The drop itself still happens and stays reversible. Very narrow; ledger only.
What I checked
- Last review: round 2, sha
8637651b19700187a0cd99dac34122b2de6f4ef3, submitted 2026-10-28T11:35:32Z. - New commits read: 1 —
775e5d70"fix(sweep): sweep v3 review round 2 notes (#491)" (4 files, +175 −25). Read the fullgit diff 8637651b..775e5d70and the code around every hunk. - Read in full from the saved lists: 4 reviews (both round-1 reviews, both round-2 reviews), 2 comments (the round-1 fix summary at 11:29:10Z, the round-3 fix summary at 12:11:21Z), 0 inline comments (the file is empty).
- New items since my last review, with dispositions:
- Reviewer 1's round-2 review (11:36:42Z) — read in full. Their two findings match my round-2 notes 1 and 3 plus one item I had called fixed in part; I re-checked each in the new commit before agreeing. All fixed now.
- The author's round-3 comment (12:11:21Z) — checked every claim against the code. All four hold. The eval-box runs and killed mutations are the author's; I verified by reading.
- Commit
775e5d70— reviewed as a first review, result above.
- The lazy plan against the apply machinery:
getandclaimboth callstrip;stripbuilds the plan only when an answer with outputs exists, and the closure memoizes it.v3Filteredis passed by value, but the closure and theclaimedpointer share state, so the memo and the claimed list work. Confirmed. v3MarkedIDscorrectness:toolCallIDreads the tool message's ownToolCallID(extract_sweep_v3.go:281-286) andtoolIndicesreturns tool-message indices (common.go:457-465), so the before-set is keyed by the same ids the claims use. A tool message with no id maps to"", which no claimed id can be. Confirmed.- The
v3Askedclear against the question lifecycle: the cold branch runs only when a mem answer exists (in.hasHeld, line 509), so a pending, unanswered question is never cleared. The hybrid rules-only branch (line 651) still seesaskedonly while a question is truly out. Confirmed. - The new and changed tests: read all 5 (
TestV3RuleSelectorMakesNoModelCallAtThePingAndKeepsNoCopy,TestV3RuleSelectorRefusesARegisteredPingCandidate,TestV3AColdRequestWithNoStoredAnswerBuildsNoPlan,TestV3ColdCutSplitsRuleDropsFromJudgeDrops,TestV3AColdApplyThatChangesNothingStillClearsTheHybridQuestion). Each matches a path I traced by hand. The helpers they use (sweepPingCand,warmHold,heldFor,coldCtx,v3Conv,tCalls) all exist. - Fail-open and the default path: every new branch is behind
e.v3; with v3 off,applyHeldreturns through the plainstoreHeldsource, byte-identical to before. The new code adds no drop path. Confirmed. - I did not run the tests: live tests are not approved and Go is not installed on this machine.
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 3 of 3 | 775e5d70b60f |
approve |
Verdict: approve. Every earlier finding is fixed. Three small notes stay, all non-blocking.
What I checked
- Last review: round 2, 8637651, 2026-10-28T11:36:42Z
- New commits read: 1 (775e5d7 fix(sweep): sweep v3 review round 2 notes (#491))
- Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files)
- New items since my last review, and what I did about it:
- Commit 775e5d7 — read the full diff and the code around each change in all 4 files. Results below.
- Author comment (2026-10-28T12:11:21Z) — checked all 4 claims against the code. Claims 1, 2 and 4 hold fully. Claim 3 holds only in part: the split exists and its test passes, but no production caller can pass it a rule drop (note 1 below).
- Reviewer 2's round-2 review (2026-10-28T11:35:32Z) — read in full. I checked its 3 non-blocking items myself: item 1 is my item 1, item 3 is fixed, item 2 is addressed but vacuous in production (note 1).
- No new inline comments.
Earlier findings
My round-2 finding 1: applyHeld built the v3 plan on every cold request. FIXED.
v3Filtered now takes a plan closure and calls it inside strip, and strip returns at once when the answer is absent or has no outputs (extract_sweep_v3.go:868-871). The closure caches its result, so one apply builds one plan. TestV3AColdRequestWithNoStoredAnswerBuildsNoPlan pins both sides: 0 builds without a stored answer, 1 with one. The v3PlanBuilds counter is the test's probe. A lighter scan stays on the same path — note 2 below.
My round-2 finding 2: a cold apply that changed nothing left v3Asked set. FIXED.
The v3Dispatch cold branch now clears v3Asked before the apply, not only after a counted cut (extract_sweep_v3.go:519-524). It runs whether the apply changes something or nothing. TestV3AColdApplyThatChangesNothingStillClearsTheHybridQuestion pins it: an answer whose only output is gone from the conversation, changed == 0, v3Asked false. I traced the test's path by hand: the recheck drops the verdict as output_gone, the claim consumes the mem answer, and the clear has already run. A panic between the clear and the apply also stays correct: the recover gives the answer back, and a held answer takes the apply branch, not the hybrid_rules_only branch.
Reviewer 2's round-2 items (I checked each myself):
- Lazy plan — the same as my finding 1. Fixed.
- Cold-cut rule/judge split — addressed, but the split cannot fire. See note 1.
- No ping copy under
selector: rule— fixed.registerPingreturns before it snapshots anything (extract_sweep_ping.go:261-264). The early return skips only the registration; the keeper sends a plain ping through the existing no-candidate path.TestV3RuleSelectorMakesNoModelCallAtThePingAndKeepsNoCopygoes throughOffload, so the mutation "do not skip" would register a candidate and fail the test. The refusal inSweepPingSubstitutestays as the second guard for a candidate registered before a config change, pinned byTestV3RuleSelectorRefusesARegisteredPingCandidate. A doc line now overstates the counting — note 3 below.
No earlier finding was rejected by the author.
Findings
None.
Non-blocking
- extract_sweep_v3.go:906-921 — the cold cut's rule/judge split cannot fire on any production path. Both call sites pass an empty
ruleOf:applyHeldpassesnil(extract_sweep_apply.go:801), and thev3Dispatchcold branch nilsplan.rulesbeforenewV3Held(extract_sweep_v3.go:517), sosrc.ruleOfis empty too. A mem answer never carries rule verdicts anyway —carryRefused's v3 branch strips them before carrying (extract_sweep_warm.go:1446-1456). So every cold-apply drop is a judge drop, and the ledger is correct — butTestV3ColdCutSplitsRuleDropsFromJudgeDropsexercises the split only by callingv3ColdCutdirectly with a hand-builtruleOf. The marker-verification half of the function is a real gain (a counted drop must be claimed, unmarked before, and marked now). If the split is meant to stay, drop a note onv3ColdCutsayingruleOfis empty today; if not, simplify it away. - extract_sweep_apply.go:797 —
v3MarkedIDsruns on every cold request when v3 is on, even with no stored answer. It is much lighter than the plan it replaced (no JSON parsing, no regex, no file evidence), but it still reads the full text of every tool output. The same lazy treatment would remove it: compute the set only when an answer was claimed. - docs/components/advanced-offload.md:671-672 — the doc says the rule-mode ping is "counted as
ping_refused_rule". After theregisterPingskip, a rule-mode deployment counts its pings assweep_no_candidate(the no-candidate path), andping_refused_rulefires only for a candidate registered before a config change. The commit changed no docs. Reword the parenthetical, or count the skip itself.
What else I checked in the new commit
- Fail-open and reversibility: the commit adds no drop path.
v3ColdCutonly books numbers.registerPing's skip removes work; the keeper's plain-ping fallback is the pre-existing no-candidate path. - The default path is untouched:
applyHeldreturns early for!e.v3with the same call as before; theregisterPingskip needse.v3 && selector == rule. - The
beforesets are ordered right:applyHeldcomputesbeforeafterreplayDropshas re-marked old drops, so replays are not counted. When a store answer and a mem answer both apply on one cold request, the secondbefore(inv3Dispatch) is computed after the first apply, so no id is counted twice. - The
v3Filteredclaim list:getstrips without recording,claimstrips, countscold_protected_filteredand records the claimed drop ids. One apply records each id once. - Concurrency: the
planclosure and its cache live in oneapplyHeldcall; theclaimedslice is a pointer to a local. Thev3Askedclear takeswarmMu, like every other write to the warm table. - The tests: read all 5 new or changed ones. Each names the behavior it pins, and each matches a path I traced by hand.
- I did not run builds or tests (not approved). The author reports
-raceand lint runs on eval box 1; my claims come from reading the code.
|
Cleanup push. No behavior change. Verified on eval box 1:
|
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 4 of 5 | 96b0434e32d6 |
approve |
Verdict: approve
Earlier findings, dispositions
All round-3 items were non-blocking notes. Reviewer 1 raised the same three, plus one on the rule split. All are fixed in commit 96b0434e:
- My round-3 note 1 (reviewer 1's note 3): the doc said the
ruleping is "counted asping_refused_rule", which the registerPing skip made stale. — Fixed. The doc now says a rule-mode ping keeps no copy and counts assweep_no_candidate, andping_refused_rulefires only for a candidate left from before a config change (docs/components/advanced-offload.md:671-673). That matches the code:registerPingreturns before it snapshots anything, so the keeper meets no candidate. Verified. - My round-3 note 2 (reviewer 1's note 2):
v3MarkedIDsran on every request, answer or not. — Fixed. The set is now read through anonClaimcallback that runs when a claim hands out an answer, before the apply changes any message (extract_sweep_apply.go:797-798, extract_sweep_v3.go:874-886). A cold request with no stored answer computes neither the plan nor the marked set. Verified in the code; the ordering is right, becausestripruns insideclaim, before the recheck and before any drop is written. - My round-3 note 3: the loose
"<<cg:"substring test could under-count a drop whose output quotes the marker literal. — Fixed. Both the before-set and the after-check usecarriesRealMarker(extract_sweep_v3.go:926, 943-948). The test fixture now stores the marker key, so its marker is real (extract_sweep_v3_test.go:744-747).carriesRealMarkerdoes a cheap text check first and reads the Store only for marker-carrying text, andc.Storeis set on both call paths. Verified. - Reviewer 1's round-3 note 1: the cold cut's rule/judge split could not fire on any production path, and they asked for a note on the function. — Done, and their reading is right. I checked it myself:
applyHeldpasses nil, and thev3Dispatchcold branch nilsplan.rulesbeforenewV3Held(extract_sweep_v3.go:516-517), soruleOfis empty on both production paths. The comment onv3ColdCutnow says so (extract_sweep_v3.go:918-921). Keeping the split is sound: it costs nothing and counts a future path right.
No finding was rejected by the author. Every round-3 note is fixed.
Findings
None. The cleanup commit introduces no defect I could prove.
Non-blocking
None. I looked for new notes in the changed code and found none that would survive a check.
What I checked
- Last review: round 3, sha
775e5d70b60f22e18178aaf2e81fb284f4943972, submitted 2026-10-28T12:15:52Z. - New commits read: 1 —
96b0434e"chore(sweep): sweep v3 round 3 cleanup, no behavior change (#491)" (4 files, +29 −8). Read the fullgit diff 775e5d70..96b0434eand the code around every hunk. - Read in full from the saved lists: 6 reviews (both round-1, both round-2, both round-3), 3 comments (11:29:10Z, 12:11:21Z, 12:40:33Z), 0 inline comments (the file is empty).
- New items since my last review, with dispositions:
- Reviewer 1's round-3 review (12:16:17Z) — read in full. Their three notes match mine; I re-checked each in the new commit before agreeing. Their note on the vacuous rule split I verified independently (see disposition 4). Their claim that
carryRefusedstrips rule verdicts before carrying I take from their trace; the empty-ruleOfconclusion holds through the two call sites alone. - The author's cleanup comment (12:40:33Z) — checked all four claims against the code. All hold. The eval-box runs are the author's; I verified by reading.
- Commit
96b0434e— reviewed as a first review, result above.
- Reviewer 1's round-3 review (12:16:17Z) — read in full. Their three notes match mine; I re-checked each in the new commit before agreeing. Their note on the vacuous rule split I verified independently (see disposition 4). Their claim that
- The
onClaimmechanism against the apply machinery:v3Filtered.stripcalls it only onclaim, never onget, and always before any message is changed;v3Held.claimcalls it once, whencombineaccepts, beforeclaimedIDsis built.v3ColdCutruns only whenchanged > 0, which implies the claim won, sobeforeis never read unset; a nil map read would be safe anyway. The closures are set before the source is passed toapplyHeldFrom, so both copies see them. Confirmed. - The marker pair for consistency: the before-set and the after-check now use the same strict test, so an output that quotes the marker literal reads as unmarked in both and can no longer hide a drop, and an output whose marker's Store record was pruned reads unmarked in both, so the pair stays self-consistent.
carriesRealMarkerreturns true when the Store is nil, the safe direction, and both call paths always have a Store. Confirmed. - The ruleOf comment for accuracy:
plan.rules = nilin the cold branch and nil at theapplyHeldcall site, so every production cold drop is booked as a judge drop today. The ledger was already correct; the comment now says why. Confirmed. - Fail-open and the default path: the commit changes ledger counting and doc text only. No new drop path, no request-path change; with v3 off, nothing in the diff runs. Confirmed.
- The changed test:
TestV3ColdCutSplitsRuleDropsFromJudgeDropsnow stores the marker key before it marks the fixture messages, socarriesRealMarkeraccepts them. The four cases (rule, judge, marked-before, never-marked) are unchanged. Verified against the new signature. - I did not run the tests: live tests are not approved and Go is not installed on this machine.
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 4 of 5 | 96b0434e32d6 |
approve |
Verdict: approve. All three of my round-3 notes are fixed. No new defect.
What I checked
- Last review: round 3, 775e5d7, 2026-10-28T12:16:17Z
- New commits read: 1 (96b0434 chore(sweep): sweep v3 round 3 cleanup, no behavior change (#491))
- Read in full: 6 reviews, 3 comments, 0 inline comments (from the three files)
- New items since my last review, and what I did about it:
- Commit 96b0434 — read the full diff and the code around each change in all 4 files. Results below.
- Author comment (2026-10-28T12:40:33Z) — checked all 4 claims against the code. All hold.
- Reviewer 2's round-3 review (2026-10-28T12:15:52Z) — read in full. Its 3 non-blocking notes map to my notes 2 and 3 plus one I had not raised (the marker substring test). I checked all three myself; all are fixed in this commit.
- No new inline comments.
Earlier findings
My round-3 note 1: the cold cut's rule/judge split cannot fire, so a note or a simplification was needed. FIXED (a note).
v3ColdCut now carries the comment: ruleOf is empty on every production path today, a cold answer never carries rule verdicts, and the split stays for a future path that does (extract_sweep_v3.go:918-920). That is the option I proposed, and the comment states the facts I verified in round 3.
My round-3 note 2: v3MarkedIDs ran on every cold request, answer or not. FIXED.
The set is now read through an onClaim callback: applyHeld and the v3Dispatch cold branch set src.onClaim = func() { before = v3MarkedIDs(c, req) }, and the callback runs only when a claim hands out an answer — in v3Filtered.strip on the claim pass (extract_sweep_v3.go:886-888) and in v3Held.claim after the claim wins (extract_sweep_v3.go:475-477). I traced the timing: the claim happens inside applyHeldFrom before any message changes, so before still sees the pre-apply state. When no answer exists, strip returns at !ok and the callback never runs. When a claim loses the race, same. A cold request with no stored answer now computes neither the plan nor the marked set.
My round-3 note 3: the doc said the rule ping is counted as ping_refused_rule. FIXED.
The doc now says the rule ping keeps no conversation copy, so it counts as sweep_no_candidate, and ping_refused_rule fires only for a candidate left from before a config change (docs/components/advanced-offload.md:671-673). That matches the code exactly: registerPing's skip leads the keeper to the no-candidate path, and the SweepReasonV3Rule refusal is reachable only by a stale candidate.
Reviewer 2's round-3 note 3 (the marker substring test — I had not raised it; I checked it myself and agree): FIXED.
Both v3MarkedIDs and v3ColdCut now use carriesRealMarker instead of strings.Contains(text, "<<cg:") (extract_sweep_v3.go:929, 942-946). This is better than a one-sided fix: the before-set and the after-check use the same real-marker test, so an id counts only when its message was unmarked before the claim and carries a real marker after the apply — exactly the writes this apply made. A quoted marker literal no longer reads as marked. The test fixture stores the marker key (st.Put("zz", ...)), as a real marker requires. I also checked the nil-Store branch of carriesRealMarker (returns true, the safe direction): without a Store there are no stashed drops anyway, so it can only under-count the ledger, never miscount a drop.
No earlier finding was rejected by the author.
Findings
None.
Non-blocking
None new.
What else I checked in the new commit
- The
onClaimplumbing:v3Filteredis passed by value, but the callback is a closure over the localbefore, so the write is visible to the caller.v3Heldis a pointer, set afternewV3Held. Each apply callsclaimonce, so the callback runs at most once per apply. A panic after the claim and before the apply leavesbeforeset and unused —changedis reset to 0 by the recover, sov3ColdCutis not called. - The claim-order split on a double apply: when a store answer and a mem answer both apply on one cold request, each
beforeis read at its own claim time, so the first apply's markers are in the secondbefore. No id counts twice. - No behavior change beyond the ledger precision: the commit changes what is counted and when the scans run, not what is dropped. Every drop path is unchanged, so fail-open and reversibility hold as verified in earlier rounds.
- The default path is untouched: all changes sit behind
e.v3. - The changed test (
TestV3ColdCutSplitsRuleDropsFromJudgeDrops) still covers all four cases: rule drop, judge drop, marked-before, never-marked. The fixture now matchescarriesRealMarker's contract. - I did not run builds or tests (not approved). The author reports
-race, lint andmkdocs build --stricton eval box 1; my claims come from reading the code.
|
Design change from the owner: the sweet spot is a share of the effective context (where the client compacts), not of the window. Why. What changed
Tests (mutation killed for each): the table field is parsed and the chain passes it on; Verified on eval box 1: |
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 5 of 5 | 47e1badb394d |
approve |
Verdict: approve
Earlier findings, dispositions
Round 4 ended with no findings and no notes on either side, and the author rejected nothing. Reviewer 1's round-4 review (12:43:47Z) was an approve with nothing new, so there is no earlier finding left open. This round reviews the new feature commit on its own.
Findings
None. The feature commit introduces no defect I could prove.
Non-blocking
- internal/modelinfo/table.go:109-112 —
ParseTablerejects a negativecompaction_pointbut accepts one above the window. A typo (1670000for167000) makes C larger than the window, and thenResolveuses it as it is (compactionpoint.go:215-230). For v3 that is the safe direction: the sweet spot is never reached, so nothing is dropped. For the summarizer it is the dangerous one: the trigger fires at a fraction of C, so it never fires, and the conversation runs into the provider's limit. The compactionpoint package's own notes call a too-high C "the dangerous one" (compactionpoint.go:97-102). Consider rejectingcompaction_point > windowinParseTablewhen the entry states both, as a guard against the typo. Not deriving the value from the window, as the design says, and guarding against nonsense input are different things. - extract_sweep_v3.go:612 —
noteV3CSourcecounts on every warm request that reaches the sweet-spot check, whilenot_in_sweet_spotnext to it is paced atwarm_every_n. On a deployment that sits below the spot,c_sourcegrows aboutwarm_every_ntimes faster thanrefused. The doc says it counts checks, so the meaning is right; only the noise shape differs from the paced counters beside it. Consider pacing it too.
What I checked
- Last review: round 4, sha
96b0434e32d69b716f6332f2d68ceae91fcebce5, submitted 2026-10-28T12:43:40Z. - New commits read: 1 —
47e1badb"feat(sweep): size the v3 sweet spot from the effective context (#491)" (13 files, +367 −45). Read the fullgit diff 96b0434e..47e1badband the code around every hunk. - Read in full from the saved lists: 8 reviews (both round-1, both round-2, both round-3, both round-4), 4 comments (11:29:10Z, 12:11:21Z, 12:40:33Z, 13:30:45Z), 0 inline comments (the file is empty).
- New items since my last review, with dispositions:
- Reviewer 1's round-4 review (12:43:47Z) — read in full. An approve with no findings; nothing to re-check.
- The author's design-change comment (13:30:45Z) — checked all six points against the code. All hold. The data-dependence statement ("None. It is config.") matches what the code reads: the new input is the operator's
MODEL_PRICEStable, not stored customer data, so the existing sweep row still covers it. - Commit
47e1badb— reviewed as a first review, result above.
- The "nothing changes unless the field is set" claim, the critical one: the old base was
FillDenominator()(the point when set, else the window, cachephase.go:175-183). The new base skips a point whose source iswindow_fallback. I checked every source the shipped resolver can produce:ForreturnsWindowFallbackwithFrac: 1.00(compactionpoint.go:196-199), so a fallback point always equals the window, and the skip changes the label only.Measured(haiku, 0.996) andAssumed(opus, sonnet, 1.00) points pass through to C exactly as before, andCutFracmultiplies the same base as before. With nocompaction_pointin the table,ResolvereturnsForunchanged. Confirmed: the numbers move only when the operator states a value. - The proxy wiring:
resolveCompactionPoint(proxy.go:2158-2170) reads the operator table through the same chain pattern as the window, falls back toForwhen the chain states nothing, and is safe whenWindowsis nil (the type assertion fails,statedstays 0). Both paths use it:/compact(proxy.go:727, 756-757) and the chat path (proxy.go:1143, 1305-1306), so the summarizer and the span read the same figure, as the doc says. Confirmed. - Division safety in the new code:
noteV3Refusaldividespbyconly afterv3Step'sP <= 0andC <= 0returns, andv3Gatedivides byPandCon the same guarantee.v3CutPointreturns a non-empty source whenever it returnsC > 0. Confirmed. - The stats surface:
CSourceinV3Stats,CSourcein eachV3Cut,CutPoint/CSourceinWarmDecision— all additive withomitempty, so/statsstays append-only.Any()now also fires onCSource, which only makes the v3 block appear when checks ran. Confirmed. - The new tests, read against the code:
TestV3CutPointFollowsTheSummarizerThenTheCompactionPointThenTheWindow(all six cases including the fallback label),TestV3SweetSpotUsesTheOperatorCompactionPoint(0.85 x 167k reached at 150k; the window case refused at 150k under 170k, with the rig'swarm_every_n: 3pacing giving one paced refusal over four requests),TestV3CSourceIsReportedForEachCase(all three sources, plus the decision-log fields),TestV3AnAcceptedCutRecordsCAndItsSource, the threecompactionpointtests,TestTableParsesCompactionPoint, and the proxy resolution test. The helpers they use (lastWarmDecision,r.refused,eventAppliedWarm, the rig fields) all exist. Each test names the behavior it pins. - Fail-open and the default path: with v3 off, nothing in the offload diff runs; the proxy change is behind the same option as the window and degrades to the old resolver when the table states nothing. The feature changes when a cut is tried, not how a drop is made, so reversibility and the per-component recover are untouched. Confirmed.
- I did not run the tests: live tests are not approved and Go is not installed on this machine. The author reports
-race, lint andmkdocs build --strictruns on eval box 1; my claims come from reading the code.
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 5 of 5 | 47e1badb394d |
blocking |
Verdict: blocking. One finding: the dashboard span does not read the operator's compaction_point, but three shipped texts say it does.
What I checked
- Last review: round 4, 96b0434, 2026-10-28T12:43:47Z
- New commits read: 1 (47e1bad feat(sweep): size the v3 sweet spot from the effective context (#491)). Read the full diff and the code around every hunk.
- Read in full: 9 reviews, 4 comments, 0 inline comments. My saved lists held 8 reviews; reviewer 2's round-5 review (13:36:00Z) arrived after I saved them. I fetched it and read it in full before posting.
- New items since my last review, and what I did about it:
- Commit 47e1bad — reviewed as a first review. Result below.
- Author comment (2026-10-28T13:30:45Z) — checked all six points against the code. Five hold. Point 4 ("the summarizer and the dashboard span read
compactionpointtoo, so an operator value applies to them as well") is half false. See the finding. - Reviewer 2's round-5 review (2026-10-28T13:36:00Z) — read in full. Approve, two non-blocking notes. I checked both myself; see Non-blocking. Their check of the doc sentence traced only the proxy paths, not the dash package.
Earlier findings
Round 4 ended approve on both sides, with no findings and no notes. Nothing is open. The author rejected nothing.
Findings
1. The dashboard span does not read the operator's compaction_point, but the doc, the config example, and the PR comment say it does.
Three shipped texts make the claim:
- docs/components/advanced-offload.md:666 — "The summarizer and the dashboard span read the same figure, so an operator value applies to them too."
- deploy/service/prices.example.yaml:33-34 — "the summarizer and the dashboard span read it too."
- The PR comment, point 4 (13:30:45Z).
The summarizer half is true. The proxy fills Ctx.CompactionPoint through resolveCompactionPoint (proxy/proxy.go:2158-2170). The summarizer paths size their span from CutFrac x FillDenominator() (components/offload/prefix_econ.go:285-286, components/offload/extract_sweep_warm.go:608-609). FillDenominator returns the compaction point when it is set (components/cachephase.go:175).
The dashboard half is false. Both dashboard readers call the bootstrap table directly:
- dash/compactepisode.go:502 —
ceil := compactionpoint.For(conv[0].Model) - dash/replaycap.go:249 —
ceil := compactionpoint.For(model).Frac
The operator-aware Resolve has one production caller: proxy/proxy.go:2168. I grepped the repo; those two dash lines are the only other readers of the package.
Consequence, with the doc's own example (GLM, compaction_point: 167000, window 200000):
- Live v3 sweet spot: 0.85 x 167k = 142k. Live summarizer span: CutFrac x 167k.
- Dashboard:
Forhas no GLM entry, so it returnswindow_fallback, Frac 1.0. The compact-episode span and the replay-cap ceiling use the whole 200k window. - The dashboard then disagrees with live behavior exactly when the operator sets the field — the motivating case of this commit. In replaycap the counterfactual client compacts at 200k instead of 167k, so turns past 167k stay credited to us. The cap over-credits.
The fix is small. The dash walk already takes the operator's window through modelinfo.Exact(windows, ctx, model) (dash/compactepisode.go:1283-1286), and modelinfo.Chain.CompactionPoint exists. Route the ceiling through the same chain, like the window. Or correct the three texts to say the dashboard reads the built-in table only.
Why blocking: the claim is operator-facing, in the doc and the config example. An operator who sets the field will trust a dashboard that no longer matches production.
Non-blocking
- proxy/proxy.go:2141-2150 — the commit inserted
resolveCompactionPointbetweenresolveWindow's doc comment andresolveWindowitself. The comment now reads as if it documents the new function. Move it down past the new function, or split it. - I agree with reviewer 2's round-5 notes 1 and 2, after checking each myself:
ParseTablerejects a negativecompaction_pointonly (internal/modelinfo/table.go:109-112). A value above the window parses. For the summarizer that is the dangerous direction: the trigger never fires and the conversation runs into the provider limit. A guard inParseTablewhen the entry states both fields would catch the typo.noteV3CSourcecounts every sweet-spot check, whilenot_in_sweet_spotnext to it is paced atwarm_every_n(components/offload/extract_sweep_v3.go:612-616). The doc says it counts checks, so the meaning is right. Only the noise shape differs.
What else I checked in the new commit
- "Nothing changes unless the field is set." The old base was
FillDenominator(): the point when set, else the window. The newv3CutPointskips a point whose source iswindow_fallback. I checked every source the shipped resolver can produce.ForreturnsWindowFallbackwithFrac: 1.00, so a fallback point always equals the window. The skip changes the label only.MeasuredandAssumedpoints pass to C as before.CutFracmultiplies the same base as before. With no field in the table,ResolvereturnsForunchanged, and a test pins that. Confirmed. resolveCompactionPointsafety. NilWindowsfails the type assertion,statedstays 0, andResolvefalls back toFor. Both/compact(proxy.go:727) and the chat path (proxy.go:1143) use it.- Division safety.
noteV3Refusaldividespbyconly afterv3Step'sP <= 0andC <= 0return.v3Gatedivides byPandCon the same guarantee.v3CutPointreturns a non-empty source whenever it returnsC > 0. - The stats surface.
V3Stats.CSource,V3Cut.CSource, andWarmDecision.CutPoint/CSourceare additive withomitempty, so/statsstays append-only.Any()now fires onCSourcetoo, which only makes the v3 block appear when checks ran. - Fail-open and the default path. With v3 off, nothing in the offload diff runs. The proxy resolution degrades to the old figure when the table states nothing. The feature changes when a cut is tried, not how a drop is made, so reversibility and the per-component recover are untouched.
- Data dependence. The new input is the operator's
MODEL_PRICEStable, not stored customer data. The author's statement ("None. It is config.") matches the code. - The new tests, read against the code:
TestV3CutPointFollowsTheSummarizerThenTheCompactionPointThenTheWindow,TestV3SweetSpotUsesTheOperatorCompactionPoint,TestV3CSourceIsReportedForEachCase,TestV3AnAcceptedCutRecordsCAndItsSource, thecompactionpointtests,TestTableParsesCompactionPoint, and the proxy resolution test. The helpers they use all exist. Each test names the behavior it pins. - I did not run builds or tests (not approved). The author reports
-race, lint andmkdocs build --stricton eval box 1; my claims come from reading the code.
Review round 5 on #763. - the compact-episode span, the summarize ledger and the replay cap resolve the compaction point through the operator table first, as they already do for the window; with no field set the numbers are the same as before - ParseTable rejects a compaction_point above the entry's window, and names the model - noteV3CSource is paced at warm_every_n, like the refusal counters - move resolveWindow's doc comment back above resolveWindow Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
|
Round 5 fixes are in one push. Verified on eval box 1: Blocking: the dashboard did not read the operator's
Non-blocking, all fixed
|
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 6 of 6 | d4cf2d5b5eaf |
approve |
Verdict: approve. My round-5 finding is fixed, on all three dashboard paths. Both of reviewer 2's round-5 notes are fixed. No new defect.
What I checked
- Last review: round 5, 47e1bad, 2026-10-28T13:40:40Z
- New commits read: 1 (d4cf2d5 fix(dash): read the operator's compaction_point in the dashboard (#491)). Read the full diff and the code around every hunk in all 11 files.
- Read in full: 10 reviews, 5 comments, 0 inline comments (from the three files; the inline file is empty).
- New items since my last review, and what I did about it:
- Commit d4cf2d5 — reviewed as a first review. Result below.
- Author comment (2026-10-28T15:07:42Z) — checked every claim against the code. All hold.
- No new review from reviewer 2 since my round-5 post. No new inline comments.
Earlier findings
My round-5 finding (blocking): the dashboard span did not read the operator's compaction_point, but three shipped texts said it does. FIXED.
I traced all three dashboard paths:
- The compact-episode span.
walkCompactEpisodesWithtakes apointFn, andCompactionEpisodesForpassesoperatorPoint(ctx, windows)(dash/compactepisode.go:446-457, 1301-1308). The oldcompactionpoint.Forcall at line 502 is nowpoint(conv[0].Model, w). - The summarize ledger.
summarizerLedgerpasses the sameoperatorPoint(dash/summarizeattr.go:134-138). - The replay cap, including the SQL path.
ReplayLedgerForCtxpassesoperatorPoint(ctx, windows)towalkCapSession(dash/replaycap.go:390), andReplayLedgerFordelegates toReplayLedgerForCtx(replaycap.go:348-349), so theapi.gocallers get it too. The oldForcall at line 249 is nowpoint(model, w).Frac.
The resolution matches the proxy's precedence. operatorPoint asks modelinfo.OperatorCompactionPoint (the capability on the resolver, dash/compactepisode.go:455-459), then compactionpoint.Resolve. A stated value wins; nothing stated gives Resolve(model, 0, w), which returns For(model) unchanged. So with no field set, every number is the same as before. The plain walkCompactEpisodes and walkReplayCap keep their signatures and use bootstrapPoint, which is For — I grepped: no production caller of either is left, so no dash path reads the bootstrap table while an operator value exists.
The arithmetic is right where the window is a guess. In walkCapConversation the assumed window gives Frac = stated / w, and limit = Frac x w = stated, so the absolute limit is the operator's figure whatever the window.
The tests pin each side: the episode span and the replay-cap ceiling use the operator value, the cap closes at the operator's ceiling, the SQL path takes it through ReplayLedgerFor, and with no field both walks are unchanged (dash/operatorpoint_test.go). The helpers they use all exist — I checked exactWindow, testPrice, row, capTestRow, fixedWindow, testWindows, handPrice, mkEvent, openTestDB, DayMs, CacheHit, AccountingComplete.
The doc now names the three readers and is true (docs/components/advanced-offload.md:666). The prices.example.yaml claim is true again.
My round-5 non-blocking note (proxy comment placement): FIXED. resolveWindow's doc comment is back above resolveWindow, and resolveCompactionPoint has its own (proxy/proxy.go:2143-2177).
Reviewer 2's round-5 note 1 (ParseTable accepted a point above the window): FIXED. I checked it myself. ParseTable now rejects compaction_point > window when the entry states both, and the error names the model (internal/modelinfo/table.go:112-114). The guard runs only when window > 0, so a point stated without a window still parses — right, because the window may come from another link. TestTableRejectsACompactionPointAboveItsWindow covers the rejection and both accepted cases. I grepped every compaction_point fixture in the repo; none states a point above its window, so nothing existing now fails to parse.
Reviewer 2's round-5 note 2 (noteV3CSource unpaced): FIXED. I checked it myself. The counter now sits under the same paced flag as the refusal counters — t.v3Reqs % e.warmEveryN == 0 (components/offload/extract_sweep_v3.go:586, 612-614). I traced the test's arithmetic: request(0) plus six requests give v3Reqs 1 through 7, paced at 3 and 6, so exactly 2 counts — what the test asserts. The doc says "counted once per warm_every_n warm requests" (advanced-offload.md:701).
No earlier finding was rejected by the author.
Findings
None.
Non-blocking
- Two doc comments still name the old ceiling source. dash/replaycap.go:29 says the cap uses "
compactionpoint.For"; it now uses thepointresolver, which isForonly when no field is set. dash/compactepisode.go:1125 saysClientCeilingUsed.Provenanceis"measured", "assumed" or "default"; it can now carry"operator"too (and"window_fallback", already before this PR). One-line fixes, whenever the files are touched next.
What else I checked in the new commit
- No request-path change. The dash is offline analysis. The only
components/offloadchange is the counter's pace. Fail-open, reversibility and the default path are untouched. OperatorCompactionPointsafety. A resolver without the capability fails the type assertion and returns(0, false), sooperatorPointfalls back toFor(internal/modelinfo/modelinfo.go:314-323). A nil resolver behaves the same.modelinfo.Exactis already called on the same resolver unguarded, so no new nil path exists.- The
With-wrapper pattern.walkCompactEpisodesandwalkReplayCapdelegate to theWithforms withbootstrapPoint, so the old signatures and their tests are unchanged. I grepped for production callers of the plain forms: none remain. Resolvewith a stated point.Fracisstated / window, capped at 1. Both dash call sites passw > 0(the episode walk skips unknown windows first; the cap walk substitutes an assumed window first), so the cap-1 branch is a safety net only.limit = Frac x wgives the stated figure exactly.- The
ParseTableguard against existing tables. The check runs before the negative check and uses the entry's original match text in the error. An entry with a point and no window, or a point equal to the window, still parses — the test covers both. - The v3 test change.
TestV3CSourceIsReportedForEachCasenow asserts an exact count (2 over 6 requests), not just "at least one", so a mutation that ignorespacedfails it. - Data dependence. Unchanged: the dash reads the operator's config table, not stored customer data.
- I did not run builds or tests (not approved). The author reports
-raceondash(own call),proxy,components/offload,internal/compactionpoint,internal/modelinfo,keepalive, plus lint andmkdocs build --stricton eval box 1; my claims come from reading the code.
amiddavid
left a comment
There was a problem hiding this comment.
Verdict: approve. One new commit since my round-5 review. It fixes every round-5 finding: reviewer 1's blocking dashboard gap, and both of my notes. I found no new defect in it. One residual note stays non-blocking.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 6 of 6 | d4cf2d5b5eaf |
approve |
What I checked
- Last review round: round 5, sha
47e1badb394d2fa21f127f9ee993de9748158bcb, posted 2026-10-28T13:36:00Z. - New commits read: 1 —
d4cf2d5b"fix(dash): read the operator's compaction_point in the dashboard (#491)" (11 files, +224 −31). Full diff read, plus the code around each hunk. - Items read in full: 10 reviews (
.review-in-reviews.txt, 492 lines), 5 comments (.review-in-comments.txt, 67 lines), 0 inline comments (.review-in-inline.txt, empty). - New items, with dispositions:
- Reviewer 1's round-5 review (2026-10-28T13:40:40Z, blocking). Disposition below.
- Author's round-6 comment (2026-10-28T15:07:42Z). Claims match the code.
- Commit
d4cf2d5b. Reviewed in full. No blocking defect.
Dispositions of round-5 findings
- Reviewer 1, blocking: the dashboard did not read the operator's
compaction_point. Fixed. I re-checked this myself before agreeing.- The removed lines in this commit's diff prove the round-5 state:
ceil := compactionpoint.For(...)indash/compactepisode.goanddash/replaycap.go. Reviewer 1 was right, and my round-5 check of the doc sentence was incomplete: I traced only the proxy paths. I did not check the dash package readers. My miss, noted. - Now all three dash readers take a
pointFn. The compact-episode span (CompactionEpisodesFor), the summarize ledger (summarizeattr.go), and the replay cap (ReplayLedgerForCtx, the SQL path too) build it withoperatorPoint(ctx, windows). operatorPointputsmodelinfo.OperatorCompactionPointin front ofcompactionpoint.Resolve. A nil or plain resolver fails the capability assert, sostatedis 0 andResolvereturnsFor. Fail-open holds.- With no field set, nothing changes.
bootstrapPointisFor, andwalkCompactEpisodes/walkReplayCapkeep their old signatures by delegating to it. Tests pin both readers unchanged. - I grepped the repo. The only remaining production caller of
compactionpoint.ForisbootstrapPointitself. BothResolvecallers (proxy, dash) sit behind the operator lookup. No reader is left behind.
- The removed lines in this commit's diff prove the round-5 state:
- My note 1:
ParseTableshould rejectcompaction_pointabove the window. Fixed. The guard sits before the negative check, and the error names the model. Tests cover reject, point-alone, and point == window. - My note 2:
noteV3CSourcewas not paced. Fixed. It now counts insideif paced, like the refusal counters. The test expects exactly 2 counts over 6 requests atwarm_every_n: 3. I checked thev3Reqsarithmetic myself: therequest(0)makesv3Reqs1, the six 10k requests make it 2..7, paced at 3 and 6. Exactly 2. The doc says "once perwarm_every_nwarm requests". - Reviewer 1, non-blocking:
resolveWindow's comment was displaced. Fixed. The comment is back aboveresolveWindow, andresolveCompactionPointhas its own.
Findings
None blocking.
Non-blocking
- The
ParseTableguard has a residual hole. It fires only when one entry states bothwindowandcompaction_point. An entry that states a point but no window escapes the check. The model's window can still be known, from the public window map or another entry. So a typo'd point can still exceed the window. This is narrower than before — both fields in one entry, the common case, are now caught. A later change could look up the resolved window when the entry states none.
Notes on the fix
- The new tests in
dash/operatorpoint_test.gouse only helpers that exist elsewhere in the package (row,capTestRow,testWindows,handPrice,mkEvent,openTestDB). I checked each. - The replay cap computes its limit as
point(model, w).Frac * w. With an operator point this round-trips tokens through a fraction and can lose one token to float precision. A dashboard span does not need better. Not a finding.
|
New work from the owner, on top of d4cf2d5. Hybrid is not changed. Verified on eval box 1: 1. Rule (c),
2. Rule-mode logging. 3. Expand rate per source. The expand path could not tell the source without a stored label. It now can, with a name only: the drop record ( 4. Docs and data dependence. |
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 7 of 7 | cd94f98781a6 |
approve |
Verdict: approve. The new feature commit adds rule (c) and three observability surfaces. I found no defect in it. Round 6 ended approve on both sides, so no finding is open.
What I checked
- Last review: round 6, d4cf2d5, 2026-10-28T15:13:32Z
- New commits read: 1 (cd94f98 feat(sweep): v3 rule (c) unreferenced, D by rule, expand per source (#491)). Read the full diff and the code around every hunk in all 7 files.
- Read in full: 12 reviews, 6 comments, 0 inline comments (from the three files; the inline file is empty).
- New items since my last review, and what I did about it:
- Commit cd94f98 — reviewed as a first review. Result below.
- Author comment (2026-10-28T22:42:35Z) — checked all four points against the code. All hold.
- Reviewer 2's round-6 review (2026-10-28T15:13:58Z, posted after my round-6 post) — read in full. Approve, one non-blocking note. I had checked its subject myself in round 6; see Earlier findings.
Earlier findings
Round 6 ended approve on both sides. No finding is open. The author rejected nothing. Two non-blocking notes stay open, both fine to leave:
- My round-6 note (two stale dash doc comments): not fixed, unchanged. The commit touches no dash file. dash/replaycap.go:29 still names
compactionpoint.For, and dash/compactepisode.go:1123 still lists three provenance values. Still one-line fixes for later. - Reviewer 2's round-6 note (a point stated without a window escapes the
ParseTableguard): not fixed, unchanged. The commit touches nomodelinfofile. I agreed with this residual in round 6 and still do: the common case (both fields in one entry) is caught; the hole needs a point-only entry plus a window known from elsewhere.
Findings
None.
Non-blocking
- components/offload/extract_sweep_v3.go:941 — the
V3Refusalcomment saysRecentRefusalsholds "the last cut attempts a size gate refused (drop_too_small, no_rule_drops)".not_in_sweet_spotrefusals land there too:noteV3Refusalnow routes throughnoteV3SizeRefusal(extract_sweep_v3.go:976-977), which appends toRecentRefusals. The doc page says "size-gate refusals" and is right; only the Go comment's parenthetical under-lists. One-line fix. - components/offload/extract_sweep_v3.go:836-839 — the
drop_too_smallbranch ofv3GatecallswarmRatiosa second time with the same arguments, inside the branch that already computedcontentthree lines above. Same result, wasted call. Reuse the outercontent.
What else I checked in the new commit
- Rule (c) is the recheck's own signal, not a second definition.
unreferencedIDscallscoref.IndexNovel(flattenForCoref(raw), e.minTokens, schema.TextTokens)withConsumeLag < 0andNovel > 0(extract_sweep_v3.go:424-439). The recheck calls the same function with the samee.minTokens(extract_sweep_apply.go:930, extract_sweep_recheck.go:119) and readsConsumeLag >= 0for a reference after the question. With no question, "no reference at all" is the right analog. It readsRawInputwhen set, as the recheck does, so a reference only the agent's conversation carries still protects —TestV3UnreferencedReadsTheAgentsOwnConversationpins it. The echo and boilerplate guards live insideIndex, so a path echoed from a tool-call argument does not count as a reference. - Opaque outputs are never chosen.
Novel > 0requires the output to have introduced an identifier;TestV3UnreferencedNeverChoosesAnOpaqueOutputpins it with boilerplate-only outputs. This is the safe direction: no evidence, no drop. - Protections. The rule loop runs after the protection loop and skips
p.protected[i], marked outputs (carriesRealMarker), expanded outputs (isKeptVerbatim,restoredSpanGuard), and outputs belowminTokensor with no positive save.TestV3UnreferencedObeysEveryProtectioncovers all of them.protect_last_nprotects the newest 10 by position; the min age of 30 newer tool calls makes a rule (c) candidate older than that window anyway. - The min age.
len(tools)-1-k >= e.ruleUnrefMinAgecounts tool calls newer in the request (extract_sweep_v3.go:393). The config clamps<= 0to the default 30, and the registry declaresDefault: 30, Min: 0.TestV3UnreferencedMinAgeIsInToolCallspins the count. - Off by default.
parseSweepV3switches v3 on only whenrule_unreferencedis written (extract_sweep_v3.go:101-104); the rule itself runs only whene.ruleUnrefis set and the selector is notjudge(the plan returns before the rules section forjudge). Two tests pin both halves. - Fail-open and reversibility. Rule (c) adds candidates to
plan.rules; every drop still goes throughapplyHeldFrom(marker, stash, drop record, panic restore). No new drop path.TestV3UnreferencedCutNeverDropsAReferencedOutputruns a full cut and checks the referenced output survives. - The rule label on the drop record.
applyHeldFromwritesRule: ruleOfSource(src, o.ToolUseID)(extract_sweep_apply.go:1009-1012).v3Held.ruleForreturns the rule fromruleOf, elsejudge;v3Filtered.ruleForreturnsjudge, which is right because a Store answer never holds a rule verdict (rule mode asks no question; a hybrid question is never offered a rule-decided output). Old records unmarshal withRuleempty, so the field is backward compatible. With v3 off,ruleOfSourcereturns""and nothing is counted —TestV3NoRuleIsRecordedWithV3Offpins it. expandscounting.NoteSweepExpandcounts a first expand underrec.Rulewhen non-empty (extract_sweep_apply.go:452-455).noteV3Expandtakesv3Muwhile the caller holdsdropMu; no path takes them the other way round, so no lock cycle.v3CounterscopiesExpandsandRecentRefusalsunderv3Mu.RecentRefusalsis capped atmaxV3Recent(50), likeRecent.- The pacing change is counting only.
no_rule_dropsand rule-modedrop_too_smallnow count once perwarm_every_n; the return (no drop) is unchanged. The gate'sdrop_too_small(once per real cut attempt, after a question) stays unpaced, and the doc scopes the pacing to rule mode, which matches. Two old tests were updated to the pace. - The
/statssurface stays append-only.V3Stats.Expands,V3Stats.RecentRefusals,WarmDecision.RuleDandV3Refusalare new fields, all additive;Any()grows to include them. - Data dependence. The row is updated: rule (c) reads later message text in flight, as the recheck already does, and stores nothing new beyond a rule-name label with no content (docs/data-dependence.md). This matches the code.
- The D-by-rule arithmetic.
ruleDsumsSaves x contentper rule, anddBilledisvalidTokens() x contentwherevalidTokenssumsSaves— so the per-rule values sum to D. The rule-mode refusal passesplan.ruleTokens(content), the same sum over the plan. - I did not run builds or tests (not approved). The author reports
-raceoncomponents/offloadandkeepalive, lint, andmkdocs build --stricton eval box 1; my claims come from reading the code.
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 7 of 7 | cd94f98781a6 |
approve |
Verdict: approve. One new commit since my round-6 review: cd94f987, a feature commit (rule (c), rule-mode refusal logging, expand counts per source). I found no blocking defect in it. Three notes stay non-blocking.
What I checked
- Last review: round 6, sha
d4cf2d5b5eafa4c9294eee22e09075ff7361ecad, posted 2026-10-28T15:13:58Z. - New commits read: 1 —
cd94f987"feat(sweep): v3 rule (c) unreferenced, D by rule, expand per source (#491)" (7 files, +502 −13). Full diff read, plus the code around each hunk. - Items read in full: 12 reviews (
.review-in-reviews.txt, 600 lines), 6 comments (.review-in-comments.txt, 82 lines), 0 inline comments (.review-in-inline.txt, empty). - New items since my last review, with dispositions:
- Reviewer 1's round-6 review (2026-10-28T15:13:32Z, approve). It landed 26 seconds before my round-6 post, so I read it only now. Its one non-blocking note: two stale dash doc comments. Disposition below.
- Author's round-7 comment (2026-10-28T22:42:35Z). Checked every claim against the code. All hold.
- Commit
cd94f987. Reviewed as a first review. No blocking defect.
Dispositions of round-6 items
- Reviewer 1, round 6, non-blocking: two dash doc comments still name the old ceiling source. Not fixed, and I agree it stays non-blocking. I checked both myself:
dash/replaycap.go:29still says the cap uses "compactionpoint.For". It now uses thepointresolver, which isForonly when no field is set.dash/compactepisode.go:1124-1125still saysProvenanceis"measured", "assumed" or "default". It can now carry"operator"too.- This commit does not touch the dash package, so the notes stay open. One-line fixes whenever those files are touched next.
- My round-6 note: the
ParseTableguard misses a point stated without a window. Still open. This commit does not touchinternal/modelinfo. Non-blocking, as before.
Findings
None. What I verified in cd94f987:
- Rule (c) is the recheck's own signal, not a second definition.
unreferencedIDscallscoref.IndexNovelwith the same arguments and the sameRawInput-when-set wrapping asrecheckHeld(extract_sweep_recheck.go:118-120). It keeps an output only whenNovel > 0(it introduced identifiers) andConsumeLag < 0(no later reference at all). That is strictly stronger than the recheck's test, which counts a reference only after the question. An output withNovel == 0is opaque and never chosen — the coref package's ownClassifysays the same (coref.go:216-218). flattenForCorefreads onlyreq.Input(coref.go:413), so passing the wholereqor&{Input: raw}gives the same index. Ids, not positions, join the two halves, so a raw/request message mismatch cannot mislabel.- Rule (c) sits last in the else-if chain after
file_rereadandbuild_rerun, and behind every shared gate: protections,Rewritable,carriesRealMarker,minTokens, the expanded check,saves > 0. The doc's claims ("obeys every protection", "never chosen when marked or expanded") all hold in the loop. ruleUnreferencedalone switches v3 on but stays inert underselector: judge, becausev3Planreturns before the rule loop. The hint and the doc both say "needs selector rule or hybrid". Agreed behavior, stated.v3Planruns only past the sweet-spot gate, soIndexNoveldoes not run on every request. It is one more O(conversation) pass on a path that already runs file evidence and the recheck's own index.- The refusal pacing. In rule mode,
no_rule_dropsanddrop_too_smallnow count and log only on paced requests, likenot_in_sweet_spotandcut_point_unknown.P,CandcSourceare in scope at both new call sites, andnoteV3SizeRefusalguards both divisions. The two updated tests match the pacing arithmetic I verified in round 6 (v3Reqspaced at 3 and 6 over the rig's requests). - The gate's
ruleDcovers the same setdBilledcounts — both range overres.Validwith the same content ratio, so the per-rule numbers sum to D. - The drop-record label.
ruleOfSourcetype-asserts aruleNamer;v3Filteredanswersjudge(a stored answer is the judge's),v3Heldanswers the plan's rule orjudge. With v3 off no source implements it, soRulestays empty and nothing counts — pinned byTestV3NoRuleIsRecordedWithV3Off. Old drop records have norulefield and count nothing. The label is a name only, so the data-dependence row's "no content" claim holds; the row was updated. /statsstays append-only.ExpandsandRecentRefusalsare newomitemptyfields.noteV3ExpandandnoteV3SizeRefusaltakev3Mu.RecentRefusalsis capped atmaxV3Recent(50).- Fail-open and the default path.
rule_unreferencedis off by default (parseSweepV3,TestV3UnreferencedIsOffByDefaultAndNeedsTheSettingchecks three configs). Every drop still goes throughapplyHeldFrom, so the marker and the stash back it. Rule (c) changes which outputs are chosen, not how a drop is made. - The new tests use only helpers that exist elsewhere in the package (
ruleIDs,assistantMsg,tCmdArgs,v3Out,refOutput,tReadArgs,heldFor,coldCtx,resetV3ForTest,lastWarmDecision,fakeAsker,MarkKeptVerbatim). I checked each.
Non-blocking
components/offload/extract_sweep.go:1320— thefill_smallhint omitsrule_unreferenced. The hint lists every setting that switches v3 on: "selector (rule or hybrid), fill_small, fill_large, min_drop_frac, protect_tools, protect_paths or protect_last_n". This commit makesrule_unreferenceda v3-switching setting (parseSweepV3), so the list is stale again. This is the same defect class as reviewer 1's round-1 note, fixed then in8637651b. The field's own hint does say "Writing it switches the v3 gates on", so only the aggregate list lags. Add the name to the list.- The doc claims more for
recent_refusalsthan it holds.advanced-offload.mdcalls it "the last size-gate refusals". The hybrid/judge-pathdrop_too_smallinv3Gateis a size-gate refusal: it writes a decision line with the same fields, but it does not enterRecentRefusals. Only the rule-mode refusals and the sweet-spot ones do. Also,V3Refusal's comment names onlydrop_too_smallandno_rule_drops, but sweet-spot refusals land there too, with D = 0. Say in the doc which refusals the list covers, or add the gate's refusal to it. - Reviewer 1's round-6 note and my round-6 note stay open (see Dispositions). Neither is addressed by this commit, and neither blocks.
|
Gate change from the owner, after t99 (rule (c) found 15-17% at 0.85 x C, but all 10 checks were refused 1. Turns left count the postponement. In v3,
2. The avoided compaction is credited (
3. Tests (mutation killed for each unless noted): N' > N by D/g with the t99 numbers and the cap; one definition; the credit only when avoided; the formula; the off switch; the gate accepting on the credit and refusing without it; the stats; the plain warm path unchanged (no post-cut turns, no credit); |
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 8 of 8 | 4feec280d616 |
approve |
Verdict: approve. One new commit since my round-7 review: 4feec280, a gate change (turns after the cut, credit for an avoided compaction, rule_d on the gate's decision lines). I found no blocking defect in it. The open notes stay non-blocking.
What I checked
- Last review: round 7, sha
cd94f98781a6c654373f91a7484e89e8325becf4, posted 2026-10-28T22:48:20Z. - New commits read: 1 —
4feec280"feat(sweep): v3 gate counts the postponed and the avoided compaction (#491)" (7 files, +383 −43). Full diff read, plus the code around each hunk. - Items read in full: 14 reviews (
.review-in-reviews.txt, 700 lines), 7 comments (.review-in-comments.txt, 97 lines), 0 inline comments (.review-in-inline.txt, empty). - New items since my last review, with dispositions:
- Reviewer 1's round-7 review (2026-10-28T22:47:51Z, approve). It landed 29 seconds before my round-7 post, so I read it only now. Two non-blocking notes on
cd94f987: theV3Refusalcomment under-lists (open, same point as my round-7 note 2), and the doublewarmRatioscall inv3Gate(fixed by this commit — theruleDcomputation is hoisted into themeasuredblock, and the branch now readswa.ruleD). - Author's round-8 comment (2026-10-29T08:07:53Z). Checked every claim against the code. All hold, including the mutation-equivalence claim (see below).
- Commit
4feec280. Reviewed as a first review. No blocking defect.
- Reviewer 1's round-7 review (2026-10-28T22:47:51Z, approve). It landed 29 seconds before my round-7 post, so I read it only now. Two non-blocking notes on
Dispositions of round-7 items
- My note 1: the
fill_smallhint omitsrule_unreferenced. Not fixed. I greppedextract_sweep.go:1323: the hint still lists seven settings, withoutrule_unreferenced. This commit addscredit_avoided_compaction(not a v3 switcher, so its absence from the list is correct) but does not fix the stale list. Still a one-word fix. - My note 2: the doc and the
V3Refusalcomment claim more forrecent_refusalsthan it holds. Not fixed. The doc still says "the last size-gate refusals" (advanced-offload.md:730), and the gate's hybriddrop_too_smallstill writes a decision line but noRecentRefusalsentry. Reviewer 1's round-7 note on theV3Refusalcomment is the same point; I agree with it. - My note 3 / the round-6 notes: still open, unchanged. This commit touches no dash or modelinfo file. The two stale dash comments and the
ParseTableresidual hole stay as they were. All non-blocking.
Findings
None. What I verified in 4feec280:
- The postponement arithmetic.
warmTurnsLeftAftercomputes the after-cut turns withturnsUntilCut(cut, P-D, g), which is exactly the no-cut(cut-P)/gplusD/g. WithremovedBilled = 0the function returns the old estimate unchanged —warmTurnsLeftdelegates with 0, andTestV3TurnsLeftCountFromThePromptAfterTheCutpins the equality plus the t99 numbers (N 22.7, N' 45.2, difference D/g 22.5). - One definition.
turnsUntilCutis the oldcacheRewriteHorizonbody lifted into a function. The coref call passes the same three values as before, so coref's behavior is unchanged. The floor at 0 is kept. - The plain warm path is unchanged.
removedBilledis 0 without v3 at both call sites, sote.Raw == te.RawNoCutand the crossing test inavoidedCompactionUSDis false by construction.creditis then 0, so!(saving+credit > rewrite)is the old comparison.TestV3OffTheWarmGateIsUnchangedandTestV3OffTheWarmGateCountsTurnsFromThePromptAsItIspin both halves. - The credit fires only on a real crossing.
te.RawNoCut <= horizon && te.Raw > horizonuses the raw (uncapped) values — the right choice, because the cappedNcan never exceedwarm_max_turns. Without a cut the two raws are equal, so the test is false. A cut that only delays the compaction (Rawstill inside) credits nothing. The model must beturnsModelCutandte.Cut > 0, so the expected-turns and no-billed estimates never credit. creditAvoidedis really v3-only.parseSweepV3returns early when v3 is off orwarmis false, before thecreditAvoidedline (extract_sweep_v3.go:102-108). SocreditAvoidedstays false off v3, and the author's claim that dropping the!e.v3check is an equivalent mutation is right.credit_avoided_compactionalone does not switch v3 on — it is not in the on-switch list, and the hint says "It does nothing without v3".- The gate ordering for
rule_d.v3Gatesetswa.ruleDfromres.Validbefore it calls the inner gate, andwarmGate's deferred log readswa.ruleDon every exit, so accepted,does_not_payand every other apply-stage refusal carries it.TestV3DoesNotPayRefusalCarriesRuleDandTestV3AcceptedDecisionCarriesRuleDpin both. The hoist also removed the duplicatewarmRatioscall (reviewer 1's round-7 note 2, fixed). - The stats surface.
CompactionsAvoided,SavingCompactionUSD(inV3StatsandV3Cut) and the fourWarmDecisionfields are newomitemptyfields, so/statsstays append-only.noteV3Cutcounts an avoided compaction only when the credit is positive.Any()grows to includeCompactionsAvoided. - The credit formula matches the doc:
C x read + compactionSummaryFrac x C x write,compactionSummaryFrac0.10, both rates fromwarmGateRates(the cache read rate). No division, no new data input — C and the rates are metadata, as the doc says. - Fail-open and reversibility. The commit changes when a cut is accepted, not how a drop is made. Every drop still goes through
applyHeldFrom. The trigger's worth test uses the same credit with its own D (every candidate), as the commit message says. - The new tests use only helpers that exist elsewhere in the package (
warmCfg,newWarmRig,payingTail,toHeld,resetWarmForTest,lastWarmDecision, the rig'sc/windowfields). I checked each. The gate test stripswarm_expected_turnsfrom the rig so thecutturns model runs — without that,avoidedCompactionUSDcould never fire.
Non-blocking
- The round-7 notes stay open (see Dispositions): the
fill_smallhint, therecent_refusalsdoc sentence andV3Refusalcomment, the two stale dash comments, theParseTableresidual hole. docs/components/advanced-offload.md:724— "rule_dis on every v3 decision line" overstates. The trigger-stage lines (no_billed_size,no_candidate,below_mass,does_not_payfromwarmWorthAsking, Stage "trigger") carry norule_d; only the apply-stage lines do. The gate cannot know a rule split there — it sums every candidate — so the behavior is right; the doc should say "every apply-stage decision line". The author's comment says exactly that ("set once, in the gate's deferred log"); only the doc page is broader.- Two small doc-code mismatches in the new gate text. The doc says the gate accepts when
saving + saving_compaction >= rewrite; the code keeps the strict>(!(saving+credit > rewrite)), so an exact tie refuses. And the doc's horizon test is written asN <= warm_max_turns/N' > warm_max_turns, but the code compares the raw, uncapped values — the loggedturns_no_cut/turns_after_cutare capped, and a cappedN'can never exceed the horizon. The code is right in both cases; the words could say it exactly.
amiddavid
left a comment
There was a problem hiding this comment.
| 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.312 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 8 of 8 | 4feec280d616 |
blocking |
Verdict: blocking. One finding: the v3 payback gate now counts the removal's saving past the turn where the no-cut thread stops reading the removed tokens, and credits the compaction that stops it. The two terms assume opposite baselines, so their sum over-credits.
What I checked
- Last review: round 7, cd94f98, 2026-10-28T22:47:51Z
- New commits read: 1 (4feec28 feat(sweep): v3 gate counts the postponed and the avoided compaction (#491)). Read the full diff and the code around every hunk in all 7 files.
- Read in full: 15 reviews, 7 comments, 0 inline comments (from the three files; the inline file is empty).
- New items since my last review, and what I did about it:
- Commit 4feec28 — reviewed as a first review. Result below.
- Author comment (2026-10-29T08:07:53Z) — checked every claim against the code. The postponement arithmetic, the credit formula, the off switch and the
rule_dhoist all hold. The payback arithmetic itself is the finding. - Reviewer 2's round-7 review (2026-10-28T22:48:20Z, 29 seconds after my round-7 post) — read in full. Approve, three non-blocking notes. I checked each; see dispositions.
- Reviewer 2's round-8 review (2026-10-29T08:12:19Z) — read in full. Approve, with notes on the open round-7 items and three new doc-wording notes. I checked each; I agree with notes 2 and 3 and say so below. The review does not cover the baseline question in my finding.
Earlier findings, dispositions
Round 7 ended approve on both sides. No finding is open. The author rejected nothing.
- My round-7 note 1 (the
V3Refusalcomment under-lists whatRecentRefusalsholds): not fixed. The comment still names onlydrop_too_smallandno_rule_drops(extract_sweep_v3.go:941). Reviewer 2's round-7 note 2 is the same point, wider (the doc sentence too). Still a one-line fix, still non-blocking. - My round-7 note 2 (
v3GatecalledwarmRatiostwice): FIXED.wa.ruleDis now computed once, in the measured block, before thedrop_too_smallbranch and before the inner gate runs (extract_sweep_v3.go). The branch readswa.ruleD. Reviewer 2 confirmed the same fix. - Reviewer 2's round-7 note 1 (the
fill_smallhint omitsrule_unreferenced): not fixed. I checked the hint (extract_sweep.go:1323): it still lists seven settings withoutrule_unreferenced.credit_avoided_compactionis correctly absent — it does not switch v3 on. Still a one-word fix. - Reviewer 2's round-7 note 3 and the round-6 notes (stale dash comments, the
ParseTableresidual hole): unchanged. This commit touches no dash ormodelinfofile. Still non-blocking.
Findings
1. The v3 gate's saving term and its avoided-compaction credit use opposite baselines, and the sum over-credits by more than the credit itself.
Where: components/offload/extract_sweep_warm.go:770-785 (turns := te.N, warmEcon, avoidedCompactionUSD, the accept test), extract_sweep_warm.go:600-645 (warmTurnsLeftAfter).
What the two terms say about the same no-cut thread:
- The saving term:
saving = D x content x read x turns, withturns = N'capped atwarm_max_turns. It prices D as read by the no-cut thread for N' more turns. - The credit term:
avoidedCompactionUSDfires only whenN <= horizon < N'. It says the no-cut thread compacts at N, inside the horizon, and prices that compaction (C x read + 0.10 x C x write).
Both cannot hold. If the no-cut thread compacts at N, the summary replaces the dropped content, so the thread stops reading D at N. The saving must stop at N too. If the no-cut thread does not compact inside the horizon, there is no compaction to credit. Under either reading, one of the two terms counts benefit that the other one's baseline says does not exist.
The stretch between N and min(N', horizon) is not just mis-sized, the sign is wrong. After its compaction the no-cut thread reads a summary-sized prompt. The model's own compactionSummaryFrac (0.10) says that is 0.10 x C. The cut thread reads about C - D there. So per turn in that stretch the cut thread pays MORE than the no-cut thread, by about (C - D - 0.1C) x read. The gate counts +D x read.
Numbers, the t99 case from the author's comment (P 142k, D 24.8k, g 1.1k/turn, C 167k, default horizon 60):
- N = 22.7, N' = 45.2. No credit fires (N' < 60). The gate now counts the saving over 45.2 turns; the old gate counted 22.7.
- For the 22.5 turns between N and N', the no-cut thread reads about 16.7k regrowing to 41k; the cut thread reads 142k growing to 167k. The honest difference is about -125k tokens per turn. The gate counts +24.8k.
- Over-count: about 22.5 x 125k x read = 2.8M token-reads. The whole counted saving is 24.8k x 45.2 x read = 1.1M. The over-count is about 2.5 times the counted saving.
- In the avoided case of the PR's own test (horizon 30): the stretch is 7.3 turns, the over-count about 0.9M x read, the credit 167k x read + 16.7k x write. At the test's rates that is $0.27 against $0.11 — the over-count alone is about 2.4 times the credit.
What fails: the gate accepts cuts whose honest payback is negative, in the near-compaction regime this change targets. The PR's own test TestV3TheGateAcceptsOnTheCompactionCreditAndLogsIt builds one: the credit off, the gate refuses; the credit on, it accepts. The customer pays the rewrite premium once, then pays more per turn than the compacted thread would have.
Why blocking and not a design note:
- The gate's own stated principle is "The direction of every doubt is 'refuse'" (warmRatios, extract_sweep_warm.go:495-496). This change's error direction is accept, in the feature's target regime.
- The t99 motivation (all 10 checks refused
does_not_pay) is real, but the honest mechanism for "a removal is worth more than the reads it avoids" is a stated premium, as #720's doc did withreward_premium("where that gap is stated, in config, falsifiably"). A horizon that counts turns no baseline world contains hides the premium inside the saving. credit_avoided_compaction: falseturns off only the credit. The N' extension of the saving has no switch. A v3 operator cannot get the old saving arithmetic back.
Fix direction, pick one:
- Smallest: keep the credit, count the saving to N only.
te.NNoCutis already computed and logged. Both terms then share one baseline (the no-cut thread compacts at N). - Full counterfactual: saving to N, minus (C - D - 0.1C) x read per turn from N to min(N', horizon), plus the credit when avoided. This will refuse most near-compaction cuts on token cost alone.
- Keep the arithmetic and rename what it is: a deliberate premium for postponing compaction, not a payback calculation. Then
saving_usdin the decision log no longer means "cache reads saved", and the doc must say so.
Non-blocking
- I agree with reviewer 2's round-8 note 2, after checking it myself: "rule_d is on every v3 decision line" (docs/components/advanced-offload.md:724) overstates. The trigger-stage lines carry no
rule_d; only apply-stage lines do. The author's comment says "the gate's deferred log", which is the apply stage. Say "every apply-stage decision line". - I agree with reviewer 2's round-8 note 3, both halves: the doc says the gate accepts on
saving + saving_compaction >= rewritebut the code keeps the strict>(extract_sweep_warm.go:785), and the doc writes the horizon test on N and N' while the code compares the raw, uncapped values (the loggedturns_no_cutandturns_after_cutare capped). The code is right in both; make the words exact. - The round-7 notes stay open, unchanged: the
fill_smallhint, therecent_refusalsdoc sentence andV3Refusalcomment, the two stale dash comments, theParseTableresidual hole.
What else I checked
- The postponement arithmetic is right.
warmTurnsLeftAftercomputes N' withturnsUntilCut(cut, P - D, g), which is the no-cut form plus D/g. The t99 numbers check out: N 22.7, N' 45.2, difference 22.5.warmTurnsLeftwith D = 0 returns the old estimate unchanged, and the test pins the equality. - One definition.
turnsUntilCut(components/offload/prefix_econ.go) is the oldcacheRewriteHorizonbody lifted out. The coref call passes the same three values as before, floor at 0 kept. Coref is unchanged. - The plain warm path is unchanged.
removedBilledis 0 without v3 at both call sites, soRaw == RawNoCutand the credit's crossing test is false by construction.!(saving + 0 > rewrite)is the old comparison.TestV3OffTheWarmGateIsUnchangedandTestV3OffTheWarmGateCountsTurnsFromThePromptAsItIspin both halves. - The credit's crossing test uses the raw, uncapped values.
te.RawNoCut <= horizon && te.Raw > horizon— the right choice, because the capped N can never exceedwarm_max_turns. A cut that only delays the compaction credits nothing; a far cut point credits nothing.turnsModelCutandte.Cut > 0are required, so the expected-turns and no-billed models never credit. creditAvoidedis v3-only.parseSweepV3returns before the field is read when v3 is off, so the missing!e.v3check inavoidedCompactionUSDis an equivalent mutation, as the author says.credit_avoided_compactionalone does not switch v3 on.- The
rule_dhoist.v3Gatesetswa.ruleDonce when measured, before thedrop_too_smallbranch and before the inner gate.warmGate's deferred log reads it on every exit, so accepted anddoes_not_paylines both carry it.TestV3DoesNotPayRefusalCarriesRuleDandTestV3AcceptedDecisionCarriesRuleDpin both. The hoist also removed the duplicatewarmRatioscall (my round-7 note 2). - The trigger does the same with its own D.
warmWorthAskingbuildsremovedoptimistically (every candidate dropped,savessummed over the same candidate scan the question uses) and passes its ownremovedBilledtowarmTurnsLeftAfter(extract_sweep_warm.go:996-1005). The trigger and the gate share one turns model, as the comment claims. - The stats surface stays append-only.
CompactionsAvoided,SavingCompactionUSD(inV3StatsandV3Cut) and the fourWarmDecisionfields are newomitemptyfields.noteV3Cutcounts an avoided compaction only when the credit is positive.Any()grows to includeCompactionsAvoided. - The cut point in the credit.
te.CutisFillDenominator()orCutFractimes it — the same effective-context C the v3 gates use. No division, no new data input; C and the rates are metadata. - Fail-open and reversibility. The commit changes when a cut is accepted, not how a drop is made. Every drop still goes through
applyHeldFrom(marker, stash, drop record, panic restore). No new drop path. - Data dependence. Unchanged: the credit reads C and the two rates, all metadata. The doc states this.
- I did not run builds or tests (not approved). The author reports
-raceoncomponents/offloadandkeepalive, lint, andmkdocs build --stricton eval box 1; my claims come from reading the code.
) Review round 8 on #763. - the saving is priced on N, the turns until the compaction would have come without the cut: (C - P) / g. A cut only delays the compaction, and the compaction at N removes the dropped outputs anyway, so nothing past N is a saving - N' (turns from the prompt after the cut) stays in the log for reading and is not priced; one function, turnsUntilCut, still serves coref and the gate - remove credit_avoided_compaction, saving_compaction_usd, compactions_avoided and compactionSummaryFrac; the key is refused with a reason - doc and comment fixes: apply-stage decision lines, strict >, fill_small hint, recent_refusals, two dash comments Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
|
Round 8 fix. Verified on eval box 1: The saving is priced on N, not N'. R1 was right. Without the cut the thread compacts at N, and that compaction removes the dropped outputs anyway.
The avoided-compaction credit is removed. Doc and comment fixes
Tests
|
|
Two more items from the owner, on top of b97dede. Verified on eval box 1: 1. 2.
Tests (mutations killed): premium 0 equals the cost gate (same refusal, same numbers); a premium lets a refused case through and marks it |
8255b96 to
8f90546
Compare
Add a v3 configuration of the warm path. Off unless a v3 setting is written; the default config is unchanged from #720. - sweet spot: cut only when P >= fill(C) x C - one cut per round: wait for growth after an accepted cut - meaningful drop: D >= min_drop_frac x P, then #720's payback gate - selector: judge (default), rule (no model call), hybrid (one cut) - rules: file re-read or write, build/test/lint re-run - protect_tools, protect_paths, protect_last_n - counters under keepalive.sweep_warm.v3 and in the decision log Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
) Review round 1 on #763. - the ping question builds the v3 plan: no protected output is offered, and in hybrid no rule-decided output - selector rule refuses the ping question (ping_refused_rule) - a Store answer applied cold skips protected outputs - a cold or changed-prefix apply counts as a cut and starts the wait - rule drops record their own token count - refusals not_in_sweet_spot and cut_point_unknown count once per warm_every_n; a request with no billed size counts nothing - hybrid_rules_only counts only a real "no answer" - remove dead code and unused imports; fix comments and hints Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
- build the protected set lazily on a cold apply: no plan without a stored answer - selector rule keeps no ping copy, as the ping is always refused - a cold-apply cut splits rule drops from judge drops through ruleOf - a cold apply of a waiting hybrid answer clears v3Asked even when it changes nothing Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
- docs: a rule-mode ping counts as sweep_no_candidate; ping_refused_rule fires only for a candidate left from before a config change - v3ColdCut: note that ruleOf is empty on every production path today - read the marked-id set only when a claim wins, as the plan is built - use carriesRealMarker, not a substring test, for the marker check Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
The sweet spot is a share of where the client compacts, not of the window. An operator can state that point per model. - MODEL_PRICES: new optional compaction_point (billed tokens), beside window. It does not change window. - compactionpoint.Resolve prefers it (Source operator) over the bootstrap table. The proxy resolves it for /v1/messages and /compact. - v3 C: CutFrac x C with a summarizer, else the compaction point unless its source is window_fallback, else the window. - /stats v3.c_source, C and c_source in each recent cut and in the decision log. - Nothing changes unless the field is set. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
Review round 5 on #763. - the compact-episode span, the summarize ledger and the replay cap resolve the compaction point through the operator table first, as they already do for the window; with no field set the numbers are the same as before - ParseTable rejects a compaction_point above the entry's window, and names the model - noteV3CSource is paced at warm_every_n, like the refusal counters - move resolveWindow's doc comment back above resolveWindow Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…491) - rule (c), off by default (rule_unreferenced, rule_unreferenced_min_age): drop an output that nothing later references, using the recheck's own referenced_later signal (coref.IndexNovel); it obeys every protection - rule-mode refusals (drop_too_small, no_rule_drops) are paced at warm_every_n and log one decision line with D, D/P, C, c_source and D by rule; /stats v3.recent_refusals has the same - the drop record stores the name of what chose the drop (a rule or judge); /stats v3.expands counts first expands by that name - hybrid is unchanged Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…491) - turns left in v3 count from the prompt after the cut: N' = (C - (P - D)) / g. One function, turnsUntilCut, now shared with the co-reference horizon. The trigger does the same with its own D. The plain warm path is unchanged. - credit_avoided_compaction (on in v3 only): when a cut pushes the compaction past the horizon, credit saving_compaction_usd = C x read + compactionSummaryFrac x C x write. The gate accepts on saving + saving_compaction >= rewrite. Nothing is credited when the compaction is only delayed. - N, N', saving_compaction_usd and rule_d are in every v3 decision line; /stats v3 counts the compactions avoided and their credit. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
) Review round 8 on #763. - the saving is priced on N, the turns until the compaction would have come without the cut: (C - P) / g. A cut only delays the compaction, and the compaction at N removes the dropped outputs anyway, so nothing past N is a saving - N' (turns from the prompt after the cut) stays in the log for reading and is not priced; one function, turnsUntilCut, still serves coref and the gate - remove credit_avoided_compaction, saving_compaction_usd, compactions_avoided and compactionSummaryFrac; the key is refused with a reason - doc and comment fixes: apply-stage decision lines, strict >, fill_small hint, recent_refusals, two dash comments Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
#491) - fill_small default is 0.70 (70% of the effective context, a general rule), from 0.85. fill_large stays 0.6. An unset or out-of-range value reads as the default. - compaction_premium_usd (default 0, v3 only, an experiment knob): when a cut postpones the compaction, the premium joins the saving side: accept on saving_to_N + premium > rewrite. With 0 the gate is the cost gate. Every apply-stage decision logs premium_usd and passed_on_cost; /stats has v3.cuts_on_cost and v3.cuts_on_premium. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…eads (#491) - the drop record (cg:swd:) stores the tool name, the class of the tool (read, edit, command, other) and an 8-byte HASH of the call's file path or command. The path itself is never stored. One hash function serves the drop and the later scan; a prefix keeps a path and a command apart. - on each later request the sweep hashes the path or command of the later tool calls and matches them against the dropped hashes. Each drop counts once. - /stats v3.reread_after_drop (total, by_source: a rule name or judge, by_kind) and v3.dropped_by_kind, the denominator for a re-read rate. - with v3 off nothing is recorded or scanned. - data-dependence row and docs updated. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
- dry_run (bool, default false, v3 only): everything runs as a normal v3 run (the pings, the judge's questions, the rules, the recheck, the gate and its logs), but no drop is applied on any path: warm, cold (Store or memory answer), changed-prefix and the v3 cold branch. - each would-be cut is logged as cg.sweep.dry_run_cut with a real cut's fields and counted in v3.dry_run_cuts (and v3.dry_run_drops, v3.dry_run_recent_cuts). - a would-be cut does not start the growth wait, so a dry run asks as often as a real one does before its first cut. - the forwarded request has no sweep drops: no message changes, no stash, no marker, no drop record. - data-dependence row: the stored path hash is approved 2026-11-01. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
694b5a2 to
9ea9277
Compare
Box results (eval box 1, head 9ea9277,
|
amiddavid
left a comment
There was a problem hiding this comment.
| 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.322 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 12 of 13 | 9ea92771aa17 |
approve |
Verdict: approve. The PR was rebased onto a new main (base 87b29db, was 6298673). No new feature commit came with it. I verified the rebase commit by commit: 10 of the 12 commits are byte-identical patches to the ones I reviewed in rounds 2-11 (patch-ids match), and the 2 the rebase reworked I read in full. No blocking defect. One new non-blocking note: the new "operator" compaction-point source is missing from three enumeration comments.
What I checked
- Last review: round 11, sha
694b5a294eadb506e064d07d012b823e5a5ae203, posted 2026-11-01T09:26:35Z. - New commits read: 12 —
git log 694b5a29..9ea92771lists the whole series again, because the rebase rewrote every SHA:
fdc11a6dsweep v3 on the warm path ·e5c38b37ping question and cold apply ·6278f86fround 2 notes ·dd7fdb46round 3 cleanup ·64920442reworked sweet spot from the effective context ·27ef9036reworked operator compaction_point in the dashboard ·686bf36crule (c) unreferenced ·cedcb227gate counts postponed and avoided compaction ·24b38bdbsaving priced on N ·a7e55757fill_small 0.70 and the premium ·d0d851b0drop records and re-reads ·9ea92771dry_run. - How I read them.
mainmoved about 100 commits between the two bases (#720's merge and the compactionpoint work behind it, through #1002). I matched each rebased commit to its old counterpart by title and compared patch-ids: 10 pairs identical, so the code I verified in rounds 2-11 is unchanged. The 2 differing pairs (47e1badb→64920442,d4cf2d5b→27ef9036) I read as full patches, old and new side by side, plus the code around every hunk at the new head. - Read in full: 22 reviews (
.review-in-reviews.txt, 1174 lines), 12 comments (.review-in-comments.txt, 181 lines), 0 inline comments (.review-in-inline.txt, empty). - New items since my last review, with dispositions:
- Reviewer 2's round-11 review (2026-11-01T09:25:22Z, approve). It landed 73 seconds before my round-11 post, so I read it only now. Its two notes I checked myself: the cold-path dry-cut numbers (agree — same as my round-11 note 1, still open) and the carry-over list (agree, none fixed by the rebase).
- Author's comment (2026-11-10T14:25:38Z): box results on head
9ea92771— lint,go test ./...(48 packages),-raceon 8 packages,mkdocs build --strict, and a rerun on the final head after #1002 landed. Consistent with what I verified: the base ismain, #720 is merged, the branch holds 12 commits. I did not run tests myself (not approved). - The rebase itself. Reviewed as a first review where it changed content — see Findings.
What the rebase reworked (and I verified)
64920442(sweet spot from the effective context).mainnow hasPoint.Abs, theTokens()shortcut andRecordedfrom the #720/#955-era work, so the commit no longer re-adds them. It adds theOperatorsource on top:Resolve()ininternal/compactionpoint,Chain.CompactionPointandTable.CompactionPointininternal/modelinfo, thecompaction_pointfield in the MODEL_PRICES table, andresolveCompactionPointin the proxy. I checked the wiring end to end: both/v1/messagesand/compactgo throughcompactionPointFor(proxy.go:931, proxy.go:1336), which keeps the user's own client setting first and falls back toresolveCompactionPoint; the source flows intocomponents.Ctx.CompactionPointSource(proxy.go:948), andv3CutPointtreats any point that is notwindow_fallbackas C. Precedence and fail-open behavior are unchanged from what I approved before.27ef9036(operator point in the dashboard).mainaddedepisodeConversationPoint/capConversationPoint, so the commit now threads apointFnthrough them instead of replacingcompactionpoint.Forcalls. It also gatesnoteV3CSourceonpaced(extract_sweep_v3.go:686-688), so thec_sourcecounter runs at the samewarm_every_npace as the refusal counters — this matches the docs, andTestV3CSourceIsReportedForEachCasepins it (2 counts over 6 requests). Acompaction_pointabove a statedwindowis now rejected at table parse. I checked theC <= 0refusal returns beforenoteV3CSource, so the empty source is never counted.- Behavior-change naming (new repo rule). The PR body names it at the top: the data-dependence change with its approval dates, and "Every v3 setting is off by default. The default config gives the same bytes as
main. A test proves it." Thecompaction_pointfield is opt-in ("Nothing changes unless it is set"). Satisfied. - Keep-alive and the cache strategy (new repo rule). The reworked commits touch no cache-strategy code.
dry_runkeeps the pings and the questions running. Nothing shortens a cache strategy.
Dispositions of earlier findings
No finding was rejected by the author. Nothing earlier is blocking.
- My round-11 note 1 (cold dry cuts log hard-coded
passed_on_cost=false/premium_usd=0): not fixed. Both call sites unchanged (extract_sweep_apply.go:851, extract_sweep_v3.go:626). Reviewer 2's round-11 note 1 is the same finding; I re-checked it myself and agree. Still open. - My round-11 note 2 (
V3CutsForTestexported, never used): not fixed. Still only its definition (extract_sweep_testing.go:34). - The dash
Provenancecomment: not fixed, and now concretely incomplete. See Findings, note 1. - Reviewer 2's round-10 notes 2 and 3 (re-read denominator includes drops with an empty Target; client compaction pins
RereadAt): not fixed, unchanged. I re-checked both; I still agree with the author's reasoning on each. - The other open notes: not fixed, unchanged.
tkind()/target()still each parse the same arguments (extract_sweep_v3.go:1267, 1274);scanRereadsstill writes the drop records per request; a negativecompaction_premium_usdstill switches v3 on (line 109,!= 0) while the guard reads> 0(line 137); theParseTablehole (a point stated without a window skips the above-window check — kept deliberately, the new test says so); thepostponementPremiumraw edge; thet.SkipfinTestV3GatePricesTheSavingOnNAndNotOnNPrime. None is blocking.
Findings
None blocking. What I verified beyond the rework:
- The rebase drops nothing. The PR diff against the new base touches the same 24 files plus
proxy/compactioncfg.go(whichmainsplit out ofhandler.go), with the same shape: 4220 insertions against 4218 before. The warm-path files (extract_sweep_warm.goand the rest) are modifications on top ofmain's #720, as before. - The dry-run and record features are intact. The last two commits are byte-identical to
59b4ddb4and694b5a29, which I verified in full in rounds 10 and 11. I spot-checked the dry branches at the new head (v3Dispatch,v3Apply) — unchanged.
Non-blocking
- The new "operator" source is missing from the enumeration comments. The rebase makes an operator-stated
compaction_pointa realCompactionPointSourcevalue (it reachescomponents.Ctx, andClientCeilings.Provenancecan be"operator"—TestOperatorPointFeedsTheCompactEpisodeSpanasserts it). Three comments still enumerate the old set:components/component.go:685-687,apply/opts.go:56("measured | assumed | configured | client_default | window_fallback"), and theClientCeilings.Provenancecomment indash/compactepisode.go— the one already open from round 8, now missing one word. ThecompactionPointForcomment (proxy/compactioncfg.go:134) also still says "else the bootstrap table", where the fallback is now the operator table first. One sentence each. - The earlier open notes stay (see Dispositions): the cold dry-cut numbers,
V3CutsForTest, the re-read denominator sentence, the double parse, thescanRereadstraffic, the negative premium,ParseTable,postponementPremium, thet.Skipf.
amiddavid
left a comment
There was a problem hiding this comment.
| 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.322 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 12 of 13 | 9ea92771aa17 |
approve |
Verdict: approve. The change this round is a rebase, not new work. The branch moved from the old base 62986738 to main (87b29db). All 12 commits are the reviewed v3 stack. Ten apply with byte-identical patches. Two were adapted during the rebase. I read every adapted hunk and the final code around it. I found no defect.
What I checked
- Last review: round 11,
694b5a294eadb506e064d07d012b823e5a5ae203, 2026-11-01T09:25:22Z. - New commits read: 0 new commits. The head
9ea92771is a rebase of the reviewed stack, not new work. Evidence:git range-diff 62986738..694b5a29 87b29db..9ea92771: 12 commits before, 12 after. Ten map with identical patch-ids (=). Two changed (!):64920442(was47e1badb, sweet spot from the effective context) and27ef9036(wasd4cf2d5b, dash reads the operator's compaction_point).- The old range
694b5a29..9ea92771lists the whole rebased stack plus main's own commits, because the two heads sit on different lines. I enumerated it and separated the two. - I read the full range-diff (243 lines), the final code of every adapted hunk, and the head-to-head delta of every PR-touched file that differs.
- Read in full: 22 reviews (
.review-in-reviews.txt), 12 comments (.review-in-comments.txt), 0 inline comments (.review-in-inline.txt, empty). The two items newer than my last review are listed below. The rest are unchanged since round 11, when I read them in full. - New items since my last review, and what I did about it:
- Reviewer 1's round-11 review (2026-11-01T09:26:35Z, 73 seconds after my post, so I read it only now) — approve, two non-blocking notes. Dispositions below.
- Author comment (2026-11-10T14:25:38Z) — box results on the final head. I checked its claims myself: the base is
main, #720 is merged, the branch holds 12 v3 commits, and the final head is9ea92771. All hold. - The rebase itself — reviewed like a first review. Result below.
- No new inline comments.
Findings
None. What I verified in the rebase:
- No PR hunk was silently changed. I diffed the reviewed head against the new head on every PR-touched file that differs (14 files). Every delta is main's own change, not a rewrite of a PR hunk:
components/offload/extract_sweep_apply.go: a doc comment onmsgPrint(main's #787 note). The PR's hunks are untouched.keepalive/keeper.go: the head-to-head delta is byte-identical to the base-to-base delta. Main's keep-alive work sits beside the PR's hunks; nothing of the PR moved.dash/summarizeattr.go,docs/data-dependence.md,docs/components/advanced-offload.md: main's own rows and sections. Theextract_llm_sweepcomponent row, with its path-hash Decided-by line, is unchanged.
- The dry-run, re-read and premium work from rounds 9-11 is unchanged. Those commits carry identical patch-ids, so their code is exactly what I reviewed.
- The warm path under the PR did not regress. The old base and
maineach hold a version of the warm path. I checked that main's version (#720) contains the old line's round-8 fixes: the carried counters (carried_expiredand friends) exist incomponents/offload/extract_sweep_warm.go,keepalive/keeper.goand their tests on the new base.extract_sweep_warm.gois byte-identical between the two bases. Nothing was lost in the move. - Commit 5 adaptation (
64920442). The commit now adds only theOperatorsource andResolveon top of main'sConfigured/ClientDefault/Recordedwork, instead of redefining theSourcelist.internal/modelinfokeeps thecompaction_pointfield, its validation (a point above the window is rejected; negatives are rejected) and theCompactionPointlookup (ok=false when the entry states none). The proxy gainsresolveCompactionPoint— one reader for/v1/messagesand/compact, the operator's table in front of the bootstrap. TheWriteFracrefactor from main is folded in correctly: the file-levelcache_write_fracapplies only where the match charges a cache-write premium, andprices.example.yamlleavescache_read_fracunset so the per-model tiers apply, with a comment saying so. - Commit 6 adaptation (
27ef9036). The dash now injects apointFn.operatorPointwrapsmodelinfo.OperatorCompactionPointpluscompactionpoint.Resolve.episodeConversationPointandcapConversationPointkeep the client-recorded row first (newest wins), then the injected point.walkCapConversationprices the limit fromcpt.Tokens(w)and splitsCeilingConfigured(absolute) fromCeilingFrac(fraction) by source. A client's absolute number stays absolute even when the window is a stand-in, which is right: the client's own setting does not scale with our window. - The adapted code is consistent between the proxy and the dash. Both put the user's own client setting in front of the operator's statement.
- Data dependence. The rebase changes no row of this PR. The
extract_llm_sweeprow and its approval line stand as reviewed. - Behavior-change rule. Nothing in this round's change decides a new behavior for an edge case. The one precedence interaction (below) comes from composing with main's already-merged #948/#963, and the code documents it.
- I did not run builds or tests (not approved). The author reports, on the final head:
make lintok,go test ./...48 packages ok,-raceok on the eight touched packages,mkdocs build --strictok, and a re-run of lint and the touched packages after main moved once more (#1002). My claims come from reading the code.
Earlier findings, dispositions
Round 11 ended approve on both sides. No blocking finding is open. The author rejected nothing.
wa.premiumwritten and never read (my round-9 note): FIXED in694b5a29, still fixed at the new head.v3Applypasseswa.premiumtonoteDryRunCut.- Reviewer 1's round-11 note 1 (a cold dry cut logs
passed_on_cost=falseandpremium_usd=0although no gate ran): not fixed, and I agree. This is my round-11 note 1; reviewer 1 found the same thing independently. Still open, non-blocking, under-labelling only. - Reviewer 1's round-11 note 2 (
V3CutsForTestexported and unused): not fixed, and I agree after checking. No test or non-test file calls it at the new head.V3DryRunCutsForTest,DropRecordsForTestandResetV3ForTestare used; only this one is an orphan. Still open, non-blocking. - My round-10 notes 2 and 3 (the re-read denominator holds drops that can never be re-read; a client compaction pins
RereadAt): not fixed, unchanged. Reviewer 1 checked both and agrees. Undercount only. Still open, non-blocking. - The remaining open notes are unchanged (the dash
Provenancecomment, thepostponementPremiumraw edge, theParseTableresidual hole, the negativecompaction_premium_usdon-switch, the doublecallTargetparse, thescanRereadswrite volume, thet.Skipfin the pricing test). The rebase touches none of them.
Non-blocking
- proxy/compactioncfg.go:150 — the rebase puts the operator's
compaction_pointbehind the user's own client setting.compactionPointFortriesClaudeCompact/BobCompact/CodexCompactfirst (main's #948/#963) and only thenresolveCompactionPoint. On the old base no client setting existed, so this order is new to this PR's path. I believe the order is right — the user's own setting is where the client actually acts, and the dash does the same — and the code comment at compactioncfg.go:135-144 states the layering. One sentence in the PR description naming the order would let a human confirm it.
#491) Comment lines only. No code or test change. Assisted-By: Claude Sonnet 5.5 Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Merged origin/main (b329371) into this branch: d4fc4b2.
|
Data dependence change (owner approved 2026-10-28; path hash approved 2026-11-01). The rules read tool names, tool input paths and commands from the request in flight. The drop record in the Store now also keeps the tool name, the tool class (read, edit, command, other) and an 8-byte hash of the file path or command. The path itself is never stored. The
extract_llm_sweeprow indocs/data-dependence.mdis updated. "Decided by" stays the owner.Base is
main. #720 (the warm sweep) is merged as 54a51b5. This PR holds only the v3 work on top of it.Summary
main. A test proves it.What changed
P >= fill(C) x C.fillisfill_small(0.70) at C <= 200k andfill_large(0.6) at C >= 1M, linear between.CisCutFrac x windowwith a summarizer, else the compaction point (unless its source is the window fallback), else the window.compaction_pointin MODEL_PRICES (optional, billed tokens, besidewindow). It does not change the window. The proxy, the summarizer and the dashboard read it first. Nothing changes unless it is set.min_drop_frac x C. A refusal does not start the wait. No judge question runs during the wait.D >= min_drop_frac x P(default 0.15).selector:judge(default),rule(no model call),hybrid(one cut).file_reread. (b)build_rerun. (c)rule_unreferenced(off by default): drop an output that nothing later references. Every rule obeys every protection.protect_tools,protect_paths,protect_last_n(default 10), anything expanded, any marker output.dry_run(default false): everything runs, no cut is made. The forwarded request has no drops./stats v3.reread_after_dropcounts later re-reads by source and kind.v3.expandscounts first expands by source.compaction_premium_usd(default 0, experiment): when a cut postpones the compaction, the premium joins the saving side.v3.cuts_on_costandv3.cuts_on_premiumshow which cuts needed it./statsunderkeepalive.sweep_warm.v3and in the decision log.How it was tested
Eval box 1, on head 9ea9277,
-count=1:make lint: clean.go test ./...: all 48 packages ok (run on the head before the last rebase onto Fix: Price rows booked at $0 before the price map loaded #1002).-race:components/offload(625 s),keepalive,config,internal/compactionpoint,internal/modelinfo,apply,proxy(603 s),dash(851 s). All ok.mkdocs build --strict: ok.dash,components/...,internal/...,configand mkdocs run again. All ok.extract_sweep_v3_test.go,apply/sweep_dryrun_test.go,dash/operatorpoint_test.go,internal/compactionpoint,internal/modelinfo,proxy/compactionpoint_resolve_test.go. The default-config test (same bytes asmain, no v3 counter) still holds.Open questions
Technical notes
components/offload/extract_sweep_v3.go. It hookswarmStepand reusesapplyHeldFrom.turnsUntilCutis the one definition of the turns left, shared with the co-reference horizon.warm: truedoes nothing.compaction_pointin MODEL_PRICES, then the bootstrap table. The dashboard uses the same order.Part of #491.