KB-283A

06 — Heartbeat substrate live; silent gap unchanged (Phase 2 must close it)

3 min read Revision 1
dieu-45phase-1heartbeatsilent-gapiu-outbound-defaultqueue-heartbeatfn-queue-heartbeat-tick2026-05-26

06 — Heartbeat & Silent-Gap Status

Substrate now live

  • queue_heartbeat table — 1-row-per-executor UPSERT model.
  • fn_queue_heartbeat_tick(executor_name, executor_kind, status, current_job_id, lease_owner, metadata) RETURNS jsonb — gated by queue.heartbeat.enabled.
  • fn_queue_stale_check(threshold_seconds) RETURNS jsonb — passive read, returns stale executors but emits NO event in Phase 1.
  • v_queue_health — exposes per-executor status_hint ∈ {fresh, warning, stale} based on age vs queue.heartbeat.stale_threshold_seconds (default 300s; warning band = 300–600s; stale = >600s).

This generalises the proven dot_config.hc_executor_last_run cadence pattern ([[feedback-hc-executor-last-run-is-proven-heartbeat-pattern]]) from one global key to one row per executor.

Silent gap NOT closed in Phase 1

Cursor last_run_at Age at apply
iu_outbound_default (domain=iu) 2026-05-22 11:31:41 UTC ~95.6 hours

Phase 1 explicitly does not touch iu_route_worker_cursor, does not start any worker process, and does not wire the legacy worker into the new queue_heartbeat.

queue.heartbeat.enabled is false at Phase 1 exit. No executor is yet sending ticks.

This is consistent with the prompt's USER DECISION 4 ("minimal heartbeat is mandatory in Phase 1") interpreted as substrate-mandatory, activation-deferred: the building blocks are live and verified in proof, but no caller is wired up. Activation is a Phase-2 task.

Why the gap remains a §15.5 violation

Per [[feedback-dieu45-silent-gap-violation-post-enactment]]: §20.4 exempts only retroactively; continuation = fresh §15.5 violation. Phase 1's design choice is to land the substrate first so Phase 2 can close the gap with a real heartbeat writer rather than backfilling under live traffic.

Phase 2 closure path

  1. Flip queue.heartbeat.enabled to true (single UPDATE dot_config).
  2. Either:
    • Add a 1-line fn_queue_heartbeat_tick('iu_outbound_default', 'PG_worker', ...) call inside fn_iu_route_worker_run, OR
    • Have Hermes/host-cron call fn_queue_heartbeat_tick from the external orchestrator on the existing iu_outbound_default cadence.
  3. Confirm v_queue_health.status_hint='fresh' for that executor within stale_threshold_seconds.
  4. (Phase 3) emit system/queue_worker_silent event from fn_queue_heartbeat_tick on the fresh→stale transition so D31/D43 can observe.

Diagnostic now available

Even with queue.heartbeat.enabled=false, the read-only views are queryable:

SELECT * FROM v_queue_health;

→ returns executors_fresh=0, executors_warning=0, executors_stale=0, dlq_pending_count=0, … until the first tick is written. Reflects the Phase-1 reality: the substrate exists, but no executor is registered yet.

  • [[feedback-hc-executor-last-run-is-proven-heartbeat-pattern]]
  • [[feedback-dieu45-silent-gap-violation-post-enactment]]
  • [[project-dieu45-v1-0-enacted-2026-05-26]] §15.5
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-dieu45-phase-1-minimal-job-substrate-live-apply/06-heartbeat-and-silent-gap-status.md