fix: prevent automatic retries of failed startup apply

Latch explicit resource apply once per PID 1 lifetime. Fail closed before launch and permanently pause after authoritative cleanup on failed or incomplete apply; retain reconciliation on successful monitor and service restarts.

Cover deterministic 180-second retry windows, launch/ACK/child/session/service failures, cancellation, successful restarts and fresh-PID1 flags. Document RAM-only reset limits and repair-only startup; no remote health acceptance is claimed.

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-15 08:05:27 +03:00
1 parent 36aace02da
commit 643d0c6220
3 files changed
+111 -13

No files matched your search

+21 -3
View File
@@ -3,6 +3,7 @@
`plan` remains **proposal-only** and never changes runtime or config.
Explicit generic startup apply is implemented and independently reviewed locally;
remote acceptance is pending. This is not automatic recovery or production READY.
The per-PID-1 one-shot latch correction passed independent local review only.
Explicit isolated qualification temporarily installs an owned NFQ worker and
queue rules, but never changes legacy SQL groups, renderer or apply journals.
Monitor HEALTHY, old SQL measurements and public check JSON are not proof.
@@ -174,9 +175,22 @@ manager, new proof importer, SQL frontend surrogate or parallel journal exists.
PID 1 starts owned SS/DoH, reconciles known bytes, launches the acknowledged
`managed resource-apply --resource-config FILE` child before the checks-only
monitor, and starts the native daemon only with verified committed config.
This is one finite apply invocation per startup cycle, not exactly once per
container: PID 1 can retry cycles under its existing restart budget. Identical
committed requests resume by authenticated refs without reapplying the transaction.
This is at most one apply launch per PID 1 lifetime. A RAM latch is marked failed
before launch and succeeds only after child wait=0 and owned-session cleanup.
Launch/ACK failure, nonzero/signal exit, SS/DoH loss, or incomplete cleanup leaves
it failed: after authoritative cleanup PID 1 remains cancellably BLOCKED, without
restarting SS/DoH, native zapret, apply or monitoring, even across former 60s retry
windows. Cleanup still stops SS/DoH (DNS last); BLOCKED does not keep them alive.
Successful apply is skipped on later monitor/SS restarts, but every runtime cycle
still reconciles committed refs before native start. Qualification and legacy
retry behavior are unchanged.
**Ceiling:** this is not a durable manual-intent latch. A fresh PID 1 (including
an external Docker restart policy) resets authorization and, with flag=1, permits
one new attempt. Operators must disable unattended external restart/recreation
for this workflow. Set `ZAPRET_AUTOTUNE_RESOURCE_APPLY=0` for explicit repair-only
startup: prepared state is reconciled, never promoted or reapplied. Identical
committed requests still resume by authenticated refs without a new transaction.
The command refuses standalone/docker-exec callers: actual PID 1 environment,
entrypoint, namespace, direct-child executable/argv and held launch ACK are
required, plus the existing controller singleton and no pre-existing NFQ worker.
@@ -228,6 +242,10 @@ managed/resource status validates generic refs without inventing legacy groups.
Local root fixture tests cover the production snapshot factory and shared engine;
independent local review passed. Actual native/network/PID 1 apply acceptance is
**not run**. The next gate is isolated bounded remote acceptance, not live rollout.
The per-PID-1 latch correction passed independent local review and deterministic
180-second simulated retry-window fixtures; no remote PASS is claimed for it.
Roadmap: authorized isolated acceptance; no remote deployment is authorized by
local fixtures.
## Bounded remote acceptance — source `5cdc0cd`