LearnNewsExamplesServices
Frontmatter
id13439
titleFix neuralLink connectToApp e2e fixture for childapp SharedWorker topology (target.toLowerCase TypeError)
stateClosed
labels
enhancementaitestingarchitecture
assigneesneo-opus-ada
createdAtJun 16, 2026, 4:03 PM
updatedAtJun 17, 2026, 8:35 AM
githubUrlhttps://github.com/neomjs/neo/issues/13439
authorneo-opus-ada
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[x] 13355 Render first-widget transcript and blueprint evidence pane
closedAtJun 16, 2026, 5:23 PM
milestonev13.1

Fix neuralLink connectToApp e2e fixture for childapp SharedWorker topology (target.toLowerCase TypeError)

Closed v13.1.0/archive-v13-1-0-chunk-3 enhancementaitestingarchitecture
neo-opus-ada
neo-opus-ada commented on Jun 16, 2026, 4:03 PM

Context

The shared Playwright e2e fixture neuralLink.connectToApp(appName) (test/playwright/fixtures.mjs) fails for a CHILD app running under a shared SharedWorker, blocking whitebox e2es that drive create_component into a child app. This is the M2 critical-path dependency for the v13.1 cockpit (Discussion #13436) and the blocker behind the #13355 external-agent → evidence whitebox.

Observed

connectToApp('AgentOSWidget') (booting /apps/agentos/childapps/widget/index.html) throws TypeError: target.toLowerCase is not a function at fixtures.mjs:142ConnectionService.waitForSession(targetId, ...) (ai/services/neural-link/ConnectionService.mjs:621 calls target.toLowerCase()). Both I (building #13437) and @neo-gpt (reviewing it) hit the same worker-registration wall. The bridge shows ONE SharedWorker hosting multiple app windows (agentos + AgentOSWidget).

Root cause (diagnosed)

fixtures.mjs:137 resolves targetId = workerId || appName || inferredAppName. workerId comes from await window.Neo.worker.App.getWorkerId() (src/worker/App.mjs:370 returns this.id). For the childapp's SharedWorker topology, workerId resolves to a truthy non-string, so the || keeps it (the designed appName fallback never fires) and waitForSession's String#toLowerCase throws. The exact non-string shape getWorkerId returns for a multi-window SharedWorker childapp needs an empirical confirm.

The Fix

  • Fixture (fixtures.mjs): guard targetId to a usable STRING — if workerId is not a non-empty string, fall back to appName / inferredAppName (the designed fallback): targetId = (typeof workerId === 'string' && workerId) ? workerId : (appName || inferredAppName).
  • Defense (ConnectionService.waitForSession): coerce/guard target so a non-string degrades to a clear "no session" timeout, not a TypeError.
  • Empirical confirm: log typeof/value of await Neo.worker.App.getWorkerId() for the childapp — confirm the non-string shape rather than mask a deeper getWorkerId multi-window bug.

Acceptance Criteria

  • A childapp whitebox e2e (connectToApp('AgentOSWidget')getComponent / createComponent into the app) connects WITHOUT the target.toLowerCase error and reads back a live component.
  • No regression to top-level-app neuralLink e2es (e.g. NeuralLinkCreateGrid.spec.mjs).
  • Root cause empirically confirmed (what getWorkerId returns for the childapp); if a deeper getWorkerId fix is out of scope, note the mask explicitly.

Unblocks

  • #13355 external-agent create_component → evidence whitebox (the residual after PR #13437).
  • The M2 first-widget agent-driven demo (Discussion #13436).

Duplicate sweep

Checked open testing + ai labels + the recent backlog — no existing connectToApp / neuralLink-fixture ticket. Tracked locally as a session task chip before this.