You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: flaky test — lineage-and-scan-cache-part-03 worktree scan-cache TTL assertion is order/timing dependent #22579
It pins a scan-cache TTL using fake timers. Getting more calls than expected is consistent with cache entries expiring when they shouldn't — i.e. something other than the faked clock influencing TTL, or state leaking between files in the shard.
Impact
It is not tied to any particular change. I hit it across four unrelated OpenCode PRs (#22444, #22544, #22546, #22547) over a few hours; each time it cleared on a plain rerun with no code change. Because it also fails the aggregate verify check, every hit looks like a red PR and costs a diagnosis cycle before you can conclude it is noise.
Passes consistently locally: pnpm test src/main/runtime/orca-runtime.test.ts → 1294–1298 passed.
Suggested direction
Worth checking whether the runtime's scan cache reads wall-clock time (Date.now() captured outside the faked context, or a timer created before vi.useFakeTimers()) rather than the faked clock, and whether the cache is module-scoped and therefore shared with other spec files in the same shard.
Filed rather than fixed because the fix depends on how listDetectedManagedWorktrees's cache is meant to be scoped, which the runtime owners will know.
Closing as completed: the reported TTL test now isolates the two sources of nondeterminism in current main (4dd97f02d5e2).
In lineage-and-scan-cache-part-03.spec.ts, the test starts fake time at zero and uses vi.setSystemTime(10_000) / vi.setSystemTime(30_000) instead of advancing the timer queue. This changes the clock used by the TTL without running unrelated scans scheduled by earlier tests. It also stubs readRepoWorktreeAdminFingerprint to return null, so a real filesystem directory cannot short-circuit the expected rescan. Cleanup restores both the spy and real timers in finally. The assertion now checks the exact scan sequence: repo-a, repo-b, repo-a.
That implementation is present in merged #25078, an ancestor of main, and the checked-out test matches main. Validation with ORCA_BACKGROUND_LAUNCH=1: the 11 scan-cache tests passed; a full runtime-suite run also passed this test (1,461 passed, 2 skipped). The full run had two separate existing-folder import failures involving macOS /var versus /private/var paths, so I am not claiming the whole suite passed. Neither failure was the reported TTL assertion.
Activity
AmethystLiang commentedon Sep 24, 2026
thanks for reporting. looking into it
nwparker commentedon Oct 22, 2026
Closing as completed: the reported TTL test now isolates the two sources of nondeterminism in current
main(4dd97f02d5e2).In
lineage-and-scan-cache-part-03.spec.ts, the test starts fake time at zero and usesvi.setSystemTime(10_000)/vi.setSystemTime(30_000)instead of advancing the timer queue. This changes the clock used by the TTL without running unrelated scans scheduled by earlier tests. It also stubsreadRepoWorktreeAdminFingerprintto return null, so a real filesystem directory cannot short-circuit the expected rescan. Cleanup restores both the spy and real timers infinally. The assertion now checks the exact scan sequence: repo-a, repo-b, repo-a.That implementation is present in merged #25078, an ancestor of
main, and the checked-out test matchesmain. Validation withORCA_BACKGROUND_LAUNCH=1: the 11 scan-cache tests passed; a full runtime-suite run also passed this test (1,461 passed, 2 skipped). The full run had two separate existing-folder import failures involving macOS/varversus/private/varpaths, so I am not claiming the whole suite passed. Neither failure was the reported TTL assertion.