Commit Graph
7 Commits
Author SHA1 Message Date
jaredandClaude Opus 5.5 0412eeeb38 Fix a race in the cancel_command test
CI / Lint (eslint) (pull_request) Successful in 20s
CI / Test (jest) (pull_request) Successful in 19s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 3m9s
CI / Integration (api) (pull_request) Successful in 4m1s
CI / UI screenshots (before/after) (pull_request) Successful in 11s
CI / UI (playwright) (pull_request) Successful in 2m38s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
The shell creates a redirect target before writing to it, so the test
could read an empty pid file, take pid 0, and decide the child was not
running. This failed the push run of #80's merge, so that commit was not
deployed. The command now writes the pid to a temporary file and renames
it into place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 15:54:53 -05:00
jaredandClaude Opus 5.5 8698e1a4b0 Test: stub os.freemem in the availableMemory fallback test (it flaked)
CI / Lint (eslint) (pull_request) Successful in 32s
CI / Test (jest) (pull_request) Successful in 33s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m54s
CI / Integration (api) (pull_request) Successful in 2m30s
CI / UI screenshots (before/after) (pull_request) Successful in 10s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:18:49 -05:00
jaredandClaude Opus 5.5 789e5651c8 Worker memory: report available memory, not free memory (#30)
CI / Test (jest) (pull_request) Successful in 19s
CI / Lint (eslint) (pull_request) Successful in 21s
CI / Security (npm audit) (pull_request) Successful in 11s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m54s
CI / Integration (api) (pull_request) Successful in 2m36s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m29s
os.freemem() leaves out the page cache, so a healthy Linux box looks full:
the production worker (CT 153, 512 MB) has 4 MB free but 449 MB
available, and showed as 99% used instead of about 12%.

- worker: heartbeat metadata adds availableMem from MemAvailable in
  /proc/meminfo (falls back to os.freemem()); freeMem stays for old
  servers.
- Workers tab and dashboard compute used memory from availableMem when
  present, from freeMem for workers that predate it.
- Unit tests for the meminfo parsing and the fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:55:25 -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 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
jaredandClaude Opus 5.5 ea939d4430 Worker deploys from CI, with version reporting (#40)
CI / Lint (eslint) (push) Successful in 14s
CI / Test (jest) (push) Successful in 18s
CI / Security (npm audit) (push) Successful in 12s
CI / Integration (api) (push) Successful in 1m14s
CI / Scan (secrets, workflows, shell) (push) Successful in 1m29s
CI / Lint (eslint) (pull_request) Successful in 19s
CI / Test (jest) (pull_request) Successful in 13s
CI / Security (npm audit) (pull_request) Successful in 7s
CI / UI (playwright) (push) Successful in 1m43s
CI / Deploy (push) Skipped
CI / Deploy worker (push) Skipped
CI / Notify (push) Skipped
CI / Integration (api) (pull_request) Successful in 1m51s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 2m20s
CI / UI (playwright) (pull_request) Successful in 1m37s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
- 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>
2026-11-22 16:51:24 -05:00
jaredandClaude Opus 5.5 38a6d1158d Worker unit tests, coverage floors, and an SBOM per main build
CI / Lint (eslint) (push) Successful in 17s
CI / Test (jest) (push) Successful in 18s
CI / Security (npm audit) (push) Failing after 12s
CI / Scan (secrets, workflows, shell) (push) Successful in 18s
CI / Integration (api) (push) Successful in 2m58s
CI / Lint (eslint) (pull_request) Successful in 24s
CI / Test (jest) (pull_request) Successful in 15s
CI / UI (playwright) (push) Successful in 3m11s
CI / Deploy (push) Skipped
CI / Notify (push) Skipped
CI / Security (npm audit) (pull_request) Failing after 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 15s
CI / Integration (api) (pull_request) Successful in 1m18s
CI / UI (playwright) (pull_request) Successful in 1m31s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
- worker/worker.js exports PulseWorker and starts only when run directly
  (no behaviour change for the service; CT 153 needs no redeploy).
- tests/worker.test.js: success, exit code and stderr, timeout kill,
  capacity rejection, slot release after failure, ping/pong, no sends
  while disconnected.
- jest coverage floors (ratchet at today's levels): lib/ 90% lines and
  statements, 80% branches and functions; worker/ 40%.
- The audit job writes a CycloneDX SBOM of production dependencies and
  keeps it 90 days for each main build.

Part of #45 phases 3 and 4.

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