Skip to content

[PR] fix: stabilize Windows CI flakes — verif detect-once solver cache + deterministic #286 migration savedAt (#4140 instances 3&4) - #4269

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-22_4140-verif-detect-persist-savedat
Oct 23, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-22_4140-verif-detect-persist-savedat

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Part of #4140 — fixes instances 3 & 4 (the two new flake signatures added to that checklist). Does not close #4140: instance 1 (rmdir race) still has no linked fix, and instance 2 (#4079 egress-fuse) plus instance 5 (pi-omp-fork-adopt drain-cancel) are both covered by in-flight PR #3563.

查重: 无 — open+closed issue search ("verif solver detection", "#286 persist migration savedAt") plus an open-PR scan (verif/solver/savedAt/persist/migration/4140/detect/windows-ci keywords) found no competing work. Closest verif PRs (#4258 symbolic-port double-wrap, #3861 module kickoff) touch different files/mechanisms.

Instance 3 — verif solver-detection flake (red instead of clean skip)

Root cause. solveSmt2 (verif/solve.ts) re-ran the full solver ladder (cvc5-via-python → z3) on every call with no caching. A test's guard-probe and its later body solves therefore made independent availability decisions; when the probe said "available" but a body solve's fresh detection failed, the body's solveSmt2 threw no solver available uncaught → a red leg, or (per the owner's rerun data) a malformed TAP not ok … # SKIP no SMT solver available line that falls out of every tally bucket. Either way it violates the KDD #14 contract "no-solver environment auto-skips, never red."

Fix.

  • Detect-once cache in verif/solve.ts: the first decisive solver is remembered per process; guard-probe and body solves share one stable verdict, and steady-state calls spawn one solver instead of re-walking the ladder (less spawn pressure on loaded CI runners — the load-sensitive flake class). First-decisive-wins semantics are preserved exactly.
  • tests/verif-generic-append-stability.test.ts: each of the three body solves now degrades to t.skip("solver unavailable mid-test: …") if the solver is lost after the guard, matching the existing bug3691:88 idiom — so even the residual "probe-yes/solve-no" case emits a clean skip, never an uncaught throw (which also fixes the malformed-TAP-line manifestation).

Instance 4 — #286 persist-migration timing flake

Root cause. The collision test wrote A(req=7) then B(req=1) back-to-back and nudged envB.savedAt -= 1000, relying on real-clock proximity of the two writes to make A strictly newer. Under loaded CI the two writes can land ≥1s apart, flipping the winner → expected 7, actual 1. migrateLegacyIds picks by envelope.savedAt >= prev.savedAt (newest wins).

Fix (test-only). Both files now get explicit, well-separated savedAt pins (A newer than B by a full minute), so the winner is deterministic regardless of wall-clock jitter. No production change — src/persist.ts untouched.

Behavior changes (old → new)

  • Instance 3: mid-test solver loss in verif-generic-append-stability was an uncaught throw → red leg / malformed TAP line. Now a clean t.skip() with a warning. In solver-present environments results are byte-identical (first-decisive-wins preserved); only the degraded no-solver path changes.
  • Instance 4: none in production; the test asserts against explicit timestamps instead of wall-clock ordering.

Verification (local, targeted)

  • npm run typecheck — green (exit 0).
  • tests/verif-generic-append-stability.test.ts — passes against a real solver (validates the solve.ts refactor end-to-end: detection cache + fast path + full walk).
  • tests/proxy-persist.test.ts — the 会话身份不稳定:credential/upstream 维度导致长会话状态孤儿化(sessions 缺失) #286 migration subtest passes; 5 other failing subtests (debounce/flushSync/id-match) fail identically without this change (sandbox .tmp ENOTDIR artifacts) — pre-existing/environmental, not a regression here. Authoritative full-suite verdict = remote CI.

Note — sibling verif tests (tracked, not dropped)

The same "unprotected body solve" shape exists in ~7 other solver-gated verif tests (responses-ingress, conflict-watch, snapshot-render, induction-append-stability, wire-anthropic-roundtrip, wire-google-rebuild-stability, view-latch-discipline). The detect-once cache already removes their primary exposure (independent per-call re-detection). Their optional body-hardening is left out to keep this diff single-purpose; recommend folding it into #3563's Windows-harness sweep or a small follow-up.

No new config/env/CLI surface.

…eterministic #286 migration savedAt (#4140 instances 3&4)

Instance 3 (verif solver-detection flake, red instead of skip):
solveSmt2 re-ran the full solver ladder on every call, so a test's
guard-probe and its body solves made independent availability decisions;
a probe-yes/solve-no flip surfaced as an uncaught throw at the body.
Now the decisive solver is cached per process (detect-once): guard-probe
and body solves share one stable verdict, and steady-state calls spawn
one solver instead of re-walking the ladder (less pressure on loaded CI
runners). verif-generic-append-stability now skips (with warning) if the
solver is lost mid-test after passing the guard, matching the existing
bug3691 idiom, instead of throwing into a red leg.

Instance 4 (#286 persist-migration timing flake):
the collision test relied on two back-to-back wall-clock writes plus a
1000ms nudge to make A strictly newer than B; under loaded CI the writes
can land >=1s apart and flip the winner. Now both files get explicit,
well-separated savedAt pins (A newer by a full minute), deterministic
regardless of write timing. Test-only; no production behavior change.
@ranxianglei ranxianglei changed the title fix: stabilize Windows CI flakes — verif detect-once solver cache + deterministic #286 migration savedAt (#4140 instances 3&4) [PR] fix: stabilize Windows CI flakes — verif detect-once solver cache + deterministic #286 migration savedAt (#4140 instances 3&4) Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-22_4140-verif-detect-persist-savedat (83fb758)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.5075-pr.4269.cda1d97

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.749-master.5e290f2 (rolling master tag).

npm install -g billion-context@0.0.749-master.5e290f2  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows CI test shards go red randomly: two flake signatures (cleanup rmdir race in #1952 lease test, egress-fuse e2e hang in #4079)

1 participant