Repository navigation
[CTX-1457] fix(ui): prune the emptied workspace when its last shell exits (#2525) - #2535
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 54 minutes. View limit details
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 |
Contributor
Author
|
Review NEEDS-FIX addressed in 2f5c53f.
|
Xuepoo
force-pushed
the
ctx-1457/fix-last-panel-exit
branch
from
October 22, 2026 21:27
2f5c53f to
8e34d83
Compare
Xuepoo
force-pushed
the
ctx-1457/fix-last-panel-exit
branch
from
October 23, 2026 01:50
8e34d83 to
550f3b8
Compare
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.
Priority: P0 | Area: area:stability | Labels: fix,P0,area:stability | Milestone: v0.0.27 | RFC: - | Task: CTX-1457
Problem
Reported in #2525: after layout churn (many panels/workspaces, deletes, resizes,
fullscreen), the last panel of a workspace hangs on
exit/Ctrl+D and sometimesstays behind as a ghost. The shell is gone but the tile stays focused and
silently drops input.
Deterministic repro on an isolated Xvfb instance (own PIDs, no desktop
interaction):
exitto the active workspace's only panel.Before this change: the workspace stayed with a session-less tile,
has_session=false,and the focused view no longer had an input path. The primary path had the same
defect: it logged
closing primary pane, butclose_focused_leafrefuses asingleton layout, leaving the dead primary tile in place.
Root cause
TerminalApp::reap_exited_shellsdid not mirror the close-view workspaceprune (CTX-1297). Exiting the last panel of a workspace is a panel close, and
the close gesture prunes the emptied workspace and follows focus to a surviving
one. The reap path instead kept a session-less tile by design ("CTX-1044"),
which wedges input; the primary branch additionally relied on
close_focused_leaf, which cannot remove a workspace's only leaf.Fix
Runtime::workspace_index_of_view/workspace_panel_counts(the latterreturns
(tiled, floats); active slot from the live layout, inactive slotsfrom their stash).
workspace and another workspace survives (no floats/pins), prune that
workspace exactly like the close-view gesture instead of keeping a ghost.
layout surgery.
Review fix: zoom backup on inactive workspaces
An inactive workspace stores its zoom proxy (one leaf) as its stashed
layout while the real tree lives in the app-side zoom backup keyed by workspace
sequence. The prune decision must read the backup:
TerminalApp::workspace_real_panel_countsubstituteschrome.zoom.backup_leaf_ids_for_seq(workspace_seq_at(index))for the stashedtiled count, keeping the slot's float count.
with a hidden live pane no longer reads as a singleton and no longer prunes
the workspace. It falls through to the leaf path instead.
Regression coverage
reap_exited_zoomed_pane_in_inactive_workspace_keeps_workspace(new):ws1 has two panes, pane A zoomed, switch to ws2, A exits — workspace count
stays 2, the hidden pane's session and real-tree leaf survive.
reap_exited_pane_in_inactive_workspace_prunes_emptied_workspace(new):inactive sole-pane exit still prunes.
reap_exited_last_leaf_of_workspace_prunes_the_workspace(updated),reap_exited_primary_last_leaf_of_workspace_prunes_workspace(new).workspace_panel_counts_and_view_owner_cover_active_and_stashed_slots(new runtime helper unit test).
reap_exited_*, 14close_view_*, and 20workspace_*tests pass;fmt and clippy
-D warningsclean.Verified on the real event loop with the release binary: exiting the active
workspace's only panel (and Ctrl+D on the primary) prunes the workspace, keeps
the surviving workspace's live shell focused, and the app stays responsive.
A single-workspace last shell still exits in ~125 ms with the session save.
Residuals (this PR does not close #2525)
not reproduced here: 25+ minutes of real-key churn (7 panes, btop, zoom,
fullscreen, resizes, 7-shell workspace close) on isolated Xvfb stayed
responsive (12-57 threads, 58-118 fds, no watchdog stall). The remaining
freeze is likely compositor/GPU-present specific; the owner's process was
once observed in
drm_syncobj_array_wait_timeout, and the stall watchdog isstill opt-in.
BITTY_STALL_WATCHDOG=1) onthe next Wayland occurrence, and audit the synchronous
wgpuget_current_texturewait (1 s acquire timeout) plus serial PTY teardownjoins during pane/workspace close.
dead zoomed leaf in the backup) remains the pre-existing leaf-path behavior;
this fix only prevents the unsafe prune.
allocator fix.
Refs #2525, #2454, #2488