Skip to content

feat(sessions): add Ctrl+D shortcut to delete sessions (#551) - #552

Open
rhine9473 wants to merge 1 commit into
openpi-dev:mainfrom
rhine9473:feat/sessions-delete-shortcut
Open

rhine9473 wants to merge 1 commit into
openpi-dev:mainfrom
rhine9473:feat/sessions-delete-shortcut

Conversation

@rhine9473

Copy link
Copy Markdown
Contributor

Summary

Fixes #551.

This PR adds a Ctrl+D shortcut to delete sessions directly from the /sessions picker:

  1. Shortcut & Binding: Pressing Ctrl+D on a selected session triggers the deletion workflow.
  2. Confirmation Safeguard: Prompts with Delete session? Enter confirm · Esc cancel to prevent accidental deletion.
  3. Active Session Protection: Blocks deleting the currently active session with an error notification.
  4. Safe Deletion: Uses the system trash CLI when available, falling back to permanent unlink.
  5. Real-Time UI Update: Removes the deleted session from the list in real-time, advances selection to adjacent session, and updates preview smoothly.
  6. Unit Tests: Adds test coverage for deleteSessionFile under tests/extensions/sessions/sessions.test.ts.

Testing

  • node --test --experimental-strip-types tests/extensions/sessions/sessions.test.ts (7 passed, 0 failed)
  • Verified locally in interactive TUI on Windows: Ctrl+D triggers deletion confirmation, Enter deletes the file and refreshes list, Esc safely cancels.
  • Biome check verified clean.

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

审查提交:0cd022d5ae42785e9e4bf41164b7f595e817235e

需要修改后再合并。

具体问题

P2 — 同步且无超时的 trash 命令可冻结整个 Pi 进程 · extensions/sessions/sessions.ts:440

Synthetic trash helper sleeps 2 seconds; deleteSessionFile blocks before returning its Promise and 10ms timer cannot fire. No timeout/cancellation; a stalled helper can hang indefinitely. Use bounded async process execution.

验证范围

Complete three-file diff inspected; session tests and isolated fake-trash reproduction saved. Active-session rejection and confirm/cancel wiring inspected.

限制与后续

No real TUI acceptance or Windows recycle-bin integration.

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.

feat(sessions): 为 /sessions 增加 Ctrl+D 快捷删除会话功能(对齐原生 /resume 体验)

2 participants