Conversation language servers
Conversation-owned language servers
The registry LSP plugin owns one language-server slot per durable conversation id. Automatic
diagnostics from declared committed tool writes and explicit Lsp tools use the same slot in the process executing the
conversation. The existing sub-agent dispatch routes delegated turns to their runner; daemon
projections and HTTP status reads do not execute those tools or acquire servers. Runner reclamation
awaits BrainService.disposeChannel, including the LSP cleanup promise, before a daemon turn can
take ownership of that conversation. A runner answers a release request with one of three outcomes
(RunnerReleaseOutcome, src/brain/delegatedTurn.ts): released, busy while a turn runs on the
channel, and failed when the channel is idle but its cleanup threw. failed preserves the runner's
route and ownership, so cleanup failure cannot create a second owner, and it is never reported as a
running turn. The idle route sweep treats failed like busy and asks again on a later sweep. The
owner's model switch answers it with a retry message, and a daemon-side continuation or result
delivery refuses with the same cause and steers nothing into the runner.
Host root discovery and workspace filtering consume realAbs and realPathWithin from
elowen/dist/plugins/pathUtils.js. Core resolves existing ancestors of missing targets and rejects
dangling symlinks and non-ENOENT failures. LSP retains marker discovery within its selected permitted
root, never promotes an unbounded file to the filesystem root, and anchors relative host candidates
to the turn's workDir. Containment selects scope, not access: file tools still enforce
assertPathAllowed, and scoped non-admin sessions cannot perform unbounded symbol searches.
Managed and connected-computer paths keep their target-side namespaces and injected path operations;
no host realpath is applied to them.
Host package installation/removal, inventory and server spawn share join(ctx.dataDir(), 'npm').
The explicit prefix wins before PATH; standalone callers without a prefix use PATH only. Managed and
computer package operations remain in their target environment. There is no HOME/instance-root
reconstruction or old-prefix fallback. Core setup no longer provisions language servers; the plugin's
administrator /lsp picker owns supported npm installations.
Existing host installations require a separately authorized offline move before activation. The matched
registry source provides node plugins/lsp/scripts/migrate-prefix.mjs --source <absolute-old-prefix> --destination <absolute-new-prefix>.
Stop all owners and exclude concurrent writers; this is an operator precondition, not script-discovered
locking. The destination parent must exist, but the destination itself must not. Validated POSIX npm
inventory moves by one same-filesystem rename, without overwrite, copy fallback, installation or
payload execution. source-missing is not migration success. Verify inventory and one real diagnostic
after authorized activation. For rollback, stop owners again and reverse the two explicit paths with
the original location absent, then restore the matching previous release; this moves current package
state rather than restoring an earlier snapshot. Synthetic migration tests do not prove live acceptance.
Cleanup on run settlement, disposal and idle expiry
The plugin contributes registerSessionLifecycle({ releaseSession }); the lsp control exposes only
diagnostics state. BrainService invokes the generic releaseSessionResources owner through the
already-loaded registry (peek, never a plugin load at teardown) on final run settlement
(agent_settled, which calls onRunSettled in src/brain/persistence.ts), and settlement awaits
cleanup. LiveSessionRegistry's disposal callback starts the same release without blocking.
agent_end does not release resources because a run may continue. The existing diagnostics service
owns process cleanup with scope: 'process' and disposeSync; core starts it in daemon and runner
processes and retains synchronous exit disposal when ordinary stop fails or remains pending.
Synchronous disposal attempts termination but does not acknowledge asynchronous transport or lease
closure; SIGKILL cannot run it. LSP installs no separate process-exit listener.
The plugin fences late acquisition, cancels diagnostics and drains transport closure. Repeated
cleanup calls join the same promise. Root or server-language replacement waits for the old transport
to close; idle fallback defaults to 60 seconds with a 5-second sweep. The plugin's idleTtlMinutes setting defaults to one minute and accepts 0 to 240. Local transports own a process
group so disposal kills their descendants; initialize retains the owning process watchdog for
runner death. TypeScript disables its separate syntax server and uses a 1024 MiB old-space allowance,
not an RSS hard limit. The plugin sets no option that disables automatic typing acquisition for JavaScript projects.