Skip to content

test(azure-speech): make voices timeout proof deterministic - #124694

Merged
steipete merged 1 commit into
mainfrom
steipete/azure-voices-timeout-race
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/azure-voices-timeout-race

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #124684

What Problem This Solves

Fixes an issue where the Azure Speech voice-timeout integration test could fail on a loaded runner even though the request timed out correctly. The 100 ms abort could fire before the loopback connection reached the server handler, leaving the request count at zero and making the test race the request it was trying to observe.

Observed in CI job checks-node-changed-extensions-config-2: extensions/azure-speech/voices-timeout.test.ts:75 expected requestCount to be 1 but received 0.

Why This Change Was Made

The tests now hold only the timeout timers, start the real loopback request, await an explicit server-receipt promise under the existing real 1 s watchdog, and then advance the configured timeout exactly. This keeps the original 100 ms Azure budget and 250 ms Inworld budget while proving both dispatch and abort deterministically.

The sibling sweep found the same author and same race shape in Inworld, so that test uses the same proof. Mattermost already awaits server receipt, and Telegram receives response headers before testing its body deadline.

There is no production defect. fetchWithSsrFGuard intentionally starts the timeout before DNS/SSRF preflight so the entire guarded operation is bounded, and the Azure caller has no behavior that depends on distinguishing a pre-dispatch timeout from an unanswered request. Production code and timeout defaults are unchanged.

AI-assisted: yes.

User Impact

No runtime behavior changes. CI retains the full timeout contract without a scheduler-sensitive request-arrival race.

Evidence

  • Pre-fix CI evidence: checks-node-changed-extensions-config-2 failed at the request-count assertion with expected 1, received 0.
  • Repeat proof: 20/20 consecutive runs of node scripts/run-vitest.mjs extensions/azure-speech/voices-timeout.test.ts extensions/inworld/voices-timeout.test.ts passed (2 tests per run).
  • Azure Speech suite: node scripts/run-vitest.mjs extensions/azure-speech passed (4 files, 23 tests).
  • Changed gate: node scripts/check-changed.mjs passed on Blacksmith Testbox tbx_01m05pfjh7yfprgj9m3qvgt83a (exit 0): https://github.com/openclaw/openclaw/actions/runs/31958741117
  • Formatting and patch integrity: oxfmt and git diff --check passed.
  • Autoreview: .agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output reported no accepted/actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added extensions: inworld Extension: inworld plugin: azure-speech Azure Speech plugin size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@steipete
steipete marked this pull request as ready for review August 16, 2026 16:48
@steipete
steipete merged commit 3ca7b03 into main Aug 16, 2026
162 checks passed
@steipete
steipete deleted the steipete/azure-voices-timeout-race branch August 16, 2026 16:55
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
steipete added a commit that referenced this pull request Aug 25, 2026
The live-loopback + real-watchdog shape from #124694 still flaked on
loaded CI shards (2s vitest timeout, e.g. run 32714053992 on #128514):
real socket I/O raced the 1s watchdog and 2s test budget.

fetchWithSsrFGuard already treats a vi.fn fetch stub as hermetic (no
DNS pinning, no dispatcher) and passes its timeout abort signal via
init.signal, so a never-resolving signal-honoring stub plus fake timers
exercises the same production abort path with zero real I/O. The test
now also proves the request is not aborted before the configured
timeout and aborts exactly at it. 10/10 green in a local loop.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
The live-loopback + real-watchdog shape from openclaw#124694 still flaked on
loaded CI shards (2s vitest timeout, e.g. run 32714053992 on openclaw#128514):
real socket I/O raced the 1s watchdog and 2s test budget.

fetchWithSsrFGuard already treats a vi.fn fetch stub as hermetic (no
DNS pinning, no dispatcher) and passes its timeout abort signal via
init.signal, so a never-resolving signal-honoring stub plus fake timers
exercises the same production abort path with zero real I/O. The test
now also proves the request is not aborted before the configured
timeout and aborts exactly at it. 10/10 green in a local loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: inworld Extension: inworld maintainer Maintainer-authored PR plugin: azure-speech Azure Speech plugin size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant