paperclip/server
Cole Crawford 2b1a499678 fix(plugin-worker-manager): recover when a worker's stdin command channel dies
A plugin worker communicates with the host over newline-delimited JSON-RPC
on the child's stdin/stdout pipes. If the host->worker stdin pipe is
destroyed by an EPIPE (or otherwise closes) while the child process keeps
running, the worker becomes uncommandable: every `sendMessage` throws
`Worker process for plugin "<id>" is not writable`, so all host->worker
calls (e.g. http.fetch proxying) fail forever. Crucially `child.on("exit")`
never fires, so the existing crash-recovery/backoff path is never reached
and the worker silently zombies — observed in a Telegram-bridge plugin whose
getUpdates long-poll began failing after ~5 days of uptime and never
recovered until a manual disable/enable.

Fix (no polling watchdog — supervise the command channel the same way the
process is already supervised):

1. `sendMessage` passes a write callback so an async stdin write error is
   surfaced/logged instead of being swallowed.
2. `attachStdioHandlers` attaches `error`/`close` handlers to `child.stdin`.
   If the channel dies while the process is still alive (exitCode/signalCode
   null) and the stop wasn't intentional, it SIGKILLs the child so the
   normal `handleProcessExit() -> scheduleRestart()` recovery runs. This is
   the missing third failure mode, mirroring the existing exit/error handlers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 22:16:13 -06:00
..
scripts fix(server): use stable tsx/cli entry point in dev-watch 2026-03-28 06:42:03 +07:00
src fix(plugin-worker-manager): recover when a worker's stdin command channel dies 2026-08-03 22:16:13 -06:00
CHANGELOG.md chore: release v0.3.1 2026-03-12 13:09:22 -05:00
package.json fix(server): export manual OpenTelemetry spans (#10565) 2026-07-31 12:47:57 -07:00
tsconfig.json Fix root TypeScript solution config 2026-03-09 14:09:30 -05:00
vitest.config.ts fix(test): stop flaky server-suite afterAll hook timeouts (#10024) 2026-07-22 11:51:30 -07:00