feat: healthcheck ping wiring (lib/healthcheck.sh, opt-in) [code half of #297] #339

Closed
opened 2026-07-04 05:16:18 +00:00 by igor · 0 comments
Collaborator

The harness-code half of #297 (dead-man's-switch heartbeat). Opt-in + inert, so it
merges safe BEFORE the healthchecks server exists — #297 stays the operator's
server/infra half.

Scope (harness code only)

  • lib/healthcheck.sh with hc_ping <which> [start|success|fail] — a best-effort
    curl (short timeout, || true); NEVER affects tick outcome; runs even during a
    Claude cooldown (non-model).
  • Two opt-in env gates (NEW vars — do NOT reuse/rename existing):
    • HEALTHCHECK_HEARTBEAT_URL — pinged at the TOP of every tick (check A: dead-man's switch).
    • HEALTHCHECK_TASK_URL — start/success pair around the cascade's real-work path (check B:
      started-but-never-finished = crash/hang shows as "started, never completed").
    • Both unset -> clean no-op (local dev + server-down stays silent), like the SMTP2GO / GSC gates.
  • Call sites: heartbeat at the top of tick.sh; task start before a do_*_tick begins real
    work, success when it returns.
  • Document the var names in .env.example (lockstep: code names must match host .env).

Tests (required)

  • bin/test-*.sh: hc_ping is a no-op when the URL is unset (no curl); with a URL set it builds
    the right curl call (stub curl); a ping failure never changes rc.

Constraints

  • set -euo pipefail; 2-space; best-effort/inert; NEW env vars only, existing untouched.
  • Do NOT touch agent-settings.json / systemd/ / .forgejo/workflows/.
  • 50-turn budget: build, verify once (bash bin/check-sync.sh), stop. No > redirects,
    no &&/; compounds, no ./relative exec.

Merges safe before the server is up (gated). Activation is #297 (operator): stand up
healthchecks, create the two checks, drop the URLs into .env.

The harness-code half of #297 (dead-man's-switch heartbeat). Opt-in + inert, so it merges safe BEFORE the healthchecks server exists — #297 stays the operator's server/infra half. ## Scope (harness code only) - `lib/healthcheck.sh` with `hc_ping <which> [start|success|fail]` — a best-effort `curl` (short timeout, `|| true`); NEVER affects tick outcome; runs even during a Claude cooldown (non-model). - **Two opt-in env gates (NEW vars — do NOT reuse/rename existing):** - `HEALTHCHECK_HEARTBEAT_URL` — pinged at the TOP of every tick (check A: dead-man's switch). - `HEALTHCHECK_TASK_URL` — start/success pair around the cascade's real-work path (check B: started-but-never-finished = crash/hang shows as "started, never completed"). - Both unset -> clean no-op (local dev + server-down stays silent), like the SMTP2GO / GSC gates. - Call sites: heartbeat at the top of `tick.sh`; task start before a `do_*_tick` begins real work, success when it returns. - Document the var names in `.env.example` (lockstep: code names must match host `.env`). ## Tests (required) - `bin/test-*.sh`: hc_ping is a no-op when the URL is unset (no curl); with a URL set it builds the right curl call (stub curl); a ping failure never changes rc. ## Constraints - set -euo pipefail; 2-space; best-effort/inert; NEW env vars only, existing untouched. - Do NOT touch agent-settings.json / systemd/ / .forgejo/workflows/. - 50-turn budget: build, verify once (`bash bin/check-sync.sh`), stop. No `>` redirects, no `&&`/`;` compounds, no `./relative` exec. Merges safe before the server is up (gated). Activation is #297 (operator): stand up healthchecks, create the two checks, drop the URLs into `.env`.
igor self-assigned this 2026-07-04 19:43:49 +00:00
igor added spent time 2026-07-04 19:52:12 +00:00
8 minutes
igor removed their assignment 2026-07-04 19:52:12 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Total time spent: 8 minutes
igor
8 minutes
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
joshtronic/igor#339
No description provided.