flybrain/infra/units/flyshadow-guard.service
acamilo 2d8b529f42 infra: the shadow's live-impact guard (SHADOW-01 review N2, N1)
fly-shadow-run start records the live fly's baseline (fly_realtime_factor
over 10 s, fly_lag_seconds, uptime), waits for the shadow's heartbeat and
starts flyshadow-guard.timer. fly-shadow-run guard (every 60 s, root)
stops the shadow and the guard, removes the trace drop-in and restarts
flysim without the trace when fly_lag_seconds grew 1 s in the same
process or the mean realtime factor fell below min(0.97, baseline-0.03);
a paused fly is not judged, a restarted one rebaselines. check passes
--current /opt/fly/current --binary flysim-session. lint drives the
guard's rule on six cases. Runbook rewritten: the trace cannot outlive
the shadow (heartbeat, 8 GiB directory cap), not the old claim.
2026-09-30 01:39:52 +00:00

15 lines
816 B
Desktop File

# infra/units/flyshadow-guard.service — triggered by flyshadow-guard.timer.
#
# `fly-shadow-run guard` compares the live fly with the baseline `fly-shadow-run start` recorded
# before it started the shadow: if flysim's fly_lag_seconds has grown (the loop fell more than a
# second behind real time) or its mean fly_realtime_factor over 10 s fell below the baseline's
# bound, it stops flyshadow.service, removes the trace drop-in and restarts flysim without the
# trace. The live stream never pays for the shadow. Root, because it installs no file but
# removes one in /etc/systemd and restarts flysim.
[Unit]
Description=fly-shadow-run guard: the live-impact check of the shadow run (SHADOW-01)
ConditionPathExists=/srv/fly/shadow/baseline.json
[Service]
Type=oneshot
ExecStart=/opt/fly/bin/fly-shadow-run guard