Skip to content

mcp: algorithm_spec failed-plan next still says agentdescent plan --probe, not plan(spec, probe=true) #1305

Done

Description

@Birfy

What happens

On tip f0edb1e (after #1304), a successful MCP algorithm_spec already rewrites next into host tool language (#1296 / #1298):

next: show the user this estimate; after their yes, call plan with `spec` and probe=true; if that refuses, follow its next and do not start; otherwise call start with `spec` and max_calls=N

When the written spec then fails to plan (missing cases path, plan refusal, and the other algorithms_run_payload failure paths that still return next), algorithm_spec leaves the CLI retry untouched:

next: agentdescent plan <spec_path> --probe

That string was added for the CLI in #1299, and tests/test_mcp_algorithm_spec.py currently pins it. A host that followed the success-path next would call the plan tool; a host that followed this failed-path next is told to run a CLI verb it may not have, and is not told to call plan(..., probe=true).

This is the same leftover-surface class as #1296 / #1299 / #1303, now for the failure path of MCP algorithm_spec.

Repro

Fresh clone of ThinkFlowLab/agentdescent at f0edb1e. pip install -e ".[mcp]". Isolated AGENTDESCENT_HOME. No network is required: the plan fails because the cases file is missing.

from agentdescent.mcp import Tools

r = Tools(None).algorithm_spec(
    "gepa", "/path/to/prompt.md", "/path/to/missing.jsonl",
    model="deepseek-v4-flash",
    base_url="https://example.invalid/v1",
)
# r["ok"] is False, r["spec_path"] exists, error names `cases`
# r["next"] == "agentdescent plan <spec_path> --probe"

By contrast, the same tool's success path already returns an MCP plan(..., probe=true) next, not a CLI command.

Expected

  • When MCP algorithm_spec writes a spec but planning fails, next should name a fix of the written spec and then plan(..., probe=true) in tool language, for example: fix the written spec, then call plan with that spec and probe=true; if that refuses, follow its next and do not start. It must not say agentdescent plan or evolve / start.
  • The CLI algorithms run failed-plan next stays agentdescent plan <spec> --probe (text form still next: fix <spec>, then ...). A successful algorithm_spec next, MCP plan, and CLI plan / algorithms run --probe next lines are unchanged.
  • No model name is guessed. The tool still does not start a run or probe.

Suggested fix

  • In agentdescent/mcp.py (algorithm_spec), after the CLI helper returns, rewrite a failed-plan next that starts with agentdescent plan into the MCP repair sentence above. Do not change algorithms_run_payload (that string is still correct for the CLI).
  • Pin this in tests/test_mcp_algorithm_spec.py (replace the current cli: algorithms run failed-plan next still says plan <spec>, omitting --probe #1299 pin on the MCP path).
  • Mention the failed-plan next in the algorithm_spec tool description.
  • changelog.d/<n>-mcp-algorithm-spec-failed-next.md.

Acceptance

  • MCP algorithm_spec that writes a spec and then fails to plan returns ok: false and a next that names fixing the written spec and plan(..., probe=true), with no agentdescent plan and no start / evolve.
  • A successful algorithm_spec still names plan(spec, probe=true) and then the capped start.
  • CLI algorithms run failed-plan JSON next is still agentdescent plan <spec> --probe.
  • pytest -q -o addopts='' tests/test_mcp_algorithm_spec.py tests/test_mcp_algorithm_spec_default_out.py tests/test_mcp_algorithm_spec_target_dir.py tests/test_mcp_plan_probe.py tests/test_cli_algorithms_run.py tests/test_mcp.py passes, including the new pins.

Activity

  1. added
    bug
    area:plugins
    area:cli
    on Nov 28, 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