Context
Grace measured this on the Fleet Manager's Home field (neomjs/neo-agent-institution#360, motion observation, 2026-09-30). Under useSharedWorkers the canvas worker has no requestAnimationFrame (undefined in a SharedWorker), so the renderer's loop runs on setTimeout(1000 / 60), and nothing pauses it while the window is hidden. Measurement 11 in D#18730 (2026-09-21) left the same question open: rAF throttles itself in a hidden document, a worker's timer does not. Unmeasured: Playwright's Chromium never reported the page hidden, so no probe has watched a hidden window's canvas worker yet.
The Problem
An animating Neo.app.SharedCanvas renderer keeps stepping and drawing while nobody can see it, for example in a minimized Fleet Manager or a background portal tab. The engine records the premise itself: "a hidden document throttles its own timers, not a worker's or its messages" (src/worker/HiddenTick.mjs:4).
The Architectural Reality
Read at dev 7ff8467baa:
Neo.app.SharedCanvas#pause / #resume (src/app/SharedCanvas.mjs:249, :304) forward to the renderer. Their only callers are the portal hero's deactivate() / activate() (apps/portal/view/home/parts/hero/Container.mjs:52, :44), which pause the hero while its part is out of view. Nothing pauses on the window's visibility.
Neo.canvas.Base#pause sets isPaused, canRender honours it, and #resume restarts the loop (src/canvas/Base.mjs:212, :142, :226).
Neo.worker.App#onVisibilityChange (src/worker/App.mjs:840) fires the window's app visibilitychange with {hidden, windowId}. Neo.component.MagicMoveText subscribes to it (src/component/MagicMoveText.mjs:224).
SharedCanvas hosts: Neo.app.header.Canvas; the portal's hero, footer, timeline and services canvases; the Institution's ObservatoryCanvas and Home canvas.
The Fix
Neo.app.SharedCanvas takes its window's current visibility and subscribes to its app's visibilitychange, after MagicMoveText's precedent: pause while hidden, resume when visible. A window that is already hidden never reports, so the current state is read, not waited for. The subscription follows the host into another window and ends on destroy. A hidden window and a host's own pause() are two separate reasons: the renderer runs only when neither holds, so a portal hero paused out of view stays paused when its window comes back.
Acceptance Criteria
Contract Ledger
Rows read at PR #19338's head b636b1de6d.
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
Neo.app.SharedCanvas#pause / #resume |
this ticket; the portal hero's activate() / deactivate() are the callers |
The host's own pause reason (hostPaused). A pause before the canvas is ready holds once it is |
Nothing is forwarded before isCanvasReady |
JSDoc |
unit/app/SharedCanvasVisibility.spec.mjs, host-pause arm |
The visibility subscription: SharedCanvas#listenToWindow and #onWindowVisibility |
Neo.worker.App#onVisibilityChange fires the window app's visibilitychange |
On construct and on a window move, the host takes the window's current visibility, then follows its reports. It lets go of the old window's app on a move and on destroy |
An app that never reports leaves the current visibility in force |
JSDoc |
the same spec: hide/show, follow/destroy, created-hidden, moved-into-hidden |
Neo.worker.HiddenTick#isHidden(windowId) (new) |
App#onConnect seeds it from document.hidden; every visibilitychange updates it |
true while the window's last report said hidden |
false for a window it never heard from |
JSDoc |
the spec's hidden-window arms; the unit worker mock answers visible |
Renderer forwarding: renderer.pause / resume({windowId}) |
Neo.canvas.Base#pause / #resume and canRender |
syncRenderLoop forwards the combined state while the canvas is ready. A canvas that becomes ready while paused starts paused |
Nothing before ready |
JSDoc |
the spec's ready-while-hidden arm |
Out of Scope
requestAnimationFrame in SharedWorkers, and Electron's background throttling.
- Renderers hosted outside
SharedCanvas, such as the Sparkline under Neo.component.Canvas: the same loop behind a different host.
- The open presenter and grouping questions of D#18730.
Avoided Traps
- Pausing from each app's view: every host would repeat the same listener, and the next
SharedCanvas would miss it. The engine owns the renderer's lifecycle.
- One pause flag for both reasons: a visibility
resume() would wake a host that paused itself, as the portal hero does while out of view.
Related
D#18730 · neomjs/neo-agent-institution#360
Decision Record impact: none.
Structure map: N/A. The change stays in existing engine files (src/app/SharedCanvas.mjs, possibly src/canvas/Base.mjs) and adds no file or folder.
Live latest-open sweep: the latest 20 open issues at 2026-09-30T18:25:21Z; no equivalent found.
A2A in-flight claim sweep (all read states, last 30): no claim on SharedCanvas or canvas visibility.
MC sweep: "shared canvas render loop keeps running while the window is hidden, SharedCanvas pause resume never called, HiddenTick hidden window worker timers", 6 results; D#18730 measurement 11 left the question open, no decision found.
Exact search: gh search issues --owner neomjs "canvas pause hidden visibilitychange", 0 results.
Own-assignment sweep: 6 open in this repository, none on canvas lifecycle.
Origin Session ID: eee527e0-79de-4edb-b4c2-eb89d3780d56
Retrieval Hint: query_raw_memories("SharedCanvas renderer keeps drawing while the window is hidden visibilitychange pause resume")
Context
Grace measured this on the Fleet Manager's Home field (neomjs/neo-agent-institution#360, motion observation, 2026-09-30). Under
useSharedWorkersthe canvas worker has norequestAnimationFrame(undefinedin a SharedWorker), so the renderer's loop runs onsetTimeout(1000 / 60), and nothing pauses it while the window is hidden. Measurement 11 in D#18730 (2026-09-21) left the same question open: rAF throttles itself in a hidden document, a worker's timer does not. Unmeasured: Playwright's Chromium never reported the page hidden, so no probe has watched a hidden window's canvas worker yet.The Problem
An animating
Neo.app.SharedCanvasrenderer keeps stepping and drawing while nobody can see it, for example in a minimized Fleet Manager or a background portal tab. The engine records the premise itself: "a hidden document throttles its own timers, not a worker's or its messages" (src/worker/HiddenTick.mjs:4).The Architectural Reality
Read at dev
7ff8467baa:Neo.app.SharedCanvas#pause/#resume(src/app/SharedCanvas.mjs:249,:304) forward to the renderer. Their only callers are the portal hero'sdeactivate()/activate()(apps/portal/view/home/parts/hero/Container.mjs:52,:44), which pause the hero while its part is out of view. Nothing pauses on the window's visibility.Neo.canvas.Base#pausesetsisPaused,canRenderhonours it, and#resumerestarts the loop (src/canvas/Base.mjs:212,:142,:226).Neo.worker.App#onVisibilityChange(src/worker/App.mjs:840) fires the window's appvisibilitychangewith{hidden, windowId}.Neo.component.MagicMoveTextsubscribes to it (src/component/MagicMoveText.mjs:224).SharedCanvashosts:Neo.app.header.Canvas; the portal's hero, footer, timeline and services canvases; the Institution'sObservatoryCanvasand Home canvas.The Fix
Neo.app.SharedCanvastakes its window's current visibility and subscribes to its app'svisibilitychange, afterMagicMoveText's precedent: pause while hidden, resume when visible. A window that is already hidden never reports, so the current state is read, not waited for. The subscription follows the host into another window and ends on destroy. A hidden window and a host's ownpause()are two separate reasons: the renderer runs only when neither holds, so a portal hero paused out of view stays paused when its window comes back.Acceptance Criteria
visibilitychangewithhidden: truepauses the host's renderer, andhidden: falseresumes it. The subscription follows the host into another window, and a destroyed host no longer listens. Unit arm with the renderer stubbed.SharedCanvasrenderer jumps on its first frame after a resume.getStats().framesdoes not advance, and the Observatory's canvas draws no frames. Residual-Owner: neomjs/neo-agent-institution#367.Contract Ledger
Rows read at PR #19338's head
b636b1de6d.Neo.app.SharedCanvas#pause/#resumeactivate()/deactivate()are the callershostPaused). A pause before the canvas is ready holds once it isisCanvasReadyunit/app/SharedCanvasVisibility.spec.mjs, host-pause armSharedCanvas#listenToWindowand#onWindowVisibilityNeo.worker.App#onVisibilityChangefires the window app'svisibilitychangeNeo.worker.HiddenTick#isHidden(windowId)(new)App#onConnectseeds it fromdocument.hidden; everyvisibilitychangeupdates ittruewhile the window's last report said hiddenfalsefor a window it never heard fromrenderer.pause/resume({windowId})Neo.canvas.Base#pause/#resumeandcanRendersyncRenderLoopforwards the combined state while the canvas is ready. A canvas that becomes ready while paused starts pausedOut of Scope
requestAnimationFramein SharedWorkers, and Electron's background throttling.SharedCanvas, such as the Sparkline underNeo.component.Canvas: the same loop behind a different host.Avoided Traps
SharedCanvaswould miss it. The engine owns the renderer's lifecycle.resume()would wake a host that paused itself, as the portal hero does while out of view.Related
D#18730 · neomjs/neo-agent-institution#360
Decision Record impact: none. Structure map: N/A. The change stays in existing engine files (
src/app/SharedCanvas.mjs, possiblysrc/canvas/Base.mjs) and adds no file or folder. Live latest-open sweep: the latest 20 open issues at 2026-09-30T18:25:21Z; no equivalent found. A2A in-flight claim sweep (all read states, last 30): no claim on SharedCanvas or canvas visibility. MC sweep: "shared canvas render loop keeps running while the window is hidden, SharedCanvas pause resume never called, HiddenTick hidden window worker timers", 6 results; D#18730 measurement 11 left the question open, no decision found. Exact search:gh search issues --owner neomjs "canvas pause hidden visibilitychange", 0 results. Own-assignment sweep: 6 open in this repository, none on canvas lifecycle.Origin Session ID: eee527e0-79de-4edb-b4c2-eb89d3780d56 Retrieval Hint:
query_raw_memories("SharedCanvas renderer keeps drawing while the window is hidden visibilitychange pause resume")