fix: retry dropped permission replies - #14360
Conversation
Auto-approve and manual permission replies use a pooled HTTP connection to the CLI backend. When that socket is closed before the response completes, the reply fails and the permission request stays pending, so the agent waits and the chat shows a permission prompt that cannot be resolved. Retry only transient transport failures, and never retry a decisive server error. Apply the retry to manual replies, auto-approve replies, and the pending-permission recovery list.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summary (commit 675ed4b)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 675ed4b)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (6 files)
No new memory leaks or unbounded resources were introduced: Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
Point the transient-classifier comment at the VS Code mirror it matches, drop the unreachable trailing throw, and assert the cancellation path stops the retry loop.
What Problem This Solves
Auto-approve and manual permission replies travel over a pooled HTTP connection to the CLI backend. When that socket is closed before the response completes, the reply fails with a transient transport error and the permission request stays pending. With auto-approve on, the agent waits indefinitely. With auto-approve off, the prompt cannot be resolved.
Why This Change Was Made
The reply path had no retry for transport failures, so a single dropped connection stranded the request. The fix retries only transient transport failures (including undici's
TypeError: terminated) and never retries a decisive server error, so a missing request or a client/server mismatch still fails fast. It covers manual replies, auto-approve replies, and the pending-permission recovery list.User Impact
Evidence
Reproduced in isolated VS Code with the self-test harness and a TCP proxy that drops the first permission reply:
Focused checks: SDK permission tests 13 passed, extension permission recovery tests 33 passed, extension typecheck and lint passed.
This fixes the dropped-reply failure only. It does not address separate reports of "Unknown permission route" or an unclickable "Allow once".