Repository navigation
fix: nine small fixes (#328 #339 #166 #461 #610 #198 #452 #207 #174) - #746
Conversation
The builtinTools allowlist was missing 8 tools a live Claude Code 2.1.283 session declares: ArtifactCheck, ArtifactComments, ArtifactData, SendFeedback, ReadMcpResourceTool, ReadMcpResourceDirTool, ListMcpResourcesTool and DesignSync. DesignSync was the list's own example of a name that only looks built-in. That belief was wrong. It is Claude Code's own claude.ai/design bridge. On the snapshot the removal page was measured against, it was the largest misclassified item: declared, never invoked, by 1,592 of 1,959 tool-bearing sessions. A missing name reports as `client_tool`, which says "check what declares this" instead of "do not touch". So every one of these was hidden behind the danger warning. How it was tested: TestBuiltinClassification rows for all 8 names fail on clean origin/main and pass with this change (box run, glm-small-fixes-main vs glm-small-fixes). Full ./dash/... -race suite passes. Closes #328 Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
FoldSearchOutput ranked fold candidates by their byte size. A
fold can be bigger in bytes and still cheaper in tokens: 500
bytes of base64 or minified JSON can be fewer tokens than 200
bytes of prose. The byte order and the token order disagree
exactly when it matters, so the sweep sometimes kept the more
expensive output.
Rank by the token estimate the sweep already uses everywhere
else (internal/tokens), with byte size kept as the tiebreaker.
The stored fold metadata still reports bytes, so nothing
downstream changes.
How it was tested: TestThePickBetweenSurvivorsJudgesTokensNotBytes
fails on clean origin/main ("chose 904 bytes/331 tokens, want the
token-winner: 1074 bytes/266 tokens") and passes with this change
(box run, glm-small-fixes-main vs glm-small-fixes). Full
./components/reformat/... -race suite passes.
Closes #339
Written by GLM through Claude Code
Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
PRAGMA wal_checkpoint(TRUNCATE) reports a busy checkpoint as a
result row, not as an error. checkpoint() scanned the row and
discarded it. So the WAL-bloat protection ran as a no-op exactly
when a reader held the lock — which on a live dashboard is most
of the time — and an operator had no way to tell a checkpoint
that ran from one that was silently skipped.
Read the (busy, log, checkpointed) row and WARN when the
checkpoint did not complete, with the frame counts. No outer
retry loop: the pool's busy_timeout(5000) already makes the
single call retry the lock for up to 5 seconds internally, and
stacking attempts on top of that only stacks 5-second waits
(a measured 25 seconds for 5 attempts).
How it was tested: TestCheckpointRetriesWhileAReaderHoldsTheLock
holds a read transaction across a whole janitor pass and fails on
clean origin/main at the log assertion ("a checkpoint that stayed
busy for the whole retry budget left no trace"); with this change
it passes, and the pass after the reader lets go truncates for
real. Full ./dash/... -race suite passes.
Closes #166
Written by GLM through Claude Code
Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
ValidateShapeFor answered a tool_use by scanning for its id anywhere in the remaining messages. A provider may send the tool_result before a sibling tool_use that shares its group — the "sibling-first" wire order. The scan then found the id, but in the wrong group: a later group holding a NEW tool_use with the same shape looked answered, and a genuinely unanswered tool_use in a mid group looked fine. Both directions of the false positive. Add ValidateShapeGrouped, which takes the #457 WireGroup view alongside the flat messages and answers a tool_use only inside its own run: the tool_result must carry the same group index, and the group may not end on an unanswered assistant turn. ValidateShapeFor keeps its signature and its old semantics, and still backs the ungrouped call sites. How it was tested: TestValidateShapeGroupedReadsWireAdjacency fails to even compile on clean origin/main (undefined: ValidateShapeGrouped), and passes with this change; a mutation that ignores the groups fails the same test. Full ./schema/... and ./internal/... -race suites pass. Closes #461 Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
The rewritten-tail parent rule (#559, internal/thread) is `if lcp < th.n-2 || 2*lcp <= th.n { continue }`. It is one expression carrying two distinct boundaries, and neither edge had a test: nothing pins the exact point where 2*lcp == n flips the rule, and nothing pins the n-3 decline — the point just below the conversation-tail threshold where a thread must NOT be treated as a rewritten tail. Add two tests, one per boundary, each built as a minimal fixture that lands exactly on the edge. #610 asked for the coverage; the code under test is unchanged. How it was tested (mutation proofs, box run glm-small-fixes-mut): deleting `|| 2*lcp <= th.n` fails the half-boundary test; deleting `lcp < th.n-2 ||` fails the n-3 test. Both pass on the unmutated code. Full ./internal/thread/... -race suite passes. Closes #610 Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
commitgate marks a replayed-branch commitRefresh irreversible through a hand-maintained table in commitgate_irreversible_test.go. Nothing enforced its completeness: a new computed-eff commitRefresh call site (one whose marker argument is computed rather than the literal markerFull) could skip the table and the test would still pass, silently losing the irreversibility guarantee for that site. Add a go/ast completeness check that walks every file in the offload package, finds the commitRefresh calls whose marker argument is not the literal markerFull, and fails when any of them is missing from the table — by file and function name, the same keys the table uses. Mirrors the gateExempt pattern already used for the same class of gap. How it was tested (mutation proof, box run glm-small-fixes-mut): renaming the marker at the replayStale site in summarize.go to markerSummary fails the new check, naming summarize.go:replayStale as uncovered. Restored, it passes. Full ./components/offload/... -race suite passes. Closes #198 Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
sweep_stale_prefix counted two different declines as one. A
stale prefix means the stashed body was the wrong one. A shifted
coordinate system means an EARLIER component changed the message
count, so the span to verify against the stash could not be
located at all. The remedies differ — a stale prefix is re-asked,
a shifted one cannot be — so one bucket hid both.
Add the sentinel components.ErrCoordsShifted beside
ErrStalePrefix, and return it from rawSpanForHash when the span
cannot be located because the count changed. The sweep gates it
as sweep_coords_shifted; the cache-aware summarizer counts it as
cache_aware_summarizer_coords_shifted. Both keys are listed in
the /stats golden contract. Neither is Prometheus-exported yet
(notExportedWhy says why), so no alert or dashboard changes.
How it was tested: the new sweep and summarizer tests fail on
clean origin/main ("a shifted coordinate system was not counted
as sweep_coords_shifted", gates showed it landing in
sweep_stale_prefix) and pass with this change. A mutation proof
(ErrCoordsShifted swapped back to ErrStalePrefix at
cache_aware_summarizer.go) fails the summarizer test. Full
./components/... and ./proxy/... -race suites pass.
Closes #452
Written by GLM through Claude Code
Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
When the SSE splicer withholds a turn, the usage block in the withheld bytes never reaches the client's view of the stream. responseUsageWhy classified that window as usageMissAbsent — "the provider streamed no usage" — which points the operator at the provider instead of at us. The `usage_unreadable` counter, which exists for exactly this, was unreachable on the spliced path. Give responseUsageWhy the window's spliced flag (the sniffer already knows it) and upgrade usageMissAbsent to usageMissUnreadable when the window was spliced. A usage block that was present but rejected by the dialect parsers stays a dialect finding, whatever the window did. Buffered (non-stream) bodies pass false. The usage-shape record now carries spliced=true so the reason is visible per request. How it was tested: TestASplicedStreamReportsUnreadableNotAbsent fails to compile on clean origin/main (responseUsageWhy arity) and, on a mutation that ignores the flag, fails with the window classified as absent; with this change it passes, and the recorded usage shape says spliced=true. Full ./proxy/... -race suite passes. Closes #207 Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
The SSE peek counts a proxy tool_use handed back to the client as a leak. It had one counter, sse_expand_after_stream, so an adjudicate leak landed in the expand bucket. The issue called this unattributable at two of the three bail sites, because nothing had parsed the turn when they fire. The peek knows better: it parses every event, so it can report the names it withheld. pass now returns the matched proxy tool names (first appearance, deduplicated) alongside the withheld bytes, and a countLeak closure attributes each name to its own counter — sse_adjudicate_after_stream for adjudicate, the expand counter for everything else. A round that leaks BOTH tools is counted in both, which the old boolean `found` could not express. `called` is hoisted with `withheld`, so a round that ends without running pass (an upstream failure, a JSON round after a stream) still attributes the previous round's tool_use. Both counters stay /stats-only (notExportedWhy says why) and both keys are listed in the /stats golden contract. No alert or dashboard changes. How it was tested: TestPassReportsWhichProxyToolItWithheld pins the peek's name reporting; TestAnAdjudicateLeakOnTheSSEPathIs- CountedAsItself fails on a mutation that counts every leak as expand (SSEExpandAfterStream:1, SSEAdjudicateAfterStream:0) and passes with this change. TestStatsShapeIsUnchanged and TestEverySnapshotFieldIsExportedOrExempt cover the new key. Full ./proxy/... -race suite passes. Closes #174 Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
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.311 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | a4ea9422f942 |
approve |
Verdict: approve
Findings
None. Every changed path behaves as the commit messages claim. Fail-open holds on each path I traced.
Non-blocking
-
schema/validate.go:106 —
ValidateShapeGroupedhas no caller that passes a real grouping.- Every caller in the repo (
ValidateShape,ValidateShapeFor, the summarize shape oracle incomponents/offload/summarize_shape_test.go) still passes nil groups. The #461 false positive stays for all of them. - Issue #461 itself calls the check test-only and proposes exactly this API, so the commit matches its issue. But
applyalready computes a wire grouping (apply.go:1990, forsummarizeSpan) and does not feed it to the validator. A future test that re-normalizes a #457-shaped transcript must know to use the new API, or the blind spot returns. - Fix (later PR): wire the grouping apply already computes into the shape check, or into the summarize oracle test.
- Every caller in the repo (
-
proxy/proxy.go:1692 —
countLeakcounts every non-adjudicate name as an expand leak.passtakes one required proxy name plus a variadic tail. If a third proxy tool is ever added to that list, its leak lands insse_expand_after_streamsilently.- Fix: switch on the name against the full set
passwas given, or assert membership before bucketing.
-
proxy/usage.go:735 —
spliced()reports true when nothing was dropped, in one corner.total > len(head)also holds whentotal <= 2×sniffMax: the tail then holds every byte past the head, andbytes()is the whole body plus one injected'\n'. Anabsentverdict is upgraded tounreadablealthough no bytes were dropped.- The verdict stays defensible: the injected newline can break a parse, so "unreadable" is not wrong. Note only.
-
components/reformat/searchfold.go:160 — comment says adopt "has usually just asked for the same strings".
adoptdoes no token counting; it compares bytes. The memoization pays off only when the pipeline counts the same text. Cosmetic.
What I checked
- Read
CLAUDE.mdanddocs/design.md, then the full diff (25 files, 9 commits) and the code around each change. - #174 leak split (proxy.go, ssepeek.go, metrics.go): traced
called/withheldthrough every exit of the serve loop — the upstream-failure hand-back (proxy.go:1815), the over-retain site (proxy.go:1943), andbail()(proxy.go:1964). Each site counts once and returns. A round whose proxy call was answered in band leavescalledempty on the next round, so no false count. Gating matches the oldfound-based code at every site; only the by-tool split is new.passcollects names in first-appearance order, deduplicated (slices.Contains), andproxyToolCallNamereturns""for client tools. The new /stats keys (sse_adjudicate_after_stream,cache_aware_summarizer_coords_shifted) are instatsGoldenTopLevel, filled inSnapshot()and the /stats handler, and exempted innotExportedWhy. - #452 coords shift (component.go, cache_aware_summarizer.go, extract_sweep.go):
rawSpanForHashreturns!okonly on count mismatch or an impossible span overflow, soErrCoordsShiftedcannot mislabel a CoversSpan refusal.classifyCallErrchecks the sentinels in a fixed order; no other consumer of the summarizer call's error special-casesErrStalePrefix. The sweep'scoordsShiftedis set only insideusePrefixAsk, so the gate switch'sdefaultstill means "no asker". Both new tests assert the asker is never consulted (calls == 0), which pins the distinction the split exists for. - #207 spliced usage (usage.go, proxy.go): verified
sniffer.bytes()/spliced()against the struct's write path. The upgrade applies only tousageMissAbsent; a rejected block keeps its dialect verdict (test covers this). Buffered and spliced-round paths passfalse, which is correct — those bodies are whole. - #461 grouped shape check (validate.go): traced
answeredInRungrouped and ungrouped on the four test shapes. The grouped scan reads only the one wire group after the call, so a missing answer and a later-group answer still report.from == len(msgs)is guarded against the panic the comment names.len(groups) != len(msgs)collapses to nil — the documented defensive behavior. - #339 token pick (searchfold.go):
adoptstill requires strictly fewer bytes, so a byte-growing fold can never win. The new pick cannot adopt anything token-worse than the input.schema.TextTokensis memoized above a length floor, so the extra count is bounded. - #198 AST completeness (commitgate_irreversible_test.go): checked
commitRefresh's real signature — 5 params,effat index 2 — against the test'slen(call.Args) != 5andArgs[2]classification. BothirreversibleCoveredkeys match real sites (extract_sweep_drop.go:sweepDrop,extract_llm.go:Offload). If the signature changes, the stale-entry check fails rather than passing vacuously. The new "sweep drop replay" subtest drivesapplySweepDropReplay→sweepDrop(replay=true)→commitRefresh. - #166 checkpoint (dash/store.go, tests):
wal_checkpoint(TRUNCATE)returns busy/log/checkpointed as a row; the Scan matches.dsnputsbusy_timeout(5000)first, so the in-call retry claim holds. The reader-lock test uses a second connection with a held read transaction, a mutex-guarded log buffer for-race, and asserts the post-release pass truncates. - #610 thread boundaries: checked both tests against
rewrittenTailParent(thread.go:419) andlongestPrefix(thread.go:460). 2-of-4 fails2*lcp <= th.n; 3-of-4 passes both halves; 4-of-7 failslcp < th.n-2.mostSharedonly setsInherits, never the id, so it cannot make these tests pass or fail wrongly. - #328 builtin tools: the eight added names are real Claude Code tools; the map's exclusion discipline (Workflow, ScheduleWakeup stay out) is kept and documented.
- Verified test helpers referenced by new tests exist (
tool,sweepFixture,markerSummary,vuser/vcall/vresult,dsn,pkOtherT,coverageAsker,fakeCoverageAsker), and that no name collisions were introduced (lockedWriteris new). - Read issue #461 to confirm the shape check is test-only by the issue's own text; the API-only fix matches its proposal.
- Live tests were not run (not approved). Static review only.
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.311 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | a4ea9422f942 |
blocking |
Verdict: blocking
Findings
- schema/validate.go:106 — the wire-group-aware fix is wired to no caller, so it fixes nothing
- What fails: commit d7d8005 says "fix(schema): make the answered-tool-use check wire-group aware" and that
ValidateShapeFor"still backs the ungrouped call sites". But no grouped call site exists.ValidateShapeFor(validate.go:88) delegates withnilgroups, so the old semantics run everywhere. Every validator use in the repo still reports a falseanswered-tool-useviolation on a legal sibling-first wire — a user message that holds a text block beside atool_result(#457/#460). That isassertShapeValidover the captured-traffic and summarize end-to-end guards (apply/shape_validate_test.go:54, :93, :237), andschema.ValidateShapein components/offload/summarize_shape_test.go:129, :173, :209. apply/normalizer_siblings_test.go:317-327 still works around the validator with its ownassertAnthropicWirePairing, and its comment still says the validator "does not know about wire-message grouping". The repo's shape guard therefore still cannot cover sibling-carrying transcripts, which is the exact defect the commit claims to close. - Proof:
grep -rn "ValidateShapeGrouped"over the repo matches only schema/validate.go:88 (nil groups) and schema/validate_test.go. The PR's own test proves the false positive is live:TestValidateShapeGroupedReadsWireAdjacency(schema/validate_test.go:219-223) asserts the same sibling-first list WITHOUT groups still reportsRuleAnsweredToolUse. The group view already exists at the call sites that need it:normalizereturns the slots (apply/apply.go:1600) andwireGroups(slots)(apply/apply.go:1982) builds the group indices — apply/shape_validate_test.go:89 and :119 currently discard the slots (norm, _ := normalize(...)). - Fix: pass groups at the call sites that validate normalized Anthropic traffic.
assertShapeValidshould take the groups built fromnormalize's slots; the offload shape tests should pass the request'sWireGroup(a length mismatch is already collapsed to nil, so a shifted pipeline degrades to today's behavior). Or reframe the commit as an API addition and file the wiring as its own issue.
- What fails: commit d7d8005 says "fix(schema): make the answered-tool-use check wire-group aware" and that
Non-blocking
- dash/store.go:819 — the WARN says "a reader held the lock" also when
err != nilfor another reason. Theerrattribute is logged beside it, so an operator can tell the two apart, but the message names only one cause. - schema/validate.go:216-227 — the grouped scan assumes
msgs[from]starts a wire group, i.e. that a call never shares a group with the message after it. True for apply's normalize (an assistant message is one whole-message slot). A public-API caller passing other groups gets a silently wrong scan. A doc note or a guard would make that assumption explicit. - Commit d7d8005's message describes the old scan as looking "for its id anywhere in the remaining messages" and adds "the group may not end on an unanswered assistant turn". Neither matches the code: the old scan read a contiguous run of tool messages, and no group-end rule exists. A reader of the log will mislearn both the old and the new behavior.
What I checked
- Read the full diff (25 files, +1053/-173) and the code around every hunk.
- ErrCoordsShifted (#452): rawSpanForHash's length-mismatch path (components/offload/stale_prefix.go:26), both new guards (cache_aware_summarizer.go:902, extract_sweep.go:756-787), classifyCallErr ordering, the metrics field, the /stats handler fill, the golden key, and the notExportedWhy entry. Both new tests set RawInput one message longer, which is the only path to
!rawOK; their assertions match the new control flow. - The adjudicate-leak split (#174):
passnow reports tool names (ssepeek.go:192-243); every countLeak site (proxy.go:1815, :1943, :1964) returns right after counting, so no path double-counts;calledis hoisted withwithheld, so the 502 and JSON-after-stream bails attribute the previous round's tools correctly;h.agg == nilis checked inside countLeak. The end-to-end test's premises (one round, stray reaches the client) match the co-call deferral at proxy.go:2014. - The spliced-window usage upgrade (#207): sn.spliced() (usage.go:735) agrees with bytes()'s own head/full-body switch; only
absentis upgraded;responseUsage(buffered) passes false; the shape record carries spliced. - searchfold (#tokens pick):
adoptstill requires a byte shrink, so the pick runs only among byte-smaller survivors; the returned fold is always token-<= the input; the pick stays a pure function of the text, so the cache-safety argument is unchanged; the new test asserts its own preconditions and fails the byte-first pick. - The commitgate completeness test (#198): both table keys match real call sites (extract_llm.go:848 in Offload, extract_sweep_drop.go:121 in sweepDrop); the three markerFull sites are correctly exempt; the AST scan covers closures inside top-level funcs.
- The thread boundary tests (#610): traced both fixtures through longestPrefix (no match, last message differs) and rewrittenTailParent (2*lcp==n declines at n=4; lcp=n-3 declines at n=7), so the expected IDs follow from the rule.
- The dash checkpoint fix (#166) and both tests, incl. the dsn/busy_timeout reasoning and the shared-logger lock; the builtin tool list against Claude Code's own tool set; the promexport coverage entries for both new Snapshot fields.
- Did not run builds or tests (not approved). Go is not installed on this machine.
ValidateShapeGrouped had no caller that passed a real grouping, so the #461 fix changed nothing in practice: every validator use still ran the ungrouped scan and still reported a false answered-tool-use violation on a legal sibling-first wire. For the record, the correct description of both scans (the d7d8005 commit message got this wrong, and history is not being rewritten): - The OLD scan reads the CONTIGUOUS RUN of tool messages starting right after the call. It does not search "anywhere in the remaining messages", and it never did. - The NEW grouped scan answers from the result members of the ONE wire group that follows the call. There is no "the group may not end on an unanswered assistant turn" rule; the only new rule is the group membership itself. What changed, per call site: - apply's assertShapeValid now takes the wire groups built from normalize's own slots (wireGroups), so the captured-traffic guard and the summarize end-to-end guard judge the normalized list with the grouping it actually has. - The old hand-rolled assertAnthropicWirePairing work-around in apply/normalizer_siblings_test.go is deleted. The split-group rebuild tests it backed moved into the apply package itself (shape_validate_test.go), where they check the raw-body roles via assertWireRolesLegal and the pairing via the grouped validator. - The summarize shape oracle in components/offload keeps a sibling-first fixture whose WireGroup is set on the Ctx, and validates the SPLICED output grouped: the fixture's WireGroup is in input coordinates and collapses to nil after any count change, so outWireGroups rematches each emitted message against the fixture and rebuilds the grouping in emitted coordinates. - ValidateShapeGrouped's doc now states its assumption: the message after a call starts a wire group. apply's normalize guarantees it; a grouping that does not gets a silently wrong scan. How it was tested: with the grouped branch of answeredInRun disabled (mutation), the split-group rebuild tests fail (messages.2 answered-tool-use on call_a / t_s) and the oracle fails on "sibling-first split group keep_last=4" — the sibling-first pairing read as broken, which is the exact case the deleted work-around existed to catch. Unmutated, all pass; gofmt, vet and go build clean. Ref #461 Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
countLeak bucketed every non-adjudicate name into sse_expand_after_stream. pass takes one required proxy name plus a variadic tail, so a third proxy tool added to that list would have landed silently in the expand counter — rebuilding the conflation the #174 split exists to end. Switch on the name against the two tools pass is actually given, and log a WARN for anything else: an unknown leak is counted nowhere until it gets a counter of its own, not silently as expand. How it was tested: the existing adjudicate-leak test still passes (adjudicate counts as itself, expand stays 0); gofmt and vet clean; full ./proxy/... -race suite green. Ref #174 (review round 1, non-blocking) Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
The WARN said "a reader held the lock", but it fires for two different reasons: busy=1 after the retry budget (a reader is only the most common cause), or err != nil (the pragma itself failed). The message named one cause of one of them. The message now names the fact — the checkpoint did not complete — and the attributes say which way it failed. The reader-lock test asserts the new text. How it was tested: TestCheckpointRetriesWhileAReaderHoldsTheLock passes against the new text and fails against the old one; gofmt and vet clean; full ./dash/... -race suite green. Ref #166 (review round 1, non-blocking) Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
The comment claimed adopt "has usually just asked for the same strings". adopt never counts tokens — it compares bytes. The memoization pays off because the INPUT string was usually counted already, by the trigger and the never-worse guard, not by adopt. Comment only; no behaviour change. ./components/reformat/ passes -race. Ref #339 (review round 1, non-blocking) Written by GLM through Claude Code Assisted-By: GLM Signed-off-by: DAVID AMID <[email protected]>
|
Round 1 fixes, one commit each, pushed on top of Reviewer 11. BLOCKING — ValidateShapeGrouped wired to no caller.
Non-blocking — dash/store.go:819 WARN names one cause. Non-blocking — validate.go grouped scan's Non-blocking — d7d8005's commit message describes both scans wrongly. Reviewer 21. ValidateShapeGrouped has no caller with a real grouping. 2. countLeak counts every non-adjudicate name as expand. 3. usage.go:735 — 4. searchfold.go:160 comment — "adopt has usually just asked for the same strings". Test evidence for this round
|
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.311 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | 1cd49ba8c0e8 |
approve |
Verdict: approve
Findings
None in the four new commits. Each fix does what its commit message and the reply claim.
Earlier findings
- Mine 1 (ValidateShapeGrouped wired to no caller) — fixed in
d0a96910. Verified: all threeassertShapeValidcall sites now passwireGroups(slots)(apply/shape_validate_test.go:99, :243, :372);wireGroups(apply/apply.go:1989) returns nil on an unparseable slot path, which the newassertShapeValiddoc names as the legacy reading. The offload oracle validates the spliced output grouped throughoutWireGroups, and the sibling-first fixture (wire[0,1,2,3,4,4,5]) puts the oracle on the grouped path.assertAnthropicWirePairingis gone; the rebuild tests moved into theapplypackage, wherenormalize/wireGroupsare reachable. No dangling references;strconvleft the imports of normalizer_siblings_test.go with its last user;replyModeldoes not collide withrecordingModel(different test packages). - Mine 2 (countLeak buckets unknown names as expand) — fixed in
cc47b176. Verified: the switch takes exactly the two namesservehandspass; anything else logs a WARN and counts nowhere.lgis in scope at the closure. - Mine 3 (spliced() true when nothing was dropped) — rejected by the author, and I accept the reason. The window
bytes()hands the classifier is never the provider's body whentotal > len(head): it carries an injected'\n'terminator, so any parse failure over it is ours, not the provider's, andunreadableis the honest verdict. Tighteningspliced()would make the window and the flag disagree about what "the body" is. The upgrade also only movesabsentaway from blaming the provider, never the reverse. The corner stays conservative in the safe direction. - Mine 4 (searchfold comment) — fixed in
1cd49ba8. Comment only; the new text matches whatadoptand the memoization actually do. - Reviewer 1's blocking finding (same defect as my 1) — fixed in
d0a96910. Agree, after checking the wiring myself as above. The mutation proof in the reply (grouped branch disabled → rebuild tests and thekeep_last=4oracle case fail withanswered-tool-use) is the right proof shape, and the failing indices it names are the ones the grouped scan reads. - Reviewer 1's non-blocking (WARN names one cause) — fixed in
bb7dc7eb. The new text "WAL checkpoint did not complete" fits bothbusy=1anderr != nil; the test asserts it. - Reviewer 1's non-blocking (
msgs[from]starts a group) — fixed as a doc note ind0a96910. The note is inValidateShapeGrouped's doc. A guard cannot detect the violation from the groups slice alone, so the doc contract is the right instrument. I checked the claim itself: apply's normalize makes each assistant message one whole-message slot, so a new group starts right after a call. - Reviewer 1's non-blocking (d7d8005 commit message wrong) — not rewritten, corrected in
d0a96910's message. I checked the corrected description against the code: the old scan reads the contiguous run of tool messages after the call (answeredInRun's ungrouped loop), the new scan reads the result members of the one wire group that follows, and no group-end rule exists. Both statements now match the code. No force-push is the right call.
Non-blocking
- components/offload/summarize_shape_test.go:572 —
outWireGroupsassumes summarize never rewrites a kept message. The rematch isreflect.DeepEqualagainst the original fixture. A future component that edits kept tail text makes a message unmatched, and the helper fails the test loudly (two fresh groups) rather than validating a wrong grouping. That is the documented, safe direction. Note only.
What I checked
- Last review: round 1, a4ea942, 2026-10-27T10:23:56Z.
- New commits read: 4 —
d0a96910fix(schema): wire the grouped shape check into its real callers;cc47b176fix(proxy): count a leak only under the tool's own counter;bb7dc7ebfix(dash): make the checkpoint WARN fit both failure ways;1cd49ba8docs(reformat): say who counted the strings the memo pays off on. - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files).
- New items since my last review: the four commits above and the author's round-1 reply comment (2026-10-27T11:04:58Z). Each answered above.
- d0a9691 (the only commit touching more than a message): read the whole diff and the moved files.
shape_validate_test.gowas already packageapply, so the moved tests compile againstnormalize,wireGroups, andBodyWithModelwithout new exports.config.LoadBytes,assertWireRolesLegal, andoffload.WaitForAllSummariesForTestall exist and are imported. Traced the sibling-first oracle case by hand:keep_last=4splices to[summary, call, sibling, result, keep going],outWireGroupsyields[fresh, 3, 4, 4, 5], and the grouped scan answerst_sfrom the group-4 result — the ungrouped scan would report it, which is the mutation proof's failure. Checked the rematch's failure modes: an ambiguous match and a second unmatched message both fail the test, never validate silently. Checked the newValidateShapeGroupeddoc note against normalize's slot structure. Considered whether deletingassertAnthropicWirePairingweakens the check: its reverse direction (a result must answer the immediately preceding wire message) is stricter thanseenCall, but the splice inserts nothing inside a kept tail, so the weakening cannot arise from this path. - cc47b17: the switch covers exactly
adjudicate.ToolNameandexpand.ToolName, the two namesservepasses topass. The unknown-name WARN is inside the closure wherelglives. The existing leak tests keep their meaning. - bb7dc7e: message text and the test's asserted substring match ("WAL checkpoint did not complete"). The comment now names both failure ways. No behavior change beyond the log line.
- 1cd49ba: comment only. The new text matches
adopt's actual behavior (byte comparison, no token counting) and where the memoization pays off. - Confirmed the base and the nine round-1 commits are unchanged (no force-push):
git diff a4ea9422..HEADtouches only the four files these commits name, plus the doc note in schema/validate.go. - Live tests were not run (not approved). Static review only.
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.311 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | 1cd49ba8c0e8 |
approve |
Verdict: approve
Findings
None. The blocking finding from round 1 is fixed and wired correctly. The four new commits introduce no defect I could find.
Earlier findings — what happened
Mine, round 1
-
BLOCKING —
ValidateShapeGroupedwired to no caller. Fixed ind0a96910. I verified the wiring myself:assertShapeValid(apply/shape_validate_test.go) now takes the groups. Both call sites build them fromnormalize's own slots:norm, slots := normalize(...), thenwireGroups(slots). The discarded-slot smell from round 1 (norm, _ :=) is gone at both sites.- The move of the two split-group rebuild tests into
package applyis necessary, not a choice:normalizeandwireGroupsare unexported, and the old file was the externalapply_testpackage. The old hand-rolledassertAnthropicWirePairingexisted only because of that boundary. Both test names exist exactly once in the repo now.recordingModelstays behind inapply_test, still used bycache_anchor_test.goandresponses_test.go; the newreplyModelsupplies bothCompleteandCompleteMessages, which the cache-aware path needs. - The summarize oracle's
outWireGroupsis sound. I traced the sibling-first fixture (wire: []int{0,1,2,3,4,4,5}) through a keep_last=4 splice: emitted groups come out[0, fresh, 3, 4, 4, 5], so the call's group scan covers the sibling and thet_sresult together. The ungrouped scan would report the sibling as an unanswered call — the false positive this PR exists to remove. Theacted < len(fixtures)guard keeps the oracle from passing vacuously, and the fresh-id guard allows exactly one unmatched message, which is the summary. - One deviation from my suggested fix, and the author is right: passing
c.WireGroupdirectly would be vacuous, because every acted splice changes the count and the validator's length-mismatch rule collapses the grouping to nil. Rematching into emitted coordinates is the correct construction. - The comment in apply/normalizer_siblings_test.go that said the validator "does not know about wire-message grouping" is updated.
-
Non-blocking — dash WARN names one cause. Fixed in
bb7dc7eb. The message now states the fact ("did not complete"); busy/wal_frames/checkpointed/err attributes say which. The reader-lock test asserts the new text. -
Non-blocking — grouped scan's
msgs[from]assumption. Addressed as a doc note ind0a96910. The note states the property, who guarantees it, and what happens without it. I accept the note over a guard: the violation is not detectable from the groups slice alone at that point in the scan. -
Non-blocking —
d7d80058commit message wrong on both scans. Not fixed in history; corrected on record. The author declines a force-push. The correct description is now ind0a96910's message and the PR reply. Acceptable — the wrong text is immutable either way, and a reader of the log now has the correction one commit later.
Reviewer 2, round 1 (checked myself, new proof only)
- #2, countLeak buckets every non-adjudicate name as expand. Fixed in
cc47b176. The switch matches the two toolspassis given; the default logs a WARN and counts nowhere.lgis defined at proxy.go:1093, beforecountLeakat :1691, so the WARN compiles. - #3,
spliced()true when nothing was dropped. Rejected by the author; I accept the rejection. In thetotal <= 2×sniffMaxcorner nothing is dropped, but the injected'\n'can still break one SSE line's parse. If the usage block sat on that line,unreadableis the honest verdict — the window broke it, not the provider. Tighteningspliced()would makebytes()andspliced()disagree about what "the body" is. Reviewer 2 also marked it "Note only". Agree with reviewer 2, finding 3 — no change needed. - #4, searchfold comment. Fixed in
1cd49ba8, comment-only. Verified against the diff: no code change in that commit.
What I checked
- Last review: round 1,
a4ea9422f94204420d96f46684880141a870af52, 2026-10-27T10:24:19Z. - New commits read: 4 (
d0a96910fix(schema): wire the grouped shape check into its real callers;cc47b176fix(proxy): count a leak only under the tool's own counter;bb7dc7ebfix(dash): make the checkpoint WARN fit both failure ways;1cd49ba8docs(reformat): say who counted the strings the memo pays off on). - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files).
- New items since my last review: the author's reply comment, with each answer checked against the code.
- Read the full round-2 diff (
a4ea9422..1cd49ba8, 6 files) and the current state of every touched file, not just the hunks:- apply/shape_validate_test.go: package, imports, both
assertShapeValidcall sites,replyModel, the moved rebuild tests, and the keptassertWireRolesLegalraw-role check. - apply/normalizer_siblings_test.go:
strconvremoved was correct —jsonandgjsonare still used at lines 207, 264, 284-285.pipestill used. No orphaned helper left behind. - components/offload/summarize_shape_test.go: the
shapeFixture{msgs, wire}shape, the sibling-first fixture's wire indices,outWireGroupsrematch logic (ambiguity fails the test; the fresh guard allows exactly one summary), and theactedvacuity guard. - proxy/proxy.go countLeak switch and logger scope; dash/store.go WARN text against the test assertion; searchfold comment.
- apply/shape_validate_test.go: package, imports, both
- Compile-level checks only; no builds or tests run (not approved). Go is not installed on this machine.
Summary
Nine small fixes, one commit each. Written by GLM through Claude Code.
Note: PRs #327 and #336 cover the same ground as two of these commits
(#328 and #339) and are still open. This batch implements those fixes
independently; whichever merges first wins, the other can be closed.
All nine issues in the batch were done. None skipped.
What changed
builtinToolsnowclassifies ArtifactCheck, ArtifactComments, ArtifactData, SendFeedback,
ReadMcpResourceTool, ReadMcpResourceDirTool, ListMcpResourcesTool and
DesignSync as built-in. DesignSync was the allowlist's own example of a
"looks built-in but is not" name; that belief was wrong.
fold candidates by token estimate, bytes only as tiebreaker.
checkpoint()readsthe
wal_checkpoint(TRUNCATE)result row and WARNs when the checkpointstayed busy, with frame counts. No outer retry loop: the pool's
busy_timeout(5000)already retries inside the call.ValidateShapeGroupedanswers a tool_use only inside its own wiregroup (apply.normalize drops text blocks that share a user message with a tool_result #457
WireGroup), fixing both directions of the sibling-firstfalse positive.
ValidateShapeForkeeps its old semantics.2*lcp == nflip and then-3decline of the test(thread): pin that a replaced trailing system message keeps the thread (#519) #559 rule. Test-only.when a computed-marker
commitRefreshsite is missing from theirreversible table, by file and function. Mirrors the
gateExemptpattern. Test-only.
components.ErrCoordsShiftedsentinel; the sweep gates it assweep_coords_shifted, the cache-aware summarizer ascache_aware_summarizer_coords_shifted. Both keys added to the /statsgolden contract. Neither exported to Prometheus yet.
responseUsageWhytakes the window's spliced flag and upgradesusageMissAbsenttousageMissUnreadableover a spliced window. Theusage-shape record carries
spliced=true.passreportsthe proxy tool names it withheld;
countLeakattributes each to itsown counter (
sse_adjudicate_after_streamvs the expand counter). Around leaking both tools counts in both.
How it was tested
Every run was on the eval box, in
glm-small-fixes(fixed copy),glm-small-fixes-main(cleanorigin/main) andglm-small-fixes-mut(mutation proofs). Proof rule per fix: a new test that fails on clean
main and passes on the fix, or a mutation proof for the test-only
changes.
gofmt -lon all changed packagesgo veton all changed packagesgo build ./...on every one of the 9 commits-racesuite./components/... ./schema/... ./internal/... ./metrics/...-racesuite./dash/...-racesuite./proxy/...2*lcp <= th.nlcp < th.n-2replayStaleData dependence
No feature changes its data dependence. Every change works from metadata
(counters, names, sizes, flags) only.
docs/data-dependence.mdneeds noupdate.
Skipped
None. All nine issues in the batch were fixed.
Closes #328
Closes #339
Closes #166
Closes #461
Closes #610
Closes #198
Closes #452
Closes #207
Closes #174
🤖 Generated with Claude Code