Observability: heal runs are invisible in swarm.db — record the healer's investigation as a run #92

Closed
opened 2026-08-26 03:02:21 +00:00 by matou-build-agent · 3 comments

From the 2026-08-25 observability review.

Symptom. heal.sh runs a claude investigation (a pooled heavy slot, up to 15 min — timeout 900, heal.sh:260) recorded only as files in its evidence dir (agent-out.log). No runs/processes/events rows, so heal time is absent from the machine timeline, the TUI util bar, and any later reconstruction of what a host was doing.

Direction. Open a runs row (trigger heal) + processes row on start, close with the heal outcome as verdict; write an events row pointing at the evidence dir. swarm.db already has a heal event kind envisioned in its schema comment (swarm-db.py, events.kind).

Same commit: lib test update per CLAUDE.md.

From the 2026-08-25 observability review. **Symptom.** `heal.sh` runs a claude investigation (a pooled heavy slot, up to 15 min — `timeout 900`, `heal.sh:260`) recorded only as files in its evidence dir (`agent-out.log`). No `runs`/`processes`/`events` rows, so heal time is absent from the machine timeline, the TUI util bar, and any later reconstruction of what a host was doing. **Direction.** Open a `runs` row (trigger `heal`) + `processes` row on start, close with the heal outcome as verdict; write an `events` row pointing at the evidence dir. swarm.db already has a `heal` event kind envisioned in its schema comment (`swarm-db.py`, events.kind). Same commit: lib test update per CLAUDE.md.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.
Ruling: ready-for-agent. Two-way door — an additive db write using an event kind (heal) already reserved in swarm-db.py's own schema comment; revertible by a later commit, provable by lib test coverage. No one-way-door concern applies.

Agent Brief

Category: enhancement
Summary: Record the healer's investigation as a run in swarm.db.

Current behavior:
heal.sh runs a claude investigation occupying a pooled heavy slot for up to 15 minutes, recorded only as files in its evidence directory. No runs/processes/events rows exist, so heal time is invisible to the machine timeline, any util view, or later reconstruction of host activity.

Desired behavior:
A runs row (trigger heal) and processes row are opened on start and closed with the heal outcome as verdict; an events row (kind heal) points at the evidence directory.

Key interfaces:

  • The same swarm-db-lib.sh helpers already used by session-runner/triage recording.
  • heal.sh's existing success/failure outcome, which should map to the closing verdict.

Acceptance criteria:

  • A heal run that actually invokes claude opens runs + processes rows
  • Rows close on every exit path with heal's real outcome as verdict
  • An events row (kind heal) records the evidence directory path
  • Lib test coverage added/updated

Out of scope:

  • Spend capture for the heal claude call (#94)
  • The always-on sampler (#97)
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** Ruling: `ready-for-agent`. Two-way door — an additive db write using an event kind (`heal`) already reserved in `swarm-db.py`'s own schema comment; revertible by a later commit, provable by lib test coverage. No one-way-door concern applies. ## Agent Brief **Category:** enhancement **Summary:** Record the healer's investigation as a run in swarm.db. **Current behavior:** `heal.sh` runs a claude investigation occupying a pooled heavy slot for up to 15 minutes, recorded only as files in its evidence directory. No `runs`/`processes`/`events` rows exist, so heal time is invisible to the machine timeline, any util view, or later reconstruction of host activity. **Desired behavior:** A `runs` row (trigger `heal`) and `processes` row are opened on start and closed with the heal outcome as verdict; an `events` row (kind `heal`) points at the evidence directory. **Key interfaces:** - The same `swarm-db-lib.sh` helpers already used by session-runner/triage recording. - `heal.sh`'s existing success/failure outcome, which should map to the closing verdict. **Acceptance criteria:** - [ ] A heal run that actually invokes claude opens `runs` + `processes` rows - [ ] Rows close on every exit path with heal's real outcome as verdict - [ ] An `events` row (kind `heal`) records the evidence directory path - [ ] Lib test coverage added/updated **Out of scope:** - Spend capture for the heal claude call (#94) - The always-on sampler (#97)
Author
Member

swarm-claim host=matou-dev-server-01 run=1545
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=1545 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #92 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 92,
  "status": "success",
  "commits": [
    "46e6dc4"
  ],
  "changed_files": [
    "STATUS.md",
    "heal.sh",
    "tests/heal-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/heal-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A heal run that actually invokes claude opens runs + processes rows": "heal.sh run_agent opens swarmdb_run_start (trigger heal) + proc-open (kind claude) at the claude choke point; proven by tests/heal-test.sh #92 scenario asserting one heal-trigger run row and one claude process row after an investigating heal",
    "Rows close on every exit path with heal's real outcome as verdict": "heal_on_exit EXIT trap proc-closes + swarmdb_run_end; verdict earned as diagnosed/no-diagnosis/limit-parked; test asserts ended_at set and verdict='diagnosed' on the investigate path",
    "An events row (kind heal) records the evidence directory path": "swarmdb_event <run> '' heal ... \"$EVIDENCE\" in run_agent; test asserts one kind='heal' event whose evidence LIKE the /tmp/matou-heal-x-y.* evidence dir",
    "Lib test coverage added/updated": "tests/heal-test.sh gains the swarm.db-trace scenario (positive investigate path + negative downgraded-kill path) and pins SWARM_DB into every run_heal* helper; 15 scenarios pass"
  },
  "summary": "heal.sh records its claude investigation as a heal-trigger run + claude process + heal event in swarm.db, finalised on every exit path with the investigation outcome as verdict.",
  "blockers": []
}
**close-report** for #92 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 92, "status": "success", "commits": [ "46e6dc4" ], "changed_files": [ "STATUS.md", "heal.sh", "tests/heal-test.sh" ], "tests": [ { "command": "bash tests/heal-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL; done", "exit_code": 0 } ], "criteria": { "A heal run that actually invokes claude opens runs + processes rows": "heal.sh run_agent opens swarmdb_run_start (trigger heal) + proc-open (kind claude) at the claude choke point; proven by tests/heal-test.sh #92 scenario asserting one heal-trigger run row and one claude process row after an investigating heal", "Rows close on every exit path with heal's real outcome as verdict": "heal_on_exit EXIT trap proc-closes + swarmdb_run_end; verdict earned as diagnosed/no-diagnosis/limit-parked; test asserts ended_at set and verdict='diagnosed' on the investigate path", "An events row (kind heal) records the evidence directory path": "swarmdb_event <run> '' heal ... \"$EVIDENCE\" in run_agent; test asserts one kind='heal' event whose evidence LIKE the /tmp/matou-heal-x-y.* evidence dir", "Lib test coverage added/updated": "tests/heal-test.sh gains the swarm.db-trace scenario (positive investigate path + negative downgraded-kill path) and pins SWARM_DB into every run_heal* helper; 15 scenarios pass" }, "summary": "heal.sh records its claude investigation as a heal-trigger run + claude process + heal event in swarm.db, finalised on every exit path with the investigation outcome as verdict.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#92
No description provided.