Repository navigation
fix(daemon): stop schema-blocked background work - #1466
Conversation
Problem: a critical schema preflight blocked live ingest but still allowed the daemon to start periodic DB loops and the post-ingest converger. On the live archive that produced heavy physical reads even though the watcher refused to start.\n\nWhat changed: schema-blocked startup now keeps the degraded HTTP/browser surfaces observable while skipping all DB-opening background tasks and converger construction. A daemon CLI regression test pins the exact schema-blocked path.\n\nVerification: pytest -q tests/unit/daemon/test_daemon_cli.py -q; ruff check polylogue/daemon/cli.py tests/unit/daemon/test_daemon_cli.py; mypy polylogue/daemon/cli.py tests/unit/daemon/test_daemon_cli.py; devtools verify --quick.\n\nRef #1447
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 9 minutes and 53 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a100086807
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary: Failed live-ingest paths now retry through live_cursor backoff instead of being immediately requeued from batch metrics. The daemon can still converge source files, but a failing catch-up group no longer turns into a half-second disk hot loop. Problem: After the #1466 deploy, polylogued reached real catch-up and processed the large Codex chunks, then repeatedly logged batching 305 changed files and requeued 305 failed files. Live IO samples reached roughly 23 GB of reads and IO PSI full avg10 was roughly 24%, while live_cursor had zero failed rows. Retry state was bypassing the durable cursor/backoff mechanism. Solution: Added failed cursor record listing, replaced direct metrics failed_paths requeueing with cursor-owned retry scheduling, scheduled due failures back into pending work, and added a delayed wake-up for the next retry timestamp. Tests assert backed-off failures are not immediately requeued and only due failures re-enter pending work. Verification: - pytest -q tests/unit/sources/test_live_catchup_planning.py tests/unit/sources/test_live_watcher.py -> 65 passed - ruff check polylogue/sources/live/watcher.py polylogue/sources/live/cursor.py tests/unit/sources/test_live_catchup_planning.py tests/unit/sources/test_live_watcher.py -> pass - mypy polylogue/sources/live/watcher.py polylogue/sources/live/cursor.py tests/unit/sources/test_live_catchup_planning.py tests/unit/sources/test_live_watcher.py -> pass - devtools verify --quick -> exit_code 0, total_duration_s 37.93 - pre-push devtools verify --quick -> exit_code 0, total_duration_s 35.40 - GitHub checks: Analyze (python), CodeQL, GitGuardian, build (runtime), build (distroless) -> pass Ref #1447
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Stops schema-blocked daemon startup from launching any DB-opening background work. The daemon can still expose degraded browser/API surfaces, but a critical schema preflight now blocks the watcher, periodic archive tasks, and the post-ingest converger.
Problem
After deploying #1465, the live service correctly refused live ingest because the archive metadata reported schema v12 against runtime v8, but it still started the convergence engine and periodic loops. On the real archive,
read_bytesrose by about 1.17 GB in 5 seconds even though the watcher was blocked. That defeats the schema preflight's purpose and can keep the host under IO pressure.Solution
run_daemon_servicesfrom creating WAL, heartbeat, convergence-debt, health, DB optimize, or status-snapshot tasks whenwatcher_blockedis true.DaemonConvergerunconstructed under the same schema-blocked state.Ref #1447
Verification
pytest -q tests/unit/daemon/test_daemon_cli.py -q->18 passedruff check polylogue/daemon/cli.py tests/unit/daemon/test_daemon_cli.py->All checks passed!mypy polylogue/daemon/cli.py tests/unit/daemon/test_daemon_cli.py->Success: no issues found in 2 source filesdevtools verify --quick->exit_code: 0,total_duration_s: 35.03devtools verify --quick->exit_code: 0,total_duration_s: 33.62