t8y2/dbx · error · TimeoutError

timed out waiting for agent readiness

Error message

timed out waiting for agent readiness

What it means

The bench agent driver's __init__ starts the agent subprocess, spawns stdout/stderr reader threads, and waits on a readiness event; if readiness is not signaled within BENCH_READY_TIMEOUT (default 30s) or the ready line was never seen, it raises TimeoutError with the collected failure context.

Source

Thrown at agents/drivers/argo-go/bench/agent_compare.py:46

            candidate.command,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True,
            bufsize=1,
        )
        self.request_id = 0
        self.request_lock = threading.Lock()
        self.write_lock = threading.Lock()
        self.pending: dict[int, queue.Queue] = {}
        self.ready = threading.Event()
        self.saw_ready = False
        self.exited = threading.Event()
        self.stderr_lines: list[str] = []
        threading.Thread(target=self._read_stdout, daemon=True).start()
        threading.Thread(target=self._drain_stderr, daemon=True).start()
        if not self.ready.wait(env_float("BENCH_READY_TIMEOUT", 30.0)) or not self.saw_ready:
            raise TimeoutError(self._failure("timed out waiting for agent readiness"))

    def _read_stdout(self) -> None:
        assert self.process.stdout is not None
        for line in self.process.stdout:
            try:
                response = json.loads(line)
            except json.JSONDecodeError:
                continue
            if response.get("ready") is True:
                self.saw_ready = True
                self.ready.set()
                continue
            response_id = response.get("id")
            if not isinstance(response_id, int):
                continue
            with self.request_lock:
                response_queue = self.pending.get(response_id)
            if response_queue is not None:

View on GitHub (pinned to c0390bff16)

Solutions

  1. Raise the timeout: set BENCH_READY_TIMEOUT to e.g. 120 (env_float, seconds)
  2. Inspect the captured stderr/failure output in the TimeoutError to find why the agent never became ready
  3. Verify the agent command/args and that its ready-line format still matches what _read_stdout expects

Example fix

// before
agent = ArgoAgent(cmd, args)  # times out after 30s on cold start
// after
import os
os.environ["BENCH_READY_TIMEOUT"] = "180"
agent = ArgoAgent(cmd, args)
Defensive patterns

Strategy: try-catch

Validate before calling

timeout_s = float(os.environ.get('BENCH_READY_TIMEOUT', '30'))
if expected_warmup_seconds > timeout_s:
    os.environ['BENCH_READY_TIMEOUT'] = str(expected_warmup_seconds + 60)

Try / catch

try:
    agent = ArgoAgent(cmd, args)
except TimeoutError as e:
    print(e)  # includes collected stderr/failure context
    print('agent failed to become ready; check command, args, and BENCH_READY_TIMEOUT')
    raise SystemExit(1)

Prevention

When it happens

Trigger: Agent process fails to print its readiness line within the timeout because it crashed, hung, is slow to load a large model, or the ready protocol changed; process exits early and saw_ready stays False.

Common situations: First run downloading weights or warming up exceeds 30s; wrong agent command/args so the process dies; broken ready-line handshake after an agent version update; missing API key causing the agent to exit immediately.

Understand the failure class

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/e8273a2e3e8859cc. Report an issue: GitHub.