flybrain/infra/units/flyshadow-guard.service
acamilo 19d84de387 infra: the guard judges the live fly against its own baseline (SHADOW-01 review round 2, G1)
fly-shadow-run start measures a 10-minute baseline before the shadow
exists (sixty 10-s realtime-factor means: mean, spread; the lag growth
rate). The guard trips only on a sustained degradation against it: 3
checks in a row where the last 5 samples of the same process fall below
the baseline realtime factor or grow lag faster than the baseline rate,
by more than max(0.05, 4 x spread / sqrt 5). It stops itself when
flyshadow.service is not running; check refuses after a guard trip or
with the shadow down. lint drives the rule over RTF traces shaped on the
release CT (a flat 0.66, 0.77-0.99 noisy, real time with hiccups) which
must not trip, and degradations which must. Section 18 and the runbook
follow.
2026-09-30 01:39:52 +00:00

15 lines
843 B
Desktop File

# infra/units/flyshadow-guard.service — triggered by flyshadow-guard.timer.
#
# `fly-shadow-run guard` compares the live fly with the 10-minute baseline `fly-shadow-run start`
# recorded before it started the shadow: on a sustained degradation of the realtime factor or the
# lag growth rate against that baseline (3 checks in a row, 5-sample windows), it stops
# flyshadow.service, removes the trace drop-in and restarts flysim without the trace. The live
# stream never pays for the shadow. It stops itself when the shadow is not running. 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