fix(agent): surface retries and honor Retry-After - #6112
Conversation
Signed-off-by: Johan Schmidt <130892839+GitGeniusX@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03b0911e67
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let first_failure = queue.retry_count(&batch.channel_id) == 0; | ||
| if first_failure { | ||
| spawn_failure_notice( |
There was a problem hiding this comment.
Surface the first recently-active hard-timeout retry
When the first failure is TimeoutKind::Hard { recently_active: true }, the preceding branch requeues the batch without posting the new notice. Because that increments the channel's retry count, this check also suppresses the notice if a later attempt fails through the generic branch. Repeated recently-active hard timeouts can therefore leave the user without feedback until final dead-lettering, contrary to the change's retry-visibility goal; emit the one-shot notice for this retry path as well or track notice delivery separately from the retry count.
AGENTS.md reference: AGENTS.md:L13-L18
Useful? React with 👍 / 👎.
Summary
When a provider turn fails transiently, the harness currently stays silent until the full retry budget is exhausted. For Azure Foundry that can leave a healthy, online agent visibly unresponsive for about 25 minutes. The generic OpenAI-compatible transport also ignores the provider's
Retry-Afterhint on HTTP 429, so its three attempts can land inside the same throttle window.This change:
Retry-Afterhints on the generic OpenAI-compatible transport used by Azure Foundry, falling back to existing jittered backoffRelated issue
Closest existing issue: #5196. Related: #5557 and #5918 / #5975.
This is complementary rather than duplicate work: #5557 is the relay HTTP publish path; this PR changes the
buzz-agentprovider transport. #5975 parks recognized multi-hour subscription-limit errors; this PR gives immediate feedback for the generic retry path and does not change retry/dead-letter policy.Testing
Retry-Afterbefore its successful retrycargo test -p buzz-agent -p buzz-acpcargo clippy -p buzz-agent -p buzz-acp --all-targets -- -D warningscargo fmt --all -- --checkjust ci(workspace lint/tests, desktop, web, Tauri, and 1,465 mobile tests)No desktop or mobile UI changes.
Follow-up
After merge and an upstream image release, downstream deployments can pin the released digest; no deployment-specific fork is required.