Skip to content

mcp: algorithm_spec next tells the host to start without plan(probe=true) or max_calls #1296

Done

Description

@Birfy

What happens

On tip 23b1b1eb (0.11.0, after #1294), the MCP form of algorithms run tells a host to start a paid run without a probe and without a per-call cap.

agentdescent algorithms run NAME PATH CASES --model … --base-url … already plans and then prints:

next: agentdescent plan <spec> --probe, then agentdescent evolve <spec> --max-calls 19

MCP algorithm_spec is documented as the same verb. After a successful call it returns the estimate (agent_calls_upper_bound: 19 on the same 12-case, 1×1 trial) but its next is:

show the user this estimate; after their yes, call start with `spec`

There is no plan(spec, probe=true) step, and start is not told to pass max_calls from that estimate. A host that follows the tool's own next — rather than the skill / slash-command prose — will start the run unprobed and uncapped. SKILL.md and the Claude/Codex/OpenCode algorithms.md / evolve.md commands already say the opposite: run plan with probe=true, do not start if it refuses, and pass max_calls.

A related gap on the same Path A surface: MCP plan(spec) with the default probe=false returns ok: true and no next field at all. The CLI counterpart, a bare agentdescent plan <spec>, does name plan --probe, then evolve --max-calls N. So the MCP plan/start path does not carry the preflight and cap that #1218 put on the CLI plan next line.

This is the same leftover-surface class as #1201 / #1228 / #1217, now for algorithm_spec.next (and the silent MCP plan success).

Repro

Fresh clone of ThinkFlowLab/agentdescent at 23b1b1eb. pip install -e ".[mcp]". Isolated AGENTDESCENT_HOME. Same 12-case text fixture as demo --kind text.

CLI control (works):

agentdescent algorithms run gepa ./prompt.txt ./cases.jsonl \
  --model deepseek-v4-flash \
  --base-url https://ark.cn-beijing.volces.com/api/coding/v3 \
  --rounds 1 --workers 1 --out spec.json --json
# "next": "agentdescent plan …/spec.json --probe, then agentdescent evolve …/spec.json --max-calls 19"

MCP (measured with a stdio Path A client):

algorithm_spec({
  name: "gepa",
  path: "<abs>/prompt.txt",
  cases: "<abs>/cases.jsonl",
  model: "deepseek-v4-flash",
  base_url: "https://ark.cn-beijing.volces.com/api/coding/v3",
  rounds: 1,
  workers: 1
})
# ok: true
# estimate.agent_calls_upper_bound: 19
# next: "show the user this estimate; after their yes, call start with `spec`"
# no ready, no probe, no max_calls in next

plan({spec})                # probe omitted / false
# ok: true, no "next" key, no ready

plan({spec, probe: true})   # only if a live key is present; a refusal is already correct
# ok: false, ready: false, next: <repair>

The success next is hardcoded in agentdescent/mcp.py (algorithm_spec):

result["next"] = ("show the user this estimate; after their yes, call "
                  "start with `spec`")

Expected

  • A successful algorithm_spec should tell the host the same two first-run steps the CLI already prints: show the estimate; after yes, plan(spec, probe=true); if that refuses, follow its next and do not start; otherwise start with spec and max_calls equal to estimate.agent_calls_upper_bound (or a smaller trial cap).
  • A successful MCP plan with probe=false should carry a next that names plan(spec, probe=true) and a capped start, matching the CLI plan next line. A refused probe is already ok: false / ready: false / repair next — leave that contract alone.
  • No model name is guessed. algorithm_spec still does not have to probe itself (same as CLI algorithms run without --probe).

Suggested fix

  • Change the algorithm_spec success next in agentdescent/mcp.py to name plan(..., probe=true) and start(..., max_calls=<upper bound>).
  • Give a successful MCP plan (no probe) a next in the same shape, so a host that called plan directly is not left without a next step.
  • Extend the MCP / first-run tests that pin algorithm_spec / plan payloads.
  • changelog.d/<n>-mcp-algorithm-spec-next.md.

No change to the probe-refusal contract (ok: false, ready: false). No change to the placeholder-refusal behaviour of init / algorithms run / plan.

Acceptance

  • MCP algorithm_spec on a plan-ready target returns a next that includes plan with probe=true and start with max_calls (the estimate's agent_calls_upper_bound, or a clearly marked placeholder only if no estimate exists).
  • MCP plan(spec) without probe returns a next that names a probe and a capped start.
  • A refused plan(..., probe=true) is still ok: false / ready: false with a repair next, not start.
  • CLI algorithms run --json is unchanged (plan --probe, then evolve --max-calls N).
  • Tests pin the new strings.

Activity

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