- #3: the list response includes waiting_for_input for each execution
(a running execution blocked on a prompt). The row shows it as
'waiting' (the design system's purple status) and the Waiting status
filter, which could never match, now finds it.
- #4: new only_internal=true filter (Gandalf and scheduler runs), used by
the Automated tab, so it pages and counts on the server like the Manual
tab; the client-side filter over one shared page is gone.
- Tests: integration for waiting_for_input and both server filters; UI
for the waiting status and the filter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Production refused 1,052 of the UI's requests with 429 in one day: every
user arrives through the reverse proxy, so the per-IP limiter put the
whole team in one bucket, and each open page reloaded its whole list on
every live event (about two per Gandalf command).
- lib/ratelimit.js keys both limiters: a trusted SSO identity gets
user:<name>, a request with the valid Gandalf key gets 'gandalf' (an
invalid key falls back to the IP, so nobody can drain Gandalf's bucket),
everything else the IP. The API default goes from 300 to 1000 per
15 min per bucket.
- Pulse.util.throttle: live-event reloads on Executions, Dashboard and
Workers run at most once per 2 s (at once when idle, then once at the end
of the window). User actions still reload immediately.
- Unit tests for the keys. No visual change.
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>
- #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>
- 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>
The four known-bug tests from #59 now pass as normal tests.
- #8 abort: each workflow execution gets an AbortController. The abort
route fires it; the engine checks it before every step and stops; wait
steps, retry delays and waits for a worker's result end as soon as it
fires. New test: aborting during a 20 s command stops the workflow
within seconds and runs no further step.
- #20 goto to a missing step: the execution now fails (it reported
completed). Workflows are also checked on save: a goto, route or prompt
route to a step id that doesn't exist is a 400 ('end' is always valid).
A workflow saved before the check still fails at runtime (tested by
writing one directly).
- #9 schedules whose worker is offline: instead of skipping silently, the
scheduler records a failed run ('Worker offline: the scheduled command
was not sent'), visible in Executions.
- An invalid cron expression (or any bad schedule) is a 400 with the
parser's message instead of a 500.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- eslint-plugin-security 4.2.1 (recommended-legacy) with
detect-object-injection off (it flags every obj[key]) and file/regex
rules off for CI scripts and tests. The remaining hits were false
positives with a one-line reason each (fixed page names, the worker's
own directory, a null check), plus one real tidy-up: the condition
tokenizer's number regex is now two flat patterns with no backtracking,
and malformed numbers like 1.2.3 are refused.
- zizmor 1.32.0 in the Scan job. Its findings are fixed:
persist-credentials: false on every checkout (no job pushes), container
images pinned by digest (tag kept in the reference), and the deploy tag
step takes github.* values through env instead of template expansion.
Left as is: secrets-outside-env (auditor persona; Gitea has no
deployment environments).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Workflow conditions (step.condition and route `if`) are now parsed and
interpreted by lib/condition.js instead of being run with Node's vm
module. The language covers what workflows use: state/params lookups,
parseInt/parseFloat/Number/String/Boolean, a few string methods, the
usual operators with JavaScript semantics. Conditions can only read the
workflow's own data. Every condition in the production workflows gives
the same result as before (differential test, 150 random states each).
- Creating and updating a workflow rejects conditions that don't parse
(400 with the step and the error).
- Creating a workflow requires admin, like editing already did.
- Only the admin group may use Pulse (pages, API and live WebSocket);
employees get 403. Gandalf and workers use API keys and are unaffected.
- The live-update UI test finds its execution's row by id instead of
counting rows (the list is capped at 50).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- workflows.int.js (11): all-worker execute, failure stops the workflow,
parse to route, false conditions skip, prompts (invalid option refused,
routes on the answer), params (required, substituted, unsafe refused),
dry run, endless goto detection, abort stays failed.
- scheduler.int.js (5): a due schedule runs on its worker and advances
next_run; disabled schedules don't run; admin-only and input checks.
- Known bugs as test.failing (each verified to fail on its assertion):
abort doesn't stop the engine (#8), goto to a missing step completes
(#20), an offline worker's schedule leaves no trace (#9), and an invalid
cron expression returns 500 instead of 400.
- PULSE_SCHEDULER_TICK_MS (default 60 s, minimum 1 s) so the test stack
ticks the scheduler every second.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- eslint: errors for ==, unused or shadowed variables, eval and friends,
prefer-const, curly, throw literals, useless catch/escape, constant
conditions (loops allowed), unused expressions (short-circuit allowed);
--max-warnings 0. Fixed the few violations (two unused requires in
server.js, a shadowed mock argument in a test).
- Scan job: scripts/ci/check-web-template.sh fails if public/web_template
differs from upstream at the commit in its VERSION (change it upstream,
then scripts/sync-web-template.sh).
- New job UI screenshots (before/after), PRs only, when public/, views/
or the render/nav code changed: runs the base branch and the PR side by
side with the same seeded data and uploads one before/after image per
page, desktop and phone (scripts/ci/screenshots.js). Not required.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The worker reports its commit (VERSION file, or git rev-parse in a
checkout) in worker_connect and heartbeat metadata. The server keeps it
per live socket and /healthz lists worker_versions.
- deploy/pulse_worker_deploy.sh <sha> <ts>, for the webhook on a worker
host: replay and age checks, commit must be on main, installs worker.js
and the npm manifests from exactly that commit, writes VERSION, npm ci,
restarts, waits until /healthz lists the sha, else restores the
previous files. Sandbox tests cover deploy, replay, stale and malformed
input, off-main commits, no-op redeploys and rollback.
- New CI job Deploy worker after Deploy: only when worker/ or the npm
manifests changed since the commit the workers report, so unrelated
merges don't restart the worker; then waits for the worker to reconnect
on the new commit.
- README: Worker deploys (install, hook definition, adding a worker host).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New CI job `Integration (api)` (#45 phase 3) runs the real server and three
workers on Node 20 against MariaDB and tests them as a black box over HTTP
and WebSocket (20 tests, about 12 s):
- Gandalf contract: submit and poll, stdout from command_result, failures
with exit code and stderr, 401 for wrong or missing key, 400 for missing
fields or an unknown worker, 404 for an unknown execution
- Auth: SSO identity, 401/403, heartbeat key, /healthz exposes only status;
WebSocket upgrade refused without credentials, with a wrong key or a wrong
group; live events reach a signed-in browser; a browser socket cannot
forge a command result
- Reliability: a worker killed mid-command fails the execution at once; a
worker at capacity answers with a failure; an aborted execution stays
failed when the late result arrives; a disconnected worker shows offline
The last test found a bug from #42: the close handler deleted the worker's
runtime-id entry before checking whether the socket was still live under its
database id, and the two ids are normally the same key. So a disconnected
worker was never marked offline and showed 'online' until the stale
heartbeat sweep. Gandalf was unaffected (it checks live sockets).
MariaDB setup for CI moves to scripts/ci/mariadb.sh, shared by both jobs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New required-to-be job `UI (playwright)` (#45 phase 5): the official
Playwright image with a MariaDB service container. scripts/ci/ui-stack.sh
starts the real server and three workers (WORKER_AUTH_ENFORCE=1), then
tests/ui/ runs 30 tests on desktop and a phone viewport:
- every page loads with no page errors, console errors or failed requests
(enforced by a shared fixture for every test)
- quick commands run on a worker and their output and status show in
Executions; multi-worker mode; failing commands show as failed
- workflows are created and run from the UI and complete on all workers
- Executions updates live over the authenticated browser WebSocket
- no SSO identity: 401 page and API; wrong group: 403
- every page fits a phone screen
External requests are blocked in tests so SSO headers never leave the
machine. Deploy now also waits for the UI job. The API and execution rate
limits can be raised with PULSE_API_RATE_MAX / PULSE_EXEC_RATE_MAX for
test stacks; production defaults are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#45 phase 2.
- GET /healthz (unauthenticated): running git sha, version, database
reachability, connected workers, uptime. 503 when the database is down.
- deploy/pulse_deploy.sh, versioned for the first time (it only existed
as a hand-edited file on CT 122). It takes <sha> <ts> from the signed
webhook payload and:
- refuses requests older than 5 minutes, or not newer than the last
accepted one (replays);
- refuses commits that aren't on main;
- checks out exactly that sha (before, it deployed whatever main was);
- runs npm ci --omit=dev (before, npm install --production) and
restarts;
- waits for /healthz to report the sha with a working database, and
otherwise rolls back to the previous commit.
- tests/deploy-script.test.js runs the script in a sandbox (temporary git
origin, fake systemctl/npm/curl): exact-sha deploy with .env kept, replay,
stale request, off-main commit, malformed input, and rollback of an
unhealthy build.
- CI's deploy job now succeeds only once production reports the tested sha
as healthy, before tagging. Before, it only checked that the server
answered.
- README: CI/CD and deploy documentation, including installing the script
and the hooks.json arguments.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace every em dash and en dash outside user-visible UI text with a
colon, comma, hyphen or "to". The UI strings and the vendored
web_template are handled separately.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
authenticateSSO and authenticatePage took the user and groups straight
from the Remote-* headers, and the server listens on every interface, so
any LAN host could connect directly, claim any user and group, and run
commands on the workers. It could also write whatever it claimed into the
users table.
Add TRUSTED_PROXIES (addresses or CIDR ranges) and ignore the identity
headers unless the TCP peer is on the list. The peer address is used
rather than a forwarding header, which a client could forge. It fails
closed: unset means no SSO login succeeds, with a startup warning.
Rejected attempts are logged with their source. Worker and Gandalf
API-key routes are unchanged.
Closes#37
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mysql2 3.24 (pulled in by the audit fix in #35) returns MariaDB JSON columns as
JS objects. GET /api/internal/executions/:id and GET /api/workflows/:id still
called JSON.parse on the value, threw, and silently returned [] / {}. This broke
Gandalf's relay checks (false 'PBS unreachable' ticket) and the workflow edit
modal. Guard both sites with the same typeof check already used by
GET /api/executions/:id.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HamVMDrA8RqhyxmUHgiqRp
- Extract validateWebhookUrl, applyParams, evalCondition, calculateNextRun
to lib/utils.js so they can be tested without DB connection
- Fix cron-parser v5 API: parseExpression → CronExpressionParser.parse
- Add 31 jest tests covering all four utility functions
- Add test.yml CI workflow running jest on every push/PR
- Add jest devDependency
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add 'parse' step type: reads KEY=VALUE lines from last command output into execution state
- Add 'route' step type: evaluates JS conditions list, auto-jumps to first match with no user input
- Support condition field on parse steps (skip when conditional execute was also skipped)
- Widen execution detail modal to min(1100px, 96vw) to eliminate horizontal scrolling
- Show last command output in prompt boxes so user has context before clicking
- Add formatLogEntry support for parse_complete and route_taken log actions
- Apply applyParams() substitution to prompt messages ({{server_name}}, {{iface}}, etc.)
- Fix prompt button onclick using data-opt attribute to avoid JSON double-quote breakage
Co-Authored-By: Claude Sonnet 4.6 <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>
server.js:
- Fix bug: when all targeted workers disconnect before step runs, results[] was empty
and results.every() returned true vacuously (silent false success). Now tracks sentCount
and fails with 'no_workers' log if nothing was actually dispatched
- Remove per-message console.log on every WebSocket message (high noise)
- Only log a warning for failed commands (not every success)
index.html:
- loadSchedules() catch now shows error message in scheduleList (was silent)
- abortExecution() shows server's error message from JSON body instead of generic string
(e.g. "Execution is not running" instead of "Failed to abort execution")
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Security:
- validateWebhookUrl() rejects non-http/https and private/internal IPs
- Validate webhook URL on workflow create and update
- Replace error.message in all HTTP 500 responses with 'Internal server error'
- Add requireJSON middleware (HTTP 415 if Content-Type wrong) on POST/PUT routes
- Reject missing API keys in worker heartbeat (not just wrong ones)
- Validate prompt response against allowed options before accepting
Bugs fixed:
- goto infinite loop protection: stepVisits[] counter, fails at GOTO_MAX_VISITS (100)
- wait step: validate duration (no NaN/negative), cap at WAIT_STEP_MAX_MS (24h)
- _executionPrompts now stores {resolve, options} for option validation
- JSON.parse wrapped in try/catch: workflows/:id, executions/:id, internal/executions/:id, POST /api/executions, scheduler worker_ids
- pong handler uses ws.dbWorkerId (set on connect) not message.worker_id
- Worker disconnect now marks worker offline in DB and broadcasts update
- command validation (type + empty check) on POST /api/workers/:id/command
- workflow_id required check on POST /api/executions
Performance & reliability:
- markStaleWorkersOffline() runs every 60s, marks workers without recent heartbeat offline
- Named constants: PROMPT_TIMEOUT_MS, COMMAND_TIMEOUT_MS, QUICK_CMD_TIMEOUT_MS,
WEBHOOK_TIMEOUT_MS, WAIT_STEP_MAX_MS, GOTO_MAX_VISITS, WORKER_STALE_MINUTES
New features:
- GET /api/health (auth required): version, uptime, worker counts
- DELETE /api/executions/completed: bulk delete finished executions (admin)
- schedule_value positive-integer validation for interval/hourly schedule types
- Request logging middleware: [HTTP] METHOD /path STATUS Xms
Code quality:
- All console.log on error paths changed to console.error
- Removed stray debug console.log in POST /api/workflows
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rate limiting: 300 req/15min general, 20 req/min on POST /api/executions
- Cron schedule type support using cron-parser for full cron expressions
- Webhook notifications: POST to workflow webhook_url on execution complete/failed
- Dry-run mode: simulate workflow execution without running any commands
- Global execution timeout via EXECUTION_MAX_MINUTES env var (default 60min)
- Execution filtering: status, workflow_id, started_by, after, before, search
- Event-driven command result delivery (replaces 500ms DB polling)
- Atomic log appends via JSON_ARRAY_APPEND (no read-modify-write race)
- Separate browserClients/workerClients sets (workers no longer receive broadcasts)
- Stale execution cleanup on startup (mark running→failed after crash)
- Scheduler overlap prevention (skip if same workflow already running)
- Frontend: webhook_url field in create/edit workflow modals
- Frontend: dry-run checkbox in workflow param modal
- Frontend: ESC closes modals, ws.onerror handler added
- Frontend: selectedExecutions changed from Array to Set (O(1) ops)
- Frontend: XSS fixes via escapeHtml() on all user-controlled innerHTML
- Frontend: param modal keydown listener deduplication fix
- Remove unused npm packages (bcryptjs, body-parser, cors, js-yaml, jsonwebtoken)
- Add express-rate-limit and cron-parser dependencies
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Automated executions (started_by gandalf: or scheduler:) no longer
trigger success/failure toast alerts for connected browser users.
Server now includes is_automated flag in command_result broadcasts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Worker does not echo command_id back in command_result message.
Previously this caused all workflow steps to time out after 120s.
Now: find the command_sent entry for the commandId, then take the
next command_result after it — safe since steps run sequentially.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- server.js: add authenticateGandalf middleware (X-Gandalf-API-Key header)
and two internal endpoints used by Gandalf link diagnostics:
POST /api/internal/command — submit SSH command to a worker, returns execution_id
GET /api/internal/executions/:id — poll execution status/logs
Also tag automated executions as started_by 'gandalf:*' / 'scheduler:*';
add hide_internal query param to GET /api/executions; change cleanup
from daily/30d to hourly/1d to keep execution history lean
- index.html: add Manual / Automated sub-tabs on Execution History tab so
Gandalf diagnostic runs don't clutter the manual run view; persists
selected tab to localStorage; dashboard recent-run strip filters to
manual runs only; sub-tabs show live counts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This will help diagnose the 'Cannot read properties of undefined' error
by logging each step of the workflow creation process.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removed old/obsolete workflow execution system that was conflicting
with the new executeWorkflowSteps() engine:
Removed:
- activeExecutions Map (old tracking system)
- executeWorkflow() - old workflow executor
- executeNextStep() - old step processor
- executeCommandStep() - old command executor (duplicate)
- handleUserInput() - unimplemented prompt handler
- Duplicate app.post('/api/executions') endpoint
- app.post('/api/executions/:id/respond') endpoint
This was causing "Cannot read properties of undefined (reading 'target')"
error because the old code was being called instead of the new engine.
The new executeWorkflowSteps() engine is now the only workflow system.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added comprehensive command scheduling system:
Backend:
- New scheduled_commands database table
- Scheduler processor runs every minute
- Support for three schedule types: interval, hourly, daily
- calculateNextRun() function for intelligent scheduling
- API endpoints: GET, POST, PUT (toggle), DELETE
- Executions automatically created and tracked
- Enable/disable schedules without deleting
Frontend:
- New Scheduler tab in navigation
- Create Schedule modal with worker selection
- Dynamic schedule input based on type
- Schedule list showing status, next/last run times
- Enable/Disable toggle for each schedule
- Delete schedule functionality
- Terminal-themed scheduler UI
- Integration with existing worker and execution systems
Schedule Types:
- Interval: Every X minutes (e.g., 30 for every 30 min)
- Hourly: Every X hours (e.g., 2 for every 2 hours)
- Daily: At specific time (e.g., 03:00 for 3 AM daily)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes:
Server-side:
- Added automatic cleanup of old executions (runs daily)
- Configurable retention period via EXECUTION_RETENTION_DAYS env var (default: 30 days)
- Cleanup runs on server startup and every 24 hours
- Only cleans completed/failed executions, keeps running ones
- Added pagination support to /api/executions endpoint
- Returns total count, limit, offset, and hasMore flag
Client-side:
- Implemented "Load More" button for execution pagination
- Loads 50 executions at a time
- Appends additional executions when "Load More" clicked
- Shows total execution count info
- Backward compatible with old API format
Benefits:
- Automatic database maintenance
- Prevents execution table from growing indefinitely
- Better performance with large execution histories
- User can browse all executions via pagination
- Configurable retention policy per deployment
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Problem:
- Workers generate random UUID on startup (runtime ID)
- Database stores workers with persistent IDs (database ID)
- UI sends commands using database ID
- Server couldn't find worker connection (stored by runtime ID)
- Result: 400 Bad Request "Worker not connected"
Solution:
- When worker connects, look up database ID by worker name
- Store WebSocket connection in Map using BOTH IDs:
* Runtime ID (from worker_connect message)
* Database ID (from database lookup by name)
- Commands from UI use database ID → finds correct WebSocket
- Cleanup both IDs when worker disconnects
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes:
- Removed duplicate /api/executions/:id endpoint that didn't parse logs
- Added workers Map to track worker_id -> WebSocket connection
- Store worker connections when they send worker_connect message
- Send commands to specific worker instead of broadcasting to all clients
- Clean up workers Map when worker disconnects
- Update execution status to completed/failed when command results arrive
- Add proper error handling when worker is not connected
Fixes:
- execution.logs.forEach is not a function (logs now properly parsed)
- Commands stuck in "running" status (now update to completed/failed)
- Commands not reaching workers (now sent to specific worker WebSocket)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes:
- Removed all migration code from server.js
- Database schema fixed directly via MySQL:
* Dropped users.role column (SSO only)
* Dropped users.password column (SSO only)
* Added executions.started_by column
* Added workflows.created_by column
* All tables now match expected schema
- Server startup will be faster without migrations
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes:
- Drop password column from users table (SSO authentication only)
- PULSE uses Authelia SSO, not password-based authentication
- Fixes 500 error: Field 'password' doesn't have a default value
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>