Skip to content

test: gate the module-retry test on promises, not timers - #71

Merged
RWOverdijk merged 1 commit into
mainfrom
fix/flaky-module-retry-test
Nov 2, 2026
Merged

RWOverdijk merged 1 commit into
mainfrom
fix/flaky-module-retry-test

Conversation

@RWOverdijk

Copy link
Copy Markdown
Member

The race

a module whose start fails is retried with backoff... fixed the degraded window at ~60 ms (moduleRetry: { baseMs: 20 }) but raced to read /status after onReady by polling every 10 ms. On a loaded runner the boot + poll + fetch overran the window, so the first read saw the module already retried back to running. Seen on the macOS CI run after the 2.2.5 bump; flaky by construction.

The fix

No timing assumptions:

  • The third start() awaits a test-held gate, so flaky cannot reach running until the degraded status has been read — the window is open by construction, not by luck.
  • onReady resolves a promise (raced against host so a failed boot fails loudly instead of hanging) — no while (!address) poll.
  • Recovery is observed via a signal the module fires from inside its successful start, then a /status read (a socket round trip always lands after the supervisor's synchronous write).

The supervisor still drives everything the test asserts: the retries fire on its own backoff timer (a broken retry now times out the test), the states, lastError, and attempts: 3 are its output unchanged.

npm run agentic:verify exit 0 locally.

The degraded assertion raced the backoff window: on a slow runner the
first /status read arrived after the retry had recovered the module.
The third start now waits on a test-held gate, so degraded is stable
until read; recovery is observed through the module's own signal.
The supervisor still drives the retries — a broken retry times out.

Co-authored-by: aivi-agent[bot] <331678708+aivi-agent[bot]@users.noreply.github.com>
Harness: OpenCode v2.2.5, mlx-serve/Qwen3.8-Flash-Next-MLX-Serve-iQ-MLX-4.7bpw
@RWOverdijk
RWOverdijk merged commit 5b50344 into main Nov 2, 2026
2 checks passed
@RWOverdijk
RWOverdijk deleted the fix/flaky-module-retry-test branch November 2, 2026 12:58
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.

1 participant