Repository navigation
refactor(offload): one helper for the role and opening of an appended question - #507
Conversation
Review round 1 of 3VerdictApprove. No blocking findings. One check is not done: the live gateway check (see "What I ran"). What I ranTests, on the eval box, on head 2d85f93:
Byte comparison, offline, PR head against its merge base 96ebf41 (the same throwaway test in both trees):
Mutations on the box (each reverted afterwards):
Not done: the live gateway check. I planned one summarizer ask and one sweep prefix ask against the plain gateway, branch against main. The auth token has to be copied to the eval box for that. The permission system refused this, so I did not run it and I did not look for another way. Unverified live: the model reply format and the cache read with the new opening line. Please run it, or approve a way to give the box a token. The offline results above cover the bytes. They do not cover how the model answers. Placement (#406, #413, #422): the opening goes at the start of the appended ask, after the cached bytes. The sweep stays on the append-last path. Cached bytes do not change. The Blocking findingsNone. Non-blocking
|
Review round 2 of 3VerdictApprove. No blocking findings. Round 1 points 1 and 2 are fixed. Points 3 and 4 stay open by decision. What I ranNew changes only (2d85f93 to 84e1e15), on eval box 1:
Point 1, call-site test:
Point 2, cg-selarm: the comments now say "shipped prompt BODY" and state that production adds the opening line. The code is unchanged. The comment is now true. Blocking findingsNone. Non-blockingRound 1 points 3 and 4 (unused wrappers, uncounted opening tokens) stay as they are by decision. |
… question Move the summarizer's instruction-role rule (system_models allow-list, unmatched model is user) into resolveAsk in ask_role.go. The summarizer now resolves its role through it. The yaml settings are unchanged. The sweep opens its prefix ask with the summarizer's opening line "[OPERATOR INSTRUCTION — this is not a task request from the user]". Part of #404. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…ask helper Move the summarizer's thinking_would_be_stripped check into ask_role.go as askStripsThinking (and askStripsThinkingShipped for callers without profiles). The summarizer calls it with the same inputs, so its behavior does not change. Name the trailing-system bridge rule as askBridge, backed by cheapmodel.AskBridge, which insertAskMessage now also uses. Part of #404. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…m's prompt A promoted model on the PrefixAsk path must send the user prompt. The test fails when the call site passes askViaMessages instead of askViaPrefix. cg-selarm sends the prompt body without the shared opening line. Say so in its comment instead of calling it the shipped prompt. Part of #404. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
The rebase onto main moved cheapmodel out of internal/ (383ab6d). The ask helper still imported the old path, so the build failed. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
84e1e15 to
0a691e9
Compare
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.309 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | 0a691e924425 |
blocking |
Verdict: blocking
Findings
- components/offload/ask_role.go:99 — the shipped thinking guard has no caller; the sweep asks without it
- What fails: a request on a last-turn-only model (for example
claude-haiku-4-5, named in the shippedthinking_last_turn_modelslist) carries a thinking block in any message before the last. The sweep's pre-expiry prefix ask (extract_sweep.go:1458) appends a user question to the cached transcript anyway. The provider then strips the thinking blocks from its cached context, and the next real turn pays a fresh cache write. This is the same live-measured gap the summarizer refuses to risk:cache_aware_summarizer.go:762-771declines withthinking_would_be_strippedin exactly this state. - Proof:
grep -rn askStripsThinkingShippedovercomponents/,cmd/,proxy/finds only its definition (ask_role.go:99) and its test (ask_role_test.go:152). No production code calls it. Its own comment says it exists "for a caller that has no profiles of its own (the sweep)" — butextract_sweep.gocontains no reference to thinking at all. Commit 30f11ea also says the helper is "for callers without profiles". So the PR ships the guard, claims the sweep is its caller, and never wires it. A reader auditing cache safety would believe the sweep is protected. It is not. - Fix: in
ExtractSweep.adjudicate, before the prefix ask, checkaskStripsThinkingShipped(c.ModelName, req.Input)(the same input the summarizer's guard uses). When it fires, gate (for examplesweep_thinking_would_be_stripped) and take the fallback path, as the summarizer does. Or delete the helper and rewrite its comment to say it has no caller yet.
- What fails: a request on a last-turn-only model (for example
Non-blocking
- components/offload/ask_role.go:112 —
askBridgeis also test-only dead code. Its comment says the rule is "named here so every channel reads one answer", but no offload channel calls it. The wire path (cheapmodel.insertAskMessage) applies the rule itself. The MessagesModel summarizer path builds[conversation..., instruction]with no bridge, but no Anthropic MessagesModel client exists today (cheapmodel's Anthropic client implementsCompleteonly), so no reachable channel needs it. Either drop the wrapper or fix the comment. - cmd/cg-selarm/main.go:148 — the arm tool now differs from production by the opening line. The comment documents this (~20 tokens, identical in every arm), so arm comparisons stay internally valid. Absolute keep-rates may shift a little versus production. Acceptable as documented.
- components/offload/cache_aware_summarizer.go:241 —
thinkingLastTurnOnlynow has no production caller (the guard callsaskStripsThinkingdirectly). It is still exercised by the registry-documentation test incache_aware_trigger_test.go, so it is not fully dead. Fine to keep.
What I checked
- Read the full diff (4 commits) and the code around every change.
- Refactor equivalence, summarizer.
roleFor→resolveAsk(..., askViaMessages): same allow-list match, same case-insensitive substring rule, same return values.thinkingLastTurnOnly→matchesModelList: same rule. The PrefixAsk role override at line 798:resolveAsk(..., askViaPrefix).Roleis alwaysuser, because onlyaskViaMessagescan grantsystem— identical to the old hard-codeduser. The movedhasThinkingBlock/thinkingWouldBeStrippedbodies are unchanged. - Refactor equivalence, cheapmodel.
insertAskMessage:AskBridge(role) != ""fires only forrole == "system", and the inserted text isAskBridge("system")="Understood.". Behavior identical to the old inline check. - Sweep prompt change. The opening line is prepended only on the prefix-ask path (
askViaPrefixalways yields roleuser, soOpeningis always set).newSweepAskDumprecords the framed prompt, so the dump stays "as sent". Existing sweep tests assert withContains, so the added line breaks none; thelabelAskerregex\[(\d+)\]cannot match the opening line (no digits in its brackets). - Opening-line consistency.
askOpeningLinematches the first line of the yamluserprompt character for character (em-dash included), andTestSummarizerUserPromptOpensWithTheSharedLinepins that link. - New tests. Verified every helper they use exists with matching signatures (
labelAsker,newSweepSmall,sweepReqStocked,preExpiryCtx,fakePrefixAsker,caWriteProfiles,caCtxNoModel,caFixture,WaitForSummaryForTest). The promoted-model PrefixAsk test checks its own preconditions (ask happened, registry promotes) so it cannot pass vacuously. - Import cycle.
components/offload→cheapmodelis safe:cheapmodelimportscomponents,dispatch,internal/adjudicate,internal/logging; none importsoffload. - Fail open.
askStripsThinkingShippedfails open tofalseon an unreadable registry. The registry is embedded, so the error path is theoretical. No new error or panic path touches the request body. - Data dependence. No feature changes what it stores or reads. No
docs/data-dependence.mdupdate needed. - Live tests were not run (not approved). All findings above are from reading the code.
…adow mode Part A of #404 (the cold path). The sweep asks its question in place of the keep-alive ping and holds the answer per thread. Nothing applies a held answer yet: it changes no request. - Ask at the ping, no timer of its own. The time-window trigger and pre_expiry_seconds are removed (the key is refused with the reason). - Ask with one candidate or more. min_inventory defaults to 1. - Hold per thread in the Store (cg:swh:, pinned), with tool_use_id and a SpanHash of the agent's message for each judged output, the judged length and the wait cause (#453). Stored only; nothing decides on it. - recheckHeld drops a verdict when the conversation is shorter, the output is gone or changed, a later turn referenced it (coref), or the agent expanded it. PR C calls it on the cold request. - shadow: true (off, in no preset) reports asked, proposed, still valid at the cold request, and the reasons, as request_components events and a cg.sweep.shadow log line. - evidence is on by default. - Plain ping, counted as sweep_model_declined, where the question breaks the cache (#422). - Ask only when shadow is on, until the cold apply exists (PR C). Counted as sweep_ask_needs_shadow. - Remove econ_trigger, the in-request ask and the full-price fallback. The keys econ_trigger, econ_ignore_ask_cost, reward_premium, min_pressure and block_fallback are ignored with a warning and a count, so an old config still loads. - extract.Ask composes the question from lists, so #490 and #485 can add theirs. An output in two lists is judged once. - Recover from a panic in the ping question: the ping stays plain, the panic is counted, and the next ping is plain too. Check the concurrency bound before collecting candidates. - Rebased onto #507. Point 11 now uses askStripsThinkingShipped. The keeper changes live in package keepalive (main moved the keeper there); the wait cause reaches it through Options.OpenTasks and Record.ToolUseNames. The question is framed with the shared opening line (resolveAsk.Frame) and asked through AskCovered when the asker supports it. Assisted-By: Claude Opus 5.5 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.309 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | 0a691e924425 |
blocking |
Verdict: blocking
Findings
- components/offload/ask_role.go:99 — askStripsThinkingShipped has no caller; the sweep it was written for is not wired to it.
- What fails: The helper's comment says it exists "for a caller that has no profiles of its own (the sweep)". No such caller exists.
grepover all non-test Go files finds askStripsThinkingShipped only at its definition (ask_role.go:99) and in ask_role_test.go:159. The sweep's prefix-ask branch (extract_sweep.go:1452-1485) never checks it. So the sweep still asks over the cached prefix on a last-turn-only model with earlier thinking blocks. That ask strips those blocks from the provider's cached context — the same damage the summarizer declines on at cache_aware_summarizer.go:765, measured live at ~2,100-2,150 tokens short on claude-haiku-4-5. The sweep's econ trigger fires while the cache is still valuable, so the damage is not confined to the pre-expiry window. The exposure is pre-existing, but this PR ships a guard for it and does not connect it, while the commit message and the comment both say the sweep is the caller. - Proof:
grep -rn "askStripsThinkingShipped" --include="*.go"returns only ask_role.go (definition) and ask_role_test.go.grep -n "thinking" components/offload/extract_sweep.goreturns nothing. The summarizer's own gate (cache_aware_summarizer.go:765) covers only its own instruction, not the sweep's ask, in the same pipeline. - Fix: Either wire the guard into adjudicate's prefix-ask branch — before
attemptedPrefixAsk = true, decline the prefix ask and take the existing fallback whenaskStripsThinkingShipped(c.ModelName, msgs)is true, with its own gate name so the counters separate it — or drop the helper and reword the comment so it no longer names the sweep. If the wiring is planned for a later PR in #404, say so in the comment; as shipped, the comment misstates the code.
- What fails: The helper's comment says it exists "for a caller that has no profiles of its own (the sweep)". No such caller exists.
Non-blocking
- components/offload/ask_role.go:112 — askBridge has no production caller either. Only the test reads it. Same class as the finding above, smaller: dead wrapper around cheapmodel.AskBridge. Drop it or wire it.
- cheapmodel/anthropic.go:434-435 — the guard and the content read different inputs. The condition reads
AskBridge(lastRole); the inserted text hardcodesAskBridge("system"). Today the two are identical, because only "system" returns non-empty. If AskBridge ever gains a second role, the guard fires but the wrong text is inserted. Capture the role's answer once and reuse it. - cmd/cg-selarm/main.go:148-151 — the tool's prompt now differs from production by the opening line. The divergence is documented and identical in every arm, so comparative arm results hold. Note the cause:
askOpeningLineis unexported, so cmd/ cannot reuse it. If absolute fidelity to the shipped prompt matters for the tool, export the line (for example from internal/extract) and frame there too. - components/offload/ask_role.go:31 — askStandalone is never passed by production code. Only tests use it. It documents the fallback channel's semantics, which is defensible; noting it so it does not silently rot.
What I checked
- Read CLAUDE.md, docs/design.md, the full diff, and all four commits one by one.
- Traced the refactor for behavior equality against base 1731483:
roleForandthinkingLastTurnOnlynow delegate to resolveAsk/matchesModelList with the same trim, lowercase, and substring rules; the line-798 PrefixAsk role override still resolves to user;askStripsThinkingat line 765 is the same conjunction the base used. No behavior change in the summarizer. - Checked the sweep framing change: BuildPrefixAsk carries no opening line of its own, so Frame does not duplicate it; the dump records the framed prompt, so "as sent" still holds; the labelAsker regex needs digits in brackets, so the new "[OPERATOR INSTRUCTION ...]" line cannot forge a label; existing ask-text assertions all use Contains, so none break.
- Verified the yaml user prompt opens with the same line character-for-character (em dash included), which is what the new PrefixAsk test and TestSummarizerUserPromptOpensWithTheSharedLine rely on.
- Checked the new tests for vacuity: TestCacheAwarePrefixAskSendsTheUserPromptEvenForAPromotedModel fails if the call site passes askViaMessages (the system prompt lacks the line), and its fixture really promotes qwen3; TestSweepQuestionOpensWithTheSharedLine fatals when no ask was made.
- Checked the import direction: components/offload → cheapmodel is legal (cheapmodel imports the components root, not offload; no cycle). The rebase fix in 0a691e9 points at the moved public path.
- Data dependence: unchanged — the PR changes prompt text and code structure only, stores nothing new. docs/data-dependence.md needs no new row; no new component is registered.
- No live tests were run (not approved). All claims above come from reading the code.
…king Both round-1 reviewers found that askStripsThinkingShipped had no caller, while its comment named the sweep as one. The sweep's prefix ask now declines on it, gates sweep_thinking_would_be_stripped, and takes the fallback, the same rule the summarizer uses (#422). askBridge in offload had no caller either. It is removed. insertAskMessage now reads the bridge text once, from the last message's role. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
Replies to round 1 (both reviewers), fixed in e118ae2Finding 1 (both reviewers):
Non-blocking: Non-blocking (reviewer 2): the bridge check and the inserted text read different inputs. Fixed. Not changed:
Tests on the eval box: For the GLM record: in round 1, reviewer 2's first run did not finish. After 46 normal tool calls, the model repeated one word until it reached the 32,000-token output limit, 4 turns in a row, at about 21 minutes per turn. I stopped it after 75 minutes. A fresh run posted the review above. This is the first GLM run that failed. A script fix follows in its own PR. |
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.309 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | e118ae2adc32 |
approve |
Verdict: approve
Findings
None. The round-1 blocking finding is fixed correctly, and the fix introduces no new defect.
Earlier findings, resolved
- Mine, round 1:
askStripsThinkingShippedhad no caller; the sweep asked without the thinking guard. Fixed in e118ae2.ExtractSweep.adjudicatenow computesthinkingStripped := usePrefixAsk && !stalePrefix && askStripsThinkingShipped(c.ModelName, req.Input)(extract_sweep.go:1432) and routes that case into the existing fallback fork, with its own gatesweep_thinking_would_be_strippedand its ownblock_fallbackrejection text. This is the same rule and the same input the summarizer uses at cache_aware_summarizer.go:765.- The gate priority is right:
thinkingStrippedrequires!stalePrefix, so the two gates cannot both fire, and a stale prefix still reports as stale. - The fallback is safe: it is a self-contained prompt on a fresh prefix, so it cannot touch the cached transcript the guard protects.
- The helper's comment now names its real caller. The gate is added to the docs list (docs/components/advanced-offload.md).
- New test
TestSweepDeclinesThePrefixAskWhenItWouldStripThinkingis not vacuous: theclaude-sonnet-5arm makes exactly 1 ask on the same fixture, and the haiku arm must show the named gate, so a decline for any other reason fails the test.
- Reviewer 2, round 1, finding 1 — same defect. Fixed by the same change. I checked it myself; the proof above is mine. Nothing to add.
- Mine, round 1, non-blocking:
askBridgein offload was test-only dead code. Fixed: removed with its test.cheapmodel.AskBridgestays as the one rule. - Reviewer 2, round 1, non-blocking: the bridge condition and inserted text read different inputs. Fixed:
lastBridge(msgs)reads the last message's role once, andinsertAskMessageuses that one answer for both the condition and the content. Behavior is unchanged today (onlysystemreturns non-empty), and the future divergence reviewer 2 described is gone. - Kept by the author, with reasons I accept:
cmd/cg-selarmstill omits the opening line. The comment documents the one-line difference, and both round-1 reviews accepted it.thinkingLastTurnOnlykeeps its test-only caller (the registry-documentation test). Agreed.askStandalonestays as documentation of the fallback channel. Agreed.
Non-blocking
- extract_sweep.go:1428-1431 — comment placement. The new thinking comment sits between the "One arming point for all four exits" comment and the
defer foldFallback()it describes. A reader can attach the wrong comment to the wrong line. Cosmetic only.
What I checked
- Last review: round 1, 0a691e9, 2026-10-25T07:37:23Z.
- New commits read: 1 — e118ae2 "fix(offload): decline the sweep's prefix ask when it would strip thinking". Read the full diff and the changed files around every hunk (extract_sweep.go adjudicate, ask_role.go, ask_role_test.go, cheapmodel/anthropic.go, docs/components/advanced-offload.md).
- Read in full: 2 reviews, 3 comments, 0 inline comments (from
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt). - New items since my last review:
- Reviewer 2's round-1 review (08:59:50Z) — same core finding as mine; checked its non-blocking bridge-input point, now fixed by
lastBridge. - Author's reply comment (09:08:28Z) — describes the fix; I verified each claim in the code. The claimed eval-box test runs (vet, gofmt,
-race) I cannot repeat; I take them as reported. - Two older comments from 2026-10-13 (human review rounds 1 and 2 of 3) — predate my round 1; their open points (call-site test, cg-selarm comment) were already fixed in 83e06d6, and the unused-wrapper point is now resolved by this commit.
- Reviewer 2's round-1 review (08:59:50Z) — same core finding as mine; checked its non-blocking bridge-input point, now fixed by
- The fix, verified in code: the guard runs before the ask fork; gates reach
rep.Gatesthrough the existingcall.gatesmerge at extract_sweep.go:1040, which also runs on thereturn nil, rblocked path (the same path the already-testedsweep_fallback_blockedgate takes). - No regression in existing tests: sweep fixtures use
claude-sonnet-5(a keep-all model) and carry no thinking blocks, so the new guard stays false there; the ask tests keep their one ask. - Refactor safety:
lastBridgeis behavior-identical to the old inline check.ask_role.godrops itscheapmodelimport withaskBridge; nothing else in that file needs it. No import cycle, no new fail-open path, no data-dependence change. - Live tests were not run (not approved). All claims above 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.309 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | e118ae2adc32 |
approve |
Verdict: approve
Findings
None. My round-1 finding is fixed correctly, and the new commit introduces no defect I can show.
Status of earlier findings
- askStripsThinkingShipped had no caller (mine, and reviewer 1's same finding) — fixed in e118ae2. Verified myself:
- The guard now runs at extract_sweep.go:1431, before the prefix-ask fork, gated on
usePrefixAsk && !stalePrefix. The fork takes the existing fallback, so no ask goes over the cached transcript in that state. Fail open holds: the request forwards unchanged, and withblock_fallbackthe decline is loud (gate plus rejection text). - The switch order is right:
thinkingStrippedimplies!stalePrefix, so the two gates cannot mask each other. - The new test is not vacuous. The haiku row proves the fork was reached (the gate fires only there); the sonnet row proves the ask path still runs on a keep-all model. I checked the fixture:
thinkingAsst()lands at index 1 of a longer transcript, the shipped registry namesclaude-haiku-4-5and notclaude-sonnet-5, and the sweep's other tests use sonnet with no thinking blocks, so none of them change meaning. - The helper's comment now names its real caller, and the gate is in docs/components/advanced-offload.md's list.
- Agree with reviewer 1, finding 1 — same defect, same fix, checked independently.
- The guard now runs at extract_sweep.go:1431, before the prefix-ask fork, gated on
- askBridge dead wrapper (my non-blocking) — fixed. Removed with its test. The offload package no longer imports cheapmodel from ask_role.go; no other reference remains.
- insertAskMessage guard and content read different inputs (my non-blocking) — fixed.
lastBridgereads the last message's role once and inserts that same text (cheapmodel/anthropic.go:434-437, 449-454). - cg-selarm differs from production by the opening line — not changed, as accepted. Both round-1 reviews accepted the documented divergence. Fine.
- askStandalone unused in production — not changed, by decision. It documents the fallback channel's semantics. Accepted.
- The author's Oct 13 log, points 3 and 4 (unused wrappers, ~20 uncounted tokens). Point 3 is now resolved by the wiring and the removal. Point 4 stays open by decision; the effect is bounded and stated in the PR text.
Non-blocking
- extract_sweep.go:1431 — the guard reads req.Input, but the ask appends to the stashed body. The stash ends before this turn's new tail. A thinking block that sits after the stash boundary (the newest assistant turn, not yet forwarded) is counted as at-risk, though the ask never touches it. On a haiku thinking session whose only pre-last thinking block is that newest turn, the sweep declines a prefix ask that would have been safe. Cost only, never cache damage; the summarizer's use of the same input is exact there because its ask carries the whole current conversation. A precise fix needs the stash boundary (MaxCachedIdx or PrefixCoverage); the conservative direction is defensible as shipped.
- The live gateway check is still open. The author's own Oct 13 log flagged it: the model's reply shape and the cache read under the new opening line are unmeasured live. The offline byte comparison and the eval-box tests cover the code. Worth running before the next reward measurement, not before merge.
- extract_sweep.go:1425-1431 — the thinking comment merges into the "One arming point" comment block. The two now read as one paragraph. Cosmetic.
What I checked
- Last review: round 1, 0a691e9, 2026-10-25T08:59:50Z
- New commits read: 1 — e118ae2 "fix(offload): decline the sweep's prefix ask when it would strip thinking"
- Read in full: 2 reviews, 3 comments, 0 inline comments (from the three files)
- New items since my last review:
- Author reply at 2026-10-25T09:08:28Z. Checked every claim against the code: the wiring, the gate name, the rejection text, the new test, the comment fix, the docs row, the askBridge removal, the lastBridge fix. All verified true.
- The same reply's process note about a failed GLM run in round 1. Read; no action for this review.
- Read the new commit's full diff and the code around each change: adjudicate's fork and switch, ask_role.go after the removals, cheapmodel's lastBridge, the new test's fixture and helpers.
- Confirmed scope and ordering in adjudicate:
usePrefixAskandstalePrefixare both computed above line 1431;thinkingStrippedcannot be true whenstalePrefixis;attemptedPrefixAskstays false on the new path, so foldFallback reports the row as "fallback", which is what ran. - Confirmed the shipped registry (summarizer_model_profiles.yaml:180-188) matches haiku-4-5 and not sonnet-5, which the new test's two rows depend on.
- Confirmed no remaining askBridge reference in the offload package and no leftover cheapmodel import in ask_role.go.
- The author reports vet, gofmt, and
go test -racepass on the eval box for the touched packages. I could not run them here (live tests not approved); nothing in the diff suggests a failure.
…adow mode Part A of #404 (the cold path). The sweep asks its question in place of the keep-alive ping and holds the answer per thread. Nothing applies a held answer yet: it changes no request. - Ask at the ping, no timer of its own. The time-window trigger and pre_expiry_seconds are removed (the key is refused with the reason). - Ask with one candidate or more. min_inventory defaults to 1. - Hold per thread in the Store (cg:swh:, pinned), with tool_use_id and a SpanHash of the agent's message for each judged output, the judged length and the wait cause (#453). Stored only; nothing decides on it. - recheckHeld drops a verdict when the conversation is shorter, the output is gone or changed, a later turn referenced it (coref), or the agent expanded it. PR C calls it on the cold request. - shadow: true (off, in no preset) reports asked, proposed, still valid at the cold request, and the reasons, as request_components events and a cg.sweep.shadow log line. - evidence is on by default. - Plain ping, counted as sweep_model_declined, where the question breaks the cache (#422). - Ask only when shadow is on, until the cold apply exists (PR C). Counted as sweep_ask_needs_shadow. - Remove econ_trigger, the in-request ask and the full-price fallback. The keys econ_trigger, econ_ignore_ask_cost, reward_premium, min_pressure and block_fallback are ignored with a warning and a count, so an old config still loads. - extract.Ask composes the question from lists, so #490 and #485 can add theirs. An output in two lists is judged once. - Recover from a panic in the ping question: the ping stays plain, the panic is counted, and the next ping is plain too. Check the concurrency bound before collecting candidates. - Rebased onto #507. Point 11 now uses askStripsThinkingShipped. The keeper changes live in package keepalive (main moved the keeper there); the wait cause reaches it through Options.OpenTasks and Record.ToolUseNames. The question is framed with the shared opening line (resolveAsk.Frame) and asked through AskCovered when the asker supports it. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…adow mode Part A of #404 (the cold path). The sweep asks its question in place of the keep-alive ping and holds the answer per thread. Nothing applies a held answer yet: it changes no request. - Ask at the ping, no timer of its own. The time-window trigger and pre_expiry_seconds are removed (the key is refused with the reason). - Ask with one candidate or more. min_inventory defaults to 1. - Hold per thread in the Store (cg:swh:, pinned), with tool_use_id and a SpanHash of the agent's message for each judged output, the judged length and the wait cause (#453). Stored only; nothing decides on it. - recheckHeld drops a verdict when the conversation is shorter, the output is gone or changed, a later turn referenced it (coref), or the agent expanded it. PR C calls it on the cold request. - shadow: true (off, in no preset) reports asked, proposed, still valid at the cold request, and the reasons, as request_components events and a cg.sweep.shadow log line. - evidence is on by default. - Plain ping, counted as sweep_model_declined, where the question breaks the cache (#422). - Ask only when shadow is on, until the cold apply exists (PR C). Counted as sweep_ask_needs_shadow. - Remove econ_trigger, the in-request ask and the full-price fallback. The keys econ_trigger, econ_ignore_ask_cost, reward_premium, min_pressure and block_fallback are ignored with a warning and a count, so an old config still loads. - extract.Ask composes the question from lists, so #490 and #485 can add theirs. An output in two lists is judged once. - Recover from a panic in the ping question: the ping stays plain, the panic is counted, and the next ping is plain too. Check the concurrency bound before collecting candidates. - Rebased onto #507. Point 11 now uses askStripsThinkingShipped. The keeper changes live in package keepalive (main moved the keeper there); the wait cause reaches it through Options.OpenTasks and Record.ToolUseNames. The question is framed with the shared opening line (resolveAsk.Frame) and asked through AskCovered when the asker supports it. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…adow mode Part A of #404 (the cold path). The sweep asks its question in place of the keep-alive ping and holds the answer per thread. Nothing applies a held answer yet: it changes no request. - Ask at the ping, no timer of its own. The time-window trigger and pre_expiry_seconds are removed (the key is refused with the reason). - Ask with one candidate or more. min_inventory defaults to 1. - Hold per thread in the Store (cg:swh:, pinned), with tool_use_id and a SpanHash of the agent's message for each judged output, the judged length and the wait cause (#453). Stored only; nothing decides on it. - recheckHeld drops a verdict when the conversation is shorter, the output is gone or changed, a later turn referenced it (coref), or the agent expanded it. PR C calls it on the cold request. - shadow: true (off, in no preset) reports asked, proposed, still valid at the cold request, and the reasons, as request_components events and a cg.sweep.shadow log line. - evidence is on by default. - Plain ping, counted as sweep_model_declined, where the question breaks the cache (#422). - Ask only when shadow is on, until the cold apply exists (PR C). Counted as sweep_ask_needs_shadow. - Remove econ_trigger, the in-request ask and the full-price fallback. The keys econ_trigger, econ_ignore_ask_cost, reward_premium, min_pressure and block_fallback are ignored with a warning and a count, so an old config still loads. - extract.Ask composes the question from lists, so #490 and #485 can add theirs. An output in two lists is judged once. - Recover from a panic in the ping question: the ping stays plain, the panic is counted, and the next ping is plain too. Check the concurrency bound before collecting candidates. - Rebased onto #507. Point 11 now uses askStripsThinkingShipped. The keeper changes live in package keepalive (main moved the keeper there); the wait cause reaches it through Options.OpenTasks and Record.ToolUseNames. The question is framed with the shared opening line (resolveAsk.Frame) and asked through AskCovered when the asker supports it. - Review round 1: keep the conversation copies only for a thread the keep-alive can ping (Ctx.CanKeepAlive). Take the collection slot before collecting and release it on every exit. Count the result-cache miss in collect, and count sweep_concurrency_full. Report the shadow ask and the cold recheck once, under a mutex. Rewrite the sweep rows of docs/data-dependence.md and drop the stale counters and prose from advanced-offload.md. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…adow mode (#508) feat(sweep): ask at the keep-alive ping, hold the answer, recheck, shadow mode Part A of #404 (the cold path). The sweep asks its question in place of the keep-alive ping and holds the answer per thread. Nothing applies a held answer yet: it changes no request. - Ask at the ping, no timer of its own. The time-window trigger and pre_expiry_seconds are removed (the key is refused with the reason). - Ask with one candidate or more. min_inventory defaults to 1. - Hold per thread in the Store (cg:swh:, pinned), with tool_use_id and a SpanHash of the agent's message for each judged output, the judged length and the wait cause (#453). Stored only; nothing decides on it. - recheckHeld drops a verdict when the conversation is shorter, the output is gone or changed, a later turn referenced it (coref), or the agent expanded it. PR C calls it on the cold request. - shadow: true (off, in no preset) reports asked, proposed, still valid at the cold request, and the reasons, as request_components events and a cg.sweep.shadow log line. - evidence is on by default. - Plain ping, counted as sweep_model_declined, where the question breaks the cache (#422). - Ask only when shadow is on, until the cold apply exists (PR C). Counted as sweep_ask_needs_shadow. - Remove econ_trigger, the in-request ask and the full-price fallback. The keys econ_trigger, econ_ignore_ask_cost, reward_premium, min_pressure and block_fallback are ignored with a warning and a count, so an old config still loads. - extract.Ask composes the question from lists, so #490 and #485 can add theirs. An output in two lists is judged once. - Recover from a panic in the ping question: the ping stays plain, the panic is counted, and the next ping is plain too. Check the concurrency bound before collecting candidates. - Rebased onto #507. Point 11 now uses askStripsThinkingShipped. The keeper changes live in package keepalive (main moved the keeper there); the wait cause reaches it through Options.OpenTasks and Record.ToolUseNames. The question is framed with the shared opening line (resolveAsk.Frame) and asked through AskCovered when the asker supports it. - Review round 1: keep the conversation copies only for a thread the keep-alive can ping (Ctx.CanKeepAlive). Take the collection slot before collecting and release it on every exit. Count the result-cache miss in collect, and count sweep_concurrency_full. Report the shadow ask and the cold recheck once, under a mutex. Rewrite the sweep rows of docs/data-dependence.md and drop the stale counters and prose from advanced-offload.md. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]> docs(data-dependence): record David's approval of the sweep change (#508) The ping-time question and the held answer in cg:swh: (metadata only) are approved, with the two in-memory conversation copies per thread kept only while the keep-alive can ping the thread, for at most 256 threads and 30 minutes. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…ed run (#697) fix(review): stop a reviewer that never ends, and never resume a failed run On #507 a GLM reviewer repeated one word up to the 32k output limit, 4 turns in a row, about 21 minutes each. Nothing stopped it, and a later round would have resumed that same session. - Each reviewer run now has a wall-clock limit, OFFLOAD_REVIEW_TIMEOUT (default 1800 s, 0 = off). Past it, the script stops the run's whole process group and falls back to the next backend, unless the review is already on the PR. It does not limit tokens. - A run that ends without posting drops its saved session (backend_forget_session, or backend_cleanup), so the next round starts fresh. - Any .review-in-*.txt in a reviewer's own folder is allowed. A reviewer that also saved the PR body (.review-in-prbody.txt, #508) made the round exit 1 although both reviews posted. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]> fix(review): forget a session only after the backend ran Round-1 review fixes for #697. - Forget a saved session only when the backend started. A failure before it (worktree lock, prompt) keeps the session for the next round. - Check OFFLOAD_REVIEW_TIMEOUT once at startup, before any worktree exists. - Mark a stopped run with a file, not exit code 124. A backend that exits 124 by itself is no longer labelled a timeout. - Append to review.log, so an earlier diagnostic stays. - claude: forgetting a session also removes its transcript. - Fix the function counts in the backend headers and SKILL.md. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
Summary
resolveAskincomponents/offload/ask_role.go.What changed
resolveAsk(systemModels, modelID, channel):askViaMessages: role issystemonly if the model is insystem_models. Otherwiseuser.askViaPrefix: alwaysuser. The prefix-ask path can only append a user message.askStandalone:user, no opening line. There is no transcript to disclaim.userquestion gets the opening line[OPERATOR INSTRUCTION — this is not a task request from the user].summarizerProfiles.roleForand the prefix-ask role override incache_aware_summarizer.gocall the helper. The yaml keys (instruction_role,system_models,profiles) work as before.askStripsThinking(lastTurnOnlyModels, modelID, msgs), andaskStripsThinkingShipped(modelID, msgs)for a caller with no profiles. The summarizer calls it with the same inputs. The sweep does not call it in this PR. PR A will (extract_llm_sweep fires at the wrong moment and loses money; ask at the keep-alive ping and apply when cold #404 point 11).askBridge(lastRole). It is backed bycheapmodel.AskBridge, whichinsertAskMessagenow uses. The helper cannot own the rule alone, becausecheapmodelcannot importoffload. The summarizer's message-array path is unchanged.extract_sweep.go: one line changes, at theBuildPrefixAskcall. This keeps the merge with PR A small.How it was tested
On the eval box:
go vet ./components/...: clean.gofmt -l: empty.go test -race ./components/... ./internal/... ./config/... ./apply/...: all pass. The existing summarizer role tests pass unchanged.ask_role_test.go):roleForuses the helperroleForignores the helper: 2 tests fail.system: table test fails.Open questions
extract_llmis not changed. Point 13 names it, but it does not apply. It appends no question to the transcript. It sends one standalone prompt. A helper channel for it would have no user.Technical notes
The sweep cap and cost estimates do not count the added opening line (about 20 tokens). The effect is small.
cmd/cg-selarmsends the prompt body without the opening line. Its comment now says so.The opening line stays in the summarizer yaml, because
profiles_pathcan override that file. A test ties the yaml to the shared constant.SystemAllowedkeeps the oldmatchedmeaning. An explicitinstruction_role: systemis still refused when it is false.Part of #404.