Skip to content
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
JOORVIS wants to merge 1 commit intomainfrom
feature/retry-planning-implementation-errors
Draft

feat: retry planning/implementation agent runs up to 2 times on error#2
JOORVIS wants to merge 1 commit intomainfrom
feature/retry-planning-implementation-errors

Conversation

@JOORVIS
Copy link

@JOORVIS JOORVIS commented Feb 24, 2026

Summary

  • Add retryCount field (default 0) to PlanIssueMessage and ImplementIssueMessage DTOs
  • Restructure PlanningRunExecutor and ImplementationRunExecutor to capture errors after both finally blocks run, then dispatch a retry message with a new runId and incremented retryCount if retryCount < 2; only apply error labels and post a comment on the final definitive failure
  • handlePrCreated now throws RuntimeException on missing PR metadata so the outer catch handles it uniformly for retries
  • Add comprehensive retry test cases for both executors

Retries are transparent on GitHub — the issue stays in planning-ongoing / implementation-ongoing state throughout, with error labels and comment only appearing after all retries are exhausted.

Test plan

  • Existing PlanningRunExecutorTest tests pass (error-path tests updated to use retryCount=2 to hit final-failure path)
  • New retry tests in PlanningRunExecutorTest: error outcome at retry 0/1/2, throwable at retry 0/2, tryCreateRunClaim failure fallback
  • New ImplementationRunExecutorTest covers the same retry scenarios plus revision field preservation and missing PR metadata retry
  • ImplementIssueHandlerTest unchanged — handler is a thin wrapper and unaffected

Closes #1

🤖 Generated with Claude Code

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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recover from planning or implementation errors

1 participant