t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Codex turns retry indefinitely when the provider endpoint is unreachable, and the run never hits a deadline

Open bignosecss opened this issue 2 weeks ago • 2 comments

What happened

A delegated Codex child sat in Retrying provider (117) for 2h00m. The only error row was:

Connection failed: error sending request

The lineage panel showed 1 running the whole time and the elapsed timer kept counting. The run ended only when I pressed stop (2h00m33s after it started).

Underlying cause on this machine

~/.codex/config.toml pointed model_provider.base_url at a local proxy port with nothing listening (curl -m 3 returned 000, no socket in ss). Codex app-server reported willRetry: true on every attempt, so the retry row kept incrementing.

With the label fix from #29224, maxAttempts correctly becomes null in the open-ended phase and the UI shows a bare count — that part behaves as intended. The gap is what happens around it:

  • Codex never gives up in its "waiting for network" phase (same situation as #30791, where the reporter saw a 17h thread).
  • The run therefore stays running with no deadline and no way to distinguish "endpoint is dead, this will never recover" from "transient blip".
  • The only exit is a manual stop.

After I started the endpoint on the configured port, the same delegation completed in seconds.

Why it matters

  • A delegated child occupies the lineage as "running" for hours, and the parent waits on it.
  • Unattended runs never resolve themselves.
  • "Provider endpoint unreachable" looks identical to "still retrying, might recover".

Expected

  • A deadline for the disconnected phase (e.g. N minutes or M attempts without a successful request), after which the run fails with a transport_error and keeps the retry count visible.
  • Or an explicit "provider unreachable" classification (connection refused / no listener) that does not present itself as retrying.
  • If indefinite retry is intentional, say so in the UI and surface a stop action inline.

Repro

  1. Point a Codex provider's base_url at a closed local port.
  2. Delegate any task to a Codex child.
  3. Watch the attempt count climb with ~60s backoff; the run stays working until interrupted.

Environment

  • T3 Code 0.1.9, Linux
  • codex-cli 0.169.0, custom model provider, model glm-5.3-flash

bignosecss avatar Nov 16 '26 10:11 bignosecss

This is the same problem as #29208, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

juliusmarminge avatar Nov 16 '26 11:11 juliusmarminge

[!NOTE] Drafted with Claude Code (running inside T3 Code), posted from my account.

Thanks @juliusmarminge — #29208 does fix one half of our report: with the 10-minute retry budget, a turn like ours (Codex base_url on a closed local port, Retrying provider (117), Connection failed: error sending request) now fails as transport_error instead of running for 2h. It's on main, and in nightly from v0.1.10-nightly.20261114.4695 (not in stable 0.1.9 yet, which is what we run).

The other half of the report is still open, so we'd like this reopened for it:

  1. A dead endpoint should be classified as unreachable, not retried until the budget runs out. Connection refused / no listener is not transient — every retry is guaranteed to fail. With only the deadline, an unattended delegated child, and the parent waiting on it, still burns a full 10 minutes in a row that reads as "still retrying, might recover". The issue asked for a deadline or an explicit "provider unreachable" classification; #29208 ships the deadline, not the classification.
  2. The failure row doesn't carry what's needed to tell the two apart. Our only error text was Connection failed: error sending request, which is identical whether the port is dead or the network blipped. Surfacing the underlying cause (connection refused vs. timeout/reset) would make the row actionable on its own.

Suggested scope for a follow-up:

  • On an unambiguously non-retryable transport failure (no listener / ECONNREFUSED), settle the turn as failed immediately with the existing transport_error class, keep the retry count visible, and label it "provider unreachable".
  • Surface the underlying transport cause in the failure row.
  • Optionally make the 10-minute budget a setting.

To be clear, we're not asking for the 10-minute backstop to be removed — the remaining gap is classification and fail-fast for the case that cannot recover. If you'd rather track that as its own issue than reopen this one, that works for us.

bignosecss avatar Nov 16 '26 14:11 bignosecss