Repository navigation
test(runtime): fix the stale orchestration context timestamp before the sync reads the clock - #35516
Conversation
…he sync reads the clock The mock built completed_at when the projection called it, after the projection captured now. With 1 ms or more between the two, the "stale" row was within the freshness window and the test failed under load.
|
STATUS: ready for review at ea65cbc. Test-only flake fix. Reproduced on main under load (1/6 fail); with the fix, 8/8 pass under load and the whole orca-runtime.test.ts file passes. |
[Low impact] This test-only change appears safe to merge. SummaryFixes a flaky test by computing
Reviews (1) · Last reviewed commit: "test(runtime): fix the stale orchestrati..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review.
|
ELI5
A test checks that an old, finished task is not shown as current. It made its "old" timestamp a moment too late, so on a busy machine the task looked fresh and the test failed. The test now makes the timestamp up front, before the code under test reads the clock.
What Changed
expected { …(1) } to be undefined. It failed shard 5/5 on fix(wsl): session history reads never boot a stopped WSL distro (E9) #35367, which is unrelated, and fails on main locally in 1 of 6 runs under CPU load.How it broke: the mock built
completed_at(now − window − 1 ms) at the moment the code under test called it. The code captures its ownnowearlier, when the sync starts. If 1 ms or more passed between the two, the row was at most exactly the window old. The code counts that as recent.The fix computes the timestamp once, before the sync. The product code is unchanged.
Why
Fixing the timestamp before the clock read removes the race completely.
To confirm the cause: with a temporary 5 ms busy-wait inside the mock, the old test fails every run and the new one passes every run.
Linked Issue
N/A (internal flake; failing run 40788108475).
Visual Proof
N/A: test-only change, no UI or behavior change.
Testing
Results (macOS):
pnpm test src/main/runtime/orca-runtime.test.ts: 1499 passed, 3 skipped.pnpm tc,pnpm run typecheck:ci,pnpm run check:code-quality:changed, the anti-slop oxlint, and ast-grep.AI Disclosure
Review
Agent skill upstream boundary
Notes
Test-only change; no security, platform, SSH, mobile, compatibility, or performance impact.
Flag-off: test-only change; no runtime behavior.
User-risk: none; no product code changes.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)