Skip to content

fix(review): add Close button to exit Pi review session#523

Merged
backnotprop merged 3 commits intobacknotprop:mainfrom
gwynnnplaine:main
Apr 10, 2026
Merged

fix(review): add Close button to exit Pi review session#523
backnotprop merged 3 commits intobacknotprop:mainfrom
gwynnnplaine:main

Conversation

@gwynnnplaine
Copy link
Copy Markdown
Contributor

Fixes #522

Had the same issue and couldn't figure out how to close the session without killing the agent, so I tried to fix it.

Added a Close button to the Pi review toolbar. When you have annotations it flips to Send Feedback, so the action always makes sense. On the server side there's a new /api/exit endpoint that resolves the session cleanly.

Hope it helps, let me know if anything looks off!

@gwynnnplaine gwynnnplaine changed the title add Close button to exit Pi review session fix(review): add Close button to exit Pi review session Apr 8, 2026
@backnotprop
Copy link
Copy Markdown
Owner

Awesome!

@gwynnnplaine
Copy link
Copy Markdown
Contributor Author

Hm, probably also we should delete temp local worktree?

@backnotprop
Copy link
Copy Markdown
Owner

@gwynnnplaine yes, if it short circuits that part.

I was thinking I might edit your PR just to make it more agent-agnostic because I think this will be nice for other users. If you don't mind a commit, I'll go ahead and put that in and then merge this for you.

@gwynnnplaine
Copy link
Copy Markdown
Contributor Author

@gwynnnplaine yes, if it short circuits that part.

I was thinking I might edit your PR just to make it more agent-agnostic because I think this will be nice for other users. If you don't mind a commit, I'll go ahead and put that in and then merge this for you.

Sure! I was thinking about making that agnostic, but had no idea how it works on other agents (sorry, I'm Pi addicted). Feel free to commit new changes, or you are busy, I can extend that by myself!

…te mode

Extends the Pi-specific exit/close feature to work across all agent
origins (Claude Code, OpenCode, Copilot CLI, Codex, Gemini CLI) and
adds the same capability to annotation sessions.

- Rename PiReviewActions → AgentReviewActions, remove origin === 'pi' gate
- Add /api/exit endpoint to both Bun and Pi annotate servers
- Add Close button to platform mode (GitHub/GitLab PR review)
- Close always visible; Send Feedback/Annotations appears alongside when
  annotations exist
- Warning dialog when closing with unsent annotations
- Handle exit in all calling layers (hook CLI, OpenCode, Pi extension)
- Fix stale closures: isExiting and showExitWarning in keyboard handler deps
- Fix openLastMessageAnnotation return type to include exit flag
- Make ExitButton title a prop with generic default

For provenance purposes, this commit was AI assisted.
@backnotprop
Copy link
Copy Markdown
Owner

backnotprop commented Apr 10, 2026

Hey, I've pushed updates to your branch that generalize the Close button across all agents and extend it to annotate mode.

Here's where Close lives now:

UI 0 annotations Has annotations
Review (agent) [Close] [Approve] [Close] [Send Feedback] [Approve]
Review (platform) [Close] [Post Comments] [Approve] [Close] [Post Comments] [Approve]
Annotate [Close] [Close] [Send Annotations]
Plan unchanged unchanged

Key changes on top of your work:

  • All agents get Close: removed the origin === 'pi' gate; renamed PiReviewActions to AgentReviewActions
  • Annotate mode: added /api/exit to both Bun and Pi annotate servers, wired up the UI
  • Close always visible: no more flip; Close stays put, Send Feedback/Annotations appears alongside it when there's something to send
  • Warning dialog when closing with unsent annotations ("You have N annotations that will be lost if you close.")
  • Platform mode (GitHub/GitLab PR review) also gets a Close button
  • Fixed a few stale closures in keyboard handler dependency arrays and a missing return type on openLastMessageAnnotation

All exit handlers covered: hook CLI (4 paths), OpenCode (3 paths), Pi extension (3 paths). Plan mode intentionally untouched since Approve/Deny are the right signals there.

Global attachments (pasted/uploaded images without text annotations)
were not counted in the annotate mode exit logic. This meant Close
would fire without warning and Send Annotations would not appear
when only image attachments existed.

For provenance purposes, this commit was AI assisted.
@backnotprop backnotprop merged commit 3b1b331 into backnotprop:main Apr 10, 2026
7 checks 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.

[BUG] No way to end a plannotator review session without killing the Pi agent

2 participants