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

Open
HAL9000 wants to merge 3 commits from fix/stdlib-transport-cleanup into master

3 Commits

Author SHA1 Message Date
HAL9000 10e8167ef7 fix(lsp): address reviewer blockers — remove duplicate step, move LspError import, fix metadata
CI / lint (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 1m2s
CI / security (pull_request) Successful in 1m5s
CI / quality (pull_request) Successful in 1m1s
CI / build (pull_request) Successful in 50s
CI / helm (pull_request) Successful in 51s
CI / push-validation (pull_request) Successful in 35s
CI / unit_tests (pull_request) Successful in 5m11s
CI / docker (pull_request) Successful in 1m37s
CI / integration_tests (pull_request) Successful in 8m57s
CI / coverage (pull_request) Failing after 19m24s
CI / status-check (pull_request) Has been cancelled
- Remove duplicate @then("ltcov the transport should be alive") in
  features/steps/lsp_transport_coverage_steps.py; the same step is
  already defined at features/steps/lsp_transport_post_spawn_cleanup_steps.py:92
  for issue #7044. The duplicate caused AmbiguousStep at behave load
  time, erroring every BDD feature in the suite (root cause of the
  CI unit_tests + coverage gate failures).
- Remove redundant inline `from cleveragents.lsp.errors import LspError`
  inside StdioTransport.start(); the module-level import at line 30
  is sufficient and inline imports violate the project import rule.
- Update CONTRIBUTORS.md: correct the PR number from #11160 (the
  linked issue) to #11185 (this PR).
- features/lsp_transport_subprocess_cleanup.feature: add the required
  `@tdd_issue @tdd_issue_11160` tags per the TDD bug-fix workflow,
  fix the `returnscode` typo in a scenario name, and rename the
  `dye_on_start` command label to `die_on_start`.

ISSUES CLOSED: #11160
2026-06-15 00:41:18 -04:00
controller-ci-rerun 007fd66b90 chore: re-trigger CI [controller] 2026-06-15 00:41:18 -04:00
HAL9000 8e41165223 fix(lsp): cleanup subprocess on failed initialization in StdioTransport.start()
After Popen() succeeds, verify the spawned process is still alive via poll().
If it died immediately during initialization (binary corrupted, missing shared
libraries, etc.), call stop() to release the handle and raise LspError with exit code.
This prevents resource leaks where _process was left pointing to a terminated Popen object.

ISSUES CLOSED: #11160
2026-06-15 00:41:18 -04:00