The lane's `onScreenSession` walked every `[data-sidebar-right-session]` element
and took the first without a `hidden` attribute. On 0.2.x the host marks BOTH
each RETAINED seat (one per Conversation stays in the DOM) AND each seat's panel
with that attribute, so the walk could name a background Conversation and the
A → B → A round trip failed on `selectConversation` (real mount lane: expected
`session-eeb1…`, read `session-b8e4…`, 60s timeout).
Read the panel that is actually laid out (`[data-sidebar-right-panel]:visible`) —
the same `:visible` convention the rest of this lane already uses — and keep a
visible-seat fallback. Mount lane: 10/10 (was 9/10).
The comparison with PR #712 left three of its cases uncovered here: #712
parked an unsaved editor draft, an unsaved commit message and the chosen
worktree in module-level memory and tested each by unmounting. This branch
claims the host's `keepMounted` makes that memory unnecessary, but the claim
was only ever exercised for tree expansion and scroll — the draft was
explicitly recorded as unverified, and it is the one loss a reader cannot
re-derive by looking again.
All three are now measured on a real host, in the retention lane's A -> B -> A
round trip:
- an unsaved EDIT typed into the file's editor must still be in the document;
- an unsaved COMMIT MESSAGE must still be in the changes tab's box;
- the CHOSEN WORKTREE must still be selected, rather than re-derived from the
inventory.
The lane's workspace becomes a real git repo (idempotently: it persists across
local runs) with one staged change — that is what renders a usable commit box —
plus a linked checkout for the worktree choice. Two host details the lane has
to respect, both recorded in comments: the worktree selector only renders when
the inventory holds more than one entry, and paths are compared through
`realpathSync` because macOS /var is a symlink to /private/var while git
reports the resolved form.
Measured: 8/8 on 0.1.7-rc.1 + headless Chromium, and the full unit suite
(113 files / 1141 tests) stays green.
"State survived" is not the same claim as "nothing was silently reloaded":
the retention lane asserted the visible vector (expansion, scroll, chip) but
never looked at the network, so a body that remounted and refetched
everything would have passed it.
The lane now counts the plugin's own reads. These routes are POSTs, so the
path being listed or read travels in the BODY — the counter parses it, which
is what lets one level or file be told apart from a fresh read. It then opens
a real file in conversation A and requires, on return:
- the file is still open as a tab, and selecting it shows the editor without
a second `fs.read` of its bytes;
- no `fs.read` of that file happened anywhere in the round trip.
Measured against the real host (0.1.7-rc.1, headless Chromium): zero plugin
reads on returning to A — the seat lands on its previous tab and shows the
content it already holds.
One ordering fact this lane had to be taught: opening a file in merged mode
swaps THAT tab's content to the editor, so the tree component unmounts and
its scroll starts over by design (attributed with a probe: hide/show keeps
320, opening a file drops it to 0). The lane therefore re-builds the scroll
offset after the file step before measuring the conversation round trip,
which is the claim the offset is actually evidence for.
DSH 0.1.7 gives a tab TYPE the `keepMounted` switch: a marked body stays
mounted through hiding, tab selection and Session switches. That is exactly
what the plugin tried to fake with module-level memory, so declare it on
every plugin type (the descriptor types and the `files` takeover) and let
the host hold the component state — tree scroll, unsaved drafts, chip
renames — with no plugin-side memory at all.
With the bodies staying up, the per-session record registry from the
previous commit is what keeps co-resident sessions apart; both halves are
required, because a body may still be remounted by the host (type disposal,
session teardown) and the records must outlive that.
Verification on a real host (`scripts/e2e-mount.sh`: npm pack -> fresh
scratch profile -> real `dsh web` pinned to 0.1.7-rc.1 -> headless Chromium),
new lane `tests/e2e/tree-scroll.e2e.ts`: build state in conversation A,
switch to B, come back, and compare the whole observable vector (tree
expansion, scroll offset, chip title) — plus the negative half, that B does
not inherit A's state.
That lane also exposed a defect in the old one: it picked its "second
conversation" by row index, but the session tree's first row is a WORKSPACE
row and a seeded session with no messages takes no row at all, so the
"A -> B -> A" round trip was re-selecting the same session and every
assertion held vacuously. It now identifies sessions by
`data-row-key="session:<id>"` and creates a real second session through the
rail.
`tests/e2e/mount.e2e.ts` reaches the side-chat tab through its guide entry
now: with the record retained, the chip shows the thread's own title, so
the old `/Side Chat/` chip match no longer names it.
Docs: AGENTS.md records the two facts that must hold together, and
docs/plans/2026-09-25-native-tab-state-retention-keepmounted.md replaces the
park/archive design (PR #712) with this one.