Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
|
@nexxeln you were assigned to #32161, which this PR closes. The inactivity bot closed the issue, but The production diff is +64/-42 across three files. The other 244 added lines are tests. There are two independent commits: the first makes the listener share the app graph with The |
The original fresh boundary omitted router-registering middleware. Keep corsVaryFix fresh per listener while retaining shared app services, and build Default without persistent test auth.
7580445 to
d3c74c6
Compare
Issue for this PR
Closes #32161
Type of change
What does this PR do?
When the TUI also starts an HTTP listener (
--port,--hostnameor mDNS), the process builds two independent Effect service graphs: the listener uses a fresh MemoMap instartListener, and everything else usesAppRuntime. The listener's first request andcheckUpgradethen load the same directory at the same time, so the project bootstraps twice: twocreating instanceand twofromDirectorylogs, plugin init running twice, and a second graph left resident.startListenernow builds with the process MemoMap, so the listener shares the app graph withAppRuntime. The layers the listener owns (routes, router, websocket tracker, the CORSVaryfix) are built withLayer.fresh, so auth is still re-read per listener.The second commit fixes a hang on the same path. If the loading fiber is interrupted (for example the listener scope closes during bootstrap), the
InstanceStoreDeferred never settled anddisposeAllwaited on it forever.completeLoadnow settles the Deferred on every exit, waiters see the interruption, and the entry is removed.This differs from #35998, which shares the
InstanceContextacross graphs. Each graph would still bootstrap its own per-directory state, so the duplicate work is deferred and not removed.#32161 was closed by the inactivity bot after 60 days, but the problem is still on
dev:startListenerstill builds with its ownLayer.makeMemoMapUnsafe().How did you verify your code works?
bun test --timeout 30000 test/server/httpapi-listen.test.ts test/project/instance.test.tsinpackages/opencode: 31 pass.bun run typecheckpasses.httpapi-listen.test.ts(the three orderings of the shared-instance test, the listener-restart test and the websocket test) and twoInstanceStoreinterruption tests ininstance.test.ts.--port 0loggedcreating instancetwice on the base build and once with this change (3 of 3). I did not repeat these runs on the final commit. Logs from the base build, one run with--port 0and one without: external-double-init.logs.log, r1-noport.log.Screenshots / recordings
N/A, non-UI change.
Checklist