2026-09-14: The bridge that swallowed its own exec

A silent exit is the deadliest failure mode. When a critical daemon exits zero, launchd assumes the work finished cleanly. Neo spotted the flashing amber badge during morning inspection. The Firewalla bridge on 127.0.0.1:1984 had gone dark. Force Flow could no longer enforce curfews or screen-time rules. Every self-healing guard had fired in turn and collapsed. Tommy stood watch as we traced the cascade to a single escaped quote that caused a shell script to swallow its own execution.
The silent exit zero
Section titled “The silent exit zero”The Firewalla bridge on the Mac Mini is wrapped by ~/.sanctum/scripts/firewalla-bridge.sh. It runs under the system LaunchDaemon haus.sanctum.firewalla, detailed in services and the port summary. In a provenance commit intended to stamp running binary hashes before execution, an inline Python snippet was embedded:
# The offending line in scripts/firewalla-bridge.sh:python3 - "$BRIDGE" "~/.sanctum/state/firewalla-bridge-running.json" <<'"'"'STAMP'"'"' 2>/dev/null || true...STAMP
exec /usr/local/bin/node "$BRIDGE"The bug was subtle. Because the heredoc token was written as <<'"'"'STAMP'"'"', bash interpreted the delimiter tag as containing literal embedded single quotes: 'STAMP'.
When the script reached the unquoted STAMP line, bash refused to terminate the here-document. It kept reading. It fed every subsequent line directly into Python’s standard input. That swallowed both STAMP and exec /usr/local/bin/node "$BRIDGE".
Python parsed the stream and crashed on a syntax error. Because stderr was discarded with 2>/dev/null || true, the crash was invisible. Bash reached the end of the script and exited zero. The daemon was dead, but launchd believed it had succeeded.
The cascade of failed healers
Section titled “The cascade of failed healers”Once the bridge process died, every automated guard in the haus attempted recovery and stumbled, echoing the resilience principles in The zero-plaintext citadel:
sanctum-firewalla-watch.shUnbound Variable Bug: In its alerting branches, variable declarations ended with trailing backslashes (MSG="..." \ curl ...). Underset -uo pipefail, bash attempted command substitution before setting the variable, aborting withMSG: unbound variable.firewalla-watchAuth Confusion: The watcher only scanned for log lines containing"Token refreshed". When the daemon died, token refreshes stopped. After 120 minutes, the watcher classified the state asAUTH-EXPIRED—a state where it intentionally refuses to restart the bridge. It lacked any basic check for whether the bridge process was simply dead.force-flow-bridge-sentinel.pyDomain Mismatch: When the sentinel detectedBRIDGE-DOWN, it delegated healing tohaus.sanctum.firewalla-watchrather than restartingsystem/haus.sanctum.firewalladirectly, believing user LaunchAgents lacked permission.- R2D2 Recipe Domain Mismatch: R2D2’s
heal-force-flow-bridge-down.sh, documented in agents, attemptedlaunchctl kickstart -k "gui/$UID_NUM/haus.sanctum.firewalla". Because the bridge is a system daemon, launchd rejected the command. Furthermore, passing-kto a system domain target without root privileges resulted inOperation not permitted.
The multi-tier repair
Section titled “The multi-tier repair”We resolved all layers across the stack:
- Heredoc Delimiter Fix: Corrected
<<'"'"'STAMP'"'"'to clean<<'STAMP'inscripts/firewalla-bridge.sh. The provenance stamp now executes cleanly and passes control directly toexec /usr/local/bin/node "$BRIDGE". sanctum-firewalla-watch.shHardening: Added explicitBRIDGE-DOWNprocess detection viapgrep. When the process is dead, the watcher immediately kickstarts the system daemon. The trailing backslash syntax errors onMSGwere eliminated.- R2D2 Self-Heal Repair: Updated
heal-force-flow-bridge-down.shto targetsystem/haus.sanctum.firewallaand use passwordless kickstarts. - Sentinel Defense-in-Depth:
force-flow-bridge-sentinel.pynow directly issuessudo -n /bin/launchctl kickstart -k system/haus.sanctum.firewallain parallel with delegating to the watch agent. - Permanent Sudoers Envelope: Added
bert ALL=(root) NOPASSWD: /bin/launchctl kickstart [-k] system/haus.sanctum.firewallaand/usr/bin/xcodebuild -license accepttosudoers-sanctum-kickstart(installed to/etc/sudoers.d/sanctum-kickstart), closing the privilege gap permanently. - Xcode License & Git Resilience: Background macOS updates bump Xcode / Command Line Tools and break
/usr/bin/gitwithrc=69. We installed standalone Homebrewgit(/opt/homebrew/bin/git), updatedscreen-time-sentinel.shto prefer it and auto-accept licenses onrc=69, and embedded auto-acceptance in bothsanctum-sunday-upgrade.shandapple-post-boot.sh.
Following the repair, system/haus.sanctum.firewalla resumed listening on 127.0.0.1:1984, authenticated with Firewalla cloud, and Force Flow reported enforcement_ready: true. All sentinels and commit validations pass cleanly.