Repository navigation
fix(desktop): confirm before closing active ports - #6007
Merged
Merged
Conversation
Contributor
📝 WalkthroughWalkthroughPort termination now requires confirmation through a shared, suppressible alert flow. Single and bulk kill actions stop on cancellation, while tests cover alert copy, dismissal, suppression persistence, and unavailable-alert fallback. ChangesPort termination confirmation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant usePortKillActions
participant confirmClosePorts
participant Alert
participant PortKilling
Caller->>usePortKillActions: invoke port kill action
usePortKillActions->>confirmClosePorts: request confirmation
confirmClosePorts->>Alert: display confirmation
Alert-->>confirmClosePorts: confirm or cancel
confirmClosePorts-->>usePortKillActions: return boolean
alt confirmed
usePortKillActions->>PortKilling: terminate selected ports
PortKilling-->>Caller: return kill result
else cancelled
usePortKillActions-->>Caller: return undefined or empty array
end
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Ready to review this PR? Stage has broken it down into 2 individual chapters for you:
Chapters generated by Stage for commit ec2814c on Jul 27, 2026 11:57pm UTC. |
Roshvan
marked this pull request as ready for review
July 28, 2026 00:02
Contributor
Author
Roshvan
marked this pull request as draft
July 28, 2026 00:05
saddlepaddle
approved these changes
Jul 28, 2026
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.



Summary
Why
The ports hover card called the kill path immediately. “Close all ports” could therefore terminate running processes with no confirmation, even though terminal and agent close flows already protect the same destructive outcome.
The root cause was that
usePortKillActionsdelegated directly tokillPortTargetwithout a destructive-action guard. Centralizing the guard in that hook covers both sidebar implementations and prevents individual port buttons from bypassing it.Impact
Users now see a destructive confirmation before closing one or many active ports. Cancel and dismiss preserve the processes; confirming keeps the existing kill and refresh behavior. The optional suppression setting stays consistent with other running-process warnings.
Verification
bun run lint:fixbun run lintbun test apps/desktop/src/renderer/hooks/ports/usePortKillActions/confirmClosePorts.test.ts apps/desktop/src/renderer/hooks/ports/usePortKillActions/killPortTarget.test.tsbun run --cwd apps/desktop typecheckhttp://localhost:3105, workspace route/v2-workspace/06367ee2-0f02-4525-a2b8-f4a23923c0eaScreenshots are attached in the visual verification comment below.
Summary by cubic
Add a confirmation before closing active ports in the desktop app. Protects both single-port and “Close all ports” actions, matching terminal close behavior and preventing accidental process kills.
Written for commit ec2814c. Summary will update on new commits.
Summary by CodeRabbit