Skip to content

fix(workspace): reconcile exited sessions to close stale pane/workspace - #2

Merged
freecodetiger merged 2 commits into
mainfrom
copilot/fix-workspace-exit-stuck-issue
Jul 29, 2026
Merged

fix(workspace): reconcile exited sessions to close stale pane/workspace#2
freecodetiger merged 2 commits into
mainfrom
copilot/fix-workspace-exit-stuck-issue

Conversation

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Handle PTY sessionClosed events in AppModel so exit no longer leaves a dead pane/workspace rendered with no live session.

  • Root cause
    • TerminalEvent.sessionClosed was emitted but not consumed by workspace runtime state.
  • Behavior change
    • Closed session in multi-pane workspace → remove only that pane.
    • Closed session as last pane → close that workspace runtime; if none remain, close terminal window.
  • Implementation
    • Added SessionClosedAction decision path + reconciliation flow in AppModel.
    • Added focused app tests for action selection.
case .sessionClosed(let session):
  reconcileClosedSession(session)

Layer touched

  • PTY / sessions
  • VT bridge / terminal state
  • Renderer (Metal / cell-grid / text)
  • Smooth scroll / history browse
  • Workspace / splits / panes
  • Settings / themes / UI chrome
  • AI CLI integration (notifications, side input)
  • Docs / CI / scripts
  • Tests only

User-visible behavior

Typing exit in a pane now tears down that exited session from workspace state instead of leaving the UI stuck on a dead terminal surface.
If that pane was the workspace’s last live session, the workspace closes; if it was the last workspace, the window closes.

How I tested

scripts/check-architecture.sh
swift build            # blocked in this environment: missing vendored ghostty/zig-out artifacts
swift test             # blocked in this environment: missing vendored ghostty/zig-out artifacts
swift build && swift test && scripts/check-architecture.sh
# UI / renderer changes: also
./scripts/build-app-bundle.sh release

Checklist

  • swift test passes
  • scripts/check-architecture.sh passes (Core does not import SwiftUI)
  • Commit messages follow Conventional Commits
  • Docs updated if applicable

Copilot AI changed the title [WIP] Fix workspace stuck after executing 'exit' command fix(workspace): reconcile exited sessions to close stale pane/workspace Jul 29, 2026
Copilot AI requested a review from freecodetiger July 29, 2026 06:28
@freecodetiger
freecodetiger marked this pull request as ready for review July 29, 2026 06:45

@freecodetiger freecodetiger left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

well

@freecodetiger
freecodetiger merged commit 443a6a6 into main Jul 29, 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.

[Bug]: The workspace stuck after executing 'exit'

2 participants