Skip to content

feat(workspace): keep an emptied workspace open on its own empty-tabs surface - #185

Merged
nplez1 merged 3 commits into
nplez1/mainfrom
nplez1/feature-empty-tabs-state-closing-all-tabs-should
Oct 25, 2026
Merged

nplez1 merged 3 commits into
nplez1/mainfrom
nplez1/feature-empty-tabs-state-closing-all-tabs-should

Conversation

@nplez1

@nplez1 nplez1 commented Oct 25, 2026

Copy link
Copy Markdown
Owner

What this is

Closes the three symptoms in #96. Closing the last agent or terminal tab of a workspace
no longer deselects it: the workspace stays selected, its tab strip keeps the "+" create
entry, and the pane body shows an empty-tabs surface modelled on the landing screen — the
Orca mark and wordmark, "This workspace has no open tabs.", a New <agent> agent /
New terminal pair with their shortcuts called out, and the star-the-repo footer.

  • No landing page swap. leaveWorktreeIfEmpty, the legacy last-terminal fallback,
    landOnEmptiedWorktree and emptiedWorktreeLandingPatch all stop writing the landing
    patch, so closing the last tab leaves the workspace selected. preserveWorktreeSelection
    existed only for that path and is deleted with its four call sites.
  • No sleeping. Only the close record separates "the user emptied this" from "this build
    never initialized it", so the moon glyph, the "Hide sleeping" sweep, the jump palette and
    the reveal auto-unhide all read it. The workspace on screen with nothing to render is
    awake whatever emptied it.
  • No implicit re-seed. Activation no longer passes reseedEmptiedWorkspace (the option
    is gone), so re-opening an emptied workspace lands on its surface instead of seeding the
    shell the user just closed. Startup restore, workspace creation and setup/issue work still
    seed.

The surface renders only for a workspace the user actually emptied — nothing renderable, a
terminal row that exists, and a fresh close record — so a fresh worktree, a host-owned list
still mirroring, or a chat launch waiting on its host cannot flash it.

Verification

  • pnpm tc clean (18,087 / 3,231 / 37 / 16,090 files).
  • Lint gate @bc996216d4: PASS — 33 green, 0 failing.
  • Changed-code quality gate: 0 new findings across 37 changed files.
  • pnpm test src/renderer/src/lib src/renderer/src/components src/renderer/src/store:
    42,251 passed, 2 expected fail, 76 skipped, 4,706 files.
  • New coverage: workspace-emptied-on-purpose.test.ts (10 cases), two sleep cases (a slept
    chat with a close record stays asleep; the workspace on screen with nothing to render stays
    awake), 5 cases in WorkspaceEmptyState.test.tsx, 3 in TabGroupPanel.empty-workspace.test.tsx
    (including that the floating panel's external strip does not render the surface), and the
    reseed suite rewritten to the new contract.
  • Live in the dev app over CDP (hidden renderer, no focus taken): closing the only tab leaves
    activeWorktreeId set with tabs: 0 and the surface on screen; no moon glyph and no
    "Sleeping" label; the row survives "Hide sleeping" on; ⌘T, the "New terminal" button and
    the "New Claude agent" button each open the first tab (the agent one lands a claude
    terminal); re-selecting the emptied workspace afterwards does not re-seed a terminal.

Reviewed by Opus 5.5, high (claude/opus): R1 (3 blocking fixed), delta clean on R2. R3 applies
the delta's MINOR findings and one lint-ratchet fix — the surface gate now reads the pane's own
slices in a single boolean selector — and re-ran the same suites and lint gate at bc99621.

Known gaps, stated rather than hidden

  • A workspace emptied by closing a non-terminal tab (chat, browser, editor) writes no
    close record, so it reads awake only while it is on screen, and shows no empty-tabs surface
    or re-seed suppression when it never held a terminal. Terminal closes — the reported case —
    are covered end to end. A renderer-side "emptied" mark would close this; it needs persisted
    state, so it is a follow-up rather than part of this branch.
  • The close-record exemption lasts the record's 30-day TTL, even after the user leaves the
    emptied workspace, so a workspace sitting empty for a month stays visible under "Hide
    sleeping". Before this branch it was hidden as asleep.
  • Mobile reads host-stamped activity facts, not close records, so "Hide sleeping" there may
    still hide an emptied workspace.
  • Star telemetry from the new surface is attributed to landing; the source list lives in
    src/shared/gh-star-source.ts, which this branch does not touch.
  • In the main-owned layout path (ORCA_LAYOUT_OWNER_IS_MAIN, off in shipped builds),
    selectAfterClose with no next tab does not clear the group's activeTabId; the landing
    patch used to. The pane renders nothing either way, but that switch should be checked before
    it is turned on.

… surface

Closing the last tab of the active workspace no longer deselects it. The
workspace stays selected, its tab strip keeps the "+" create entry, and the
pane body shows an empty-tabs surface with the Orca mark, the shortcut that
opens each kind of tab, a "New <agent> agent" / "New terminal" pair, and the
GitHub star button.

- close paths: leaveWorktreeIfEmpty, the legacy last-terminal fallback,
  landOnEmptiedWorktree and emptiedWorktreeLandingPatch all stop writing the
  landing patch, so `preserveWorktreeSelection` (now vestigial) goes away.
- empty-tabs surface: WorkspaceEmptyState renders in the group body when the
  worktree has no terminal, browser, editor or unified rows.
- sleep: only the close record distinguishes an emptied workspace from one
  that was never initialized, so the moon glyph, the "Hide sleeping" sweep,
  the jump palette and the reveal auto-unhide all read it and treat the
  emptied row as awake.
- seeding: activation no longer forces `reseedEmptiedWorkspace`, and the gated
  re-seed honours the tombstone, so re-opening an emptied workspace lands on
  the empty-tabs surface instead of seeding the shell the user just closed.
  Startup hydration, workspace creation and setup/issue work still seed.

Refs #96
…ed one

Review round 1 found the emptiness signal and the surface's own gate both too
coarse.

- The predicate now requires the workspace to have nothing renderable at all
  (`workspace-emptied-on-purpose.ts`), so a workspace that still holds slept
  chat tabs or an open editor file keeps its sleeping glyph, its place in the
  "Hide sleeping" filter and its reveal auto-unhide instead of reading awake.
- The workspace on screen with nothing to render is awake too, so closing a
  chat, browser or editor tab as the last one no longer makes the selected row
  read asleep or drop out of "Hide sleeping".
- The empty-tabs surface renders only for a workspace the user emptied, not for
  one whose first tab is still arriving: a fresh worktree, a host-owned list
  still mirroring or a chat launch waiting on its host no longer flashes it.
- The close-record scan is cached per map identity and status epoch, the same
  way the live-agent set is, and the hook reads the status clock rather than
  wall time.
- `reseedEmptiedWorkspace` is deleted: nothing passed it any more, so the
  contract's escape hatch was dead. `landIfEmptied` goes the same way.
- The Orca tile and wordmark are one shared `OrcaBrandMark`, so the landing
  screen and the empty state cannot drift (including the tile colour).
…ices

The delta re-check's MINOR findings and one ratchet step, in one place.

- `hasFreshClosedTabRecord` carries the record half of the predicate, so the
  pane can ask for a boolean instead of building a synthetic `tabsByWorktree`
  row. That row always passed the shared helper's existence check while the
  seeder read the real store, so a host-mirrored workspace whose row had not
  arrived could show the surface while the seeder treated it as uninitialized.
  The pane now requires `Object.hasOwn(state.tabsByWorktree, worktreeId)`.
- One selector, so `TabGroupPanel` re-renders when this workspace's verdict
  changes rather than on every terminal close anywhere and every liveness
  epoch. The keyed literal it replaced also counted as four renderer layout
  writes against a baseline of one.
- `useWorktreeIdsWithEmptySurface` skips a workspace it already decided, so the
  per-record scan cannot go quadratic.
- `isWorkspaceEmptiedOnPurpose` no longer needs the shared row check: a close
  record only exists for a workspace that had a tab closed.
@nplez1
nplez1 merged commit 095cf32 into nplez1/main Oct 25, 2026
@nplez1
nplez1 deleted the nplez1/feature-empty-tabs-state-closing-all-tabs-should branch October 25, 2026 09:59
nplez1 added a commit that referenced this pull request Oct 26, 2026
Repairs the failures the merge introduced rather than allowlisting them:

- process-host's sync path missed upstream's captureStderrAsBytes
- a fork-only real-git test never got upstream's worker-thread child-processes
- a filesystem test's mock path did not follow the file into ipc/filesystem/
- merged hunks put upstream's `orca-dev`/`.orca` back over `orca-np-dev`/`.orca-np`
  in four suites
- markKimiWorkspaceTrusted became async; upstream's callers had no await
- the conflict check had slipped behind the merge-queue branch, so a conflicting
  PR on a merge-queue branch was offered "Merge when ready"
- the fork's autoMergeActionWhenDirectMergeAvailable lost both call sites
- a Jira user field with a fixed choice list rendered as a text box
- the skill bundle manifest arrived built from upstream's skills; regenerated
- orca-repository.test.mjs was a pre-merge defect from #185, fixed here

Records 9 environment-bound reds with evidence, all on code byte-identical to
upstream 0571e45: 7 sqlite-binding (Bun 1.4.4 against Apple's system SQLite),
verify-cli-bin (macOS /private/var), and reclaim-worktree-generated-files
(macOS Bun reports ENOTEMPTY where Node reports EACCES).

Runs the gate with upstream's own lane setting for recordDependencies: its CI
sets CI, so upstream never sees the fire-and-forget teardown races this switch
exposes here. Evidence in LOCAL-PATCHES.md.
nplez1 added a commit that referenced this pull request Nov 25, 2026
…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]>
nplez1 added a commit that referenced this pull request Nov 26, 2026
…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]>
nplez1 added a commit that referenced this pull request Nov 26, 2026
…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]>
nplez1 added a commit that referenced this pull request Nov 26, 2026
…471)

* fix(workspace): closing the last editor keeps the workspace on its empty-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]>

* fix(workspace): scope the unrecorded empty-tabs surface to the current 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]>

* test(workspace): narrow the last-editor-close test comment to what it pins

Refs #96

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(workspace): keep the empty-tabs rationale out of upstream-owned 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]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant