feat(agent): configurable max retries and error desktop notifications#2998
Open
processtrader wants to merge 4 commits into
Open
feat(agent): configurable max retries and error desktop notifications#2998processtrader wants to merge 4 commits into
processtrader wants to merge 4 commits into
Conversation
5338204 to
40142bd
Compare
…ions Add `max_retries` option to crush.json for controlling provider request retries, and send desktop notifications on unrecoverable agent errors. 💘 Generated with Crush Assisted-by: Crush:glm-5.1
💘 Generated with Crush Assisted-by: Crush:glm-5.1
RetryError.Unwrap() returns the last inner error, which is often a ProviderError. errors.As(err, &providerErr) matched before the RetryError branch, making the retry count display dead code. This caused "Stream Transport Error — unexpected EOF" with no retry info instead of "Network Error — unexpected EOF (retried N time(s))". Order RetryError check first and extract ProviderError title/message from the retry chain when present. 💘 Generated with Crush Assisted-by: Crush:glm-5.1
40142bd to
af67d20
Compare
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.
Summary
Configurable max retries: Adds a
max_retriesoption tocrush.jsonunderoptionsto control how many times provider requests are retried on transient failures. Defaults to the library's built-in default (2 retries) when unset.Error desktop notifications: When the agent encounters an unrecoverable error (not a user cancel and not already handled specifically, e.g. Hyper auth), a desktop notification is now sent to alert the user. This is especially useful when a long-running request fails after all retry attempts are exhausted.
Improved network error display: When retries are exhausted due to network failures (connection reset, timeouts, etc.), the error is now shown as
"Network Error"with a clean message like"connection reset by peer (retried 2 time(s))"instead of the raw Go error string.Retry progress notifications: A desktop notification is now shown during each retry attempt, displaying the delay before the next attempt (e.g.
"Retrying in 2s"). This gives users visibility into the retry process instead of silent failures.Configuring max retries
Add to your
crush.json:{ "options": { "max_retries": 5 } }0or unset — uses the library default (2 retries, i.e. 3 total attempts)1— one total attempt, no retries5— up to 5 retries (6 total attempts)Retries apply with exponential backoff and respect provider
retry-afterheaders. Both the main agent and the agentic fetch sub-agent respect this setting.Desktop notifications on error
When all retries are exhausted or an unrecoverable provider error occurs, the user receives a desktop notification:
This complements the existing Hyper re-authentication notification and only fires for non-interactive sessions where the user might not be actively watching the terminal. The detailed error message is always shown in the TUI.
Test plan
"max_retries": 1incrush.json, provoke a transient provider error, verify no retry occurs"max_retries": 0or omit it, verify default retry behavior (2 retries)go test ./internal/agent/ -run TestLastRetryableCause— all 5 sub-tests pass💘 Generated with Crush
Assisted-by: Crush:glm-5.1