Skip to content

feat(mcp): close three read-capability gaps left by the six-tool cutover - #3132

Merged
Sinity merged 1 commit into
masterfrom
feature/mcp/close-read-capability-gaps
Jul 18, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/mcp/close-read-capability-gaps

Conversation

@Sinity

@Sinity Sinity commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the three documented "Known gaps" from PR #3095's six-tool MCP read algebra: no way to list personal-state records back, no postmortem/pathology reports, and status(scope="sources"/"embeddings") silently falling through to archive stats.

Problem

PR #3095 replaced the ~97-tool MCP surface with six read transactions (query/read/get/explain/context/status) plus four privileged transactions. It shipped with a documented "Known gaps" section admitting three read capabilities lost no equivalent dispatch in the new surface:

  1. Personal-state listing (marks/annotations/saved-views/recall-packs/workspaces/corrections/blackboard notes) — write() could create these records but nothing could list them back.
  2. Postmortem/pathology reports — the retired get_postmortem_bundle/get_pathologies tools had no successor.
  3. status(scope="sources"/"embeddings") — declared in the status() signature but both silently fell through to the same scope="archive" payload.

All three were confirmed "trivial": the underlying Polylogue facade calls stayed live and independently tested through the cutover (unchanged by it); only the MCP dispatch wiring was missing.

Solution

All changes are in polylogue/mcp/server_cutover.py:

  • query(projection=...) gains 7 personal-state projections (marks, annotations, saved_views, recall_packs, workspaces, corrections, blackboard), each a thin dispatch onto the existing list_* facade call + page_items + the existing typed payload class (MCPUserMarkListPayload etc., which survived the cleanup PR unused). Offset pagination is not yet exposed (mirrors the existing projection="sessions" precedent, which also fixes offset at 0).
  • query(projection=...) gains postmortem/pathologies, reusing build_session_query_request's filter scaffolding and dropping the MCP default page limit (replace(spec, limit=None)) before handing the spec to the 200-session analysis cap — the same trick the retired get_postmortem_bundle/get_pathologies tools used, otherwise the shared page-size default of 10 silently caps the matched scope and defeats the facade's own analysis cap. Also adds abandoned_sessions/stuck_sessions as two more thin projections (no semantic overlap found with postmortem/pathologies, so kept separate per the plan's documented fallback).
  • status(scope="sources") wires the existing named_source_freshness handler through the already-unused ref parameter (single-source by design, matching the retired tool's own scope).
  • status(scope="embeddings") wires embedding_status_payload via a small _EmbeddingStatusEnv config adapter (mirrors the retired embedding_status tool), with include=("detail",)/include=("bands",) mapping to its include_detail/include_retrieval_bands params.

Rebased onto master after #3128 landed a fifth status() scope (coordination) concurrently — merged cleanly since it's a disjoint if scope == ... branch in the same function; also updated status()'s docstring to describe all four now-wired non-archive scopes.

No new MCP declaration rows needed: query/status already exist in TARGET_DEFAULT_READ_ALGEBRA with result-semantics broad enough to cover the new projections/scopes (documented in each function's docstring, matching the context(intent="resume") precedent).

Verification

  • devtools test tests/unit/mcp/ — 184 passed (16 new, in tests/unit/mcp/test_query_gap_projections.py).
  • devtools verify --quick — green (format/lint/mypy --strict/render-all-check).
  • Live read-only smoke pass (POLYLOGUE_ARCHIVE_ROOT=~/.local/share/polylogue via sinnix-scope background, same pattern as fix(mcp): harden six-tool cutover — session correlation, status(operation), SessionStart preamble #3095) against the real ~18k-session archive: all 12 new projections/scopes returned valid payloads with no errors — postmortem/pathologies matched 153 sessions over the last 7 days, abandoned_sessions found 74, status(scope=embeddings) reported real catch-up state (total_sessions=2498), status(scope=sources) returned a real freshness projection.

Ref polylogue-t46.8.2

🤖 Generated with Claude Code

Problem: the six-tool MCP read algebra (PR #3095) shipped with three
documented capability gaps versus the retired ~97-tool surface: no way to
list personal-state records back (marks/annotations/saved-views/recall-packs/
workspaces/corrections/blackboard notes -- write() could create them but
nothing could list them), no postmortem/pathology reports, and
status(scope="sources"/"embeddings") silently falling through to the same
archive-stats payload as scope="archive". All three were "trivial": the
underlying Polylogue facade calls stayed live and independently tested
through the cutover; only MCP dispatch wiring was missing.

What changed (polylogue/mcp/server_cutover.py):
- query(projection=...) gains 7 personal-state projections (marks,
  annotations, saved_views, recall_packs, workspaces, corrections,
  blackboard), each a thin dispatch onto the existing list_* facade call +
  page_items + existing typed payload class.
- query(projection=...) gains postmortem/pathologies (reusing
  build_session_query_request's filter scaffolding, dropping the MCP
  default page limit before handing the spec to the 200-session analysis
  cap, mirroring the retired get_postmortem_bundle/get_pathologies tools'
  own replace(spec, limit=None) trick) plus abandoned_sessions/
  stuck_sessions (no overlap found with postmortem/pathologies, so kept as
  separate thin projections per the plan's fallback).
- status(scope="sources") wires the existing named-source-freshness handler
  through the already-unused ref parameter; status(scope="embeddings") wires
  embedding_status_payload via a small _EmbeddingStatusEnv config adapter.

Verification:
- devtools test tests/unit/mcp/ -- 182 passed (16 new, in
  test_query_gap_projections.py).
- devtools verify --quick -- green (format/lint/mypy --strict/render-all).
- Live read-only smoke pass (POLYLOGUE_ARCHIVE_ROOT=~/.local/share/polylogue
  via sinnix-scope background) against the real 18k-session archive: all 12
  new projections/scopes returned valid payloads with no errors --
  postmortem/pathologies matched 153 sessions over 7d, abandoned_sessions
  found 74, status(scope=embeddings) reported real catch-up state.

Ref polylogue-t46.8.2
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 11 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 195a9107-90dd-4f54-93da-46bde1fcbbe6

📥 Commits

Reviewing files that changed from the base of the PR and between 5ad26b2 and 8c1d9da.

📒 Files selected for processing (2)
  • polylogue/mcp/server_cutover.py
  • tests/unit/mcp/test_query_gap_projections.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/mcp/close-read-capability-gaps

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.

@Sinity
Sinity merged commit 7c16125 into master Jul 18, 2026
3 checks passed
@Sinity
Sinity deleted the feature/mcp/close-read-capability-gaps branch July 18, 2026 21:52
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