Repository navigation
fix(daemon): back off failed live ingest paths - #1467
Conversation
Problem: the live watcher requeued batch failed_paths directly, so a failing catch-up group could loop every debounce interval without creating live_cursor failure rows or honoring backoff. On the live archive this produced repeated 305-file batches and severe IO PSI while the daemon made no progress.\n\nWhat changed: failed source retries are now cursor-owned. The watcher scans failed live_cursor records, schedules due failures back into pending work, and sleeps until the next retry timestamp for backed-off failures. Catch-up and live flush paths no longer translate metrics failed_paths into immediate pending work.\n\nVerification:\n- pytest -q tests/unit/sources/test_live_catchup_planning.py tests/unit/sources/test_live_watcher.py -> 65 passed\n- 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\n- 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\n- devtools verify --quick -> exit_code 0\n\nRef #1447
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughLiveWatcher now implements a backoff-based retry scheduler for previously failed files. It queries failed cursor records via ChangesLive File Retry Scheduler
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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: e0d482b41f
ℹ️ 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 Defers expensive session-insight rebuilds for very large source files while they are still actively appending, without reducing daemon convergence scope. Archive writes and targeted FTS repair still run immediately; insight convergence becomes durable debt until the source is quiet. Problem After #1467 was deployed, the failed-file hot requeue loop stopped, but live monitoring still showed severe physical reads on tiny appends to huge active Codex sessions. source_payload_read_bytes was only a few KB per attempt while /proc PID io showed roughly 2.36 GB of reads over 10s, pointing at derived session insight rebuilds rehydrating whole conversations on every append. Solution - Add a 64 MiB / 60s quiet-window guard to the daemon insights stage. - Return convergence debt, not success, when a huge source is still hot so the daemon must still converge once the file quiets. - Mark this expected deferral with a fixed 60s retry cadence instead of exponential failure backoff. - Shorten the daemon's convergence-debt retry loop from 10 minutes to 60 seconds. - Add focused coverage for hot large deferral, quiet large rebuild, small active rebuild, and fixed retry scheduling. Verification - pytest -q tests/unit/daemon/test_convergence_stages.py tests/unit/daemon/test_daemon_convergence.py tests/unit/daemon/test_daemon_cli.py tests/unit/sources/test_live_catchup_planning.py -> 45 passed - pytest -q tests/unit/sources/test_live_watcher.py -> 60 passed - devtools verify --quick -> exit_code 0, total_duration_s 34.58 - pre-push devtools verify --quick -> exit_code 0, total_duration_s 34.61 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
Failed live-ingest paths now retry through
live_cursorbackoff instead of being immediately requeued from batch metrics. The daemon can still converge every source file, but a failing catch-up group no longer turns into a half-second disk hot loop.Problem
After the #1466 deploy,
polyloguedreached real catch-up and processed the large Codex chunks, then repeatedly loggedbatching 305 changed file(s)andrequeued 305 failed file(s) for live retry./proc/$pid/ioreached ~23 GB of reads and IO PSI full avg10 hit ~24%, whilelive_cursorhad zero failed rows. That means retry state was bypassing the durable cursor/backoff mechanism.The sampled failed paths were valid-ish Antigravity/Hermes inputs and parsed successfully in a fresh temp archive, so the correct fix is not scope reduction or quarantine.
Ref #1447
Solution
CursorStore.list_failed_records()so the watcher can inspect failed cursor rows with their retry timestamps.failed_pathsrequeueing with cursor-owned retry scheduling.next_retry_atso convergence continues without hot polling.Verification
pytest -q tests/unit/sources/test_live_catchup_planning.py tests/unit/sources/test_live_watcher.py-> 65 passedruff 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-> passmypy 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-> passdevtools verify --quick-> exit_code 0, total_duration_s 37.93devtools verify --quick-> exit_code 0, total_duration_s 35.40Summary by CodeRabbit