Repository navigation
Closed
Labels
priority/p0-criticalPriority P0: a release blocker or a critical defectscope/mcpModel Context Protocol tools, system resources, and promptstype/bugType bug: the code does not do what it must
Milestone
Description
Context & Rationale
src/devops_cli/ai/mcp/server.py builds 169 argv lists that start with ['uv', 'run', 'devops', ...]. Nothing resolves them against the CLI, and 12 of them fail on every call.
Missing commands (7):
benchmark_embeddings(:2092) andbenchmark_suite(:2119) call a top-leveldevops benchmark. The command isdevops ai benchmark(commands/ai.py:99).ai_architecture(:2144) callsdevops analyze architecture, which has never existed.scan_gitleaks(:1857),scan_semgrep(:1868) andscan_checkov(:1878) call scan aliases. 4cfe033 (v0.2.10, 2026-09-05) removed those aliases, andtests/test_codebase_hygiene_and_shims.py:84-92asserts they are gone. The tools arrived one day later in 22bba04 (v0.2.11), so they have never worked.resource://workspace/status(:1159) callsdevops workspace list.
Unknown options (5):
repos_syncappends--all(:234-236).devops repos synchas never had that option; the call was added in 4e48cd7.resource://argo/fleet/statuspasses--json(:1241).scan_complexitypasses--max-nesting-depth(:1892). The real option is--max-indent(commands/scan.py:420-422).k8s_chaospasses--experiment(:1940).k8s_auditpasses--namespace(:1961).
None of these is a regression: each entry point was broken from the start.
Why nothing caught it:
- A failure comes back as ordinary tool text (
Command exited with status 2: ... No such command,server.py:60-62), not as an MCP error. tests/test_mcp.py:377-401patches_run_mcp_cmdand asserts the mock's own return value.typer.main.get_command(main.app)cannot resolve past the first segment, because the lazy proxies accept extra args (core/cli.py:126-150).
Planning record: docs/ROADMAP.md:1040 (P0, no issue) plans this fix and says to reuse the resolver from docs/ROADMAP.md:908, the Phantom Command, Option and Tool Reference Gate (P1, no issue). Its '3 of 170' count checked only top-level names. #739 does not migrate entries without an issue.
Scope & Deliverables
- Deliverable:
- One resolver function under
src/devops_cli/docs/, behind thedevops docs checkseam, designed asROADMAP.md:908specifies:- walk
resolve_commanddown frommain._COMMAND_SPECSontyper.main.get_commandobjects; - call
make_context(resilient_parsing=False)on the leaf, neverinvoke; - duck-type the vendored Click classes, with negative-control tests that fail if a Typer upgrade changes the walk.
- walk
- An AST collector for
ai/mcp/server.py:- collects list literals starting with
uv run devops, plus literal flags added to the same variable by.appendor.extend; - replaces non-literal elements with placeholders;
- reports only unknown commands, unknown options and unexpected extra arguments.
- collects list literals starting with
devops docs checkruns both.- Fix or delete the 12 entry points:
- benchmark tools: use
devops ai benchmarkwith its real options (--type,--models,--suite); - scan tools: use
devops scan secrets,sastoriac; scan_complexity: use--max-indent;k8s_chaosandk8s_audit: pass only options that exist;- the workspace resource: back it with an existing command, or delete it;
- the argo resource: drop
--json; repos_sync: dropall_repos;ai_architecture: delete it, with no shim.
- benchmark tools: use
- Rewrite the mock pass-through assertions for the changed tools.
- Regenerate
docs/MCP_TOOLS.md, add CHANGELOGRemovedentries, and mark part (1) ofROADMAP.md:1040delivered.
- One resolver function under
- Acceptance criteria:
devops docs checkcovers at least 169 literal argv lists and reports 0 unresolved commands and 0 unknown options.- The fixture argv
uv run devops analyze architectureis reported as unresolved, naminganalyze. - A fixture with an unknown option is reported with its source line.
- No test in
tests/test_mcp.pyasserts a mocked return value for a changed or removed tool. uv run devops docs checkpasses with the regenerateddocs/MCP_TOOLS.md.- The docs stage grows by at most 1 s, recorded in the task file.
- No network access, no subprocess, no new dependency.
- Key questions:
- Should
ai_architecturecome back later, backed by the import graph? (proposed) Only when something needs it. - What happens to the vulture step in
ROADMAP.md:1040? (proposed) It is dropped, and the task file records that. The import-cycle part is a separate item.
- Should
- Constraint:
- The resolver is importable from
src/, so thatROADMAP.md:908(prose references),ROADMAP.md:1058part 3 (workflow invocations) and feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697's workflow-contract test can reuse it instead of writing a second walker. - One PR.
- The resolver is importable from
Strategic Alignment
- Milestone: v0.2.24 if admitted as a critical fix (an owner-set P0 defect fix); otherwise Backlog, ranked first.
- Design: CONTEXT.md (Critical fix)
- Depends on: none
Metadata
Metadata
Assignees
Labels
priority/p0-criticalPriority P0: a release blocker or a critical defectscope/mcpModel Context Protocol tools, system resources, and promptstype/bugType bug: the code does not do what it must
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 1, 2026
Admitted to v0.2.24 as a critical fix, by the owner's decision (2026-10-01): a P0 defect fix. 12 of 169 MCP tools call commands or options that don't exist, and every agent session loads them.
fix(mcp): mcp tools and resources call commands and options that exist (
dan-petty commentedon Oct 1, 2026
Closed by #867, merged into
release/v0.2.24.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.24 (#905)