Repository navigation
feat(retry): pass failed runs to retry_on - #181
Merged
Merged
Conversation
A run that exits nonzero returns {:ok, %Result{success: false}}, which
Retry.execute/3 returned after one attempt without calling :retry_on.
It now passes that tuple to :retry_on and retries when it returns true.
The default predicate still retries only timeouts and System.cmd errors.
The wrapper does not classify capacity or rate-limit failures: codex-cli
0.165.0 reports a 429, 503 or 529 only in its own message text. The
Retry docs and README say so and show a caller-side predicate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #152, with option 2 from the issue thread: keep classification structured-only and ship only the
Retrychange.Plan
Retry.execute/3returns{:ok, %Result{success: false}}after one attempt;:retry_onsees only{:error, _}:retry_onalso receives{:ok, %Result{success: false}}and can retry it{:timeout, _}and{:system_cmd, _}The comment on #152 showed that codex-cli 0.165.0 does not pass the provider's status or error code through in
--jsonoutput. A 429, 503 or 529 appears only in codex's own message text (exceeded retry limit, last status: 429 Too Many Requests,unexpected status 503 ...). A structured-only classifier would match nothing, so none is added. TheRetrymoduledoc and README document this and show a caller-side predicate overTurn.from_result/1that matches that text, at the caller's choice.The docs also state why failed runs are not retried by default: a retry re-sends the prompt and can repeat the failed attempt's tool commands.
Tests
test/codex_wrapper/retry_test.exs, with a fake codex that counts invocations:retry_onreceives{:ok, %Result{success: false}}and, returningtruewithmax_retries: 2, runs codex 3 times;retry_on.Checks
mix format --check-formatted,mix compile --warnings-as-errors,mix credo --strict,mix test(837 passed, 4 excluded),mix dialyzer,mix docs --warnings-as-errors.