Skip to content

Flaky test: agy-auth-cache '#1077 re-probes after unauth TTL lapses' races TTL against process-spawn latency #1435

Description

@amrmelsayed

Flake (diagnosed by the bugfix-1433 builder, 2026-08-12; hit PR #1434's CI)

packages/codev agy-auth-cache.test.ts '#1077 re-probes after unauth TTL lapses' sets a 50ms TTL, then awaits runLane - which spawns a process - before asserting the cache entry. Under CI load the spawn exceeds 50ms, the entry expires mid-test, the read returns null, and the assertion fails. Classic TTL-vs-latency race: the test is timing-dependent, not behavior-dependent.

Fix direction

Either inject a fake clock so TTL lapse is deterministic, or split the assertion: one test that the entry exists immediately post-write (no spawn in between), one that an EXPIRED entry re-probes (explicitly aged, not raced). Detail in codev/state/bugfix-1433_thread.md once that lane merges.

Impact

Fails unrelated PRs' Unit Tests job intermittently (observed PR #1434, run 2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/consultArea: Consult CLI / consultation tooling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions