Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Heuristic:AIScientists Dev WorldSeed Infra Retry Vs Code Crash

From Leeroopedia
Knowledge Sources
Domains Error_Handling, Distributed_Computing
Last Updated 2026-10-26 19:00 GMT

Overview

Distinguish infrastructure-level failures (retry) from code-level crashes (do not retry) when dispatching training experiments to the remote EC2 daemon.

Description

When a training experiment fails, the `AutoresearchWorker` must decide whether to re-enqueue it. Retrying a transient HTTP timeout makes sense — the daemon may recover. Retrying an OOM or syntax error is wasteful — the same code will crash the same way.

The `_is_retryable_infra_failure()` method classifies crash reasons:

  • Retryable (infra): `http_timeout`, `http_error:*`, `daemon_5xx`, `job_status_timeout`, `job_not_found`, `daemon_restarted`
  • Not retryable (code): `oom`, `syntax_error`, `exit_1`, `timeout`, `daemon_not_configured`

Retries are capped: `EXPERIMENT_INFRA_MAX_ATTEMPTS=2` for experiments, `VERIFY_MAX_ATTEMPTS=3` for verifications.

Usage

Apply this heuristic in any system that dispatches work to a remote execution service. Classify failures before deciding to retry, and only retry failures where the environment, not the code, is the root cause.

The Insight (Rule of Thumb)

  • Action: Call `_is_retryable_infra_failure(reason)` before re-enqueuing. Only re-enqueue if it returns `True` and `attempt < MAX_ATTEMPTS`.
  • Value: `EXPERIMENT_INFRA_MAX_ATTEMPTS=2`, `VERIFY_MAX_ATTEMPTS=3`. Retryable reasons: `http_timeout`, `http_error:*`, `daemon_5*`, `job_status_timeout`, `job_not_found`, `daemon_restarted`.
  • Trade-off: Retrying infra failures adds latency (re-queue + re-train). Not retrying code crashes means the agent must fix their code — which is the correct behavior.
  • Compatibility: The reason string comes from `TrainingResult.crash_reason`, set by `EC2Runner` based on HTTP status codes and exception types.

Reasoning

Infrastructure failures are transient by nature — a network blip, a daemon restart, a 5xx error. The same source code will succeed on retry. Code-level failures are deterministic — an OOM at batch_size=512 will OOM every time until the agent reduces the batch size.

Retrying code crashes wastes GPU time (210s per attempt) and gives the agent false hope. Recording the crash immediately with the stdout tail lets the agent see the error and fix it on their next wake.

The asymmetric limits (2 for experiments, 3 for verifications) reflect that verifications are more critical — a stuck verification strands a paper in `verifying` forever.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment