Repository navigation
perf(daemon): skip inode-churn catch-up rehash - #1034
Conversation
Problem: live catch-up trusted recorded fingerprints only when device and inode still matched. After mount or home-state churn, production had 10,916 unchanged files classified for full fingerprint reads, forcing about 31 GB of startup rehash work before useful ingest could begin.\n\nWhat changed: treat stable path + stable byte size + existing content fingerprint as the hot skip path, independent of inode/device changes. Appends and truncations still trigger work by size/offset, and files without fingerprints still populate cursor state.\n\nVerification: pytest tests/unit/sources/test_live_watcher.py -q --tb=short; pytest tests/integration/test_live_read_amplification.py -q --tb=short; ruff check polylogue/sources/live/watcher.py tests/unit/sources/test_live_watcher.py
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. 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 (5)
✨ 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: f74566e19a
ℹ️ 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 Use the indexed `action_events` base table to decide whether changed conversations have action rows before repairing action-event FTS during daemon convergence. ## Problem After #1034 removed the full source-file rehash path, the live production daemon still accumulated heavy reads while converging changed files. `py-spy` showed the remaining busy thread inside `_action_fts_has_rows_for_conversations`, which queried `action_events_fts` by `conversation_id`. On the production archive this behaves like an FTS-table scan during catch-up. ## Solution The repair decision now probes `action_events(conversation_id)` instead. That table has normal indexes, and the production query plan uses a covering index. The daemon still repairs or inserts the full action FTS rows from the persisted base data; only the existence probe changes. ## Verification - `pytest tests/unit/daemon/test_convergence_stages.py -q --tb=short` → `10 passed in 7.93s` - `ruff check polylogue/daemon/convergence_stages.py tests/unit/daemon/test_convergence_stages.py` → `All checks passed!` - Push hook quick baseline → `exit_code: 0` - Production query-plan check: `EXPLAIN QUERY PLAN SELECT 1 FROM action_events WHERE conversation_id IN (...) LIMIT 1` → `SEARCH action_events USING COVERING INDEX idx_action_events_sort` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved the reliability and accuracy of search index maintenance for action events by enhancing how the system determines when repairs are necessary. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/Sinity/polylogue/pull/1035) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
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
Avoid full-file fingerprint reads during daemon catch-up when a source path has the same byte size and an existing content fingerprint but its device/inode changed under the cursor.
Problem
The deployed daemon still hammered disk after #1033.
py-spy dumpshowed startup stuck infingerprint_file()fromLiveWatcher._plan_catch_up(). A production cursor classification found 10,916 files / 31.35 GB in thefingerprint_readpath solely because storedst_dev/st_inono longer matched the filesystem, even though paths, sizes, parser fingerprints, and stored content fingerprints were stable.Solution
Treat stable path + stable byte size + recorded content fingerprint as the catch-up skip path independent of inode/device churn. Appends still trigger work via
size > byte_offset, truncations still fall through, and legacy cursors without fingerprints still populate cursor state.Verification
pytest tests/unit/sources/test_live_watcher.py -q --tb=short→ 60 passedpytest tests/integration/test_live_read_amplification.py -q --tb=short→ 5 passedruff check polylogue/sources/live/watcher.py tests/unit/sources/test_live_watcher.py→ All checks passeddevtools verify-file-budgets→ cleandevtools render-all→ generated surfaces refreshedfast_skip; residualappendis 3 files / 27.7 MB.