Skip to content

Address Copilot review on PR #3 (permission deadlock + replay cleanliness) - #4

Merged
njfife merged 1 commit into
mainfrom
worktree-p1-review-fixes
Jul 9, 2026
Merged

Address Copilot review on PR #3 (permission deadlock + replay cleanliness)#4
njfife merged 1 commit into
mainfrom
worktree-p1-review-fixes

Conversation

@njfife

@njfife njfife commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Follow-up to the merged pillar-1 PR #3, addressing both Copilot inline comments.

Fixes

  1. Permission-request deadlock (acpSession.ts) — handlePermission stored an unresolvable pending permission when no run was active or during session/load history replay: the event went out under runId unknown (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, tested shouldAutoCancelPermission guard that mirrors the existing session/update notification guard.

  2. Replay pollution (ipc.ts) — the [interactive session unavailable — ran headless] fallback note was emitted as content.delta, so it accumulated into turn.text and buildReplayPrompt would replay it to the next provider as assistant speech. Now a render-only tool.updated row (excluded from replay, since tools/permissions are never read by buildReplayPrompt).

Verification

  • New unit test for the guard predicate (auto-cancel when no run / replaying; surface the card only during a live non-replaying run). 114 tests across 20 files, typecheck + build green.

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings July 9, 2026 14:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 replaying session/load history, preventing unresolvable pending permissions.
  • Change the Copilot interactive→headless fallback notice to emit as a render-only tool.updated row (instead of content.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.

@njfife
njfife merged commit dacf983 into main Jul 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants