LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtSep 1, 2026, 7:42 AM
updatedAtSep 1, 2026, 10:48 AM
githubUrlhttps://github.com/neomjs/neo/issues/18010
authorneo-opus-grace
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 1, 2026, 10:48 AM

A fire-and-forget remote dispatch turns an expected teardown reject into an unhandled-rejection storm

neo-opus-grace
neo-opus-grace commented on Sep 1, 2026, 7:42 AM

Context

Successor to #17976, which is closed as premise-falsified. @tobiu reported on 2026-08-31 that opening a built portal emitted the same rejection thousands of times:

Base.mjs:411  Uncaught (in promise) undefined
(anonymous)         @ Base.mjs:411
promiseMessage      @ Base.mjs:405
(anonymous)         @ RemoteMethodAccess.mjs:164
(anonymous)         @ Body.mjs:1271
Promise.then
onStoreLoad         @ Body.mjs:1270
fire                @ Observable.mjs:284
onCollectionMutate  @ Store.mjs:1082
fire                @ Observable.mjs:284
splice              @ Base.mjs:1608
appendFeedBatch     @ Workspace.mjs:620

#17976 attributed this to neo-config.json's basePath re-anchoring, and prescribed re-anchoring it into dist/esm. That was traced to source and refuted — the module boot chain never reads basePath, and the prescribed change would have broken resourcesPath, the Font Awesome href and every theme stylesheet root. Full trace on #17976.

What survives is the storm itself, which #17976 pushed out of scope as "the amplifier, not the fault". With the fault gone the amplifier is the whole finding, and unlike the fault it is verifiable at source without reproducing @tobiu's session.

Separated from inference: the observed operation is a Neo.main.DomAccess.scrollTo dispatch rejecting under a ticking store feed. Not established: which context produced @tobiu's specific frames — the trace names apps/workstation/view/Workspace.mjs while the reported URL is the portal, and #17976 never reconciled that. This ticket claims the mechanism, not that session.

The Problem

src/worker/Base.mjs:311 is the reply path:

} else if (promise = action === 'reply' && me.promises[replyId]) {
    if (data.reject) {
        promise.reject(data.data)
    }

A remote call therefore legitimately rejects — most notably on the dead-port teardown path, where a SharedWorker window has closed and its message port is gone. #17894 deliberately typed that rejection so consumers could discriminate expected teardown from real failure. It typed the reason. It did not add a handler, and the call sites did not grow one.

src/grid/Body.mjs:1269-1277 is the site in the trace:

if (me.mounted && !postChunkLoad) {
    me.timeout(50).then(() => {
        Neo.main.DomAccess.scrollTo({direction: 'top', id: me.gridContainer.view.id, value: 0, windowId})
    })
}

The returned promise is dropped inside a .then() callback. When it rejects there is no handler anywhere on the chain, so it surfaces as Uncaught (in promise). me.timeout(50) also means the dispatch fires 50ms after the mount check — the window it addresses may be gone by the time the message is sent, which is exactly the condition that produces the typed rejection.

Why thousands and not one. onStoreLoad runs on every collection mutation (Store.mjs → Observable#fire), and a ticking feed (appendFeedBatch in the workstation workspace) mutates the store on an interval. One unhandled dispatch per tick, indefinitely. The amplification is not incidental — it is what turns a benign teardown race into a console nobody can read, which then hides every real error underneath it.

The surface is engine-wide, and this ticket does not claim to fix it. Census on dev at 2026-09-01:

shape count in src/**
Neo.main.<Service>.<method>( call sites 97
of those, dispatched inside a .then() callback with no .catch() 8
.catch( anywhere in src/** 30

Most of the 97 drop the promise entirely rather than chaining .then(), which is the same defect with fewer frames.

The Architectural Reality

  • src/worker/Base.mjs:398-411 — promiseMessage() builds the promise; :311 rejects it. Both halves are correct and neither is the defect.
  • src/worker/RemoteMethodAccess.mjs:164 — the generated remote stub that returns that promise. It is the seam every one of the 97 sites goes through.
  • src/core/Base.mjs:1172 — trap(promise) exists and is adjacent, but is not the fix: it registers a destroy-time canceller and re-rejects, so a trapped promise still needs a handler. src/component/Base.mjs:1406/1429/1591 use it correctly, always under await.
  • src/grid/Body.mjs:1269 and src/table/Body.mjs:615 are the same shape in two classes.

The Fix

Fix the observed storm; do not decide the engine-wide contract inside a bug ticket.

  1. The named sites stop being fire-and-forget. src/grid/Body.mjs:1269-1277 (and its src/table/Body.mjs:615 twin) must dispose of the rejection rather than drop it — a scroll nudge into a window that has gone away is an expected outcome, not a failure to report.
  2. The disposition is stated where a reader will meet it. Whatever handling lands carries a JSDoc clause naming why this dispatch may reject and why that is not an error, so the next reader does not re-add a bare .then().
  3. The engine-wide question is routed, not answered here. Whether the remaining ~95 sites are fixed one by one, whether RemoteMethodAccess should dispose of the typed teardown rejection centrally, or whether the engine should grow an explicit fire-and-forget verb is a shaping question with engine-wide blast radius. It belongs in an Ideation Sandbox Discussion, and this ticket deliberately does not pre-empt it.

Contract Ledger Matrix

Target Surface Source of Authority Behavior Fallback Docs Evidence
grid.Body#onStoreLoad scroll dispatch (src/grid/Body.mjs:1269) this ticket a rejection from the post-timeout scrollTo is disposed of at the call site, never left unhandled none — an unhandled rejection here is the defect method JSDoc names the teardown reason negative control: force the dispatch to reject and assert no unhandled rejection reaches the runtime
table.Body scroll dispatch (src/table/Body.mjs:615) this ticket same shape, same disposition none same same arm against the twin
typed teardown rejection (src/worker/Base.mjs:311) #17894 unchanged — the reason stays typed and stays a rejection; this ticket adds handling, it does not silence the producer n/a existing the #17894 arms stay green
the remaining ~95 dispatch sites not this ticket undecided — routed to a Discussion n/a n/a census recorded above so the next owner does not re-derive it

Decision Record impact

none. No ADR governs remote-dispatch error handling today; if the Discussion in Fix item 3 converges on a central disposition, that is where an ADR would be proposed.

Acceptance Criteria

  • A rejecting scrollTo dispatch from grid.Body#onStoreLoad produces no unhandled rejection, proven by an arm that forces the reject path rather than by inspection.
  • The arm is a mutation control both ways: it must go red against current dev, and it must not pass merely because the dispatch never fired — non-vacuity asserted by observing the dispatch itself.
  • The src/table/Body.mjs:615 twin carries the same disposition and its own arm; a fix that lands on one and not the other is the shape that let this survive.
  • The typed rejection from #17894 still rejects and still carries its reason — asserted, so "handled" is not silently implemented as "no longer rejects".
  • The census in this body is restated in the PR against the tree it merges into, so the deferred surface is a live number and not a stale one.
  • A Discussion exists for the engine-wide disposition, linked here. This ticket does not wait on it.

Out of Scope

  • The remaining ~95 Neo.main.* dispatch sites. Named, counted, deliberately deferred to the Discussion in Fix item 3 — a 97-site sweep inside a bug ticket is how a contract gets decided by whoever happened to be holding the keyboard.
  • Changing promiseMessage or the :311 reply path. #17894 settled the producer; this is a consumer defect.
  • apps/workstation/view/Workspace.mjs's ticking feed. It is the amplifier's amplifier — it makes one defect visible thousands of times, and it is correct on its own terms.
  • Anything about basePath, dist/esm module resolution, or which tree executes. That was #17976's premise and it is falsified; see its closing comment.

Avoided Traps

  • Adding a bare .catch(() => {}). It fixes the console and destroys the signal: a real scrollTo failure becomes indistinguishable from an expected teardown. The disposition has to discriminate on the typed reason #17894 provides, which is the entire reason that ticket typed it.
  • Reaching for trap() because it is nearby. core.Base#trap re-rejects by design (src/core/Base.mjs:1183); wrapping the dispatch in it changes nothing about the unhandled rejection and adds a destroy-time canceller nobody asked for.
  • Fixing the amplifier instead of the fault. Slowing or debouncing the workstation feed would reduce the line count and leave the defect. #17976 already made the mistake of ranking these two; the fire-and-forget dispatch is the fault at any tick rate.
  • Deciding the engine-wide contract here. 97 sites and a central seam (RemoteMethodAccess) is a shaping question. A bug ticket that quietly settles it creates a precedent nobody reviewed.
  • Treating the missing .catch() as a style nit. It is not lint-shaped: the same omission is correct wherever the dispatch cannot reject, and the discriminator is runtime teardown state, not syntax.

Related

  • #17976 — the falsified predecessor this succeeds; its closing comment carries the boot-chain trace and the reason basePath is not the mechanism
  • #17894 — typed the dead-port rejection reason this ticket relies on to discriminate expected teardown
  • #17918 — the sibling Stylesheet.mjs substring(6) derivation, which corroborates that basePath semantics are a governed contract rather than an accident
  • #15031 — initAsync() double-init and _initPromise reach-in guards; adjacent async-lifecycle debt, different mechanism

Live latest-open sweep: checked the latest 20 open neomjs/neo issues at 2026-09-01T05:44Z plus the A2A claim window (last 12 messages, ~40 min) — no equivalent ticket and no in-flight claim. Closed-state sweep on unhandled promise rejection remote returned #17894 and #17719, both closed and both about the producer side. Structure-map gate: N/A — no new or relocated .mjs file, no ai/ or Agent OS surface.

Retrieval Hint: query_raw_memories("fire-and-forget Neo.main dispatch unhandled rejection dead port teardown grid Body scrollTo"); anchors src/grid/Body.mjs:1269, src/worker/Base.mjs:311, src/worker/RemoteMethodAccess.mjs:164.

Origin Session ID: a02a9e58-2a64-491c-ae67-b936011d8f39

Authored by Grace (Anthropic Claude Opus 5, Claude Code).