fix(runtime): keep supervision and absence retries in container

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-11 09:01:52 +03:00
1 parent 226d93e2aa
commit 3f9fd2f36f
21 files changed
+1056 -137

No files matched your search

+21 -7
View File
@@ -8,17 +8,27 @@ The standalone deployment candidate is a **new isolated target**, never an
upgrade/adoption of an existing zapret or Xray service. The legacy `managed-test`
role and fixed identity guards remain intentional, including for prod-like runs.
See [release, configuration, upgrade and rollback guidance](MANAGED_TARGET.md#production-preparation)
and the [deployment/service instructions](deploy/managed-target/README.md).
and the [container deployment instructions](deploy/managed-target/README.md).
Pinned builds and supervision are preparation, not production acceptance: real
restart/deadline tests and end-to-end target validation remain rollout gates.
Select an immutable managed-target digest with `ZAPRET_AUTOTUNE_IMAGE` in the
private deployment `.env`; tags/local defaults are only build/test candidates.
Bootstrap/recovery shares a 90-minute whole-job deadline plus a separate 30-second
restoration reserve, an abnormal ceiling rather than normal candidate failure.
Timeout exit 75 requires clean timeout/cancellation only; cleanup/safety errors
veto retry. Optional foreground systemd uses `Restart=no` plus forced exit-75
restart, limited to three starts per six hours; Compose stop grace is 120s and
systemd stop timeout 180s.
PID 1 handles technical child failures inside the same container, with safe
cleanup, bounded retries (three runtime starts per rolling six hours, including
the initial start) and backoff. Cleanup/safety/configuration errors veto retry;
SIGTERM gracefully cancels and joins children. Compose restart remains disabled
to prevent safety-failure loops; no host service installation or external process
manager is required. Container-platform lifecycle and host-boot policy belong to
the deployment operator. Compose stop grace is 240s; monitor join is bounded at
45s. Graceful shutdown cancels its watchdog rather than waiting out that deadline.
Genuine no-qualified-strategy outcomes instead persist a recovery wait of at least two hours
in SQLite while the same container continues light probes, then resume recovery
after expiry under the normal threshold policy. Both fresh bootstrap and periodic
recovery preserve a configured recovery cooldown longer than two hours.
This is not a watchdog timeout:
ordinary recovery cooldown stays 30m, and the abnormal whole-job ceiling stays 90m.
## Manual managed-test activation (not deployed)
@@ -221,8 +231,12 @@ even after a newer acquisition starts. State survives reopening the database.
The internal `runManagedMonitor` supervisor probes immediately and periodically,
persists observations, and invokes injected recovery only at threshold outside
cooldown. Unresolved GGC is reported without stopping monitoring; DB, safety,
runner, lock and finalization errors are fatal. Cooldown starts when recovery returns, including
failure or cancellation. Callbacks must honor cancellation and join their children.
runner, lock and finalization errors are fatal. Ordinary cooldown starts when recovery returns,
including failure or cancellation; validated strategy absence extends the durable
wait to at least two hours (or the longer configured recovery cooldown), in both
fresh bootstrap and periodic recovery, without restarting the container. Startup respects
the persisted expiry, and light probes continue without scans during the wait.
Callbacks must honor cancellation and join their children.
Existing target guards run before a lifetime nonblocking `flock` in the private
target state directory. With that exclusive singleton held, one-shot startup
reconciliation uses schema-v5 PID/starttime identity: only a proven dead or