Skip to content

[runtime] Primary-shell exit tears down a live zero-PTY plugin panel #3201

Closed

Description

@Xuepoo

Priority: P1 | Area: runtime | Labels: fix, P1, area:runtime | Milestone: v0.1.0 | RFC: Pane!=PTY | Related: #3199 (PR #3200)

Summary

After #3200 made a plugin-created Dwindle panel a first-class zero-PTY leaf, the app's exit
condition still treats "no PTY session" as "nothing left to show".

crates/bitty-terminal/src/terminal_app.rs (~line 4817) computes the exit reason from
pane_session_count(). With one primary shell plus one live plugin panel
(PanelType::Rich/Helper, zero PTY sessions of its own), the count reaches zero when the
primary shell exits, the app returns AppExiting, and the event handler destroys the window
together with the still-live plugin panel — its declarative scene and panel record go with it.

This contradicts the accepted Panel-outlives-PTY direction: a Panel is a workspace leaf that
outlives its runtime session, and a zero-PTY leaf is not inert.

Scope

  • Make the exit decision account for live leaves that own no PTY session (plugin panels,
    rich content) instead of pane_session_count() alone.
  • Preserve today's behaviour when nothing live remains (last shell exits with no panels ⇒ the
    window still closes; do not turn this into "app never exits").
  • Cover the three shapes with tests: shell only, shell + live plugin panel, plugin panel only.
  • Decide explicitly (and record it) whether a window whose only remaining leaf is a plugin
    panel keeps running or closes — the UX reference rule (ghostty/kitty close the window when
    the shell exits) and the Panel-outlives-PTY invariant pull in opposite directions here, so
    the decision belongs in the terminal-platform docs, not in an ad-hoc condition.

Evidence

Activity

  1. added this to the v0.1.0 milestone on Nov 16, 2026
  2. added
    fix
    P1
    area:runtime
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1area:runtimefix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions