Closes#6, closes#21, closes#34, closes#1, closes#29. This also completes #8, whose engine side was #66.
This PR changes the worker, so the Deploy worker job will update CT 153 (a brief reconnect; Gandalf retries).
#8 follow-up: abort kills the command on the worker
The worker runs commands with spawn in their own process group. Behaviour is otherwise unchanged: the same timeout, the same 10 MB output limit and the same result fields as exec.
A new cancel_command message stops a command and everything it started: SIGTERM to the whole group, then SIGKILL after 5 s. The result reports cancelled: true. Older workers ignore the message.
The abort route sends it to the worker running each of the execution's commands.
Keepalive: the worker pings the server every 30 s. If a ping gets no pong, the connection is dead (for example after a server restart or a network drop without a proper close), so the worker terminates it and reconnects.
Reconnects: these back off from 1 s, doubling to 60 s with up to 20% jitter, and reset after a successful connection.
Startup: a failed first heartbeat is logged and retried. Before, the process exited and systemd restarted it every 10 s.
Tests
Unit: process-tree kill (including a background child), cancel by execution, backoff limits, a missed pong terminates the connection while a received pong keeps it, and startup with the server down.
Integration:
an aborted quick command's process really is gone from the worker;
an offline worker is refused and no execution is recorded;
deleting a connected worker gets a 409;
an unanswered prompt fails the execution;
a worker started with the server unreachable keeps running and retrying.
Locally: unit 143/143, integration 46/46, UI 33/33. The process checks treat zombies as dead, which fixed a test flake seen under load.
Closes #6, closes #21, closes #34, closes #1, closes #29. This also completes #8, whose engine side was #66.
**This PR changes the worker**, so the `Deploy worker` job will update CT 153 (a brief reconnect; Gandalf retries).
## #8 follow-up: abort kills the command on the worker
- The worker runs commands with `spawn` in their own process group. Behaviour is otherwise unchanged: the same timeout, the same 10 MB output limit and the same result fields as `exec`.
- A new `cancel_command` message stops a command and everything it started: SIGTERM to the whole group, then SIGKILL after 5 s. The result reports `cancelled: true`. Older workers ignore the message.
- The abort route sends it to the worker running each of the execution's commands.
## #6: quick command to an offline worker
It's now refused **before** any execution is recorded, so no execution is left stuck in "running".
## #21: prompts and waits
- An unanswered prompt **fails** the execution with `prompt_timeout`, instead of continuing as if someone had chosen.
- Prompt and `wait` steps never wait past the execution's overall deadline. A wait that gets cut short fails with `execution_timeout`.
- `PULSE_PROMPT_TIMEOUT_MS` lets the test stack use 8 s; the default stays 60 minutes.
## #34: deleting a connected worker
This gets a 409 that explains the worker would re-register on its next heartbeat. Offline workers delete as before.
## #1 and #29: worker connection resilience
- **Keepalive:** the worker pings the server every 30 s. If a ping gets no pong, the connection is dead (for example after a server restart or a network drop without a proper close), so the worker terminates it and reconnects.
- **Reconnects:** these back off from 1 s, doubling to 60 s with up to 20% jitter, and reset after a successful connection.
- **Startup:** a failed first heartbeat is logged and retried. Before, the process exited and systemd restarted it every 10 s.
## Tests
- Unit: process-tree kill (including a background child), cancel by execution, backoff limits, a missed pong terminates the connection while a received pong keeps it, and startup with the server down.
- Integration:
- an aborted quick command's process really is gone from the worker;
- an offline worker is refused and no execution is recorded;
- deleting a connected worker gets a 409;
- an unanswered prompt fails the execution;
- a worker started with the server unreachable keeps running and retrying.
- Locally: unit 143/143, integration 46/46, UI 33/33. The process checks treat zombies as dead, which fixed a test flake seen under load.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
- 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>
- #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>
- #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>
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>
jared
merged commit a1f26b2bb1 into main2026-11-23 01:44:45 -05:00
jared
deleted branch backend-bugs2026-11-23 01:45:41 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #6, closes #21, closes #34, closes #1, closes #29. This also completes #8, whose engine side was #66.
This PR changes the worker, so the
Deploy workerjob will update CT 153 (a brief reconnect; Gandalf retries).#8 follow-up: abort kills the command on the worker
spawnin their own process group. Behaviour is otherwise unchanged: the same timeout, the same 10 MB output limit and the same result fields asexec.cancel_commandmessage stops a command and everything it started: SIGTERM to the whole group, then SIGKILL after 5 s. The result reportscancelled: true. Older workers ignore the message.#6: quick command to an offline worker
It's now refused before any execution is recorded, so no execution is left stuck in "running".
#21: prompts and waits
prompt_timeout, instead of continuing as if someone had chosen.waitsteps never wait past the execution's overall deadline. A wait that gets cut short fails withexecution_timeout.PULSE_PROMPT_TIMEOUT_MSlets the test stack use 8 s; the default stays 60 minutes.#34: deleting a connected worker
This gets a 409 that explains the worker would re-register on its next heartbeat. Offline workers delete as before.
#1 and #29: worker connection resilience
Tests
🤖 Generated with Claude Code