fix(startup): reconcile profiles before bounded activation

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-10 23:27:53 +03:00
1 parent b1e458a0a5
commit e2cfccedf1
9 files changed
+338 -25

No files matched your search

+14 -4
View File
@@ -84,10 +84,20 @@ capabilities are dropped except `NET_ADMIN`, `NET_RAW`, `SETUID`, `SETGID`, `KIL
`KILL` allows bounded cleanup of workers that have dropped their UID.
Startup order: ss-server/ss-local → listener 1080 → guarded managed init on
fresh state (status on recreation) → target-local `zapret2 start` → supervised
managed monitor. Drift/pending state refuses startup; unknown state is never
adopted. SIGTERM/SIGINT cancels and waits for the monitor before stopping
target-local zapret and Shadowsocks children. Monitor fatal exits stop the
fresh state → `managed reconcile` on every startup → target-local `zapret2 start`
→ supervised managed monitor. Reconciliation uses the fixed private target DB
and restores an interrupted prepared transaction's qualified last-good bytes
before any daemon reload/start. Drift, unknown state or failed rollback exits
78 (no automatic retry); nothing is adopted. Restore a consistent whole-state
backup if needed; do not wipe/re-init persisted state.
Startup init and reconcile each have a 45-second deadline; initial daemon start
has 30 seconds, with forced kill after five more seconds for each command.
Any startup command failure/timeout exits 78, never the retry code 75. These
bounds do not shorten the monitor's 90-minute bootstrap/recovery scan budget.
SIGTERM/SIGINT cancels and waits for the monitor before stopping target-local
zapret and Shadowsocks children. Monitor fatal exits stop the
entrypoint. Monitor health is YouTube Player API status through the owned SOCKS,
not video playback/SABR; GGC candidates are scoped to the exact discovered
hostname.
+5
View File
@@ -43,3 +43,8 @@ compose_command = "/usr/bin/docker compose --env-file deploy/managed-target/.env
assert directives["ExecStart"] == compose_command + " up --no-build --abort-on-container-exit --exit-code-from target target"
assert directives["ExecStop"] == compose_command + " stop target"
assert "timeout -k 5 30 /opt/zapret2/init.d/sysv/zapret2 stop" in entrypoint
for command, seconds in (("/usr/local/bin/zapret-autotune managed init", 45),
("/usr/local/bin/zapret-autotune managed reconcile", 45),
("/opt/zapret2/init.d/sysv/zapret2 start", 30)):
assert f"timeout -k 5 {seconds} {command} || exit 78" in entrypoint
assert entrypoint.index("managed reconcile || exit 78") < entrypoint.index("zapret2 start || exit 78")