Skip to content

[Agent] Restore missing windows into existing resurrect sessions - #36

Open
tarikguney wants to merge 2 commits into
psmux:mainfrom
tarikguney:fix/resurrect-existing-session-windows
Open

[Agent] Restore missing windows into existing resurrect sessions#36
tarikguney wants to merge 2 commits into
psmux:mainfrom
tarikguney:fix/resurrect-existing-session-windows

Conversation

@tarikguney

Copy link
Copy Markdown
Collaborator

Coauthored by GitHub Copilot

TL;DR: Reuse existing resurrect sessions while restoring saved windows that are missing, instead of skipping the whole session.

Key changes

  • Reconcile saved windows by name when a session already exists.
  • Preserve matching live windows while fully restoring missing windows and their panes, layouts, titles, processes, and active state.
  • Keep @resurrect-overwrite on behavior unchanged.
  • Add regression coverage for restoring a nested window into an existing session.
Validation
  • tests\test_resurrect_overwrite.ps1: 9 passed, 0 failed
  • tests\test_resurrect_guard.ps1: 7 passed, 0 failed
  • git diff --check: clean

Final Validation Checklist

  • Confirm restoring into an existing session adds missing saved windows without duplicating matching windows.
  • Confirm restored windows retain their saved pane layout and active pane/window state.
  • Confirm @resurrect-overwrite on still replaces an existing session.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

The current name-based reconciliation can fail to restore missing windows when saved/live sessions contain duplicate window names, and the regression test should also assert that matching windows are not duplicated.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates psmux-resurrect restore behavior so that when a saved session already exists, the restore process reuses it and restores only the saved windows that are missing (instead of skipping the entire session), while keeping @resurrect-overwrite 'on' semantics intact.

Changes:

  • Add “existing session reconciliation” path that enumerates live windows and restores only missing saved windows (including panes/layout/processes) into the running session.
  • Update overwrite regression test to cover restoring a missing nested window into an already-running session.
  • Refresh user-facing docs/comments to reflect “reuse + restore missing windows” as the default behavior.
File summaries
File Description
tests/test_resurrect_overwrite.ps1 Extends the hermetic overwrite regression test to assert missing-window restoration when a session already exists.
psmux-resurrect/scripts/restore.ps1 Implements reconciliation logic for existing sessions: detect live windows and restore only the missing saved ones; updates summary reporting.
psmux-resurrect/README.md Updates documented default behavior and examples from “skip existing sessions” to “reuse and restore missing windows.”
psmux-resurrect/psmux-resurrect.ps1 Updates inline option documentation for the new default behavior.
psmux-resurrect/plugin.conf Updates inline option documentation for the new default behavior.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread psmux-resurrect/scripts/restore.ps1
Comment thread tests/test_resurrect_overwrite.ps1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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