A side thread opened while the parent was mid-turn could persist a child
session the host can never read again: SessionFormatError "delivery
throughSeq must precede its marker".
Root cause: when the parent has compacted, buildSidechatInheritance copies
the log around its last checkpoint with RENUMBERED seqs, but the inherited
session-log-deepseek/delivery-accepted watermark (throughSeq) is an
absolute seq. Left alone it keeps pointing at the parent's position and
can land at or after the marker's own new seq, which the v4 reader treats
as corrupt; the parent's includeDescendants export then fails with it.
The rebase now carries the watermark through the same map it applies to
every other seq citation, and drops the record when the watermark fell
inside the dropped span (there is no child-side equivalent). The verbatim
full-copy path is untouched — seqs are identity there, so nothing changes.
Tests: tests/sidechat-compaction-seed.spec.ts builds a compacted parent
carrying real delivery markers and asserts every surviving marker cites
the same earlier event the parent marked, while markers whose watermark
was trimmed away do not survive (red before the fix: throughSeq 15 for a
marker at seq 8).
Closes#1109
The section was nested under the removed free-window chapter; it now sits after the archive routes as 6.2, drops the false claim that the image-remove control is the host Button, and points the connection-admission references at section 6.
Hidden tab types (the built-in diff page, dsh-remote's dsh-remote:file)
have no + menu row and no native guide entry, yet the side-card inventory
still gave them an enable switch. Turning one off changed nothing in the
sidebar and only made openTab silently refuse that type - which the
reporter saw as "remote:file cannot be turned off / git:diff does
nothing", and dsh-remote saw as "remote files stop opening".
- SideCardSection: the inventory skips hidden types (the count badge
follows); tabOrder becomes the order-only tabInventory.
- service.isTabEnabled: a hidden type is always enabled, so a
tabsEnabled[id] = false written by an older build cannot keep refusing
its programmatic opens.
- docs/external-plugin-guide.md and CHANGELOG describe the contract; the
two new specs fail on the previous code.
Follow-up to the iframe isolation: after that fix a 31-diagram document
still felt janky while scrolling. The remaining cost was work competing
with the scroll gesture:
- background diagram renders kept running during scroll (each one injects
an SVG, runs DOM passes and lays out);
- hidden native tabs kept warming diagrams (tab bodies are keepMounted);
- the inline-HTML and heading-anchor MutationObservers ran a full-document
scan per mutation (measured 8-15 ms per pass, dozens of passes when a
document swaps its diagrams in);
- initial near-viewport detection read one rect per diagram between DOM
writes, forcing a layout per diagram;
- off-screen rendered SVGs still participated in layout and paint.
The queue now pauses background work for 350 ms after the last captured
scroll event, and only schedules renders whose preview is visible
(IntersectionObserver gate per preview; hidden tabs keep placeholders and
wake the queue when shown again, and unmounting a preview drops its queued
tasks). The two mutation passes coalesce bursts into one 80 ms pass.
Initial priorities come from one batched rect read before the swap writes.
.mermaidWrap gains content-visibility:auto + contain-intrinsic-size +
contain:layout paint style, so off-screen diagrams leave layout and paint.
Visible diagrams still render on demand, every diagram is still eventually
rendered, and nothing falls back to a code block.
Mermaid measures every label with SVGElement.getBBox() against a node
appended to document.body, so each measurement flushes the whole host
document's layout. Measured in the live DSH window (15,418 DOM nodes):
59-75 ms per measurement, versus 1 ms in an empty iframe document. One
diagram therefore took 1.5-7.3 s, and a 31-diagram markdown document kept
the renderer main thread blocked for >20 s - long enough for the desktop
shell's surface watchdog to kill the renderer, with tab restoration
turning it into a crash loop. CSS containment on the app root does not
help (59-62 ms); only an independent layout tree does.
Render diagrams inside a hidden sandboxed iframe instead: a self-contained
blob: document (mermaid UMD bundle + a small postMessage protocol, both
inlined by scripts/build-mermaid-frame-asset.mjs) renders each diagram;
the parent only sends/receives and sanitizes the SVG. Diagrams now take
30-104 ms each and 31 diagrams complete in ~5 s in the background, while
the client mermaid chunk shrinks from 7.04 MB to 3.69 MB (minified UMD
replaces the unminified inline bundle).
Also add a shared render queue: visible/near-viewport diagrams first, the
rest filled in on requestIdleCallback with 16 ms main-thread yields between
renders, so every diagram is still rendered (none degrades to a code
block). Fence-line-sized placeholder skeletons reserve height while a
diagram waits. No host-half route changes are needed.
cwdOf() resolves the cwd for every file/Git route, and a cold (detached)
session paid one host observation per call: sessionQuery.observeSession({
projectionMode: 'all' }) decodes the whole zstd artifact and hydrates every
projection to answer with one workingDirectory string. The 0.28.1
single-flight only covered /sidebar/api, while the real startup fan-out
never goes through it: the fs-watch socket sends one frame PER WATCHED
DIRECTORY (server resolves cwd before it even reads the op), /sidebar/file
and /sidebar/html resolve per resource, upload/write per call. A 39 MB
session was therefore decoded dozens of times in parallel — the 44-read
OOM on 0.28.0 and the 36 reads reported against 0.28.1 are the same path,
not a broken dedupe.
A detached session now resolves through sessionPersistence.stat(), which
reads the first zstd frame only (header-only, never the log), memoized per
session id (headers are immutable) and shared in-flight across concurrent
asks. activeWorktreeRootOf() answers a detached session with that address
and no longer folds the stored log. Once the host attaches the session the
committed working_directory and linked-worktree following resume as before.
Trade-off (documented): until attach, the sidebar roots at the original
project rather than the agent's last directory/worktree.
tests/smoke.spec.ts rewrites the cwd group (header ahead of a stale hint,
one header read per session, 12 concurrent asks share one, stat absent or
failing falls back to the hint, live committed directory wins, relative
header cwd still refused) and tests/active-worktree.spec.ts pins that a
detached session performs no persistence read and no git probe.