Address Copilot review on PR #3 (permission deadlock + replay cleanliness) - #4
Merged
Conversation
…render-only headless-fallback notice Addresses Copilot review comments on PR #3: - handlePermission stored an unresolvable pending permission when currentRunId was null or during session/load replay — the JSON-RPC request would deadlock the harness. Now auto-cancels (pure shouldAutoCancelPermission guard, tested), mirroring the session/update notification guard. - the '[interactive session unavailable — ran headless]' note was a content.delta, so it entered turn.text and buildReplayPrompt would replay it to the next provider as assistant speech. Now a render-only tool.updated row. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR is a focused follow-up to the interactive Copilot ACP transport (pillar 1), addressing two correctness issues: avoiding permission-request deadlocks when no UI turn can surface a permission card, and preventing transport diagnostics from polluting cross-provider replay prompts.
Changes:
- Add a pure guard (
shouldAutoCancelPermission) and use it to auto-cancel ACP permission requests when there’s no active run or while replayingsession/loadhistory, preventing unresolvable pending permissions. - Change the Copilot interactive→headless fallback notice to emit as a render-only
tool.updatedrow (instead ofcontent.delta) so it can’t be replayed as assistant text. - Add unit tests covering the new guard predicate behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main/runtime/ipc.ts | Emits the interactive-fallback diagnostic as tool.updated (render-only) instead of content.delta to keep replay prompts clean. |
| src/main/runtime/acp/acpSession.ts | Introduces and applies shouldAutoCancelPermission to prevent ACP permission-request deadlocks during no-run or replay states. |
| src/main/runtime/acp/acpSession.test.ts | Adds unit tests validating the guard’s auto-cancel vs. surface-card behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Follow-up to the merged pillar-1 PR #3, addressing both Copilot inline comments.
Fixes
Permission-request deadlock (
acpSession.ts) —handlePermissionstored an unresolvable pending permission when no run was active or duringsession/loadhistory replay: the event went out under runIdunknown(dropped by the renderer, so no card ever appeared), and the JSON-RPC request was never answered, hanging that harness turn. Now auto-cancels in those states via a pure, testedshouldAutoCancelPermissionguard that mirrors the existingsession/updatenotification guard.Replay pollution (
ipc.ts) — the[interactive session unavailable — ran headless]fallback note was emitted ascontent.delta, so it accumulated intoturn.textandbuildReplayPromptwould replay it to the next provider as assistant speech. Now a render-onlytool.updatedrow (excluded from replay, since tools/permissions are never read bybuildReplayPrompt).Verification
🤖 Generated with Claude Code