Skip to content

[PR] test: make the #3380 P2 ladder assertion state-based, immune to CI runner stalls - #6821

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-11-15_issue3380-ladder-state-assertion
Open

ranxianglei wants to merge 1 commit into
masterfrom
2026-11-15_issue3380-ladder-state-assertion

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

The #3380 P2 integration: failures escalate on the ladder, then heal clean test (tests/issue3380-dsh-rereg-selflock.test.ts) asserted the armed back-off by sampling snap.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 arms retryAt = now + 80ms and the moment the test reads the snapshot makes the delta negative.

Flake signature (why now)

查重: 无 — 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.register throw and the production arm (src/agent/dsh-native.ts:1041, inside the registerTools .catch) run in the same event-loop turn — the throw rejects the IIFE and the .catch runs as a microtask in that same turn. So the applied ladder step is exactly retryAt - throwTime, independent of when the test observes it.

The test now records Date.now() inside the mock's registerError callback and asserts snap.retryAt - armTime against _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 clean
  • npm run typecheck clean
  • Full suite: remote CI on the pushed head

…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
@ranxianglei ranxianglei changed the title test: make the #3380 P2 ladder assertion state-based, immune to CI runner stalls [PR] test: make the #3380 P2 ladder assertion state-based, immune to CI runner stalls Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-15_issue3380-ladder-state-assertion (0e213d2)

Latest build — install this exact version

npm install -g billion-context@0.0.10161-pr.6821.2ee7650

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
0e213d2 billion-context@0.0.10161-pr.6821.2ee7650 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr6821.tgz
npm install -g package

Install instructions are refreshed on each push.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant