Skip to content

fix(lsp): suppress unhandled spawn error on LSP child process#99922

Closed
cxbAsDev wants to merge 5 commits into
openclaw:mainfrom
cxbAsDev:fix/lsp-spawn-error-handler
Closed

fix(lsp): suppress unhandled spawn error on LSP child process#99922
cxbAsDev wants to merge 5 commits into
openclaw:mainfrom
cxbAsDev:fix/lsp-spawn-error-handler

Conversation

@cxbAsDev

@cxbAsDev cxbAsDev commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

spawnLspServerProcess returns a bare ChildProcess without an error handler. Missing LSP binary (ENOENT) emits unhandled error event that crashes the gateway.

Why This Change Was Made

Add child.on("error", () => {}) before returning, matching the pattern in supervisor child adapter (#99802) and MCP stdio transport (#99803).

User Impact

Missing or unstartable LSP servers no longer crash the gateway. Existing LSP initialization failure path provides diagnostics.

Evidence

Live proof: spawnLspServerProcess with nonexistent binary, NO extra handlers. Process survives. Regression test: 4 passed.

Risk

Low. One-line noop handler. Same pattern merged in #99800, #99802, #99803.

spawnLspServerProcess returns a ChildProcess without an error handler.
If the LSP server binary is missing (ENOENT), the async error event
crashes the process. Add a noop error handler, consistent with the
pattern used in the supervisor child adapter and MCP stdio transport.

Co-Authored-By: Claude <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 10:21 AM ET / 14:21 UTC.

Summary
The PR stores the spawned LSP child process, attaches a no-op error listener before returning it, and adds a regression test that emits an LSP child-process error.

PR surface: Source +2, Tests +15. Total +17 across 2 files.

Reproducibility: yes. Current main returns the spawned LSP child without an error listener, and Node failed-spawn behavior emits error; I verified the Node event behavior with focused probes but did not run the full repo test suite in this read-only pass.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Wait for QA Smoke CI or any required pending checks to finish before merge.

Risk before merge

  • [P1] QA Smoke CI was still pending at review time, so maintainers should wait for required checks to finish before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow spawn-boundary guard and regression test after maintainer review and green required checks; richer LSP ENOENT diagnostics can remain a separate follow-up.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No ClawSweeper repair lane is appropriate because the patch has no supported code defect; remaining work is maintainer review and final required-check completion.

Security
Cleared: The diff only adds a child-process error listener and a focused regression test; it does not change command sources, dependencies, workflows, permissions, secrets, or package resolution.

Review details

Best possible solution:

Land the narrow spawn-boundary guard and regression test after maintainer review and green required checks; richer LSP ENOENT diagnostics can remain a separate follow-up.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main returns the spawned LSP child without an error listener, and Node failed-spawn behavior emits error; I verified the Node event behavior with focused probes but did not run the full repo test suite in this read-only pass.

Is this the best way to solve the issue?

Yes. Attaching the guard inside spawnLspServerProcess fixes the exported helper and both runtime callers at the spawn boundary without changing command resolution; caller-only handling would leave the helper unsafe.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 11eeba972f46.

Label changes

Label justifications:

  • P2: This is a bounded agent-runtime crash fix for an optional bundled LSP child-process path with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports a live spawnLspServerProcess run with a nonexistent binary and no extra handlers where the process survived, and the latest Real behavior proof check passed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports a live spawnLspServerProcess run with a nonexistent binary and no extra handlers where the process survived, and the latest Real behavior proof check passed.
Evidence reviewed

PR surface:

Source +2, Tests +15. Total +17 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 1 15 0 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 18 1 +17

What I checked:

Likely related people:

  • vincentkoc: Git history shows Vincent Koc introduced the bundled LSP runtime and related plugin LSP surfaces that own this spawn path. (role: feature introducer; confidence: high; commits: 8193af6d4ebf, 4ebd3d11aa12, 74e7b8d47b18; files: src/agents/pi-bundle-lsp-runtime.ts, src/agents/agent-bundle-lsp-runtime.ts, src/plugins/bundle-lsp.ts)
  • steipete: Peter Steinberger refactored helper/source seams in the prior LSP runtime and plugin LSP loader area, making him a useful routing candidate for this boundary. (role: recent area contributor; confidence: medium; commits: bcd61f0a382d; files: src/agents/pi-bundle-lsp-runtime.ts, src/plugins/bundle-lsp.ts)
  • cxbAsDev: This author recently landed the sibling SSH tunnel, supervisor child adapter, and MCP stdio error-handling fixes cited by this PR, so they have current context on the process-error pattern. (role: recent adjacent process-error contributor; confidence: medium; commits: c6ed9d8d06a4, 3b37fe1de46c, 1b84316a91dc; files: src/infra/ssh-tunnel.ts, src/process/supervisor/adapters/child.ts, src/agents/mcp-stdio-transport.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (5 earlier review cycles)
  • reviewed 2026-07-04T11:29:59.673Z sha 28cef2a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T13:22:37.062Z sha 63e592a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T13:38:40.415Z sha 63e592a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T13:53:55.574Z sha 6426e7c :: needs maintainer review before merge. :: none
  • reviewed 2026-07-04T14:03:57.654Z sha 6426e7c :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 4, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 4, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 4, 2026
@steipete steipete self-assigned this Jul 5, 2026
@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thank you — this fix landed through maintainer batch PR #100399 in commit b22c36f, with contributor credit and changelog thanks preserved. Closing this source PR as superseded.

@steipete steipete closed this Jul 5, 2026
@cxbAsDev
cxbAsDev deleted the fix/lsp-spawn-error-handler branch July 15, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants