This repository was archived by the owner on Mar 15, 2026. It is now read-only.
feat: retry planning/implementation agent runs up to 2 times on error#2
Draft
feat: retry planning/implementation agent runs up to 2 times on error#2
Conversation
When a planning or implementation agent run fails (Error outcome or unhandled Throwable), automatically retry up to 2 times (3 total attempts) before applying error labels and posting an error comment. Retries are transparent on GitHub: the issue stays in its ongoing label state throughout, with error labels and comment only applied on the final definitive failure. - Add `retryCount` field (default 0) to PlanIssueMessage and ImplementIssueMessage DTOs - Restructure PlanningRunExecutor.doExecute and ImplementationRunExecutor.doExecute to capture errors after both finally blocks complete, then dispatch a retry message with a new runId and incremented retryCount if retryCount < MAX_RETRIES (2) - Change handlePrCreated to throw RuntimeException on missing PR metadata so the outer catch can handle it uniformly for retries - Add MAX_RETRIES constant and MessageBusInterface injection to both executors - Add retry test cases to PlanningRunExecutorTest and create ImplementationRunExecutorTest covering all retry and final-failure scenarios 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
retryCountfield (default0) toPlanIssueMessageandImplementIssueMessageDTOsPlanningRunExecutorandImplementationRunExecutorto capture errors after bothfinallyblocks run, then dispatch a retry message with a newrunIdand incrementedretryCountifretryCount < 2; only apply error labels and post a comment on the final definitive failurehandlePrCreatednow throwsRuntimeExceptionon missing PR metadata so the outer catch handles it uniformly for retriesRetries are transparent on GitHub — the issue stays in
planning-ongoing/implementation-ongoingstate throughout, with error labels and comment only appearing after all retries are exhausted.Test plan
PlanningRunExecutorTesttests pass (error-path tests updated to useretryCount=2to hit final-failure path)PlanningRunExecutorTest: error outcome at retry 0/1/2, throwable at retry 0/2,tryCreateRunClaimfailure fallbackImplementationRunExecutorTestcovers the same retry scenarios plus revision field preservation and missing PR metadata retryImplementIssueHandlerTestunchanged — handler is a thin wrapper and unaffectedCloses #1
🤖 Generated with Claude Code