Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: use 100dvh with vh fallback on lightbox/picker/layout/CoS surfaces (#2553)
[._.]/ Adam Eivyadba7f3740ba
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 6bdbb8ad3f..70e7893e7f 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -66,3 +66,4 @@- **[issue-2532] Extract the Shell page's socket/session/terminal lifecycle into a `useShellSession` hook.** `pages/Shell.jsx` inlined ~750 lines of xterm setup, the Socket.IO `shell:*` protocol, and the single-subscriber PTY attach/detach contract (the `pendingAttachRef {target,generation}` guards, `claim`-vs-user-intent handling, `userIdleRef` passive-idle gating, `mountedRef` deferred-work guards, and URL sync). That cohesive concern now lives in `client/src/hooks/useShellSession.js` — which documents the full attach/detach contract at the top of the file — and the route drops to a thin presentational shell (header, quick-commands, terminal container) plus two extracted panels, `components/shell/TerminalHotKeys.jsx` and `components/shell/ShellSessionTabs.jsx`. Pure structural refactor toward the WritersRoom pattern — behavior identical, generation guards preserved byte-for-byte, no route-contract change; lint, the hooks barrel test, and the client build stay green.- **[issue-2580] Await the canvas draw assertions in `MidiVisualization.test.jsx` to fix a CI flake.** The "paints the roll" test `await`ed the footer text (`findByText(/3 notes · /)`) then *synchronously* asserted `expect(ctx.fill).toHaveBeenCalled()`, but the roll paints in the `<MidiPianoRoll>` child a tick after the footer text commits — so CI intermittently landed the paint one tick late and the assertion failed. That draw assertion (and the zoom-controls `ctx.clearRect` assertion, which followed the fit/zoom button clicks) are now wrapped in `waitFor(...)` so they wait for the draw deterministically. Audited the sibling songs canvas tests (`PianoRoll`, `MidiPianoRoll`, `Metronome`, `RoundStack`, `PitchTuner`, `SingToScore`, `SongTraining`, `ReferenceAnalysis`, `SongRecordings`): only `MidiVisualization` gates its paint behind async data loading, so it was the only racy one — `PianoRoll`/`MidiPianoRoll` assert after a synchronous `render()`/`pump()` (no text-`findBy` gap), and the rest have no canvas assertions. Test-only; each test keeps its own explicit `getContext` mock.- **[issue-2541] Add a wall-clock timeout to the AI toolkit's API runner so a hung provider can't leak `activeRuns`.** `runner.js#executeApiRun` attached an `AbortController` but armed no timer, so an upstream that opened the SSE stream then stalled (or never responded) held its controller in `activeRuns` — and thus the run slot — indefinitely; the CLI path (`executeCliRun`) already had an internal timeout, and the Runs-router path invoked the API runner with no outer guard. `executeApiRun` now accepts an optional `timeout` (falling back to `provider.timeout` then a 300s default, mirroring `aiProvider`/`askService`) and arms it before the fetch. A single-settlement gate (`markSettled()`) guarantees exactly one of {timer, response paths} finalizes the run: on timeout the timer aborts the fetch/reader AND independently finalizes the run as an `ERROR_CATEGORIES.TIMEOUT` failure — so a stalled fetch/stream, a provider that never responds, and even a `ensureProviderReady` hook that never reaches the fetch are all bounded, and the failure is recorded as a timeout instead of the raw AbortError's `UNKNOWN`/HTTP 0. Both the Runs router and `promptRunner` now thread their `effectiveTimeout` into the API call (parity with the CLI/TUI branches), so a per-call override — e.g. the importer's long stage timeout — governs the ceiling instead of being cut short by the provider/default fallback; `promptRunner`'s own timer is demoted to a delayed backstop so the runner's timeout wins classification. The non-2xx error-body read now runs with the abort timer still armed (a provider that sends error headers then stalls the body is cancelled, not hung), and the success-path finalization-failure fallback rebuilds metadata from the stored record so run identity survives a write error. New unit tests prove both a hung stream and a hung readiness hook flip `isRunActive` back to false and complete with `errorCategory: 'timeout'`.+- **[issue-2553] Size four viewport-height surfaces with `100dvh` (vh fallback) so iOS Safari chrome no longer clips them.** MediaLightbox's fullscreen image (`max-h-[100vh]`), the CollectionPicker popover (`min(360px, calc(100vh - 16px))`), the Layout sidebar flyout (`calc(100vh - 16px)`), and the ChiefOfStaff avatar panel/canvas caps (`min(460px|620px, calc(100vh - 1rem))`) all measured against `100vh`, which iOS Safari inflates by the retractable browser-chrome height — so each spilled under the chrome. New parametrized `max-h-dvh-cap`/`min-h-dvh-cap`/`h-dvh-cap` `@utility` classes in `index.css` size to `100dvh` (the visible dynamic viewport) with a `100vh` fallback via the same two-declaration idiom as the existing `.h-dvh-screen`; a `--dvh-cap` upper bound and `--dvh-inset` subtracted margin (set per-surface, and per-breakpoint via arbitrary-property utilities for the responsive CoS caps) let one utility serve the plain, capped, and inset variants. Behavior is byte-identical on engines that predate `dvh`; on iOS Safari the surfaces now stay within the visible viewport.diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex 9e44d3a6ee..277aad49e7 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -1049,8 +1049,8 @@ export default function Layout() {onMouseLeave={scheduleCloseFlyout}onFocus={cancelCloseFlyout}onBlur={scheduleCloseFlyout}- style={{ top: flyoutPos.top, left: flyoutPos.left, position: 'fixed', maxHeight: 'calc(100vh - 16px)' }}- className="hidden lg:block z-[60] min-w-[220px] max-w-[min(320px,calc(100vw-5rem))] overflow-y-auto bg-port-card border border-port-border rounded-lg shadow-2xl py-1"+ style={{ top: flyoutPos.top, left: flyoutPos.left, position: 'fixed', '--dvh-inset': '16px' }}+ className="hidden lg:block z-[60] min-w-[220px] max-w-[min(320px,calc(100vw-5rem))] max-h-dvh-cap overflow-y-auto bg-port-card border border-port-border rounded-lg shadow-2xl py-1"><div className="px-3 py-1.5 text-[10px] uppercase text-gray-500 tracking-wider border-b border-port-border mb-1">{item.label}diff --git a/client/src/components/media/CollectionPickerShell.jsx b/client/src/components/media/CollectionPickerShell.jsxindex 576f3524e5..0de8bf3c83 100644--- a/client/src/components/media/CollectionPickerShell.jsx+++ b/client/src/components/media/CollectionPickerShell.jsx@@ -182,12 +182,13 @@ export default function CollectionPickerShell({<divref={menuRef}role="menu"- className="fixed bg-port-card border border-port-border rounded-lg shadow-xl z-[100] p-1.5 flex flex-col"+ className="fixed bg-port-card border border-port-border rounded-lg shadow-xl z-[100] p-1.5 flex flex-col max-h-dvh-cap"style={{left: style?.left ?? `${VIEWPORT_PADDING}px`,top: style?.top ?? `${VIEWPORT_PADDING}px`,width: style?.width ?? `${width}px`,- maxHeight: 'min(360px, calc(100vh - 16px))',+ '--dvh-cap': '360px',+ '--dvh-inset': '16px',visibility: style ? 'visible' : 'hidden',}}onClick={(e) => e.stopPropagation()}diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsxindex e8e004c868..b9186272a9 100644--- a/client/src/components/media/MediaLightbox.jsx+++ b/client/src/components/media/MediaLightbox.jsx@@ -217,7 +217,7 @@ export default function MediaLightbox({? 'relative w-full h-full bg-black flex': 'relative bg-port-card border border-port-border rounded-xl overflow-hidden max-w-6xl w-full max-h-[92vh] flex flex-col md:flex-row';const overlayPad = fullScreen ? 'p-0' : 'p-4';- const imgMax = fullScreen ? 'max-w-[100vw] max-h-[100vh]' : 'max-w-full max-h-[92vh]';+ const imgMax = fullScreen ? 'max-w-[100vw] max-h-dvh-cap' : 'max-w-full max-h-[92vh]';// Anchor low in fullscreen so the chevrons land in the letterbox bar of a// landscape image instead of covering it. Non-fullscreen keeps them centered// — bottom-anchoring would bury them in the SettingsPane underneath.diff --git a/client/src/index.css b/client/src/index.cssindex 28cfe50edd..21cb74bd6a 100644--- a/client/src/index.css+++ b/client/src/index.css@@ -150,6 +150,31 @@ body {height: 100dvh;}+/* dvh-aware sizing utilities (see .h-dvh-screen above for the cascade rationale).+ iOS Safari's retractable browser chrome makes 100vh taller than the visible+ viewport, so surfaces sized to 100vh spill *under* the chrome. These size to+ 100dvh — the visible dynamic viewport — while keeping a 100vh fallback for+ engines that predate dvh (the two-declaration idiom: the vh line lands first,+ the dvh line overrides it wherever dvh parses). Parametrized so one utility+ serves the plain, capped, and inset variants used across the app:+ --dvh-cap upper bound for the size (default: the full viewport)+ --dvh-inset amount subtracted from the viewport (default: 0px)+ Defined with @utility so responsive variants (sm:, lg:, xl:) are available;+ drive the caps per-breakpoint with arbitrary-property utilities, e.g.+ `min-h-dvh-cap lg:[--dvh-cap:460px] lg:[--dvh-inset:1rem]`. */+@utility max-h-dvh-cap {+ max-height: min(var(--dvh-cap, 100vh), calc(100vh - var(--dvh-inset, 0px)));+ max-height: min(var(--dvh-cap, 100dvh), calc(100dvh - var(--dvh-inset, 0px)));+}+@utility min-h-dvh-cap {+ min-height: min(var(--dvh-cap, 100vh), calc(100vh - var(--dvh-inset, 0px)));+ min-height: min(var(--dvh-cap, 100dvh), calc(100dvh - var(--dvh-inset, 0px)));+}+@utility h-dvh-cap {+ height: min(var(--dvh-cap, 100vh), calc(100vh - var(--dvh-inset, 0px)));+ height: min(var(--dvh-cap, 100dvh), calc(100dvh - var(--dvh-inset, 0px)));+}+body::before {content: "";position: fixed;diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsxindex b94e568228..5df2ebc288 100644--- a/client/src/pages/ChiefOfStaff.jsx+++ b/client/src/pages/ChiefOfStaff.jsx@@ -680,7 +680,7 @@ export default function ChiefOfStaff() {{/* Collapsible Content */}<divid="cos-agent-panel"- className={`${agentPanelCollapsed ? 'hidden' : 'flex'} lg:flex min-w-0 relative overflow-hidden ${hasCanvasAvatar ? 'flex-none min-h-[180px] sm:min-h-[190px] md:min-h-[190px] lg:min-h-[min(460px,calc(100vh-1rem))] xl:min-h-[min(620px,calc(100vh-1rem))]' : 'flex-1'}`}+ className={`${agentPanelCollapsed ? 'hidden' : 'flex'} lg:flex min-w-0 relative overflow-hidden ${hasCanvasAvatar ? 'flex-none min-h-dvh-cap [--dvh-cap:180px] sm:[--dvh-cap:190px] md:[--dvh-cap:190px] lg:[--dvh-cap:460px] lg:[--dvh-inset:1rem] xl:[--dvh-cap:620px]' : 'flex-1'}`}>{/* Background Effects */}<div@@ -700,7 +700,7 @@ export default function ChiefOfStaff() {// + event log without clipping; without this cap the inset-0 canvas// grows with the panel on desktop, dragging the framed avatar down// into the stats grid below it.- <div className="absolute inset-0 lg:bottom-auto lg:h-[min(460px,calc(100vh-1rem))] xl:h-[min(620px,calc(100vh-1rem))] z-[1] -translate-x-16 -translate-y-1 sm:translate-x-0 sm:-translate-y-6 md:-translate-y-8 lg:-translate-y-28 xl:-translate-y-36">+ <div className="absolute inset-0 lg:bottom-auto lg:h-dvh-cap lg:[--dvh-cap:460px] lg:[--dvh-inset:1rem] xl:[--dvh-cap:620px] z-[1] -translate-x-16 -translate-y-1 sm:translate-x-0 sm:-translate-y-6 md:-translate-y-8 lg:-translate-y-28 xl:-translate-y-36">{renderAvatar(true)}</div>)}