This repository was archived by the owner on Mar 15, 2026. It is now read-only.
feat: retry planning and implementation agent runs on error (up to 2 times)#4
Draft
feat: retry planning and implementation agent runs on error (up to 2 times)#4
Conversation
…times) When a planning or implementation agent run fails (either an Error outcome from the agent or an unhandled Throwable), automatically retry up to 2 times (3 total attempts) before applying error labels and posting an error comment. During retries the issue stays in its ongoing label state, so retries are transparent on GitHub — only the final outcome surfaces. On each retry a new run claim is created and a new message is dispatched with retryCount+1. Changes: - Add retryCount field (default 0) to PlanIssueMessage and ImplementIssueMessage - Restructure PlanningRunExecutor.doExecute to capture errors after finally blocks complete, then retry or apply final error handling - Restructure ImplementationRunExecutor.doExecute the same way; also change handlePrCreated to throw RuntimeException on missing PR metadata so the error propagates to the retry path - Inject MessageBusInterface into both executors for retry dispatch - Add MAX_RETRIES = 2 constant to both executors - Update PlanningRunExecutorTest: add fake message bus, configurable tryCreateRunClaim result, and full retry scenario coverage - Add ImplementationRunExecutorTest with equivalent retry test coverage Closes #1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
planning-ongoing/implementation-ongoinglabel state throughout; only the final outcome (success or error) surfacesrunIdand a new message is dispatched withretryCount + 1; iftryCreateRunClaimfails during retry setup, falls back to immediate final-failure handlingTest plan
PlanningRunExecutorTestandImplementationRunExecutorTestpass (verified locally)ImplementIssueHandlerTesttests still passongoingplanning-errored/implementation-erroredlabel is appliedCloses #1