Skip to content

fix(daemon): bulk repair streaming full-ingest FTS - #1462

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/live-full-fts-threshold
May 24, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/live-full-fts-threshold

Conversation

@Sinity

@Sinity Sinity commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

Live full ingest now switches to suspended FTS triggers at the same size threshold where it already switches to streaming blob ingestion. This targets large same-size source rewrites that cannot use append planning but should not pay thousands of per-row FTS trigger updates.

Problem

After #1461 was deployed, the two hot Codex append cases were fixed in live monitoring:

  • 82 MB source: changed_messages=89, elapsed_s=1.65, source_payload_read_bytes=598770
  • 235 MB source: changed_messages=278, elapsed_s=4.08, source_payload_read_bytes=2051406

The next catch-up chunk still exposed a separate unsafe path. A 37.8 MB chunk containing same-size changed Codex sessions produced:

slow_write actions=2000 blocks=2374 changed_messages=2369 changed_provider_events=5471 cid=codex:019e548a-67af- elapsed_s=25.97
read_bytes ~= 24.8 GB
IO PSI full avg10 ~= 30.7%
database is locked

Those files were too large for cheap per-row FTS trigger churn but below the old 32 MiB trigger-suspension threshold.

Solution

Use the existing _STREAMING_FULL_INGEST_BYTES threshold for full-ingest FTS trigger suspension. Files large enough to stream through the blob path now also get bulk FTS repair at commit. This preserves daemon convergence scope; it only changes the write mechanics for large full replays.

A regression verifies that a 9 MiB JSONL full-ingest source now calls _process_ingest_batch_sync with suspend_fts_triggers=True, repair_message_fts=True, and repair_action_fts=True by default.

Verification

  • pytest tests/unit/sources/test_live_batch_support.py -q -> 14 passed
  • ruff check polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py -> passed
  • mypy polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py -> passed
  • devtools verify --quick -> exit_code 0, total_duration_s 38.38

Ref #1447

Problem: after #1461, live deployment kept large hot Codex appends bounded, but same-size changed Codex sessions still need full parse and produced heavy per-row FTS trigger churn. A 37.8 MB catch-up chunk drove read_bytes past 24 GB and hit a database lock.\n\nWhat changed: live full ingest now suspends FTS triggers for files at the existing streaming threshold instead of waiting until 32 MiB. Those files already use the streaming blob path, and they now use one bounded FTS repair at commit instead of thousands of row-trigger updates.\n\nVerification: pytest tests/unit/sources/test_live_batch_support.py -q; ruff check polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py; mypy polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py; devtools verify --quick.\n\nRef #1447
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 34 minutes and 45 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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b598f5fb-ee86-49e7-8413-fa35e9062735

📥 Commits

Reviewing files that changed from the base of the PR and between 2179002 and 6461603.

📒 Files selected for processing (2)
  • polylogue/sources/live/batch.py
  • tests/unit/sources/test_live_batch_support.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/live-full-fts-threshold

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity merged commit 591798e into master May 24, 2026
6 checks passed
@Sinity
Sinity deleted the feature/fix/live-full-fts-threshold branch May 24, 2026 01:07
Sinity added a commit that referenced this pull request Aug 17, 2026
polylogue-gibn1, decisive: instrumented the sole consumer of
summary.fts_repair_session_ids (_commit_sync_ingest_side_effects) and it never
printed across five sessions and sixty messages in the failing
convergence-evidence test. The repair is nested inside `if transaction_started`,
so a route with an externally managed transaction skips FTS repair along with
every other post-write side effect.

Eliminated: repair_message_fts (defaults True everywhere, no daemon override),
the repair queue itself (content_changed appends unconditionally), the invariant
reader, and the triggers. Three independent places each assume another will
populate the index: replay defers the reinsert, ingest-side repair never runs,
and the path-scoped convergence check is a hardcoded `return False`.

Read the #1498 cascade retro as CLAUDE.md requires; its closed list names the
adjacent history (#1462, #1469, #1472, #1500, #1502), several of which narrowed
FTS repair to avoid redundant work. Those PR bodies are the place to start.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HWcPJJJvuF25CqVwTFgSQC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant