LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtOct 17, 2026, 7:57 PM
updatedAtOct 17, 2026, 9:10 PM
githubUrlhttps://github.com/neomjs/neo/issues/19837
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 17, 2026, 9:09 PM

The neuralLink fixture stops the Bridge it spawned

neo-opus-grace
neo-opus-grace commented on Oct 17, 2026, 7:57 PM

Context

defect-note 2026-10-17 17:46Z (fingerprint 7aa4bc2640663fdc). The Neural Link Bridge that the Engine's neuralLink Playwright fixture spawns outlives the run. A Stage e2e run at 17:04Z started its Bridge (npm run ai:server-neural-link from NEO_AGENTOS_RUNTIME_ROOT) on NEO_NL_PORT 18981; 31 minutes later it was still listening, and the next run found the port taken. The same happened after the 17:3xZ run. Both were stopped by exact PID.

With hosted Stage CI off until the Nov 1 reset, authors run the e2e tiers locally on the operator's machine (operator directive, relayed 2026-10-17 16:58Z; local testing is priority zero). Every run leaves a Bridge behind there.

Emmy's source triage (A2A 17:54Z), re-read here:

  • test/playwright/fixtures.mjs:261 starts the Bridge (manageConnection({action: 'start'})), and the fixture ends at await use(nl) (:861) with no finally and no stop.
  • In the Brain, ConnectionService.manageConnection with action: 'stop' kills only its own bridgeProcess (ai/services/neural-link/ConnectionService.mjs:913–923, bridgeProcess.kill()).
  • That process is the npm parent of a detached spawn (:1037–1039). Whether killing it reaps the node run-bridge.mjs child is not shown.

The Problem

A local e2e run leaves a Bridge process and a bound port per run. A later run on the same port connects to whatever is listening, which can be a Bridge started from another NEO_AGENTOS_RUNTIME_ROOT, so it may run other Brain code than the run requested. No current spec observes any of this.

The Architectural Reality

  • neuralLink (test/playwright/fixtures.mjs:244) is test-scoped. The first test of a worker spawns the Bridge when none is listening; the later tests connect to it. A per-test stop would respawn a Bridge for every test, so the stop belongs at worker end.
  • The fixture is the second Bridge entrypoint, beside the MCP server (:257). A Bridge the fixture found running belongs to someone else, such as the operator's live :8081 or another seat's, and must not be stopped.
  • The fixture ships in the neo.mjs package. Stage and the Institution import it from node_modules/neo.mjs/test/playwright/fixtures.mjs, so they receive the fix with the Engine version they pin.

The Fix

Move the Bridge lifecycle into a worker-scoped fixture ({scope: 'worker'}) that the test-scoped neuralLink depends on. Once per worker it starts or connects, and records whether this worker spawned the Bridge. After use, it stops only a Bridge it spawned, through the Brain's stop contract, never one it found running. If the witness shows that the Brain's stop leaves the node child alive, the reaping belongs to ConnectionService, which owns the spawn. That gap becomes a Brain leaf with the witness; the fixture does not kill around it.

Acceptance Criteria

  • AC-1: On an initially unused port, a run that spawned the Bridge leaves no listener and no process from that spawn once its worker ends.
  • AC-2: The same holds when a test in the run fails.
  • AC-3: A Bridge already listening on the port before the run is used and left running (the external-Bridge control).
  • AC-4: The PR records the witness for AC-1–AC-3: PID, process group and port, before and after. If the Brain's stop does not reap the child, the PR names the Brain leaf it filed.

Out of Scope

  • ConnectionService's own stop semantics (a Brain leaf if AC-4 finds a gap).
  • Consumers' pin bumps.
  • The MCP server's Bridge lifecycle.

Related

neomjs/neo-stage#27 (where the local-testing directive is recorded) · neomjs/neo-stage#145 (the runs that showed it) · neomjs/neo-stage#158 (local test output)

Live latest-open sweep: latest 20 open issues at 2026-10-17T17:56:34Z; no equivalent A2A claim sweep: last 15 lane-claim messages, all read-states; none on the fixture's Bridge lifecycle MC sweep / search: gh search issues in neo and neo-agent-brain for "fixture bridge teardown", "spawned bridge outlives", "neuralLink fixture bridge", "orphan bridge port": no results Own-assignment sweep: #19652, #19765, #19766 (the 13.3 cut), #15000; disjoint

Origin Session ID: caeb11ca-daae-42a2-8924-95229e329df2

Retrieval Hint: "neuralLink Playwright fixture spawned Bridge outlives the run worker-scoped teardown"

tobiu referenced in commit 44534e3 - "fix(test): the neuralLink fixture stops the Bridge its worker spawned (#19837) (#19838) on Oct 17, 2026, 9:09 PM
tobiu closed this issue on Oct 17, 2026, 9:09 PM