Runbook: Fix Meta-Coordinator Health Check (blind under no_new_privs)
Issue: terraphim/terraphim-ai#3005 (tracker id 4300)
Theme-ID: adf-health-alert
Severity: P1 — a monitor that reports false-green while the system is red is worse
than no monitor; it suppresses human attention.
Status: Patch verified end-to-end on bigbox; awaiting operator apply (root required).
Symptom
The ADF meta-coordinator health-check cron reports 0 stalls / 0 failures / 0 timeouts
in windows where the orchestrator is actually degraded. On 2026-06-29 it reported 0 stalls
in the same 4h window where #3004 documents 207 stalls, max 55s.
Root cause — verified by reproduction
The health-check task block invokes sudo journalctl -u adf-orchestrator. On this host
the alex user (and the orchestrator runtime) runs under the no_new_privs flag, so
sudo is refused:
$ sudo -n true
sudo: The "no new privileges" flag is set, which prevents sudo from running as root.Every sudo journalctl ... | grep -c ... || true therefore evaluates to 0, and each
guard treats 0 as healthy. Reproduced this session (2026-06-29 22:10 +02:00):
| Invocation | Lines in 4h window | reconcile_tick SLOW count |
|------------|-------------------:|----------------------------:|
| sudo journalctl ... (current/buggy) | 0 | 0 ← false green |
| journalctl -q ... (fixed) | 19,079 | 164 ← true signal |
The alex user already has journal read access via ACL on /var/log/journal
(group systemd-journal). sudo is not only unnecessary here — it is actively harmful.
Affected file
The defect lives in the deployed, unversioned runtime config (NOT in this repo):
/opt/ai-dark-factory/conf.d/terraphim.toml (root:alex 0640)Occurrences (as of 2026-06-23 mtime, still present 2026-06-29):
| Line | Block | Pattern |
|------|-------|---------|
| 68 | ### 1. Tick-Stall Detection | sudo journalctl -u adf-orchestrator ... |
| 76 | ### 2. Agent Failure Report | sudo journalctl -u adf-orchestrator ... |
| 86 | ### 2b. Agents Exceeding max_cpu_seconds | sudo journalctl -u adf-orchestrator ... |
| 832 | Mneme fleet-health synthesis | sudo -n journalctl -u adf-orchestrator ... |
Note: the meta-coordinator agent commented on
#3005at 10:05 claiming the fix was "applied". That was inaccurate — the agent ran one cycle manually withoutsudobut never edited the config. File mtime2026-06-23 16:44confirms the file is untouched. Verify any future "fixed" claim withstat -c '%y' /opt/ai-dark-factory/conf.d/terraphim.toml.
The patch (verified)
Two surgical changes:
Change 1 — remove sudo from all journalctl invocations
-q suppresses journalctl's "not seeing messages from other users" hint cleanly
(recommended in the issue's confirmation comment). No privilege escalation needed.
Change 2 — add a fail-loud telemetry precondition
Insert immediately after the export PATH=... line (currently line 64), before
## ADF Meta-Coordinator: Monitoring and Health Checks, so the script aborts loudly
instead of emitting a false-green if telemetry ever breaks again:
# Telemetry precondition: fail loud rather than report false-green.
_TELEMETRY_LINES=
if [; then
||
Apply procedure (operator with root)
# 1. Back up + patch (Change 1)
# 2. Verify the patch took (expect 0 matches)
# 3. Apply Change 2 (fail-loud precondition) — operator edits the task block,
# or re-deploys from a versioned template once #see-followup is implemented.
# 4. Reload the orchestrator so it re-reads conf.d
# 5. Smoke-test the next health check cycle manually (no sudo):
| Verification (acceptance)
After the next 4h cron cycle, the health check MUST surface the real signal:
- [ ]
stat -c '%y' /opt/ai-dark-factory/conf.d/terraphim.tomlshows a fresh mtime. - [ ]
grep -c 'sudo .*journalctl' /opt/ai-dark-factory/conf.d/terraphim.tomlreturns0. - [ ] The next cycle's
[ADF] Tick-stall detected: N in 4hissue (if any) reports a non-zeroNconsistent with#3004-class telemetry (order of 10², not 0). - [ ] No new spurious all-green cycle appears while
#3004/#4299remain open.
Deeper defect (filed separately)
The deployed /opt/ai-dark-factory/conf.d/*.toml is unversioned — not in any git
repo. That is the root cause that allowed this defect to persist silently for 6 days and
that let the meta-coordinator's "applied" comment go unchecked. The version-controlled
twins in terraphim-agents/.../tests/fixtures/conf.d/ and orchestrator.example.toml
diverge from production and do not contain this task block at all. Bringing
conf.d/ under version control (or generating it from a tracked template at deploy
time) is the structural fix that prevents recurrence. Tracked as a follow-up issue.
Why this runbook lives in terraphim-ai (not terraphim-agents)
The health check creates issues in this repo (terraphim/terraphim-ai) and references
this repo's worktrees and binaries. Per AGENTS.md dual-remote protocol, this runbook is
pushed to both origin (GitHub) and gitea mirrors, giving operators a reviewable,
reproducible artefact that satisfies the spirit of Bigbox Rule #1 (git pull/push, not
ad-hoc scp) even though the target file itself is not yet version-controlled.