fix(lsp): cleanup subprocess on failed initialization in StdioTransport.start() #11093

Closed
HAL9000 wants to merge 2 commits from fix-lsp-subprocess-cleanup-10597 into master

2 Commits

Author SHA1 Message Date
CleverAgents Bot 6e49814c78 ci: stop master workflow on PR updates
CI / lint (pull_request) Failing after 39s
CI / helm (pull_request) Successful in 31s
CI / push-validation (pull_request) Successful in 25s
CI / build (pull_request) Successful in 1m0s
CI / typecheck (pull_request) Successful in 1m12s
CI / security (pull_request) Successful in 1m12s
CI / quality (pull_request) Successful in 1m31s
CI / integration_tests (pull_request) Failing after 4m2s
CI / e2e_tests (pull_request) Successful in 4m43s
CI / unit_tests (pull_request) Failing after 5m52s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
Remove the stale pull_request trigger from master.yml so PR branch commits do not launch the master workflow.

Maintenance patch for PR #11093.
2026-06-10 20:18:31 -04:00
HAL9000 038839c950 fix(lsp): cleanup subprocess on failed initialization in StdioTransport.start()
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Failing after 1m9s
CI / build (pull_request) Successful in 1m9s
CI / quality (pull_request) Successful in 1m29s
CI / helm (pull_request) Successful in 41s
CI / typecheck (pull_request) Successful in 1m44s
CI / push-validation (pull_request) Successful in 38s
CI / security (pull_request) Successful in 1m46s
CI / benchmark-regression (pull_request) Failing after 1m9s
CI / integration_tests (pull_request) Successful in 4m33s
CI / e2e_tests (pull_request) Successful in 5m42s
CI / unit_tests (pull_request) Failing after 6m40s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 7s
Guard post-Popen code in StdioTransport.start() with try/finally so that if
any exception occurs after spawning the server process (e.g. immediate exit,
future post-spawn validation failures), the orphaned subprocess is terminated
before the error propagates. This prevents leaked child processes when callers
use Transport.start() directly without wrapping it in their own cleanup logic.

Also added a liveness check immediately after Popen -- if the server was spawned
and exited before poll() returned, we raise LspError and clean up the dead process
so callers never receive a dead-process transport instance.

ISSUES CLOSED: #10597
2026-05-09 13:26:45 +00:00