Repository navigation
feat(pm-stack): quota watchdog core — entry point, adapters, rung executors, systemd timer (#6032) - #11243
Conversation
…ader, rung 2/3 executors, producer template, systemd timer (#6032)
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review disposition (lane any-k, task 19956)
|
What this builds (#6032 remainder)
Slice 1 (decision layer, PR #7788) and rung 4 (escalation, PR #8357) already landed. This PR builds the rest of the watchdog core:
src/watchdog.ts— the oneshot entry point. Per tick: load adapters, read the state file throughcoerceHealth, observe each source (producer document + gatherer heartbeat + live CDP liveness probe), classify (including missing-document, stale-read-while-the-browser-lives, and dead-CDP — the classes the producer cannot see itself),decide, execute the rung, run rung-4 escalation/recovery, write state back atomically (tmp+rename), appendquota-watchdog-history.jsonl. Nothing decision-relevant lives in process memory (quota: claude read needs cross-tick memory — usage-endpoint 429 (proven) + oneshot gatherer defeats the fetcher's in-process cooldown/cache #5928)./json/version+/json/list, allowlist origin open, cookies present by name via the CDP websocket — values never enter the process) with one bounded supervised restart of the adapter's browser unit; rung 3: re-login driver that stops dead at a human-only challenge and marks the incident human-blocked. Repairs are gated onQUOTA_WATCHDOG_LIVE_REPAIRS=1, rung-4 production effectors (fleet queue /gh) onQUOTA_WATCHDOG_LIVE=1; the systemd unit sets both, a bare CLI run journals dry-run plans and creates nothing.src/adapters.ts+adapters/fixture.json— the adapter loader: per-provider JSON (origins allowlist, CDP port, data paths, cookie names, login hints, class/rung maps, thresholds), structurally validated, defects reported per file instead of throwing. The core contains zero provider names; the fixture adapter is the one shipped here, real provider adapters are follow-ons per the issue scope.producers/producer-template.mjs— forkable producer scaffold from the retired Meta producer pattern (timeout-bounded CDP, tab ownership, failure-class exit codes + failure documents, atomiclatest.json), plustest/fixtures/fixture-producer.mjs, the scenario-driven stub the acceptance tests drive.pm-stack/systemd/pm-quota-watchdog.{service,timer}— oneshot + timer on the gatherer cadence, offset to*:3/15.Tests (oracles named per the testing doctrine)
bun test ../exporters/test/— 35 pass, 0 fail (includes the pre-existing state + escalation suites). The newtest/watchdog.test.tsdrives the entry point end to end against a scratch tree:cooldownUntilon disk and a fresh tick honors it with no repair action (the quota: claude read needs cross-tick memory — usage-endpoint 429 (proven) + oneshot gatherer defeats the fetcher's in-process cooldown/cache #5928 regression shape);CLI fixture demo also run live: healthy tick quiet;
session-expiredscenario classified and rung 3 recorded (asskippedwith live repairs off).Live install (units + timer + a laptop-local adapter for the Meta file-export source) and the ≥3-consecutive-tick demonstration follow the merge and are reported on #6032.
Task 19956 · lane any-k
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.