Skip to content

OptimizedNodeBridge should fail fast on spawn/script errors #81

@bbopen

Description

@bbopen

Summary

OptimizedNodeBridge does not validate the bridge script path or detect spawn errors. A missing/invalid scriptPath or pythonPath yields obscure errors later instead of a clear startup failure.

Failure mode

  • scriptPath is missing or pythonPath is invalid.
  • spawn emits error asynchronously; the worker is still added to the pool.
  • Subsequent calls fail with unclear errors.

Evidence

  • src/runtime/optimized-node.ts spawnProcess() calls spawn(...) without checking existsSync(scriptPath) or waiting for spawn/error signals.

Proposed fix

  • Validate scriptPath exists before spawning (like NodeBridge).
  • Await a spawn/ready signal and fail fast on error before adding the worker to the pool.
  • Reject executeRequest with a clear BridgeProtocolError when startup fails.

Acceptance criteria

  • Invalid pythonPath or missing scriptPath fails immediately with a clear error.
  • No workers are added to the pool on spawn failure.
  • Add a test that uses a missing script path and asserts a predictable error.

Metadata

Metadata

Assignees

Labels

area:runtime-nodeArea: Node runtime bridgebugSomething isn't workingpriority:p2Priority P2 (medium)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions