Repository navigation
[PR] test: make the #3380 P2 ladder assertion state-based, immune to CI runner stalls - #6821
Open
ranxianglei wants to merge 1 commit into
Open
ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
…r stalls The P2 integration test asserted the armed back-off by sampling snap.retryAt - Date.now() into a [30, 95]ms window. That window measures observation delay, not the back-off: any runner stall between the 3rd failure arming retryAt = now + 80ms and the snapshot read makes the delta negative (got -49ms on ubuntu-24/24 in PR #6807 run 43698036798; got 25ms on #5597 windows and #5487 ubuntu). The mock's tools.register throw and the production arm (dsh-native.ts registerTools .catch) run in the same event-loop turn, so the applied ladder step is exactly retryAt minus the throw time. Record the throw time in the mock callback and assert against _regBackoffForTest(failStreak) with a tight in-turn window instead. Refs #3571 (checklist item 1), #4599
Contributor
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10161-pr.6821.2ee7650This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6821.tgz
npm install -g packageInstall instructions are refreshed on each push. |
This branch has not been deployed
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.
What
The
#3380 P2 integration: failures escalate on the ladder, then heal cleantest (tests/issue3380-dsh-rereg-selflock.test.ts) asserted the armed back-off by samplingsnap.retryAt - Date.now()and requiring it to sit in[30, 95]ms. That window measures observation delay, not the back-off: any runner stall between the moment the 3rd failure armsretryAt = now + 80msand the moment the test reads the snapshot makes the delta negative.Flake signature (why now)
test (ubuntu-latest, 24, 2):retryAt sits on the 80ms ladder step (got -49ms)— observation 129 ms after the arm. The PR touchessrc/preflight.ts+ docs + two tests; this file imports none of them.查重: 无 — no open PR stabilizes this test (open PRs mentioning 3380: #6706/#6765/#5597/#5178, all unrelated); ci-fixes is byte-identical to master, which still carries the wall-clock assertion.
The fix (test-only, zero production change)
The mock's
tools.registerthrow and the production arm (src/agent/dsh-native.ts:1041, inside theregisterTools.catch) run in the same event-loop turn — the throw rejects the IIFE and the.catchruns as a microtask in that same turn. So the applied ladder step is exactlyretryAt - throwTime, independent of when the test observes it.The test now records
Date.now()inside the mock'sregisterErrorcallback and assertssnap.retryAt - armTimeagainst_regBackoffForTest(snap.failStreak)with a tight in-turn window ([-20, +25]ms, covering in-turn GC both ways). Self-consistent for any observed streak (a 4th failure landing during a stall re-arms with step 4). Still has teeth: a flat or off-by-one ladder (20/40/160 ms at streak 3) fails by ≥60 ms.Refs #3571 (checklist item 1), #4599. No behavior change, no config surface, no kernel change.
Verification
node --import tsx --test tests/issue3380-dsh-rereg-selflock.test.ts— 6/6 pass, 10 consecutive runs cleannpm run typecheckclean