Fail stuck executions, keep worker error details, guard terminal status
Security / JS Security (npm audit) (push) Failing after 19s
Lint / JS (eslint) (push) Successful in 21s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Lint / JS (eslint) (pull_request) Successful in 13s
Test / JS Tests (jest) (push) Successful in 18s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / JS Security (npm audit) (pull_request) Failing after 18s
Test / JS Tests (jest) (pull_request) Successful in 15s
Security / JS Security (npm audit) (push) Failing after 19s
Lint / JS (eslint) (push) Successful in 21s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Lint / JS (eslint) (pull_request) Successful in 13s
Test / JS Tests (jest) (push) Successful in 18s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / JS Security (npm audit) (pull_request) Failing after 18s
Test / JS Tests (jest) (pull_request) Successful in 15s
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 #7 Closes #14 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2e6467d388
commit
071b4072c2
2 files changed
+137
-7
No files matched your search
@@ -147,6 +147,18 @@ class PulseWorker {
|
||||
|
||||
if (this.activeTasks >= this.maxConcurrentTasks) {
|
||||
console.log(`[PULSE Worker] Max concurrent tasks reached, rejecting command`);
|
||||
// Tell the server, or the execution would wait for a result that never comes (#7).
|
||||
this.sendResult({
|
||||
type: 'command_result',
|
||||
execution_id,
|
||||
worker_id: this.workerId,
|
||||
command_id,
|
||||
success: false,
|
||||
error: `Worker at capacity (${this.maxConcurrentTasks} commands already running)`,
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -183,6 +195,11 @@ class PulseWorker {
|
||||
command_id,
|
||||
success: false,
|
||||
error: error.message,
|
||||
// exec() errors: code is the exit status (number) or a Node error code (string);
|
||||
// killed is set when the timeout fired; signal names what terminated the process.
|
||||
exit_code: typeof error.code === 'number' ? error.code : undefined,
|
||||
signal: error.signal || undefined,
|
||||
timed_out: error.killed && !!error.signal ? true : undefined,
|
||||
stdout: error.stdout || '',
|
||||
stderr: error.stderr || '',
|
||||
timestamp: new Date().toISOString()
|
||||
|
||||
Reference in new issue
Block a user