Repository navigation
perf(daemon): bound session insight convergence reads - #1463
Conversation
Problem: deployed catch-up fixes still left large Codex sessions paying multi-GB physical reads during the insights convergence phase even after source parse and append writes were bounded. What changed: session insight batch loading now projects explicit columns and bounded text previews instead of hydrating full message and tool-result payloads. The daemon insights stage also queues only missing or stale session profiles, so already-converged conversations are not rebuilt on every source-path check. Verification: pytest tests/unit/daemon/test_convergence_stages.py tests/unit/storage/test_session_insight_refresh.py -q; ruff check on changed files; mypy on changed files; devtools verify --quick. Real archive probe rebuilt the 33,150-message Codex session in 13.095s with 434,913,280 physical read bytes and 761 MB max RSS, then the daemon freshness predicate returned no stale debt for the known large recent sessions. Ref #1447
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 13 minutes and 48 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 (4)
✨ 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: e8b6221b6b
ℹ️ 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".
|
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
Bounds daemon session-insight convergence for large conversations by loading only the columns and bounded text previews that the insight materializer needs, then scopes daemon insight debt checks to profiles that are actually missing or stale.
Problem
The deployed #1462 fix removed the remaining source parse/write amplification, but the live daemon still entered unsafe IO pressure during the convergence phase for a 236 MB Codex session. The latest
live_ingest_attemptrow showed only ~1.17 MB of source payload reads but ~1.19 GB of physical reads over a five-second sample, with cgroup memory dominated by file cache rather than Python heap. The expensive work had moved to session-insight convergence hydrating a 33,150-message session.Solution
load_sync_batchandload_async_batchnow use explicit projections instead ofSELECT *, truncating message text to 16 KiB and selected tool/thinking block text to 4 KiB. The archive rows remain exact; this only bounds the heuristic insight-refresh input.The daemon insights stage now checks freshness before queueing work: missing profile rows, materializer-version mismatch, or
session_profiles.source_updated_at != conversations.updated_at. Already-converged source paths/conversation IDs no longer re-trigger full insight rebuilds.Verification
pytest tests/unit/daemon/test_convergence_stages.py tests/unit/storage/test_session_insight_refresh.py -q→24 passed in 0.68sruff check polylogue/storage/insights/session/rebuild.py polylogue/daemon/convergence_stages.py tests/unit/storage/test_session_insight_refresh.py tests/unit/daemon/test_convergence_stages.py→All checks passed!mypy polylogue/storage/insights/session/rebuild.py polylogue/daemon/convergence_stages.py tests/unit/storage/test_session_insight_refresh.py tests/unit/daemon/test_convergence_stages.py→Success: no issues found in 4 source filesdevtools verify --quick→ passed locally in41.31sdevtools verify --quick→ passed in35.07spolylogued.servicestopped: rebuiltcodex:019e309f-7614-7381-a8ac-f9080f304ee6(33,150 messages) in13.095s, physical read delta434,913,280bytes, max RSS761 MB. After rebuild, the new daemon freshness predicate returned[]for the known large recent Codex sessions.Ref #1447