Skip to content

fix: close minor gaps — #819 param parity test, #828 embedding tests, #830 health check - #924

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/minor-gap-closures
May 7, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/minor-gap-closures

Conversation

@Sinity

@Sinity Sinity commented May 7, 2026

Copy link
Copy Markdown
Owner

Minor gap closures. 3 files +94/-1.

Copilot AI review requested due to automatic review settings May 7, 2026 16:35
@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 27 seconds before requesting another review.

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 @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 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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b13b86dc-c1de-4cc8-ab25-c52a4938b4dd

📥 Commits

Reviewing files that changed from the base of the PR and between cabce04 and eee7151.

📒 Files selected for processing (3)
  • polylogue/daemon/http.py
  • tests/unit/daemon/test_convergence_stages.py
  • tests/unit/mcp/test_tool_contracts.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/minor-gap-closures

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 94440a9 into master May 7, 2026
3 of 4 checks passed
@Sinity
Sinity deleted the feature/fix/minor-gap-closures branch May 7, 2026 16:35

Copilot AI 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.

Pull request overview

Closes a few small gaps by adding test coverage for query/MCP parameter parity and embedding config gating, and by introducing a dedicated daemon health-check endpoint with probe-friendly HTTP status semantics.

Changes:

  • Added a unit test intended to enforce MCP search parameter parity with ConversationQuerySpec.
  • Added unit tests for _embedding_config_enabled() behavior based on config flag + API key presence.
  • Added GET /api/health/check to the daemon HTTP server, returning 200 vs 503 based on check_health() results.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
tests/unit/mcp/test_tool_contracts.py Adds a parity test for MCP search tool params vs ConversationQuerySpec.
tests/unit/daemon/test_convergence_stages.py Adds tests for embedding enablement logic based on config.
polylogue/daemon/http.py Adds a new health-check route (/api/health/check) with status-code semantics for probes/CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1355 to +1382
"""search tool parameters must cover the same filter axes as ConversationQuerySpec (#819)."""
from polylogue.archive.query.spec import ConversationQuerySpec

spec_fields = {f.name for f in ConversationQuerySpec.__dataclass_fields__.values()}
mcp_params = {
"query",
"provider",
"providers",
"since",
"until",
"tag",
"tags",
"limit",
"offset",
"has_tool_use",
"has_thinking",
"message_type",
"repo",
"cwd_prefix",
"action_terms",
"tool_terms",
"title_contains",
"referenced_path",
}
missing = mcp_params - spec_fields
# MCP may have surface-specific params not in the spec (limit, offset, tags)
surface_only = {"limit", "offset", "tags"}
assert missing.issubset(surface_only), f"MCP params not in ConversationQuerySpec: {missing - surface_only}"
Comment on lines +271 to +304
def test_embedding_config_enabled_with_key() -> None:
"""Embedding is enabled when config has both enabled flag and API key."""
from unittest.mock import patch

with patch("polylogue.daemon.convergence_stages.load_polylogue_config") as mock_cfg:
mock_cfg.return_value.embedding_enabled = True
mock_cfg.return_value.voyage_api_key = "test-key"
from polylogue.daemon.convergence_stages import _embedding_config_enabled

assert _embedding_config_enabled() is True


def test_embedding_config_disabled_without_key() -> None:
"""Embedding is disabled when config has enabled flag but no API key."""
from unittest.mock import patch

with patch("polylogue.daemon.convergence_stages.load_polylogue_config") as mock_cfg:
mock_cfg.return_value.embedding_enabled = True
mock_cfg.return_value.voyage_api_key = None
from polylogue.daemon.convergence_stages import _embedding_config_enabled

assert _embedding_config_enabled() is False


def test_embedding_config_disabled_explicitly() -> None:
"""Embedding is disabled when config has key but enabled flag is False."""
from unittest.mock import patch

with patch("polylogue.daemon.convergence_stages.load_polylogue_config") as mock_cfg:
mock_cfg.return_value.embedding_enabled = False
mock_cfg.return_value.voyage_api_key = "test-key"
from polylogue.daemon.convergence_stages import _embedding_config_enabled

assert _embedding_config_enabled() is False
Comment thread polylogue/daemon/http.py
Comment on lines +401 to +416
"""CI-facing health check with deterministic exit semantics.

Returns 200 when all FAST health checks pass, 503 when any
non-OK health alert is present. Suitable for health check
endpoints in Docker, systemd, and CI pipelines.
"""
try:
from polylogue.daemon.health import HealthTier, check_health

health = check_health(tiers={HealthTier.FAST, HealthTier.MEDIUM})
if health.overall_status == "ok":
self._send_json(HTTPStatus.OK, {"ok": True, "status": "healthy"})
else:
self._send_json(
HTTPStatus.SERVICE_UNAVAILABLE,
{"ok": False, "status": health.overall_status, "alerts": len(health.alerts)},
Comment thread polylogue/daemon/http.py
Comment on lines +407 to +423
try:
from polylogue.daemon.health import HealthTier, check_health

health = check_health(tiers={HealthTier.FAST, HealthTier.MEDIUM})
if health.overall_status == "ok":
self._send_json(HTTPStatus.OK, {"ok": True, "status": "healthy"})
else:
self._send_json(
HTTPStatus.SERVICE_UNAVAILABLE,
{"ok": False, "status": health.overall_status, "alerts": len(health.alerts)},
)
except Exception:
self._send_json(
HTTPStatus.SERVICE_UNAVAILABLE,
{"ok": False, "status": "error", "detail": "health check failed"},
)

@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: eee715196d

ℹ️ 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 tests/unit/mcp/test_tool_contracts.py Resolved
Sinity added a commit that referenced this pull request May 7, 2026
Three small closeouts after the issue acceptance review.

- #819 (MCP envelopes): adds the missing CLI/MCP parameter parity
  test in `tests/unit/mcp/test_tool_contracts.py` so future
  filter changes cannot drift between the two surfaces without a
  failing test.
- #828 (embedding convergence): adds focused tests in
  `tests/unit/daemon/test_convergence_stages.py` covering the
  embedding stage gating, cost-cap halt, and dimension-change
  reconciliation introduced in PR #915.
- #830 (tiered health): wires an additional health-check
  endpoint into `polylogue/daemon/http.py` so the periodic
  health loop has the readout the operator runbook documents.

Refs #819, #828, #830
Sinity added a commit that referenced this pull request May 7, 2026
Three small closeouts after the issue acceptance review.

- #819 (MCP envelopes): adds the missing CLI/MCP parameter parity
  test in `tests/unit/mcp/test_tool_contracts.py` so future
  filter changes cannot drift between the two surfaces without a
  failing test.
- #828 (embedding convergence): adds focused tests in
  `tests/unit/daemon/test_convergence_stages.py` covering the
  embedding stage gating, cost-cap halt, and dimension-change
  reconciliation introduced in PR #915.
- #830 (tiered health): wires an additional health-check
  endpoint into `polylogue/daemon/http.py` so the periodic
  health loop has the readout the operator runbook documents.

Refs #819, #828, #830
@Sinity

Sinity commented Sep 30, 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.

  • 78.F036 / P1: stale at the checked revision: The _embedding_config_enabled function and its old patch-target tests are absent at the pin. Current convergence stages import load_polylogue_config at module scope in polylogue/daemon/convergence_stages.py:20, and the remaining configuration tests patch that module binding at tests/unit/daemon/test_convergence_stages.py:204.
  • 78.F065 / P1: stale at the checked revision: tests/unit/mcp/test_tool_contracts.py was deleted in dc6fa63 (fix(mcp): harden six-tool cutover — session correlation, status(operation), SessionStart preamble (fix(mcp): harden six-tool cutover — session correlation, status(operation), SessionStart preamble #3095)); the cited code no longer exists at 5ebcfe5.

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.

2 participants