Quick, scheduled and Gandalf commands relied entirely on the worker sending
a command_result. If the worker was at capacity, disconnected or restarted,
the execution stayed 'running' forever (#7). Failed commands also lost the
worker's error message (#14).
- Direct commands now get a server-side timeout: the command timeout plus
30 s. When it expires, the execution fails with a command_result entry
carrying the error, which the UI already renders and Gandalf treats as
'failed' and retries.
- When a worker socket closes, every command sent over it fails at once.
Pending workflow step waits resolve as failures, so the engine moves on.
- Every 5 minutes, a backstop sweep fails 'running' executions past
EXECUTION_MAX_MINUTES + 10 that nothing is tracking.
- updateExecutionStatus only changes a 'running' execution and reports
whether it did. A late result, or the engine finishing after an abort,
can no longer flip a failed execution to completed or fire a second
webhook.
- Aborting a quick command clears its timeout.
- command_result keeps error, exit_code, signal and timed_out in the log,
the broadcast and the workflow step result.
- The worker reports "at capacity" as a failed result instead of staying
silent, and includes exit_code, signal and timed_out on failures.
- Fix: after a worker reconnected, the old socket closing removed the new
socket's mapping and marked the worker offline, so commands got "Worker
not connected" until the next heartbeat.
Closes#7Closes#14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Any client that could reach :8080 got a WebSocket connection. Every
connection started as a browser client and received every broadcast.
worker_connect accepted a missing api_key, so anyone could register under
an existing worker's name and receive its commands. command_result was
accepted from any connection, so execution logs could be forged.
- Classify each upgrade in verifyClient (lib/wsauth.js). A request is:
- browser: a trusted-proxy Authelia identity in an allowed group;
- worker: Authorization: Bearer <WORKER_API_KEY>;
- pending: neither, allowed only while WORKER_AUTH_ENFORCE is off;
- rejected (401): everything else, and always for a wrong key.
- Only browser connections receive broadcasts. A pending connection may
send only worker_connect and is closed after 30 s if it doesn't identify.
- worker_connect requires the key. A keyless worker is allowed with a
warning until WORKER_AUTH_ENFORCE=1, so existing workers keep working
until they are updated.
- Record which worker each command was sent to. command_result is accepted
only from that worker (matched by DB id, so a reconnect mid-command
still works) and only once. pong no longer trusts a client-supplied id.
- Worker, heartbeat and Gandalf keys use a constant-time compare. Log an
error at startup if WORKER_API_KEY is unset.
- The worker sends its key at the handshake and in worker_connect.
Closes#38
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fix onclick buttons broken by JSON.stringify double-quotes inside HTML
attributes — use data-opt attribute + this.dataset.opt instead
- Track last command stdout in execution state when command_result arrives
- executePromptStep: include last command output in log entry and broadcast
so users can review results alongside the question in the same view
- GET /api/executions/🆔 propagate output field to pending prompt response
- Add .prompt-output CSS class for scrollable terminal-style output block
- Fix MariaDB CAST(? AS JSON) → JSON_EXTRACT(?, '$') (MariaDB 10.11 compat)
- Add worker/worker.js to repo (deployed on pulse-worker-01 / LXC 153)
Fix: worker was not echoing command_id back in result — resolvers always
got undefined, causing every workflow step to timeout and fail
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>