Skip to content

fix(daemon): bound FTS health counts - #1436

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/bounded-fts-health
May 23, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/bounded-fts-health

Conversation

@Sinity

@Sinity Sinity commented May 23, 2026

Copy link
Copy Markdown
Owner

Summary

Make the daemon medium-tier FTS health check use the bounded conversation_stats message count when it is available, and report stale over-indexed FTS rows as degraded instead of healthy.

Problem

The deployed FTS replacement fix restored production FTS parity, but polylogue --plain status still timed out while live ingest was processing a large Codex session. The /api/status payload includes medium health checks, and fts_readiness still scanned messages directly. The check also only treated under-indexing as unhealthy, so an overcount drift like the production failure could be reported as OK.

Solution

polylogue.daemon.health._check_fts_readiness_medium now reads SUM(message_count) from conversation_stats when that table exists, falling back to COUNT(*) FROM messages only for minimal or legacy fixtures. Any mismatch between expected message count and messages_fts_docsize is degraded: undercounts report unindexed gaps and overcounts report stale extra indexed rows.

Verification

  • pytest tests/unit/daemon/test_health_check_paths.py::test_fts_readiness_ok tests/unit/daemon/test_health_check_paths.py::test_fts_readiness_error_when_large_gap tests/unit/daemon/test_health_check_paths.py::test_fts_readiness_counts_docsize_not_virtual_table tests/unit/daemon/test_health_check_paths.py::test_fts_readiness_uses_stats_not_message_scan tests/unit/daemon/test_health_check_paths.py::test_fts_readiness_flags_stale_extra_rows -q → 5 passed
  • python -m ruff format --check polylogue/daemon/health.py tests/unit/daemon/test_health_check_paths.py → 2 files already formatted
  • python -m ruff check polylogue/daemon/health.py tests/unit/daemon/test_health_check_paths.py → All checks passed
  • python -m mypy polylogue/daemon/health.py tests/unit/daemon/test_health_check_paths.py → Success
  • pre-push devtools verify --quick → exit_code 0, total_duration_s 38.63

@coderabbitai

coderabbitai Bot commented May 23, 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 19 minutes and 14 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: 9d964292-6063-4029-9ff2-8e8b9c00c6b9

📥 Commits

Reviewing files that changed from the base of the PR and between f0219c6 and a6e8c0c.

📒 Files selected for processing (2)
  • polylogue/daemon/health.py
  • tests/unit/daemon/test_health_check_paths.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/bounded-fts-health

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 b1c386e into master May 23, 2026
6 checks passed
@Sinity
Sinity deleted the feature/fix/bounded-fts-health branch May 23, 2026 12:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6e8c0ced4

ℹ️ 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".

Comment thread polylogue/daemon/health.py Resolved
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 62.F069 / P1: fixed-already at the checked revision: The FTS health check now delegates to canonical readiness at polylogue/daemon/health.py:660 and treats absent or broken measured surfaces as errors at lines 668-679. Its denominator comes from searchable blocks rather than conversation_stats, so an empty lagging statistics table no longer masks missing FTS membership.

Only the rows listed above are dispositioned. Held findings remain open.

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