Context
Found on 2026-10-06 while deploying DevIndex's environments (neomjs/devindex#60). @neo-opus-grace first diagnosed it on 2026-08-19 but never filed it. DevIndex is a workspace: neo.mjs is a dependency under node_modules/neo.mjs, as in every npx neo-app workspace.
The Problem
In a workspace's dev mode the page sits at apps/<app>/ and the workers run from node_modules/neo.mjs/src/worker/. A worker resolves a relative URL against its own script. So DevIndex's store URL, Neo.config.basePath + 'apps/devindex/resources/data/users.jsonl' with basePath: '../../' written for the page, lands at node_modules/neo.mjs/apps/devindex/resources/data/users.jsonl.
Measured in headless Chromium on 2026-10-06, against the devindex workspace on neo.mjs 13.1.0:
- At an origin root, dev mode fetches
/node_modules/neo.mjs/apps/devindex/resources/data/users.jsonl and gets a 200. That is only because neo.mjs@13.1.0 still ships DevIndex's own data, the copy #17240 later removed. The grid shows that stale copy instead of the workspace's index, and nothing turns red.
- Under a mount (
/devindex/), the same fetch is a 404 and the grid stays empty.
- From 13.2.0, which no longer ships
apps/devindex, it is a 404 at an origin root too.
The engine already compensates for this offset in two places, each its own way:
src/data/connection/Xhr.mjs:186 prefixes ../../ to a relative URL when the worker runs inside node_modules/neo.mjs. It applies to Xhr only, and it keys on the hostname (!location.href.startsWith('https://neomjs.com/')).
src/worker/App.mjs:746 does the same for the theme map, keyed on Neo.config.workerBasePath containing node_modules.
src/data/connection/Fetch.mjs:115 and src/data/connection/Stream.mjs:71 pass the URL to fetch() unchanged.
The Architectural Reality
Neo.data.connection.Base is the shared base of Fetch, Stream and Xhr.
basePath stays page-relative. The Stylesheet addon depends on its relative form (basePath.substring(6)), and an absolute basePath broke DevIndex's boot when measured on 2026-08-19.
- A fixed
../../ fits only a page two levels below the workspace root. A nested child app (four levels, as in neomjs/multiwindowcolors) already reaches the root from the worker without a prefix, so a fixed prefix overshoots there.
- The page URL already travels.
Neo.worker.Manager sends config.url = {href, search} at registration, on both the initial and the lazy path (src/worker/Manager.mjs:314, :832). href is not the base a relative URL resolves against, though: a page with <base> resolves against its effective document base, document.baseURI. Since neomjs/devindex#62, DevIndex's built entries carry <base href="../../">, so href would resolve them into dist/<env>/apps/devindex/… instead of the shared site root (@neo-gpt's intake, 6019828439).
- A shared realm keeps the first window's config.
Neo.worker.Base#onRegisterNeoConfig merges a registration into Neo.config only while Neo.config.windowId is unset (src/worker/Base.mjs:655). A second window's registration changes nothing global; the App worker keeps each window's own config in Neo.windowConfigs[windowId] (src/worker/App.mjs:737). Stores and connections carry no window.
The Fix
- Delivery. Main adds the effective document base to the existing payload:
config.url = {base: document.baseURI, href, search}, on both registration paths.
- Gate. The rule applies only in a workspace's dev-mode layout: the worker runs inside
node_modules/neo.mjs/ (its own location) while the realm's document base does not. Everywhere else, connections keep today's worker-relative resolution. That covers the engine repo, every dist build including neomjs/devindex#62's entries (their workers sit in dist/<env>/), and a page served from inside the package, the case Xhr's hostname branch skipped.
- Resolution. One method on
Neo.data.connection.Base, used by Fetch, Stream and Xhr, resolves a relative URL (./, ../) with new URL(url, Neo.config.url.base). It replaces Xhr's hostname branch, and Xhr's insideNeo opt-out keeps its meaning.
- Selection, stated, not implied. A realm resolves against
Neo.config.url.base, the base of the window that registered it, which is the window Neo.config already describes. In a shared realm whose windows have different document bases, a connection serving another window passes an absolute URL. That is the per-connection override; no first- or last-window pick happens implicitly.
Contract Ledger
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback / Edge Case |
Docs |
Evidence |
config.url.base: a new field in the registration payload Neo.worker.Manager sends (Manager.mjs:314, :832) |
this ticket; @neo-gpt's intake |
document.baseURI of the registering window, beside the existing href and search |
Additive: existing readers of url.href and url.search are unchanged. A worker started without registration has no base and keeps worker-relative resolution |
JSDoc where the payload is built |
Unit: both registration paths carry base, and a page with <base> sends its effective base, not href |
Neo.data.connection.Base relative-URL resolution, used by Fetch, Stream, Xhr |
this ticket; the existing offsets at Xhr.mjs:186 and App.mjs:746 |
In a workspace's dev-mode layout (the gate above), a relative URL resolves against Neo.config.url.base; elsewhere, unchanged |
Absolute URLs pass through. Without url.base, resolution stays worker-relative. Xhr's insideNeo opt-out keeps its meaning. A second window's base never replaces the realm's; a connection serving another window passes an absolute URL |
JSDoc on the resolving method |
The criteria below |
Acceptance Criteria
Post-Merge Validation
Out of Scope
basePath itself, and the Stylesheet addon's relative paths.
- Direct
fetch() calls in app code outside the connections.
Related
#17240 (DevIndex's data left the package), #17976 (dist/esm resolved basePath to the repo root), neomjs/devindex#60 (the Pages environments that found this).
Live latest-open sweep: checked the latest 20 open neomjs/neo issues at 2026-10-06T15:05:55Z; no equivalent.
A2A claim sweep: the latest 25 lane claims; no overlapping claim.
MC sweep: "workspace dev mode worker resolves Neo.config.basePath…", 6 results. They surfaced the 2026-08-19 diagnosis (no ticket filed), the Xhr compensation (noted 2026-02-24) and the path-base analysis of 2026-08-27; none is a decision against fixing it.
Own-assignment sweep: 2 open (#14800, #15000); none overlapping.
Origin Session ID: 40a3c119-6419-4e87-9248-002c686708fe
Retrieval Hint: "workspace dev mode worker relative URL node_modules/neo.mjs Stream Fetch Xhr basePath"
Context
Found on 2026-10-06 while deploying DevIndex's environments (neomjs/devindex#60). @neo-opus-grace first diagnosed it on 2026-08-19 but never filed it. DevIndex is a workspace:
neo.mjsis a dependency undernode_modules/neo.mjs, as in everynpx neo-appworkspace.The Problem
In a workspace's dev mode the page sits at
apps/<app>/and the workers run fromnode_modules/neo.mjs/src/worker/. A worker resolves a relative URL against its own script. So DevIndex's store URL,Neo.config.basePath + 'apps/devindex/resources/data/users.jsonl'withbasePath: '../../'written for the page, lands atnode_modules/neo.mjs/apps/devindex/resources/data/users.jsonl.Measured in headless Chromium on 2026-10-06, against the devindex workspace on
neo.mjs13.1.0:/node_modules/neo.mjs/apps/devindex/resources/data/users.jsonland gets a 200. That is only becauseneo.mjs@13.1.0still ships DevIndex's own data, the copy #17240 later removed. The grid shows that stale copy instead of the workspace's index, and nothing turns red./devindex/), the same fetch is a 404 and the grid stays empty.apps/devindex, it is a 404 at an origin root too.The engine already compensates for this offset in two places, each its own way:
src/data/connection/Xhr.mjs:186prefixes../../to a relative URL when the worker runs insidenode_modules/neo.mjs. It applies to Xhr only, and it keys on the hostname (!location.href.startsWith('https://neomjs.com/')).src/worker/App.mjs:746does the same for the theme map, keyed onNeo.config.workerBasePathcontainingnode_modules.src/data/connection/Fetch.mjs:115andsrc/data/connection/Stream.mjs:71pass the URL tofetch()unchanged.The Architectural Reality
Neo.data.connection.Baseis the shared base ofFetch,StreamandXhr.basePathstays page-relative. The Stylesheet addon depends on its relative form (basePath.substring(6)), and an absolutebasePathbroke DevIndex's boot when measured on 2026-08-19.../../fits only a page two levels below the workspace root. A nested child app (four levels, as in neomjs/multiwindowcolors) already reaches the root from the worker without a prefix, so a fixed prefix overshoots there.Neo.worker.Managersendsconfig.url = {href, search}at registration, on both the initial and the lazy path (src/worker/Manager.mjs:314,:832).hrefis not the base a relative URL resolves against, though: a page with<base>resolves against its effective document base,document.baseURI. Since neomjs/devindex#62, DevIndex's built entries carry<base href="../../">, sohrefwould resolve them intodist/<env>/apps/devindex/…instead of the shared site root (@neo-gpt's intake, 6019828439).Neo.worker.Base#onRegisterNeoConfigmerges a registration intoNeo.configonly whileNeo.config.windowIdis unset (src/worker/Base.mjs:655). A second window's registration changes nothing global; the App worker keeps each window's own config inNeo.windowConfigs[windowId](src/worker/App.mjs:737). Stores and connections carry no window.The Fix
config.url = {base: document.baseURI, href, search}, on both registration paths.node_modules/neo.mjs/(its ownlocation) while the realm's document base does not. Everywhere else, connections keep today's worker-relative resolution. That covers the engine repo, every dist build including neomjs/devindex#62's entries (their workers sit indist/<env>/), and a page served from inside the package, the case Xhr's hostname branch skipped.Neo.data.connection.Base, used byFetch,StreamandXhr, resolves a relative URL (./,../) withnew URL(url, Neo.config.url.base). It replaces Xhr's hostname branch, and Xhr'sinsideNeoopt-out keeps its meaning.Neo.config.url.base, the base of the window that registered it, which is the windowNeo.configalready describes. In a shared realm whose windows have different document bases, a connection serving another window passes an absolute URL. That is the per-connection override; no first- or last-window pick happens implicitly.Contract Ledger
config.url.base: a new field in the registration payloadNeo.worker.Managersends (Manager.mjs:314,:832)document.baseURIof the registering window, beside the existinghrefandsearchurl.hrefandurl.searchare unchanged. A worker started without registration has nobaseand keeps worker-relative resolutionbase, and a page with<base>sends its effective base, nothrefNeo.data.connection.Baserelative-URL resolution, used byFetch,Stream,XhrXhr.mjs:186andApp.mjs:746Neo.config.url.base; elsewhere, unchangedurl.base, resolution stays worker-relative. Xhr'sinsideNeoopt-out keeps its meaning. A second window's base never replaces the realm's; a connection serving another window passes an absolute URLAcceptance Criteria
Fetch,StreamandXhrresolve a relative URL to the URL the page would, for a page two and four levels below the workspace root, at an origin root and under a mount. Specs pin each case.<base>and its workers outsidenode_modules(neomjs/devindex#62's layout) resolves exactly as before.Neo.windowConfigskeeps B's, and an absolute URL passes through.insideNeocontrol: an Xhr request withinsideNeoresolves as before.Post-Merge Validation
Out of Scope
basePathitself, and the Stylesheet addon's relative paths.fetch()calls in app code outside the connections.Related
#17240 (DevIndex's data left the package), #17976 (dist/esm resolved
basePathto the repo root), neomjs/devindex#60 (the Pages environments that found this).Live latest-open sweep: checked the latest 20 open neomjs/neo issues at 2026-10-06T15:05:55Z; no equivalent. A2A claim sweep: the latest 25 lane claims; no overlapping claim. MC sweep: "workspace dev mode worker resolves Neo.config.basePath…", 6 results. They surfaced the 2026-08-19 diagnosis (no ticket filed), the Xhr compensation (noted 2026-02-24) and the path-base analysis of 2026-08-27; none is a decision against fixing it. Own-assignment sweep: 2 open (#14800, #15000); none overlapping.
Origin Session ID: 40a3c119-6419-4e87-9248-002c686708fe
Retrieval Hint: "workspace dev mode worker relative URL node_modules/neo.mjs Stream Fetch Xhr basePath"