Skip to content

RT-171/172/183: mcp tools heal-pair repo lookup, daemon error explain - #297

Merged
m4ttheweric merged 5 commits into
mainfrom
mcp-tools
Sep 16, 2026
Merged

m4ttheweric merged 5 commits into
mainfrom
mcp-tools

Conversation

@m4ttheweric

@m4ttheweric m4ttheweric commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator
  • RT-171: resolveRepoIdentity shares reverseLookupByName (lib/repo-name-lookup.ts) with the CLI's tryResolveRepoArg for heal-pair collapse, instead of a name-search duplicated in both places.
  • lib/explain-error.ts: shared daemon-error explainer used by the mcp tools layer.
  • e2e: round-trips gate_ask against the test daemon.
  • skills/rt-chat/SKILL.md: fixes CLI-first residues (verb-table row, viewer note) per the SKILLS-71 follow-up.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • MCP tools now provide clearer explanations for recognized worktree and repository errors, including recovery guidance.
    • Repository lookups support exact identities and report ambiguous or unknown repositories more clearly.
    • Missing gates now return an explicit error.
    • MCP workflows can submit gate requests and verify their open status.
  • Documentation

    • Updated chat tool guidance to explain returned message IDs and how to construct message links. CLI output continues to include the link.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 80 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 3de9373f-29f2-44e5-b80c-54e3a40fcfbb

📥 Commits

Reviewing files that changed from the base of the PR and between 3cdd96f86735eb965acf13f9fcba1f52ab0c9c4f and 63ec360.

📒 Files selected for processing (6)
  • commands/worktree.ts
  • e2e/tests/mcp-serve.test.ts
  • lib/explain-error.ts
  • lib/mcp/__tests__/tools.test.ts
  • lib/mcp/tools.ts
  • skills/rt-chat/SKILL.md

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: cb242e61-4c89-4e90-a1da-b19f03784d91

📥 Commits

Reviewing files that changed from the base of the PR and between facced7 and 3cdd96f86735eb965acf13f9fcba1f52ab0c9c4f.

📒 Files selected for processing (6)
  • commands/worktree.ts
  • e2e/tests/mcp-serve.test.ts
  • lib/explain-error.ts
  • lib/mcp/__tests__/tools.test.ts
  • lib/mcp/tools.ts
  • skills/rt-chat/SKILL.md

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


📝 Walkthrough

Walkthrough

The change centralizes worktree error explanation, updates MCP repository and gate handling, expands gate end-to-end coverage, and documents chat_post message-link behavior.

Changes

MCP handling and gate coverage

Layer / File(s) Summary
Shared error formatting
lib/explain-error.ts, commands/worktree.ts, lib/mcp/tools.ts
explainError now lives in a shared module and remains available from commands/worktree.ts. MCP responses format recognized daemon errors through the shared mapper.
Repository and gate handling
lib/mcp/tools.ts, lib/mcp/__tests__/tools.test.ts, e2e/tests/mcp-serve.test.ts
Repository identity resolution preserves exact identities and detects ambiguity. Missing gates return no gate <id>. Tests cover repository deduplication, unknown repositories, gate_ask, and gate_list.

Chat message-link documentation

Layer / File(s) Summary
chat_post return and link guidance
skills/rt-chat/SKILL.md
The documentation states that chat_post returns a message ID and explains how MCP callers construct the message URL. CLI link output remains documented.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant MCPServeE2E
  participant MCPServer
  participant Daemon
  MCPServeE2E->>MCPServer: gate_ask for test:mcp-e2e
  MCPServer->>Daemon: create gate
  Daemon-->>MCPServer: gate ID and subject
  MCPServeE2E->>MCPServer: gate_list with open true
  MCPServer->>Daemon: list open gates
  Daemon-->>MCPServer: created gate
  MCPServer-->>MCPServeE2E: gate appears in list
Loading

Merge Risk: ⚪ Minimal · up to 3cdd9

The updated MCP and documentation paths have no identified actionable merge risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the main changes: MCP tool repository lookup and shared daemon error explanations. It is concise and specific enough for the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mcp-tools

Comment @coderabbitai help to get the list of available commands.

m4ttheweric and others added 5 commits September 16, 2026 14:12
resolveRepoIdentity now reuses reverseLookupByName (the same
heal-pair collapse the CLI's tryResolveRepoArg relies on) instead of
a naive label filter, so a legacy-name/identity pair resolves to one
match instead of reading ambiguous.

fromResponse and mr_map's direct daemon-error returns now run through
explainError (moved to lib/explain-error.ts, shared with
commands/worktree.ts) so a worktree-domain code comes back as prose
instead of bare, decided once for the whole tool roster.

RT-171, RT-172
The mcp-serve e2e's tool round trip only exercised gate_list where
the wave-2 contract named gate_ask, the epic's centerpiece tool, as
the round-trip case. gate_ask had stubbed-client unit coverage only.
Extends the same test to call gate_ask (subject resolution, gate:open
ceremony) and confirms the opened gate shows up in a follow-up
gate_list.

RT-183
The post row in the verb table and the viewer-link paragraph were the
last two spots in this skill still describing rt chat post as CLI-only,
after the rest of the skill was updated to lead with the chat_post/
chat_dm/chat_ack/chat_claim/chat_release tool faces. Names the
chat_post tool alongside the CLI form in both spots, and notes the
tool returns the message id instead of printing a link (the CLI-only
behavior), so the same viewer link can still be built from it.

SKILLS-71 (epic review F6)
fromResponse's generic explainError maps "not-found" to a worktree-trash
message (RT-172's shared explainer), which is wrong-domain for a gate id
that does not exist. gate_answer already special-cases owned-by and
gate-closed; not-found joins them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…fusal

RT-177 (merged to main after this branch forked) refuses a human-owned
gate:ask with no context. This test's gate_ask call had none.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@m4ttheweric
m4ttheweric merged commit 0002393 into main Sep 16, 2026
4 of 5 checks passed
@m4ttheweric
m4ttheweric deleted the mcp-tools branch September 16, 2026 19:32
m4ttheweric added a commit that referenced this pull request Sep 17, 2026
…#297)

* mcp tools: share heal-pair repo lookup, explain daemon errors

resolveRepoIdentity now reuses reverseLookupByName (the same
heal-pair collapse the CLI's tryResolveRepoArg relies on) instead of
a naive label filter, so a legacy-name/identity pair resolves to one
match instead of reading ambiguous.

fromResponse and mr_map's direct daemon-error returns now run through
explainError (moved to lib/explain-error.ts, shared with
commands/worktree.ts) so a worktree-domain code comes back as prose
instead of bare, decided once for the whole tool roster.

RT-171, RT-172

* e2e: round-trip gate_ask against the test daemon

The mcp-serve e2e's tool round trip only exercised gate_list where
the wave-2 contract named gate_ask, the epic's centerpiece tool, as
the round-trip case. gate_ask had stubbed-client unit coverage only.
Extends the same test to call gate_ask (subject resolution, gate:open
ceremony) and confirms the opened gate shows up in a follow-up
gate_list.

RT-183

* skills/rt-chat: fix CLI-first residues (verb-table row, viewer note)

The post row in the verb table and the viewer-link paragraph were the
last two spots in this skill still describing rt chat post as CLI-only,
after the rest of the skill was updated to lead with the chat_post/
chat_dm/chat_ack/chat_claim/chat_release tool faces. Names the
chat_post tool alongside the CLI form in both spots, and notes the
tool returns the message id instead of printing a link (the CLI-only
behavior), so the same viewer link can still be built from it.

SKILLS-71 (epic review F6)

* mcp gate_answer: return a gate-domain message for an unknown gate id

fromResponse's generic explainError maps "not-found" to a worktree-trash
message (RT-172's shared explainer), which is wrong-domain for a gate id
that does not exist. gate_answer already special-cases owned-by and
gate-closed; not-found joins them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* e2e: pass context to gate_ask so the round trip satisfies RT-177's refusal

RT-177 (merged to main after this branch forked) refuses a human-owned
gate:ask with no context. This test's gate_ask call had none.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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