Repository navigation
fix(workspace): closing the last editor keeps the workspace selected - #471
Merged
Merged
Conversation
nplez1
force-pushed
the
nplez1/issue-96-empty-tabs-state
branch
from
November 26, 2026 07:48
cb9b0bb to
815fb3e
Compare
nplez1
added a commit
that referenced
this pull request
Nov 26, 2026
…er feature's PR (#484) #466 wired `check-host-mesh-upstream-seams` into the lint gate, where it runs on every pull request, and it failed on any upstream-owned file a diff touched. The first branch to run it after that merge was #471, a workspace state fix touching eight upstream renderer files and no host-group seam at all, so the gate went from green to red for a whole class of work. A register of one feature's surface cannot demand a declaration from features it does not describe. The budget of a declared seam still fails hard — that is the guarantee the file exists to keep — and an undeclared upstream file is reported as a note. `--strict` restores the red for the host group's own branches, where an undeclared hook is exactly the sprawl the check was built to catch. The same change fixes a latent crash the old exit-early path hid: the verbose listing read `seam.budget` for every touched file.
…pty-tabs surface #185 kept an emptied workspace selected for terminal, browser and chat closes, but the two editor close paths still wrote the old landing patch: closing the last file of a workspace with no terminal or browser row (for example after the terminal was closed first) nulled activeWorktreeId and showed Landing. - closeFile and closeAllFiles no longer deselect the workspace; the now-unused unifiedTabsKeepWorktreeSelected goes with them. - The empty-tabs surface also renders when this pane has already shown content, so a last chat, browser or editor close that writes no terminal close record lands on the surface instead of a blank pane. The close record still governs re-activation and restart, where the pane has no history. - Delete tabs-empty-workspace.ts: emptiedWorktreeLandingPatch and landOnEmptiedWorktree had no callers after a sync re-homed them. Refs #96 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t visit Review round 1 of the editor-close fix. - The pane's "has shown content" mark resets whenever its workspace leaves the screen, so a retained pane cannot flash the surface on a later visit: sleep deselects before tearing tabs down, and an unrecorded empty workspace re-seeds on return. A host list that drops every row and re-mirrors while on screen is the remaining case, noted at the mark. - Pin the store invariant: closeFile and closeAllFiles on the only file of the active workspace leave it selected. A sync restored the landing patch once already. - Prune the layout-writer baselines after tabs-empty-workspace.ts went away. Refs #96 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… pins Refs #96 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… files The lint gate's check-upstream-file-comments step counted 9 fork comment lines this branch added to upstream-owned files (4776 against a baseline of 4767). - Drop the two "no deselect" comments in close-file-action.ts and recently-closed-editor-tabs.ts; the rationale is in the fix commit. - Fold the surface gate's two comment blocks in useTabGroupWorkspaceModel.ts into one six-line block, under the file's baseline of seven. - Lower the baseline to 4766 with --prune. Moved out of the code: a host list that drops every row and re-mirrors while its workspace is on screen shows the empty-tabs surface until its rows return. Refs #96 Co-Authored-By: Claude Opus 5.5 <[email protected]>
nplez1
force-pushed
the
nplez1/issue-96-empty-tabs-state
branch
from
November 26, 2026 08:23
815fb3e to
a04a1c9
Compare
nplez1
added a commit
that referenced
this pull request
Nov 26, 2026
…repeating them R4's minors: the seam paragraph pointed at "the anchors below" when they sit above it and repeated the allowlist paragraph's sentence; and the Verified paragraph credited two of the three pre-rebase dispatches while saying three. The run at 449bc7d — the rebased branch — is green on all three legs, the test that reddened taking 26,170 ms. Rebased again onto 8293fd7 (#471), which pruned the comment baseline by one: the entry's 4764/4764 is now 4763/4763.
lab-agent-np Bot
added a commit
that referenced
this pull request
Nov 26, 2026
* local(test): the perf contract Windows reddens on wall clock, not its count fork-performance-contracts reddened on main at 767c078 (run 45683322849): the windows-latest leg timed out at 30s on journal-domain-operation-window.performance.test.ts:377, while the other two legs passed and the 11-23 run was green only because the file had not reached main yet. The contract counts rows returned, not time. Its fixture builds ten chats of up to 500 turns in tmpdir(), which is 1.6s here and 33,065ms on windows-2022 — Defender scans every write, so the per-turn cost is ~20x and no product code is slow. Two closing }) lines become }, 120_000): the failing test, which upstream fixed the same way in 7b6c852 (stablyai#47789) after our sync base, and the file's other fixture-heavy test, which passed by 3.5s on that runner (26,488ms of 30s on windows-2022, 18,920ms on ubuntu-24.04) and is the slowest test in the lane. No allowlist widened: both tests still run on all three legs and assert the same counts. LOCAL-PATCHES.md carries the reason and the anchors. * local(test): the timeout bumps carry the reason the flaky-test ratchet demands `pnpm check:changed` refused the two `}, 120_000)` lines: the fork's `test-timeout-needs-reason` rule requires a reason comment directly above a per-test timeout, and that rule is right — it is what stops a timeout bump from hiding a slow test. Each comment is one line marked `fork-comment-ok:`, so `check-upstream-file-comments` stays at 4764/4764 rather than growing: the reason belongs in LOCAL-PATCHES.md, and the marker is the documented way to put the pointer above upstream's code. Also corrects the entry from the review: twelve chats, not ten, and the Defender explanation is stated as the likely cause rather than a measured one. * local(test): declare the test file's six-line seam, as the seams register requires `gate-lint`'s `check-host-mesh-upstream-seams` refused the change: an upstream-owned file the fork touches must be a declared seam with a measured budget, so the surface a sync pays for stays visible instead of silent. Budget 6 is what this costs today (two timeouts, two reason comments, two replaced lines). It only shrinks: the next sync brings upstream's own `}, 120_000)` and comment, after which our line there is identical. * local(test): record the green Windows run, and what the sync will collide with The delta review found the entry claiming the next sync "needs no decision": upstream 7b6c852 inserts its comment at exactly the spot our `fork-comment-ok:` line occupies, so that hunk collides. The resolution is now written down: keep upstream's comment, drop ours, keep the timeout. The run evidence replaces the forward reference: run 45780910456 at 803bad1 is green on all three legs, the test that reddened taking 26,610 ms against 33,065 ms on the red run. * local(test): name both dispatches, and the tests by title rather than by line R3's minors: the entry credited only one of the two green dispatches, and the line numbers are where the tests sat on the red run — they have moved. The seam paragraph names the test it means instead of "the second". * local(test): drop the seam row #484 made unnecessary, and wrong to keep main's #484 scoped `check-host-mesh-upstream-seams` to the host group's own diffs: an undeclared upstream file is a note for any other feature, and only a declared seam's budget fails hard either way. This diff carries no hosts path, so the row was not required — and keeping it would have put a hard budget on a test file that is not hosts work, so the next branch to grow it would red the lint gate for a reason #484 exists to remove. The register is main's file again; the entry records why, and its anchors are the two `it(...)` titles. * local(test): record the post-rebase run, and the two anchors without repeating them R4's minors: the seam paragraph pointed at "the anchors below" when they sit above it and repeated the allowlist paragraph's sentence; and the Verified paragraph credited two of the three pre-rebase dispatches while saying three. The run at 449bc7d — the rebased branch — is green on all three legs, the test that reddened taking 26,170 ms. Rebased again onto 8293fd7 (#471), which pruned the comment baseline by one: the entry's 4764/4764 is now 4763/4763. --------- Co-authored-by: Nathan Plesnicher <[email protected]>
4 tasks
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.
Refs #96
Possibly already fixed — what #185 already delivered
Most of #96 shipped in #185 (
095cf327059, merged 2026-10-25, "Refs #96"):terminal-tab-actions.ts:244-268,tabs-close-actions.ts:184-186).WorkspaceEmptyStaterenders inTabGroupPanel.tsx:402.use-worktree-sleep-state.ts:73-109).worktree-initial-terminal-seeding.ts:190-198,use-terminal-startup-activation.ts:87-91).The tests the issue names (
store-active-worktree-tab-close.test.ts,worktree-activation-emptied-workspace-reseed.test.ts) were deleted upstream;workspace-emptied-on-purpose.test.ts(10 cases) still passes.What this PR changes
closeFileandcloseAllFiles(close-file-action.ts,recently-closed-editor-tabs.ts) still wrote the landing patch feat(workspace): keep an emptied workspace open on its own empty-tabs surface #185 removed elsewhere: open a file, close the terminal, close the file, and the workspace dropped to Landing. They now keep it selected;unified-tabs-keep-worktree-selected.ts, used only there, is deleted.useTabGroupWorkspaceModel.tsalso shows the empty-tabs surface when the workspace was emptied while on screen, which covers a last chat, browser or editor close that writes no terminal close record. The mark resets whenever the workspace leaves the screen, so a retained pane cannot carry it into a later visit (sleep, or an unrecorded empty workspace re-seeding on return).tabs-empty-workspace.ts(emptiedWorktreeLandingPatch,landOnEmptiedWorktree) had no callers after a sync re-homed it; deleted with its re-export.last-editor-close-keeps-workspace.test.ts: realcloseFile/closeAllFileson the only file of the active workspace write no landing patch. Fails on the base versions (expected null to be 'wt-1').pnpm check:layout-writer-ratchets --prune). Besides the deletedtabs-empty-workspace.tsrow, the prune removed four rows already stale on base —pty-binding-persistence.ts,ssh-target-id-migration.ts,use-agent-pane-threads.ts,use-worktree-activity-statuses.ts. Unrelated drift; counts only went down.Remaining gaps (why this is
Refs, notFixes)Verification
Rebased onto
main@323e127eb81after the conflict, then again onto1c437ac03c3once the gate fix belowlanded. The only conflicting file was
local/upstream-file-comments-baseline.json(a regenerated ratchetartifact), resolved as the union of both sides —
total4767 → 4763 anduseTabGroupWorkspaceModel.ts7 → 6,measured by
node local/check-upstream-file-comments.mjs(4763/4763, 0 stale). No source hunk conflicted:mainchanged none of the files this branch touches, and the code commits are byte-identical to the reviewed
R2.Every row below was re-run on the final revision.
The lint gate was red on this branch for a reason that was not this branch's: #466 wired a host-group seam
register into
gate-lint.mjswhich failed on any upstream-owned file a diff touched, and this diff toucheseight of them. JSON that the diff does not declare is not a declaration this PR can make honestly, so it is fixed
where the defect is — #484 scopes the register to that feature's own diffs and is on
mainas1c437ac03c3.The gate is green here now.
pnpm tc:webpnpm test src/renderer/src/store/slices/editor/closing/last-editor-close-keeps-workspace.test.ts --maxWorkers=2pnpm test src/renderer/src/components/tab-group/TabGroupPanel.empty-workspace.test.tsx --maxWorkers=2pnpm test src/renderer/src/components/tab-bar/model/tab-bar-item-surface.test.ts --maxWorkers=2pnpm test src/renderer/src/components/editor/save/flush/discard-editor-file-changes.save-race.test.ts --maxWorkers=2pnpm test src/renderer/src/lib/workspace-emptied-on-purpose.test.ts --maxWorkers=2pnpm test src/renderer/src/components/workspace-empty-state/WorkspaceEmptyState.test.tsx --maxWorkers=2pnpm check:changedmax-lines-ratchet(src/main/host-mesh/host-mesh-driver.ts,src/main/host-mesh/host-mesh-rpc-service.ts,src/main/startup/runtime-startup/main-process-runtime-launch.ts) andreact-compiler-compat-ratchet(src/renderer/src/components/settings/runtime-environments/host-group/use-host-group-snapshot.ts,src/renderer/src/components/status-bar/host-connections/use-relayed-fleet-hosts.ts) fail identically on base1c437ac03c3— all five are the host group's rows, already allowlisted inlocal/lint-known-red.json, none is in this difforca-queue node local/gate-unit.mjsUnit gate @a04a1c9ebc (clean): PASS — 11028 passed; 0 failed (0 allowlisted, 0 unexpected); 0 flaky re-run passed; 0 unhandled error headline(s); 61 snode local/checks/host-mesh-upstream-seams.mjs --base origin/mainnode local/check-upstream-file-comments.mjsa04a1c9ebc9fork-pr-gates: lint gatepass (4m02s),typecheckpass,changed linespassFull unit suite: gate 1 PASS on the committed revision (this diff touches
config/**); nightly and again at release.Reviewed by Opus 5.5, high: R1 (1 blocking fixed), delta clean on R2
The rebase conflicts resolved above touch no source file, so
R2still covers every reviewed hunk; theonly post-review edit is the regenerated fork-comment baseline.
Review NITs, not acted on
useTabGroupWorkspaceModel.ts:89-96). Rare, and arguably correct.close-file-action.ts: a pre-existingactiveBrowserTabIdoverwrite; untouched.🤖 Generated with Claude Code