feat(monitor): add crash-safe supervisor loop
Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
1 parent
54a0fb79f8
commit
468532dc8f
12 files changed
+971
-44
No files matched your search
@@ -52,7 +52,8 @@ with a loopback IP or `localhost`, port 1–65535, and no credentials/path/query
|
||||
Video IDs must be 11 characters; durations and the failure threshold must be
|
||||
positive. Explicit empty values are invalid. Interval, consecutive-failure
|
||||
threshold and cooldown are validated future recovery policy settings only:
|
||||
**there is no scheduler, autonomous monitoring or recovery yet**.
|
||||
**An injected autonomous scheduling core exists, but no monitor command, actual
|
||||
recovery callback or live managed target is wired yet**.
|
||||
|
||||
The future managed target is a **brand-new prod-like zapret2-ss container in the
|
||||
test environment only**, not the existing container. Its stable configurable
|
||||
@@ -96,7 +97,8 @@ Signed URLs are not printed. Scanner diagnostics are retained in restricted
|
||||
artifact files rather than relayed to the terminal. No configuration is applied,
|
||||
no profile is marked active, and no service is restarted. The staged pipeline is
|
||||
scan/propose → guarded manual managed-test activation → future monitoring;
|
||||
the deployment definition exists but is not deployed; monitoring is **not implemented**. Manual
|
||||
the deployment definition exists but is not deployed; the monitor scheduling core
|
||||
is internal and **not wired to a command or actual recovery**. Manual
|
||||
proposal-only recovery is available below.
|
||||
No-argument `tune youtube` remains frontend-only and unchanged.
|
||||
|
||||
@@ -165,7 +167,7 @@ it must be writable. In Docker, mount that directory to retain history:
|
||||
docker run --rm -v autotune-data:/var/lib/zapret-autotune zapret-autotune status
|
||||
```
|
||||
|
||||
Schema version 4 is initialized transactionally on `tune` and `status`; subsequent
|
||||
Schema version 5 is initialized transactionally on `tune` and `status`; subsequent
|
||||
opens are idempotent and newer, unsupported schema versions are rejected.
|
||||
|
||||
Schema v4 adds a policy-state foundation keyed by stable service ID (not a cache
|
||||
@@ -176,13 +178,24 @@ configured threshold, an elapsed cooldown and no running recovery. Completion,
|
||||
successful or failed, requires the exact per-acquisition ownership token returned
|
||||
by acquisition, clears the lock and starts cooldown from completion time. Stale
|
||||
or duplicate completion is rejected without changing the lock, token or cooldown,
|
||||
even after a newer acquisition starts. A crash still leaves the durable lock held;
|
||||
the token does not introduce automatic expiry or crash reconciliation.
|
||||
State survives reopening the database; a crash during recovery leaves the lock
|
||||
held, pending future explicit crash reconciliation. Existing history/candidates
|
||||
are unchanged. These operations are not wired to `health youtube` or recovery:
|
||||
**no daemon, autonomous probe or container/Xray changes are added**. Manual
|
||||
managed activation is separate from this policy foundation.
|
||||
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. Recovery errors are reported without stopping monitoring; DB, lock and
|
||||
finalization errors are fatal. Cooldown starts when recovery returns, including
|
||||
failure or cancellation. 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
|
||||
PID-reused owner permits clearing its exact lease and starting crash cooldown.
|
||||
A live owner remains busy; legacy or unverifiable owners fail closed. Probe
|
||||
history is preserved. The lock file is never unlinked.
|
||||
The scheduler core has fake-time tests for scheduling, reset, cooldown,
|
||||
cancellation, parallel starts, fatal DB errors, reopen and safe startup
|
||||
reconciliation. **There is no actual recovery adapter,
|
||||
monitor CLI/entrypoint wiring or live target yet**; container/Xray are untouched.
|
||||
Manual managed activation remains separate. Verification of this increment is
|
||||
deferred to the orchestrator.
|
||||
|
||||
Schema v3 adds immutable strategy candidate definitions (group, declared exact
|
||||
endpoints, args and normalized-args fingerprint) and endpoint/protocol evidence.
|
||||
@@ -192,7 +205,8 @@ in the same transaction as the existing run. Qualification requires every declar
|
||||
endpoint to pass exactly 3/3 for both TLS1.2 and TLS1.3, with full success/coverage.
|
||||
Existing v2 history is unchanged and is not backfilled into independent candidates.
|
||||
Candidates have no DB active/installed state; managed activation uses its own
|
||||
durable config journal. Autonomous monitoring remains unimplemented.
|
||||
durable config journal. Autonomous scheduling is internal only; actual recovery
|
||||
and live monitoring remain unwired.
|
||||
The explicit `tune googlevideo` path adds exact-cache proposals only.
|
||||
Proposed runs store a SHA-256 fingerprint of validated arguments with separator
|
||||
whitespace normalized and argument order preserved; repeated proposals retain
|
||||
|
||||
Reference in new issue
Block a user