Commit graph

8 commits

Author SHA1 Message Date
Devin Foley
b3bccf3648 Fix LiveRunWidget activeRun merge bug and add idle_warning clear test
- Fix: activeRun merge in LiveRunWidget was dropping errorCode and
  lastOutputAt, preventing idle badge and last-output display from
  rendering for active runs
- Add test: verify reportRunActivity clears idle_warning error code
  and updates lastOutputAt

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-27 00:02:57 -07:00
Devin Foley
d747d847e4 Fix idle timeout tests to register in runningProcesses
The idle tests were failing because runs without runningProcesses
entries were being reaped by the orphan reaper before the idle
timeout pass could check them. Fix by spawning real child processes
and registering them in runningProcesses so the orphan reaper skips
them, allowing the idle timeout logic to evaluate them correctly.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-26 23:55:41 -07:00
Devin Foley
8e384947aa Address Greptile review: consolidate query, add idle tests, remove dead code
- Consolidate duplicate running-runs query in reapOrphanedRuns by
  reusing activeRuns for idle timeout pass (skip already-reaped runs)
- Add three integration tests: idle warning at 11 min, idle kill at
  16 min, and no-warning with recent output
- Remove unreachable idle_timeout entry from statusBadge (idle-killed
  runs have status "failed", not "idle_timeout")

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-26 23:48:58 -07:00
Devin Foley
aa88db7238 Fix test failure and address Greptile review comments
- Fix "keeps alive" test: set lastOutputAt to current time so idle
  reaper doesn't kill the test run (seed used a stale date)
- Wire up lastOutputAt and startedAt params in test seed fixture
- Remove dead wasIdle variable in clearDetachedRunWarning
- Fix deferred lastOutputAt flush to use actual last output timestamp
  instead of wall-clock time at flush

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-26 23:33:41 -07:00
Devin Foley
1b70091dcd Implement idle timeout reaper and liveness visibility for hung runs
Add lastOutputAt tracking on heartbeat runs, updated from adapter stdout/stderr
with batched DB writes (30s debounce). The orphan reaper now checks running
processes for idle timeout: warns at 10 min, kills (SIGTERM/SIGKILL) at 15 min.

- DB: add last_output_at column to heartbeat_runs (migration 0046)
- Server: idle warning/kill logic in reapOrphanedRuns, lastOutputAt flush in onLog
- Server: clear idle_warning on activity report (clearDetachedRunWarning)
- API: expose errorCode and lastOutputAt on active/recent run endpoints
- UI: orange idle warning badge on ActiveAgentsPanel and LiveRunWidget
- UI: show last output relative time in LiveRunWidget
- UI: add idle_timeout status color

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-26 23:05:47 -07:00
dotta
c916626cef test: skip embedded postgres suites when initdb is unavailable
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-26 11:12:39 -05:00
dotta
5602576ae1 Fix embedded Postgres initdb failure in Docker slim containers
The embedded-postgres library hardcodes --lc-messages=en_US.UTF-8 and
strips the parent process environment when spawning initdb/postgres.
In slim Docker images (e.g. node:20-bookworm-slim), the en_US.UTF-8
locale isn't installed, causing initdb to exit with code 1.

Two fixes applied:
1. Add --lc-messages=C to all initdbFlags arrays (overrides the
   library's hardcoded locale since our flags come after in the spread)
2. pnpm patch on embedded-postgres to preserve process.env in spawn
   calls, preventing loss of PATH, LD_LIBRARY_PATH, and other vars

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-24 11:48:59 -05:00
dotta
c844ca1a40 Improve orphaned local heartbeat recovery
Persist child-process metadata for local adapter runs, keep detached runs alive when their pid still exists, queue a single automatic retry when the pid is confirmed dead, and clear detached warnings when the original run reports activity again.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-20 06:05:15 -05:00