Repository navigation
Failed Codex turns are treated as completed: turn/completed with status "failed" loops until the tracker rate limit (fix available) #133
janpietjoris
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What happens
Current Codex reports a failed turn as
turn/completedwithturn.status: "failed", not asturn/failed.Codex.AppServer.handle_incoming/6matches everyturn/completedas a success, so the agent runner logs a completed turn, refreshes the issue from the tracker and starts the next turn right away.Reproduction
Seen with Codex CLI 0.157.1 on a Linear-backed project, with a model the Codex account rejects. For every turn the app-server sends (trimmed):
Codex never sends
turn/failedhere, so the existingturn/failedbranch is never reached.Effect
Each failed turn takes about a second. The runner loops up to
agent.max_turns, with one tracker request per turn. That was about one request a second, until the Linear API rate limit ran out. The run then failed with{:issue_state_refresh_failed, {:linear_api_status, 400}}, which was the only error the dashboard showed. After the retry backoff, the loop started again. The Codex error itself only appeared as a debug-levelCodex notification: "error"log line.SPEC.md says a failed turn must fail the worker (worker attempt pseudocode):
if turn_result failed: ... fail_worker("agent turn error").Fix available
Branch: https://github.com/janpietjoris/symphony/tree/fix/turn-completed-failed-status
Commit: janpietjoris@7664012 (one commit on top of
mainbe10a1b, 2 files, +119)app_server.ex: a clause before the genericturn/completedmatch. Whenparams.turn.status == "failed", it emits:turn_failedand returns{:error, {:turn_failed, turn_error}}, the same path asturn/failed.completedturns are unchanged, andinterruptedis left as is.app_server_test.exs: two tests with a fake codex. One replays the failed-turn sequence above and expects{:error, {:turn_failed, error}}. The other checks that acompletedturn still succeeds.make -C elixir allpasses: format check, credo strict, 301 tests with 0 failures and 6 skipped, coverage, and dialyzer with 0 errors. Without theapp_server.exchange, the new failed-status test fails.I tried to open this as a PR, but PR creation on this repository is limited to collaborators. Feel free to take the commit as is.
All reactions