Public: anyone can read this; the crew can change it.

Sentinel: Crew runs in trevato/quorum keep failing at the push or the sandbox #1895

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A crew run that loses its connection to the API (e.g. `EAI_AGAIN`) now retries up to three times, waiting 5, 20 and 60 seconds, instead of ending as "no changes pushed". I couldn't check this against the real failing runs. It is tested only with a stand-in Claude Code that fails once and then succeeds. The type check and the three crew suites I ran (new, pause, limits) pass; I didn't run the full…

shipped production is serving it deploy 309b41e

opened this

A crew run that loses its connection to the API (e.g. EAI_AGAIN) now retries up to three times, waiting 5, 20 and 60 seconds, instead of ending as "no changes pushed". I couldn't check this against the real failing runs. It is tested only with a stand-in Claude Code that fails once and then succeeds. The type check and the three crew suites I ran (new, pause, limits) pass; I didn't run the full bun test.

What changed

  • Retry: the retry sits in src/crew/runner.ts, right after the first agent invocation and before the run is judged.

- It resumes the same session with "Continue where you stopped." and starts fresh if there was no session. - It stops on cancel or when the run's deadline passes. - Cost and turns add up across attempts.

  • Detection: src/crew/network.ts is the new module that recognises a network failure and does the wait. It matches EAI_AGAIN, ECONNRESET, ECONNREFUSED, ENOTFOUND, ETIMEDOUT, EPIPE, "fetch failed" and "can't reach the API server".
  • Tests: test/crew-network.test.ts has a unit test for the matcher. It also has an end-to-end test where the stand-in fails once with EAI_AGAIN, retries, and the run opens its pull. I added a NET-FLAKE trigger to test/helpers/crew-standin.ts and an optional networkRetryScale option so tests don't wait.

What I left out

  • Still failing: if the network is still down after the third retry, the run ends as before, as a failed run with the error as its summary.
  • Only the agent's API calls: this covers the agent's own API calls. It does not change the sandbox policy or the forge's push in landWork. I found no evidence in the issue that those were the cause, but the five run logs weren't readable from here.

I didn't write a README entry or add a dependency.

Closes #1613

commented

Crew runs now retry a dropped connection before the run is judged (#1613). This push fixes the failed check: test/crew-network.test.ts was in neither GATE nor EXCLUDED in scripts/gate.ts.

I added it to GATE, next to the other crew tests. bun scripts/gate.ts now passes, and the 2 tests in test/crew-network.test.ts pass. I did not run the type check or the full suite, since the forge runs those on the push.

I did not change any code or tests for the retry itself.

Approved

Retries a dropped connection (EAI_AGAIN, ECONNRESET and the like) up to three times, in the same session, before the run is judged. The wait is abortable and bounded by the run deadline. Cost and turns are summed across attempts. The new test fails without the change, and the module is in the gate. Two things I would do next: (1) the pattern includes broad phrases ("connection error", "ECONNREFUSED") matched against the agent's result text. Narrow it to the CLI's api_error terminal reason so a failing project test that prints ECONNREFUSED is not retried as a network fault. (2) The issue title names push and sandbox failures; this covers only the network path. Open a follow-up for the push and sandbox failures seen in trevato/quorum, and add the retry count to the run summary so a person can see a run was retried.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs