Repository navigation
feat: expose embedding catch-up metrics - #1524
Conversation
Problem: semantic-search catch-up state was visible through CLI status, but daemon dashboards and scrapers could not see embedding backlog or the latest persisted catch-up run. What changed: add Prometheus series for embedding conversation backlog, embedded message count, coverage percentage, and latest embedding_catchup_runs progress. Keep scrapes bounded by avoiding exact pending-message counts, tolerate partial embedding tables, and update the metrics contract tests and internals docs. Verification: pytest -q tests/unit/daemon/test_metrics_endpoint.py --tb=short; ruff format --check polylogue/daemon/metrics.py tests/unit/daemon/test_metrics_endpoint.py; ruff check polylogue/daemon/metrics.py tests/unit/daemon/test_metrics_endpoint.py; python -m mypy polylogue/daemon/metrics.py tests/unit/daemon/test_metrics_endpoint.py; timeout 10 python metrics smoke against live archive; devtools verify --quick; devtools verify. Ref #1503
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 38 minutes and 3 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: 09c14bbc39
ℹ️ 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 Daemon embedding convergence now records the same durable `embedding_catchup_runs` progress ledger as manual `polylogue embed backfill`. Daemon status also carries and renders the latest embedding catch-up run, so operator surfaces can explain daemon-driven embedding work without relying only on Prometheus metrics. ## Problem #1523 made manual embedding backfill resumability visible, and #1524 exposed that ledger in metrics. The daemon embed stage still ran bounded batches without starting/updating/finalizing a catch-up run. That made daemon-driven semantic-search catch-up opaque: a live daemon could be doing embedding work, but `embed status`, `/metrics`, and daemon status had no shared run record to explain the current or latest daemon batch. ## Solution `_embed_conversations_sync` now selects the pending daemon batch up front, starts an `embedding_catchup_runs` row with planned conversation/message counts, records per-conversation embedded/skipped/error progress, and finalizes the run as completed, stopped, or failed with a stop reason. The legacy unit-test seam where the helper is called against an empty touched DB remains supported by treating the provided IDs as the pending window. `embedding_readiness_info` now includes the latest catch-up run when present, and `polylogued status` plain output shows the latest embedding catch-up status/progress inline with the embedding readiness section. ## Verification - `pytest -q tests/unit/daemon/test_embedding_readiness.py::test_embed_loop_counts_errors_and_returns_false tests/unit/daemon/test_embedding_readiness.py::test_embed_loop_halts_when_cost_cap_exceeded tests/unit/daemon/test_embedding_readiness.py::test_embed_loop_no_cost_cap_processes_all tests/unit/daemon/test_embedding_convergence_progress.py tests/unit/daemon/test_metrics_endpoint.py::TestFormatMetricsReadsArchiveState::test_embedding_backlog_and_latest_catchup_state --tb=short` — 7 passed. - `pytest -q tests/unit/ui/test_tui.py::test_search_flow --tb=short` — passed when rerun individually after the first broad run exposed a transient UI failure. - `pytest -q tests/unit/storage/test_scale.py::TestPerformanceBudget::test_get_many_performance_budget --tb=short` — passed when rerun individually after the first broad run exposed a transient setup/perf failure. - `ruff check polylogue/daemon/convergence_stages.py polylogue/daemon/embedding_readiness.py polylogue/daemon/status.py tests/unit/daemon/test_embedding_convergence_progress.py tests/unit/daemon/test_embedding_readiness.py` — passed. - `python -m mypy polylogue/daemon/convergence_stages.py polylogue/daemon/embedding_readiness.py polylogue/daemon/status.py tests/unit/daemon/test_embedding_convergence_progress.py tests/unit/daemon/test_embedding_readiness.py` — passed. - `devtools verify --quick` — passed. - `devtools verify` — passed: 9,454 passed, 2 xfailed under pytest-testmon. Ref #1503
|
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
Expose semantic-embedding backlog and latest catch-up progress through the daemon
/metricsPrometheus surface, so operational dashboards can see whether semantic search is ready, catching up, or stalled without runningpolylogue embed statusmanually.Problem
#1503 is about making semantic embeddings operational on live archives. #1523 added a durable catch-up ledger and CLI status visibility, but daemon observability still missed the embedding backlog and latest run state. That meant normal ops tooling could not see the semantic-search readiness gap.
Solution
/metricsseries for embedding conversation totals, embedded/pending/failed counts, embedded message count, and coverage percentage.embedding_catchup_runsmetrics for run status, rebuild mode, planned/processed/embedded/skipped/failed conversations, planned/embedded messages, and estimated cost.Ref #1503
Verification
pytest -q tests/unit/daemon/test_metrics_endpoint.py --tb=short— 15 passed.ruff format --check polylogue/daemon/metrics.py tests/unit/daemon/test_metrics_endpoint.py— passed.ruff check polylogue/daemon/metrics.py tests/unit/daemon/test_metrics_endpoint.py— passed.python -m mypy polylogue/daemon/metrics.py tests/unit/daemon/test_metrics_endpoint.py— passed.timeout 10 python ... format_metrics(get_config().db_path)against live archive — completed; reported 7,951 pending embedding conversations, 0 embedded, no catch-up run.devtools verify --quick— passed.devtools verify— passed: 9448 passed, 2 xfailed via pytest-testmon.devtools verify --quick— passed.