Skip to content

mcp: diagnose recommendations still name CLI show / apply / watch / doctor #1311

Done

Description

@Birfy

What happens

On tip c5de2343 (after #1310), MCP demo / plan / algorithm_spec already rewrite host-facing next into Path A tool language. MCP diagnose still returns the shared diagnose_payload recommendations untouched, so a host is told to run CLI verbs it may not have.

After MCP diagnose on a solved run, recommendations include:

review the diff: `agentdescent show <run_id>`
preview the write: `agentdescent apply <run_id> --dry-run`, then rerun it without --dry-run

Other verdicts leak the same way:

  • cancelled: agentdescent resume <run_id>
  • running: agentdescent watch <run_id>, then agentdescent diagnose <run_id> — and Path A has no watch tool (the host should poll status, then call diagnose when it ends)
  • run-failed (no log): agentdescent show <run_id>; a generic failure also says run \agentdescent doctor` before retrying`
  • reflector-error: (\agentdescent doctor`)`
  • partial-improvement: agentdescent show <run_id> --json
  • unknown: run \show --json``

This is the same leftover-surface class as #1307 / #1309, now for diagnose recommendations. The CLI diagnose / diagnose --json wording stays correct for an operator who has the CLI.

Repro

Fresh clone of ThinkFlowLab/agentdescent at c5de2343c6956cd909b6708d742e8b758ef3442d. pip install -e ".[mcp]". No provider key is required; show_payload can be stubbed.

from agentdescent.mcp import Tools
from agentdescent.diagnose import diagnose_payload

# Tools.diagnose currently returns diagnose_payload(...).to_dict() unchanged
r = Tools(store).diagnose(run_id)
# solved: "agentdescent show" / "agentdescent apply … --dry-run" in r["recommendations"]
# running: "agentdescent watch" in r["recommendations"]
# CLI diagnose --json still names those same CLI verbs, which is intended

By contrast, MCP demo already says call show with this run_id and call apply with this run_id and dry_run=true, not agentdescent show / apply --dry-run.

Expected

  • After MCP diagnose, recommendations name Path A tools (show, apply with dry_run=true, resume, status, doctor, plan, diagnose), not agentdescent … CLI verbs, and not --dry-run / watch.
  • A still-running run's recommendations tell the host to poll status, then call diagnose when it ends. They must not name watch.
  • Verdict, summary, and evidence stay the same as the shared payload. run_id may still be latest / last on the way in; recommendations that need an id use the resolved one, as today, without echoing latest.
  • The CLI diagnose / diagnose --json recommendations stay on the CLI verbs (agentdescent show, apply --dry-run, resume, watch, doctor).
  • No model name is guessed. The tool still does not start, apply, or resume a run by itself.

Suggested fix

  • In agentdescent/mcp.py (Tools.diagnose), after diagnose_payload(…).to_dict(), rewrite recommendations into the tool language above. Do not change diagnose.py (those strings are still correct for the CLI).
  • Mention the tool-language recommendations in the diagnose tool description.
  • Pin this in a focused MCP test (keep the CLI pins in tests/test_diagnose.py).
  • changelog.d/<n>-mcp-diagnose-recommendations.md.

Acceptance

  • MCP diagnose on a solved stub returns recommendations that name show and apply with dry_run=true, with no agentdescent and no --dry-run.
  • MCP diagnose on a running stub names status and diagnose, not watch.
  • MCP diagnose on cancelled / run-failed / reflector-error / partial-improvement / unknown stubs names the matching Path A tools (resume, show, doctor, plan) and contains no agentdescent CLI verbs.
  • CLI diagnose --json still uses agentdescent show / apply --dry-run / resume / watch / doctor.
  • pytest -q -o addopts='' tests/test_mcp_diagnose.py tests/test_diagnose.py tests/test_mcp.py passes, including the new pins.

Activity

  1. added
    bug
    area:plugins
    area:cli
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:pluginsbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions