Repository navigation
fix: close significant gaps — FTS safety, detection populate, canonical filter, backfill (#817/#844/#864) - #925
Conversation
…ulate, canonical cwd filter, backfill (#817/#844/#864) - #817: add FTS trigger safety regression test proving triggers restore after exception - #844: populate detection_warnings during parse error handling - #864: route cwd_prefix filter through working_directories_json with JSON fallback, add working_directories backfill migration from provider_meta Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits 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 (7)
✨ 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: d5738775ae
ℹ️ 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".
| parse_error=outcome.parse_error, | ||
| detection_warnings=outcome.parse_error[:500] if outcome.parse_error else None, | ||
| payload_provider=outcome.payload_provider, |
There was a problem hiding this comment.
Clear detection warnings after a successful reparse
Setting detection_warnings on failed ingests here introduces sticky warning state: when the same raw_id is retried successfully, _successful_raw_state_update does not set detection_warnings, so update_raw_state leaves the previous non-null warning in place. In practice, any transient parse failure will keep that row counted as a detection warning forever, even after parse recovery, which makes status metrics and triage output inaccurate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR targets three operational gaps: ensuring FTS trigger lifecycle safety during ingest failures (#817), improving visibility into provider detection/parse failures by persisting detection_warnings (#844), and moving --cwd-prefix filtering toward a canonical working_directories_json column with provider-meta fallback plus schema backfill scaffolding (#864).
Changes:
- Add a regression test intended to validate FTS trigger restoration behavior after ingest exceptions.
- Populate
RawConversationStateUpdate.detection_warningsduring failure-state updates in the ingest batch pipeline. - Update the SQLite filter builder to prefer
conversations.working_directories_jsonforcwd_prefixfiltering (falling back toprovider_meta), plus add schema bootstrap backfill SQL constants for working directories.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/storage/test_fts5.py | Adds a regression test around FTS trigger restoration after an ingest exception. |
| polylogue/storage/sqlite/schema_bootstrap.py | Adds SQL strings intended for backfilling working_directories_json from provider_meta. |
| polylogue/storage/sqlite/queries/filter_builder.py | Switches cwd_prefix filtering to use working_directories_json first, with provider_meta fallback. |
| polylogue/storage/search_providers/sqlite_vec_runtime.py | Formatting-only tweaks in embedding dimension queries/regex parsing. |
| polylogue/pipeline/services/ingest_batch/_core.py | Persists detection_warnings (derived from parse errors) when building failed raw-state updates. |
| polylogue/daemon/status.py | Formatting-only tweaks in embedding readiness/status line formatting. |
| polylogue/daemon/convergence_stages.py | Formatting-only tweak in embeddings meta dimension query. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Insert another message — FTS should pick it up since triggers are active | ||
| conn.execute( | ||
| "INSERT INTO messages(message_id, conversation_id, role, text, provider_name) VALUES(?,?,?,?,?)", | ||
| ("m2", "c1", "assistant", "another message", "test"), | ||
| ) | ||
| conn.commit() | ||
| count = conn.execute("SELECT COUNT(*) FROM messages_fts").fetchone()[0] | ||
| assert count == 2, f"Expected 2 FTS entries after exception recovery, got {count}" |
| _PROVIDER_META_BACKFILL_WORKING_DIRS_JSON = """ | ||
| UPDATE conversations SET working_directories_json = ( | ||
| SELECT json_extract(provider_meta, '$.working_directories') | ||
| FROM conversations AS c2 WHERE c2.conversation_id = conversations.conversation_id | ||
| ) | ||
| WHERE working_directories_json IS NULL | ||
| AND provider_meta IS NOT NULL | ||
| AND json_extract(provider_meta, '$.working_directories') IS NOT NULL | ||
| """ | ||
|
|
||
| _PROVIDER_META_BACKFILL_CWD = """ | ||
| UPDATE conversations SET working_directories_json = json_array(json_extract(provider_meta, '$.cwd')) | ||
| WHERE working_directories_json IS NULL | ||
| AND provider_meta IS NOT NULL | ||
| AND json_extract(provider_meta, '$.cwd') IS NOT NULL | ||
| """ | ||
|
|
Three follow-up fixes after the larger schema/daemon waves landed, each tied to a distinct issue but sharing files in the ingest_batch and convergence layers. - #817 (FTS safety): adds a regression test pinning that the FTS trigger restore runs before commit so a SIGKILL during trigger-suspend cannot leave the index permanently desynced (the original ordering bug from PR #882). - #844 (detection visibility): populates `detection_warnings` during parse-error handling in `pipeline/services/ ingest_batch/_core.py` and surfaces them through `daemon/status.py` so silently dropped artifacts become visible. - #864 (provider_meta graduation): adds the canonical `cwd_path` filter in `storage/sqlite/queries/filter_builder.py` and a `working_directories` backfill in `schema_bootstrap.py`, finishing the move off `provider_meta` JSON paths for the cwd-based filter. Refs #817, #844, #864
Three follow-up fixes after the larger schema/daemon waves landed, each tied to a distinct issue but sharing files in the ingest_batch and convergence layers. - #817 (FTS safety): adds a regression test pinning that the FTS trigger restore runs before commit so a SIGKILL during trigger-suspend cannot leave the index permanently desynced (the original ordering bug from PR #882). - #844 (detection visibility): populates `detection_warnings` during parse-error handling in `pipeline/services/ ingest_batch/_core.py` and surfaces them through `daemon/status.py` so silently dropped artifacts become visible. - #864 (provider_meta graduation): adds the canonical `cwd_path` filter in `storage/sqlite/queries/filter_builder.py` and a `working_directories` backfill in `schema_bootstrap.py`, finishing the move off `provider_meta` JSON paths for the cwd-based filter. Refs #817, #844, #864
#817: FTS trigger safety regression test. #844: detection_warnings populated during parse errors. #864: canonical cwd filter + working_directories backfill.