Repository navigation
test(offload): the warm-sweep tests wait on the condition, not on time - #1463
Merged
Merged
Conversation
Three warm-sweep tests used fixed 5 s polls or a tiny real-time bound. They fail on a loaded machine. - The two-asker and shared-read-rule tests wait with testutil.WaitFor. The rig gets one waitIdle helper, which forward also uses. - The outer-timeout test keeps an always-on check that all 3 batches run. Its 3-batches-over-one-bound check is time by design: it is gated with RequireTiming and uses 10x wider margins. - Remove the 3 tests from the pending list and lower the timing baseline. - Add #1193 to the decided_by line of extract_llm_sweep. Signed-off-by: DAVID AMID <[email protected]> Assisted-By: Claude Opus 5.5
Signed-off-by: DAVID AMID <[email protected]> # Conflicts: # docs/data-dependence.md
The timing subtest of the outer-timeout test slept in the asker and ignored its context, so it did not test the outer bound at all. - The asker now records the time left on its context. - With one question's bound set far above the outer one, the first deadline is the outer deadline. The test checks that it is the keeper's timeout, and that the keeper's timeout is at least 3 questions long. No sleep, no gate. Signed-off-by: DAVID AMID <[email protected]> Assisted-By: Claude Opus 5.5
Collaborator
Author
|
Local tests: waived (owner rule) |
amiddavid
commented
Nov 26, 2026
amiddavid
left a comment
Collaborator
Author
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.332 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | 42a306e180ce |
approve |
Verdict: approve
Findings
None. The PR is test-only, plus docs and baselines. No product code changed. No behavior change.
Non-blocking
components/offload/extract_sweep_warm_test.go:147—waitIdlewaits up to thetestutilbound (30 s). The deleted comment inforwardsaid 60 s for a slow-racebuild. The PR names this change, and each batch here is local token counting, not a network call. Watch heavy CI for a flake at this wait.components/offload/extract_sweep_warm_test.go:255— a fixedtime.Sleep(150 * time.Millisecond)stays inTestTheQuestionRunsAfterTheForwardAndTheForwardedRequestIsUnchanged. It is baselined (sleep=1), so it is allowed. It is the same defect class this PR fixes. A follow-up PR could convert it.components/offload/extract_sweep_warm_test.go:2112— the subtest "all batches are asked" repeats whatTestAWarmSweepOverManyOutputsAsksBatchesAndMakesOneGateDecisionAndOneCutalready checks (3 batches of 30). Harmless: it keeps the outer-timeout test self-contained.
What I checked
- Full diff
dec2ef0e..HEAD(3 commits, 5 files) and the code around each change. The mergec62ada92brings inorigin/mainonly; the cumulative diff holds just the branch's own changes. - The new waits are sound.
warmRig.waitIdlekeeps the exact old busy condition (t.asking || t.warmPending(),extract_sweep_warm.go:1112).ResolveWarmQuestionsetsasking = trueunderwarmMubefore it returns (extract_sweep_warm.go:1172), soforwardcannot pass before the question starts. The non-blockingselecton the closedblk.inchannel is a correct poll of the old blocking receive. - The outer-deadline test tests the right thing. The warm path passes
CacheAwareSummarizerCallTimeout()(300 s) as the outer bound (extract_sweep_warm.go:1283), andadjudicateWithwraps each batch withcontext.WithTimeout(c.Ctx, llmCallTimeout)(extract_sweep.go:794). WithllmCallTimeout = 10 h, Go keeps the parent's earlier deadline, so eachAsksees the outer deadline. If the code used one question's bound as the outer one,dwould be near 10 h and the checkd > outerwould fail. The preconditionouter >= 3 × perQuestion(300 s ≥ 270 s) enforces the invariant the production comment names atextract_sweep_ping.go:624-630("if either constant moves, check the other"). - No race in the probe.
batchAsker.leftis appended undera.muand read undera.muafterwaitIdle. No test in the package callst.Parallel(), so thellmCallTimeoutmutation has no concurrent reader; the restore is deferred right after the write, and the preconditionFatalfruns before the mutation. - timingguard baseline is exact. I counted the patterns in the file at the head: 1 unmarked
time.Sleep(line 255), 0 polls, 0time.After. The baseline entrysleep=1matches. The base had 5 sleeps, 3 polls, 1 after; all removed ones are gone. No new//timing:okmarkers were needed. - pending-timing-fixes.txt. The 3 removed tests no longer wait on wall-clock windows, so the waiver entries are correctly gone.
- Data dependence. Only the
decided_byline ofextract_llm_sweepchanges: it appends the #1193 approval record. No Kind, no level, no storage change. I compared the row file and the generated page field by field: they match, including the merge conflict result (main'stier_targettext kept, the branch's approval line kept). The PR names the data-dependence state at the top, as the rules ask. - PR body claims match the code: test-only, the 30 s bound named, no gate on the outer-timeout test (it needs none: its margins are 150 s wide, not load-sensitive).
- No host-package logic, no client rules, no fail-open path touched.
amiddavid
commented
Nov 26, 2026
amiddavid
left a comment
Collaborator
Author
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.332 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | 42a306e180ce |
approve |
Verdict: approve
Findings
None.
Non-blocking
docs/data-dependence/components/extract_llm_sweep.md:8— thedecided_byline backfills the #1193 approval record. That record was missing from main (commit e2d4177 updated the row'swheretext but notdecided_by). It is unrelated to this PR's test change, so by the owner's rule it would get its own PR. The PR body names it, it is one docs line, and the row and the generated page carry the same text. I accept it here.components/offload/extract_sweep_warm_test.go:595-596—r.asker = blk.labelAskeris overwritten byr.asker = nilon the next line. Pre-existing on main, not touched by this PR. Dead line; a later PR can remove it.components/offload/extract_sweep_warm_test.go:2130— the static guardouter >= 3 x llmCallTimeout(300 s vs 270 s with defaults) reads env-resolved values. An environment that raisesCONTEXT_GURU_LLM_TIMEOUTabove 100 s without raising the summarizer timeout fails this test. That failure is the guard doing its job, so I only note it.
What I checked
- Full diff
dec2ef0e..HEAD(5 files) and each of the two commits on their own. warmRig.waitIdle(extract_sweep_warm_test.go:147): same busy test as the old loops (t.asking || t.warmPending()underwarmMu), now throughtestutil.WaitFor(30 s bound, fails on timeout). The old inline loop inTestTheWarmQuestionIsJudgedByTheSharedCacheReadRuledid not fail on timeout; the new one does. Stronger, not weaker.TestAWarmQuestionAndAPingQuestionNeverRunTogetherOnAThread: bothWaitForconditions are sound. APingPlainclaim holds nothing (ping_claim.go:101-139releases it insideClaimPing), so the poll that returns false leaks no hold. While the warm question holds the thread,ClaimPingreturnsPingPlain(busy); after release it returnsPingNoneorPingSweep, so the second condition detects exactly the release.TestTheWarmSweepOuterTimeoutFitsSeveralBatches: I traced the deadline chain. The warm path passesCacheAwareSummarizerCallTimeout()(300 s) as the outer bound (extract_sweep_warm.go:1283);askwrapsc.Ctxwith it (extract_sweep_ping.go:631-639);adjudicateWithwraps that withllmCallTimeoutper batch (extract_sweep.go:794). WithllmCallTimeout = 10 h, the deadline the asker sees is the outer one, sod > outercatches a regression to one question's bound andd < outer/2catches a too-short outer bound. No sleep, no wall-clock dependence, noRequireTiminggate needed. The static guard holds with the shipped defaults (300 s ≥ 3 x 90 s).- The
llmCallTimeout = 10 hmutation is safe: not.Parallelin the package's warm tests, the write happens before the question goroutine starts, and the defer restores the value. - Coverage lost with the old 40 ms/30 ms test: a batch that fails while the others continue is still covered by
TestAFailedWarmBatchKeepsItsOutputsAndTheOthersAreGated(error path, same fail-open behavior). internal/timingguard/baseline.txt: I counted the unmarked patterns in the file by hand. Onetime.Sleepremains (line 255, no//timing:okmarker); no poll loop and notime.Afterselect remain.sleep=1matches.scripts/release/pending-timing-fixes.txt: the file's own rule says "a PR that fixes a listed test removes its line in the same PR". All three removed tests no longer use a fixed time window.- Data dependence: no component or feature behavior changes, so no row of its own is needed. The row edit and
docs/data-dependence.mdcarry the identicaldecided_bytext; #1193's commit message records the owner's approval, so the backfilled line states a real decision. - No host-package code, no client rules, no production code at all: the host-boundary and client-rule checks do not apply.
- The PR body's test notes say where the runs happened (macOS, Go 1.27.4) and list vacuity checks. I did not run tests; live tests are not approved for this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test-only. No user behavior change. No product code change, no seam 4.
Summary
scripts/release/pending-timing-fixes.txt.decided_byrecord line ofextract_llm_sweepgets fix(sweep): with warm on, keep the copy without a ping (#1191) #1193 (approved 2026-11-26).docs/data-dependence.mdis regenerated.What changed
TestAWarmQuestionAndAPingQuestionNeverRunTogetherOnAThreadtestutil.WaitForon each conditionTestTheWarmQuestionIsJudgedByTheSharedCacheReadRulewarmRig.waitIdle(usesWaitFor);forwarduses it tooTestTheWarmSweepOuterTimeoutFitsSeveralBatchesforwardnow waits up to thetestutilbound (30 s), not 60 s.internal/timingguard/baseline.txtis lowered for the file.How it was tested
Tests ran on macOS, Go 1.27.4,
GOMAXPROCS=4.CGO_ENABLED=1 go test -race -count=20 -run '^(the 3 tests)$' ./components/offload/: pass.CGO_ENABLED=1 go test -race ./components/...: pass.go test ./components/all/ ./internal/timingguard/,go vet ./components/...: pass.close(blk.out): fails at 30 s with "timed out after 30.001s waiting for the thread is released after the warm question". No hang.Refs #1193