Skip to content

v0.1.3 — bg task introspection, exit-code aware, orphan-proof

Latest

Choose a tag to compare

@idovmamane idovmamane released this 14 May 02:22

Third patch release. Focus: agents can now inspect and control their background tasks, exit codes flow through the bridge, and claude orphan processes from race conditions are eliminated.

Added

  • Exit-code aware bg task tracking. New columns exit_code, exit_signal, exit_file, is_service (migration 045). The bookkeeper wraps the user command so the exit code survives. A [bg:service] tag in the tool's description marks long-lived servers — when they die, the agent gets [BG_SERVICE_DIED] instead of [BG_COMPLETED]. Non-zero exits routed as [BG_FAILED].
  • 5 agent introspection tools: list_bg_tasks (compact list, running first, status counts), bg_task_detail (full info), get_bg_task_log (read output with tail / head / grep modes, 64KB cap), kill_bg_task (SIGTERM→SIGKILL escalation), register_external_bg (track a process detached by external scripts like start.sh).
  • Global GET /api/bg-tasks endpoint joining agents for cross-agent visibility.
  • Activity page split. CLI events and Background Tasks each have their own scrollable section with running-first sort, status badges, elapsed timer, service marker, and 15s auto-refresh. All strings i18n'd.
  • start.sh convention. The prompt asks the lead to print each spawned service as SERVICE <name> PID=<pid> PORT=<port> and to register them with register_external_bg.

Fixed

  • Orphaned claude processes from bg-task DB write races. Fire-and-forget DB writes are now serialised via lib/bg-write-tracker.js; the close handler awaits all writes before markOrphanedBgTasksDead. 5 Vitest cases. (Contributed by @AyonPal in #20.)
  • pause and intervene left hung children reparented to init. Both endpoints now escalate SIGTERM → SIGKILL after the grace window. (Contributed by @AyonPal in #20.)
  • Bookkeeper wrap broke on Python f'...' and nested quotes. Replaced the double sh -c (escape applied twice) with a per-call bookkeeper script written to /tmp/yabby-bg/<id>.sh. Zero shell escaping; exit code captured via wait $C; $?.
  • Watchdog kill treated as failure in the notification branch. Clean SIGTERMs from FINAL_OUTPUT now route through the success branch.
  • Startup sweep blindly orphaned still-alive bg rows. server.js now checks each row's PID with kill -0 before marking it orphaned.
  • markOrphanedBgTasksDead killed all running rows on CLI close. Now PID-aware.

Full Changelog: v0.1.2...v0.1.3

Special thanks to @AyonPal for spotting the orphan-bookkeeping race and shipping #20 with tests.