stablyai/orca · error · Error

Timed out waiting for ${description}

Error message

Timed out waiting for ${description}

What it means

Thrown by the WSL hook-relay reattach benchmark's generic `waitFor` helper when a probe function does not return a truthy value within timeoutMs (default 30s, polled every 100ms). It is benchmark scaffolding, not production code — it signals that some expected observable condition (relay registered, endpoint file written, hook delivered) never appeared in time.

Source

Thrown at config/scripts/wsl-hook-relay-reattach-benchmark.mjs:102

}

async function readGuestFile(distro, path) {
  const result = await run('wsl.exe', wslArgs(distro, ['/bin/cat', path]), {
    allowFailure: true
  })
  return result.status === 0 ? result.stdout : null
}

async function waitFor(description, probe, timeoutMs = 30_000) {
  const deadline = Date.now() + timeoutMs
  while (Date.now() < deadline) {
    const value = await probe()
    if (value) {
      return value
    }
    await new Promise((resolve) => setTimeout(resolve, 100))
  }
  throw new Error(`Timed out waiting for ${description}`)
}

function parseEndpoint(contents) {
  const port = Number(/ORCA_AGENT_HOOK_PORT=['"]?(\d+)/.exec(contents)?.[1])
  const token = /ORCA_AGENT_HOOK_TOKEN=['"]?([^'"\r\n]+)/.exec(contents)?.[1]
  return Number.isInteger(port) && port > 0 && token ? { port, token } : null
}

async function freeGuestPort(distro) {
  const result = await run(
    'wsl.exe',
    wslArgs(distro, [
      '/usr/bin/python3',
      '-c',
      'import socket; s=socket.socket(); s.bind(("127.0.0.1",0)); print(s.getsockname()[1]); s.close()'
    ])
  )
  const port = Number(result.stdout.trim())

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Increase the timeout via the caller (pass a larger timeoutMs) or run the benchmark on faster hardware / a warmer WSL cache.
  2. Check that out/relay/wsl/wsl-agent-hook-relay.js and its .version exist (the script builds them via build-relay.mjs if missing — confirm that build succeeded).
  3. Manually run the relay inside the WSL distro to see the real startup error the probe is masking.
  4. Verify the endpoint.env path the probe parses matches where the guest relay actually writes it ($HOME/.orca-wsl/agent-hooks/instance-<key>/endpoint.env).

Example fix

// before
await new Promise((resolve) => setTimeout(resolve, 100))

// after — log probe output on timeout for diagnosis
throw new Error(`Timed out waiting for ${description} (last probe: ${JSON.stringify(lastProbe)})`)
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: confirm the relay binary exists before waiting on the probe
import { existsSync } from 'node:fs'
if (!existsSync(bundlePath)) {
  throw new Error(`relay bundle missing: ${bundlePath}`)
}

Try / catch

try {
  await waitFor('relay endpoint', probe, 30_000)
} catch (err) {
  console.error((err as Error).message)
  // surface guest relay logs collected during the run for diagnosis
  throw err
}

Prevention

When it happens

Trigger: Calling `waitFor(description, probe, timeoutMs)` where probe() keeps returning a falsy value (null/undefined/0/'') past the deadline. Used in the benchmark to wait for the WSL guest relay to boot, register its hook endpoint, or deliver a hook event back to the host.

Common situations: WSL distro is slow to start Node, the relay bundle failed to build (out/relay/wsl missing), the endpoint.env file path is wrong, the guest relay crashed silently, or the host's PTY refresh integration never fires because pty.ts was refactored and no longer routes through the production singleton.

Understand the failure class

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/c9750da71bb4d3ea. Report an issue: GitHub.