Commit Graph

8 Commits

Author SHA1 Message Date
roboomp 941a931599 fix(tiny): repaired cuda sidecars for auto gpu requests
Extended ONNX Runtime CUDA sidecar repair to PI_TINY_DEVICE=auto and gpu on Linux x64, matching the CUDA-capable diagnostics path.

Added focused regression coverage for both generic accelerated settings.

Refs #4475
2026-07-03 18:34:56 +00:00
roboomp ccd68b9d84 fix(tiny): preserved cpu fallback when cuda sidecar repair fails
Deferred ONNX Runtime CUDA sidecar repair failure into the runtime metadata so loadTransformersRuntime keeps loading and loadPipelineWithDeviceFallback still gets its CUDA→CPU retry when NuGet is offline or the ort install script is unavailable. The failure surfaces through the CUDA diagnostics helper instead of hard-erroring the tiny worker.

Refs #4475
2026-07-03 18:26:13 +00:00
roboomp f257fd533f fix(tiny): repaired cuda side-runtime install
Downloaded missing ONNX Runtime CUDA provider sidecars when the compiled tiny-model side runtime is used with PI_TINY_DEVICE=cuda.

Preserved actionable CUDA worker diagnostics in tiny-models text output and added focused regression coverage.

Fixes #4475
2026-07-03 18:21:19 +00:00
roboomp b0e52a13ac fix(subprocess): avoided stderr capture handles for idle workers
Bun keeps the parent event loop alive when an unref'd child has a piped
stderr stream. The first #4324 fix started with stderr: "pipe", so a
long-lived idle TTS/STT/tiny/mnemopi worker could keep short CLI commands
alive even after proc.unref().

Switch worker stderr capture to a temp-file fd target instead of a Bun
ReadableStream pipe. The parent does not start any JS read while the
worker is alive; after onExit it reads the bounded tail from the file,
logs captured lines, appends the tail to the surfaced worker Error, then
closes and removes the temp capture.

Add a regression that spawns a non-test wrapper process with an idle
unref'd worker and asserts the wrapper exits immediately. Existing stderr
capture, truncation, and intentional SIGKILL behavior remain covered.

Fixes #4324
2026-07-02 16:25:41 +00:00
roboomp 4cca96c5bf fix(subprocess): captured worker stderr and surfaced it on unexpected exit
Inference worker subprocesses (TTS, STT, tiny-model, mnemopi embeddings)
were spawned with stderr: "ignore", so a native crash inside the child
was completely discarded. The parent only ever logged the bare exit code
(e.g. Kokoro TTS's recurring "tts subprocess exited with code 7"),
leaving the recurring crash loop undiagnosable.

createWorkerSubprocess now pipes stderr and drains it in the parent:

- Each decoded stderr line is forwarded to logger.debug under
  "<exitLabel> stderr" so operators get live visibility on chatty native
  runtimes without touching the chat scrollback.
- A bounded 16 KiB ring keeps the tail of stderr so the eventual exit
  Error carries the actual crash reason (ONNX Runtime traceback, glibc
  assertion, etc.) instead of "code 7" alone. The prefix is preserved so
  existing log grepping keeps working.
- The exit event and the stderr pipe are independent, so a synchronous
  read in onExit would race the drain. SpawnedSubprocess grew a
  stderrDrained: Promise<void>, and onExit chains the error surface off
  it so callers see the whole tail. Tests can await stderrDrained
  deterministically instead of racing wall-clock timers.
- Intentional terminate() SIGKILLs still stay silent — signal-exit
  gating on intentionalExit is unchanged.

Fixes #4324
2026-07-02 16:09:15 +00:00
can1357 b4f75abb30 fix(cli): strip Windows worker fallback executable 2026-06-29 16:45:47 +02:00
roboomp 777b609e63 fix(cli): preserved windows extension paths
Rejoined split Windows extension module paths before launch parsing finishes and stripped extended-length Win32 prefixes before Bun import and worker spawn APIs see them.

Fixes #3804
2026-06-29 11:50:36 +00:00
can1357 1750973503 refactor(coding-agent): established shared subprocess infrastructure to
- Established shared `subprocess` infrastructure to standardize worker IPC, environment resolution, and error handling.
- Migrated mnemopi, speech-to-text, tiny-model, and TTS clients to utilize consolidated worker-client utilities.
- Implemented common runtime helpers for ONNX model loading, logging, and process readiness probing.
- Eliminated redundant local spawn logic and environment mapping across all inference worker clients.
2026-06-22 05:50:07 +02:00