fix: add max-retry force-proceed to prevent infinite shutdown loop#3265
Merged
fix: add max-retry force-proceed to prevent infinite shutdown loop#3265
Conversation
When in-process teammates get stuck and never respond to shutdown_request, the team lead was previously instructed to "NEVER exit without shutting down all teammates first" and to "send it again" indefinitely. This creates an infinite loop that blocks TeamDelete and the non-interactive harness. This fix: - Replaces "NEVER exit" with a 3-round max-retry policy - After 3 unanswered shutdown_requests (≈6 min), mark teammate as non-responsive and proceed to TeamDelete without waiting - Fixes time budget inconsistency in Monitor Loop section (was "10/12/15 min", now matches Time Budget "20/23/25 min") Fixes #3261 Agent: issue-fixer Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
louisgv
approved these changes
Apr 11, 2026
Member
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED ✓
Commit: 5790bad
Summary
This PR fixes issue #3261 by adding max-retry logic to prevent infinite shutdown loops when teammates fail to respond. Changes are documentation-only (prompt file) with no security implications.
Findings
No security vulnerabilities detected.
Changes reviewed:
- Time budget increased: 10/12/15 min → 20/23/25 min (allows more work time)
- Max retry logic: Limits shutdown_request to 3 attempts per stuck teammate
- Prevents infinite waiting loops that block TeamDelete
Tests
✓ All 2104 tests pass
✓ No code changes (documentation only)
✓ Addresses root cause from issue #3261
Risk Assessment
- Command injection: N/A (no executable code)
- Credential leaks: N/A (no secrets handling)
- Path traversal: N/A (no file operations)
- Logic bugs: Fix improves reliability by preventing infinite loops
-- security/pr-reviewer
This was referenced Apr 11, 2026
Open
Open
bug: code-health agent stuck in plan mode loop, blocked TeamDelete (refactor cycle 2026-04-09)
#3249
Open
Open
Open
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.
Why: When in-process teammates never respond to `shutdown_request`, the refactor team lead looped forever ("NEVER exit without shutting down all teammates first" + "send it again"), blocking `TeamDelete` and the non-interactive harness. This is the root cause of recurring stuck-agent incidents (#3244, #3249, #3260, #3261).
Changes
How it prevents issue #3261
Before: team lead sends shutdown_request → no response → sends again → ... (forever)
After: team lead sends shutdown_request → no response → sends again (×3 total) → proceeds to TeamDelete regardless
Limitations
This is a prompt-level mitigation. The deeper harness issue (TeamDelete refusing to proceed when members are still "active" at the SDK level per #3154) still requires SDK-level investigation. This fix prevents the prompt from contributing to the loop.
Fixes #3261
-- refactor/issue-fixer