Abort kills worker processes; fix #6, #21, #34; worker keepalive and backoff #67

Merged
jared merged 5 commits from backend-bugs into main 2026-11-23 01:44:45 -05:00
5 Commits
Author SHA1 Message Date
jaredandClaude Opus 5.5 b5af336338 Register a prompt's pending answer before announcing it
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (pull_request) Successful in 51s
CI / Security (npm audit) (pull_request) Successful in 51s
CI / Integration (api) (pull_request) Successful in 3m51s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 3m35s
CI / Test (jest) (push) Successful in 1m41s
CI / Scan (secrets, workflows, shell) (push) Successful in 2m57s
CI / Test (jest) (pull_request) Successful in 48s
CI / UI (playwright) (pull_request) Failing after 11m39s
CI / Lint (eslint) (push) Successful in 40s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 35s
CI / Notify (pull_request) Skipped
CI / Security (npm audit) (push) Successful in 52s
CI / Integration (api) (push) Successful in 3m6s
CI / UI (playwright) (push) Successful in 2m18s
CI / Deploy (push) Skipped
CI / Deploy worker (push) Skipped
CI / Notify (push) Skipped
An answer arriving between the 'prompt' log entry and the registration got
'No pending prompt' (404); CI hit it under load on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:36:22 -05:00
jared 986791ae20 Merge remote-tracking branch 'origin/main' into backend-bugs
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 35s
CI / Test (jest) (push) Successful in 39s
CI / Security (npm audit) (push) Successful in 21s
CI / Integration (api) (push) Canceled after 3m54s
CI / Scan (secrets, workflows, shell) (push) Canceled after 3m18s
CI / UI (playwright) (push) Canceled after 0s
CI / Deploy (push) Canceled after 0s
CI / Lint (eslint) (pull_request) Canceled after 0s
CI / Deploy worker (push) Canceled after 0s
CI / Test (jest) (pull_request) Canceled after 0s
CI / Notify (push) Canceled after 0s
CI / Security (npm audit) (pull_request) Canceled after 0s
CI / Integration (api) (pull_request) Canceled after 0s
CI / Scan (secrets, workflows, shell) (pull_request) Canceled after 0s
CI / UI (playwright) (pull_request) Canceled after 0s
CI / UI screenshots (before/after) (pull_request) Canceled after 0s
CI / Deploy (pull_request) Canceled after 0s
CI / Deploy worker (pull_request) Canceled after 0s
CI / Notify (pull_request) Canceled after 0s
2026-11-23 00:27:00 -05:00
jaredandClaude Opus 5.5 397f4dd778 Worker: keepalive, reconnect backoff, no crash loop at startup (#1, #29)
- #1: the worker pings the server every 30 s over the WebSocket; if the
  previous ping got no pong, the connection is dead (server restart or
  network drop without a close) and is terminated so it reconnects. The
  ws server answers pings itself, so the server needs no change.
- #29: reconnects back off from 1 s doubling to 60 s with up to 20%
  jitter, reset on a successful connection; a failed first heartbeat is
  logged and retried instead of exiting into a systemd crash loop.
- stop() no longer schedules a reconnect.
- Tests: backoff bounds, missed pong terminates, pong keeps, startup with
  an unreachable server (unit and end to end). The #6 test now waits for
  the worker to show offline before sending one command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:08:35 -05:00
jaredandClaude Opus 5.5 d517cae7e6 Fix orphaned quick commands, prompt timeouts and worker delete (#6, #21, #34)
- #6: a quick command to a disconnected worker is refused before an
  execution is recorded, instead of leaving one stuck in 'running'.
- #21: an unanswered prompt fails the execution (prompt_timeout) instead
  of continuing as if someone had chosen; prompt and wait steps never
  wait past the execution's deadline, and a wait cut short by it fails
  with execution_timeout. PULSE_PROMPT_TIMEOUT_MS (minimum 1 s, default
  60 min) lets the test stack use 8 s.
- #34: deleting a connected worker is a 409 explaining it would
  re-register on its next heartbeat; offline workers delete as before.

Tests for each (integration 45/45).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:04:06 -05:00
jaredandClaude Opus 5.5 073114c92e Abort kills the command on the worker (#8 follow-up)
- worker: commands run with spawn in their own process group (same
  timeout, 10 MB output limit and result fields as exec). A new
  cancel_command message (by command_id, or every command of an
  execution) sends SIGTERM to the group, then SIGKILL after 5 s; the
  result reports cancelled: true. Old workers ignore the message.
- server: the abort route sends cancel_command to the worker running each
  of the execution's commands.
- Tests: the whole process tree dies on cancel (a background child too),
  execution-wide cancel leaves other executions alone, and end to end an
  aborted quick command's process is gone from the worker. Liveness
  checks treat zombies as dead (an orphan waits to be reaped).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:59:50 -05:00