Repository navigation
Description
Problem
devops devcontainer bootstrap-k8s has never deployed a stack. _auto_deploy_k8s_stack (src/devops_cli/commands/devcontainer.py:960-972) runs ["devops", "k8s", "deploy-stack", stack] (:964). devops k8s deploy-stack takes no positional argument; the stack is the --stack/-s option (src/devops_cli/commands/k8s/stack_lifecycle.py:695-726, option at :697). The call fails with "unexpected extra argument", exit 2. The line came in with 491907c (v0.2.0), and deploy_stack took the stack only as --stack then too.
The failure is easy to miss:
- The call runs with
check=False, quiet=True(devcontainer.py:966-967), andrun_subprocesscaptures output by default (core/process.py:224). The captured output is thrown away. The warning says onlyFailed to auto-deploy Kubernetes stack '<stack>'(devcontainer.py:971), with no exit status, and deploy-stack's usage error never reaches the terminal or the background log. bootstrap-k8sdeploys by default (--deploy/--no-deploy,devcontainer.py:1664-1666).- This repo's devcontainer sets
DEVOPS_K8S_AUTO_DEPLOY=true(.devcontainer/devcontainer.json:44). So everypost-startwith Minikube autostart spawnsbootstrap-k8s --stack infra --deployin the background (devcontainer.py:1146-1155,:1016-1024), and its deploy step fails inside/tmp/devops-k8s-bootstrap.log. - The test for this path,
test_bootstrap_k8s_autodeploy_k8s_stack(tests/test_devcontainer.py:792-820), patchesrun_subprocessto succeed for any argv and uses the stackobservability, whichdeploy-stackrejects (commands/k8s/networking.py:59-72). It then asserts the mock's success message.
The same broken command is printed as a tip when Qdrant is unreachable: 'devops k8s deploy-stack llm'. It appears in lang/en/messages.py:589-592 (read by commands/rag.py:167), again inline in commands/rag.py:261-262, and in lang/en/errors.py:220 (ERRORS.rag.cannot_connect, which nothing reads). #920 and #921 fix the same mistake, but only in Markdown.
The static check has a gap. #836 added resolve_devops_argv (src/devops_cli/docs/command_resolver.py) and an AST collector (src/devops_cli/docs/mcp_argv_collector.py), and devops docs check runs both (docs/generator.py:1078-1087). The collector has two limits:
- It reads only the MCP server (
collect_mcp_server_argv_references,mcp_argv_collector.py:64-74). - It collects only lists that start with
uv run devops(_is_devops_argv,:118-121;CONST_DEVOPS_ARGV_PREFIX,config/constants.py:118).
So nothing checks 8 other argv lists in src/devops_cli:
- 4
uv run devops docs …lists incommands/ci.py(:361,:445,:1022,:1024); uv run devops ci runincommands/release.py:1287;- 3 bare
["devops", …]lists, atcommands/devcontainer.py:964,:1016andcore/cli.py:132.
docs/ROADMAP.md:766 records the bare case as #836's follow-up.
Reading more files is not enough on its own. Measured on the release/v0.2.25 tip (9c879ae): with all 174 lists collected (166 in the server, 8 elsewhere), the current resolver reports 0, the broken line included. The resolver reports only literal leftover arguments, because a computed token left over "may be an option the caller computes" (command_resolver.py:78-82; _unexpected_argument, :169-177). stack at :964 is computed, so it is skipped. A planted literal ["devops", "k8s", "deploy-stack", "infra"] is reported (unexpected extra argument 'infra' for 'devops k8s deploy-stack'), but the real bug is not.
A stricter rule was measured on the same tree: report a computed single token left over where the command takes no more positional arguments, after splitting a conditional between two string literals into both alternatives. It reports exactly 2 of the 174 lists:
devcontainer.py:964, the bug;ai/mcp/server.py:604(config_output), whose option comes from a localflag = "--json" if … else "--export"(:603). With the conditional written inline, both alternatives resolve.
ai_gateway_failover (server.py:2671-2682, conditional at :2679) already passes an inline conditional, and both --simulate and --no-simulate resolve.
Cost, on this host under load:
- Parsing every module under
src/devops_cli(501 files) took 2.8-4.1 s. - Collecting only from files that contain a
"devops"string literal (16 files, all 5 files with argv lists among them, the server included) took 0.35-0.58 s.
Acceptance criteria
Call site:
-
_auto_deploy_k8s_stackruns["devops", "k8s", "deploy-stack", "--stack", stack]. A test withrun_subprocesspatched asserts the exact argv["devops", "k8s", "deploy-stack", "--stack", "infra"]. -
_auto_deploy_k8s_stackruns deploy-stack withcapture_output=False, asrelease.py:1289does fordevops ci run. deploy-stack's own output then goes to the terminal whenbootstrap-k8sruns in the foreground, and to/tmp/devops-k8s-bootstrap.logwhen it runs in the background, because the background worker's stdout and stderr are that log (devcontainer.py:1036-1042). The call site parses none of that output. - On a non-zero exit, the warning names the stack and the exit status, for example
Warning: Failed to auto-deploy Kubernetes stack 'infra' (exit 2). It quotes no text from deploy-stack. A test patchesrun_subprocessto return exit 2 with the real stderr shape: the Typer usage panel (│ Got unexpected extra argument(s) (infra) │inside╭─ Error ─╮ … ╰─╯) followed byElapsed: 0.5s. It asserts that the call passedcapture_output=False, that the warning contains'infra'andexit 2, and that the warning contains neitherElapsednor╰. -
test_bootstrap_k8s_autodeploy_k8s_stackuses a stack thatdeploy-stackaccepts, and asserts the argv it ran, not only the mock's success. - The Qdrant tip reads
devops k8s deploy-stack --stack llmand lives in one string.commands/rag.py:261-262usesMESSAGES.rag.cannot_connect_qdrant, and the unreadERRORS.rag.cannot_connect(lang/en/errors.py:220) is deleted. A test passes the command quoted in the tip toresolve_devops_argvand gets no finding.
Static check:
- The collector reads every module under
src/devops_cli. It collects list literals that start with"devops"and lists that start with"uv", "run", "devops", anddevops docs checkresolves every one. A file with no"devops"string literal is skipped without being parsed. - A computed single token (a list element, or the argument of
.append) that is left over where the command takes no more positional arguments is reported as an unexpected argument. A starred element, or.extendof a non-literal, still stands for any number of tokens and is not reported. A conditional between two string literals is resolved once for each alternative. Other callers ofresolve_devops_argv(fix(ai): the knowledge base names only commands, options and components that exist #920, fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861) see no change in behaviour. - Fixture tests:
["devops", "k8s", "deploy-stack", "infra"]and["devops", "k8s", "deploy-stack", stack]are each reported at their fixture line.["devops", "k8s", "deploy-stack", "--stack", stack], a list ending in*args, andcmd.extend(flags)are not reported.- A conditional where one alternative is an unknown option is reported, naming that option.
-
devops docs checkexits 1 and names<path>:<line>when the collector returns the broken fixture line. This follows the pattern oftest_docs_check_reports_an_unresolved_mcp_argv(tests/test_docs_mcp_argv_collector.py:157). - A test over all of
srcreplacestest_every_mcp_server_argv_resolves(tests/test_docs_mcp_argv_collector.py:129-155). With the fixes above in, it collects at least 174 lists from at least 5 files and reports none.config_outputwrites its conditional inline in the argv (ai/mcp/server.py:603-605). - Neither the resolver nor the collector runs a command or starts a process. The test over all of
srckeeps thesubprocess.Popenand_run_mcp_cmdguards. - The added collection costs at most 1 s in the gate. The task file records the measurement.
- The names that say "MCP server" are replaced, with no alias left behind: the module,
collect_mcp_server_argv_references,check_mcp_server_argvandCONST_DEVOPS_ARGV_PREFIX. The collector's docstring states the branch-blind rule and the single-token rule.
Delivery:
-
changelog.d/868.mdholds the### Fixedentries.CHANGELOG.mdanddocs/ROADMAP.mdare not edited. - Every test runs offline.
uv run devops cipasses. - Pending a person: in the devcontainer with Minikube running, run
devops devcontainer bootstrap-k8s --stack infra --deploy. deploy-stack'sInstalling …lines appear in the terminal, it printsAuto-deployed Kubernetes stack 'infra', andhelm list -Ashows the infra releases. - Pending a person: in the same devcontainer, run
devops devcontainer bootstrap-k8s --stack observability --deploy. The terminal shows deploy-stack'sInvalid stack: 'observability'. Supported stacks: infra, llm, logging, allline, then a warning naming'observability'andexit 1.
Key questions
-
Should argv built across branches be followed? (proposed) No. The collector stays branch-blind, as fix(mcp): mcp tools and resources call commands and options that exist #836's is (
mcp_argv_collector.py:50-56). A false positive from appends in branches that exclude each other is acceptable, and the docstring states the limit. The one such list insrctoday,devcontainer.py:1016-1024, reads as… --stack <stack> --deploy --no-deploy, which resolves. -
Should a computed token be reported where the command takes no positional argument? (proposed) Yes, for a single token only, with conditionals between literals split into their alternatives. Without this rule, the widened check would still pass the bug that prompted this item. Measured on today's tree, the rule adds one false positive, and inlining the conditional at
server.py:603-605removes it. From then on, an option name in an argv list must be a literal or a conditional between literals. This changes fix(mcp): mcp tools and resources call commands and options that exist #836's documented rule (command_resolver.py:80-81), which is why the owner should confirm it. Without the rule, the call-site argv test is the only guard for this bug. -
Should the collector follow a local name bound to a conditional, as in
config_output? (proposed) No. There is one such case; inline it instead. -
Do the Qdrant tips belong in this item? (proposed) Yes. They print the same broken command from
src, and neither fix(ai): the knowledge base names only commands, options and components that exist #920 nor docs: hand-written docs name only commands, options and components that exist #921 covers Python strings. -
Should the warning quote deploy-stack's stderr? (proposed) No. Leave the output uncaptured instead. The last line of a captured
devopsstderr is never the error:main.pyregisters_print_elapsedwith atexit (main.py:22-30), and it printsElapsed: …to stderr whenever the root callback has set_timing["start"](main.py:212), which happens before any subcommand parses its arguments. Measured on 9c879ae by running the real entry point with output captured, as_auto_deploy_k8s_stackdoes:devops k8s deploy-stack infra(today's call) exits 2. Its stderr is the Typer usage panel,│ Got unexpected extra argument(s) (infra) │between box-drawing borders, followed byElapsed: 1.13s.devops k8s deploy-stack --stack observabilityexits 1. Its stderr isInvalid stack: 'observability'. Supported stacks: infra, llm, logging, allfollowed byElapsed: 1.35s.
Stripping the footer and the panel borders would be fragile. The panel wraps long messages over several lines, and a Helm failure prints many lines (
stack_lifecycle.py:623-625). Uncaptured output also shows the deploy's progress during a run that can take minutes (--waitis the default, with--timeout 10m,stack_lifecycle.py:701-711). The output in the log is what deploy-stack prints when a person runs it by hand. This call site adds nothing to it, so it needs no masking of its own. -
Should
bootstrap-k8s --stackreject a stackdeploy-stackwould reject? (proposed) No, not in this item. With the output uncaptured, the background log carries deploy-stack's ownInvalid stack: '<stack>'. Supported stacks: infra, llm, logging, allline, followed by the warning that names the stack and exit 1. -
Are tests, workflows and Markdown in scope? (proposed) No. Test fixtures hold broken argv on purpose. Workflows and pre-commit entries are item (3) of fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861. Markdown belongs to fix(ai): the knowledge base names only commands, options and components that exist #920 and docs: hand-written docs name only commands, options and components that exist #921.
-
Should tuples be collected too? (proposed) No. Every argv in
srcis a list. The only matching tuple is the prefix constant (config/constants.py:118). -
Is this a critical fix? (proposed) No. It is a P1 defect in v0.2.29, and nothing in v0.2.25 to v0.2.28 waits on it.
Depends on: #836 (closed; delivered in v0.2.24 by #867). No open dependency. The item can start at any point in v0.2.29.
Related:
- fix(ai): the knowledge base names only commands, options and components that exist #920 (v0.2.27) and docs: hand-written docs name only commands, options and components that exist #921 (v0.2.28) fix
deploy-stack monitoring|gitops|tracingin the knowledge base and the hand-written docs, and resolve commands withresolve_devops_argv. fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861 (v0.2.28) item (3) resolves thedevopsinvocations in workflows with the same resolver. All three land first, so the single-token rule must leave their results unchanged. - refactor(ci): github ci runs the gate through
devops cifrom one check table #843 (v0.2.26) and fix(ci):devops cichecks run for real under their own--dry-run#885 (v0.2.27) changecommands/ci.py. fix(security): the mcp telemetry_profile tool runs any program an mcp client names #980 (v0.2.25), fix(ai): mcp command tools return the failing output and never write to the protocol stream #839 and feat(mcp): mcp tools declare ToolAnnotations, and mutating tools require approval in devops-cli's own agent loop #857 (v0.2.28) changeai/mcp/server.py. Re-count the lists after rebasing onto them. - fix(k8s): deploy-stack applies the monitoring namespace perimeter #913 and fix(k8s): deploy-stack applies the llm gateway policy and narrows its egress #795 (v0.2.29) change what
deploy-stackapplies, not its options.
Update 2026-10-08
Owner's scope decision. The auto-deploy argv fix already shipped in v0.2.26 with #741. _auto_deploy_k8s_stack runs ["devops", "k8s", "deploy-stack", "--stack", stack] (commands/devcontainer.py:970), and tests/test_devcontainer.py:2014-2040 asserts that argv. This item now delivers only the docs-check half and the Qdrant tip. _auto_deploy_k8s_stack, its warning and its tests stay as they are. Post-start auto-deploy moves to the owner-decision issue #1368: making deploy-stack's output and exit status visible would not make it deploy (premise 5 below).
Reduced acceptance criteria. These replace the "Call site" and "Static check" lists above:
- The collector reads every module under
src/devops_cli. It collects list literals that start with"devops"or with"uv", "run", "devops", anddevops docs checkresolves every one. A module with no quoteddevopsliteral is skipped without being parsed. - A computed single token left over where the command takes no more positional arguments is reported as an unexpected argument. That covers a list element or the argument of
.append. A starred element, or.extendof a non-literal, still stands for any number of tokens and is not reported. The marker is opt-in, so the Markdown collectors (fix(ai): the knowledge base names only commands, options and components that exist #920, docs: hand-written docs name only commands, options and components that exist #921) andtests/markdown_examples.py(docs(review): SELF_IMPROVEMENT, AGENTS.md and the knowledge base describe the review loop as it runs #952) see no change. - A conditional between string literals, or between such conditionals (nested), is resolved once per alternative, and each list is reported at most once.
-
roadmap_refineandroadmap_intakewrite--repo,--ref,--titleand--sourceas literals. Each is validated with_validate_mcp_arg, and the argv order is unchanged.roadmap_intake's mode flag is a nested conditional between the three literal flags.config_outputwrites its conditional inline._roadmap_cmdis unchanged. - Fixture tests:
["devops", "k8s", "deploy-stack", "infra"]and["devops", "k8s", "deploy-stack", stack](as an element and as an append) are reported at their lines.--stack stack, a*argstail andcmd.extend(flags)are not reported.- A conditional with an unknown option is reported, naming that option, and a nested literal conditional resolves each alternative.
-
devops docs checkexits 1 and names<path>:<line>for a broken collected line, with the Markdown checks patched so the call stays under 1 s. - A test over all of
srcreplacestest_every_mcp_server_argv_resolves. It finds at least 174 lists from at least 5 files and reports none. Command trees are built in a module-scoped fixture. - Neither the resolver nor the collector runs a command; the
subprocess.Popenand_run_mcp_cmdguards stay. - The added collection costs at most 1 s in the gate, and the task file records the measurement.
- The names that say "MCP server" are replaced with no alias left behind: the module,
collect_mcp_server_argv_references,check_mcp_server_argv,CONST_DEVOPS_ARGV_PREFIXand the now-unusedCONST_MCP_SERVER_MODULE. The collector's docstring states the branch-blind rule and the single-token rule. - The Qdrant tip reads
devops k8s deploy-stack --stack llmin oneMESSAGESstring.commands/rag.pyuses it on both paths,ERRORS.rag.cannot_connectis deleted, and the quoted command resolves withresolve_devops_argv. -
changelog.d/868.mdholds the### Fixedentries.CHANGELOG.mdanddocs/ROADMAP.mdare not edited. - Every test runs offline with each call phase under 1 s, and
uv run devops cipasses.
Moved to #1368: running deploy-stack with capture_output=False, the exit status in the warning, the observability stack in test_bootstrap_k8s_autodeploy_k8s_stack and test_post_start_autodeploy_k8s_stack, and both "Pending a person" bootstrap-k8s checks.
Corrected premises (checked on release/v0.2.29 at 910b823):
-
The argv half is done (feat(k8s): devops-cli runs in the homelab cluster as Jobs, and every cluster Secret is pushed from the keyring, also by deploy-stack (devops k8s push-secrets, devops k8s run-job) #741, above). The failure warning is now
MESSAGES.devcontainer.auto_deploy_failed(lang/en/messages.py:895-898) and carries a keyring unlock hint. -
Today the single-token rule reports 3 lists, not 1. They are
config_output(ai/mcp/server.py:645-647), plusroadmap_refine(:800-804) androadmap_intake(:833-843), which were added in v0.2.26 and builtf"--{name}"andf"--{mode}"option names. With the rewrites above, it reports 0 of 179. -
Counts: there are 179 argv lists in 5 files (172 in the server, 3 in
commands/ci.py, 2 incommands/devcontainer.py, and 1 each incommands/release.pyandcore/cli.py). The resolver before this change reported 0 of them. The prefilter leaves 24 of 545 modules to parse. -
Collection cost, measured in-process over seven interleaved runs at load average 10 to 12: the MCP-only collector took a median of 0.10 s, and the collector over all of src a median of 0.52 s, so about 0.4 s is added.
-
Making deploy-stack's output visible would not make auto-deploy work:
run_subprocess's isolated env dropsDBUS_SESSION_BUS_ADDRESS, so the child gets the fail keyring backend even when the keyring is unlocked.- No
--contextis passed, so deploy-stack uses the configuredk8s.context, not necessarily the Minikube thatbootstrap-k8sstarts. Post-start spawns the bootstrap by default only when that context isminikube, but a hand-runbootstrap-k8s --deployor the autostart env override deploys to whatever context is configured, including an Argo-managed one. - Post-start spawns the bootstrap before it starts the session bus, while the keyring is normally locked.
Details and options are in fix(cli): devcontainer auto-deploy reaches the keyring and the Minikube it started, or is dropped for a printed deploy-stack command #1368.
-
Updated line references: the Qdrant tip is at
lang/en/messages.py:701-704,commands/rag.py:264-266andlang/en/errors.py:237.ai_gateway_failover's inline conditional is atai/mcp/server.py:2864.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 2, 2026
Grooming (2026-10-02): Priority p2-medium → p1-high.
devops devcontainer bootstrap-k8sdefaults to --deploy, and its deploy step has failed every time since v0.2.0 behind a warning. A command that never does half its job counts as broken under policy.Checked against the code at the release/v0.2.25 tip.
dan-petty commentedon Oct 2, 2026
Placed in v0.2.29 on 2026-10-02. v0.2.29 holds P1 work that has to land before v0.3.0, which v0.2.25 to v0.2.28 had no room for. Backlog P1 items were ranked by Value, then Effort, with defects and security fixes first at a tie. This item ranked in the top ten, and two of the release's twelve slots stay open for P1 items that surface before then.
dan-petty commentedon Oct 2, 2026
Refined to Ready on 2026-10-02 for v0.2.29. The body was checked claim by claim against release/v0.2.25 at 9c879ae, and a second agent then tried to refute it; every major objection was resolved in a revision. Cited lines were updated for code that moved, and the scope was corrected where merged work changed it. Acceptance criteria were tightened so each fails on the current code, and every key question now has a proposed answer.
[-]fix(cli): devcontainer auto-deploy calls deploy-stack without --stack, and docs check resolves every devops argv in src[/-][+]fix(cli): docs check resolves every devops argv in src[/+]fix(cli): docs check resolves every devops argv in src (#868) (#1370)
dan-petty-bot commentedon Oct 8, 2026
What changed
#1370, merged into
release/v0.2.29as cc13995.19 file(s) changed.
How it was verified
Check runs at ef3185c:
Acceptance Criteria of
docs/agent/tasks/task-868-docs-check-resolves-every-devops-argv.md:src/devops_cliand collects lists that start withdevopsor withuv run devops.devops docs checkresolves each one.test_a_module_without_a_quoted_devops_is_not_parsedshows that a module that only importsdevops_cliis not parsed (ast.parsecalled twice for three modules)..appendargument, left over where the command takes no more arguments is reported. A starred element or an.extendof a runtime value is not. A conditional between literals is resolved once per alternative, nested conditionals included.test_a_single_token_placeholder_is_reported_only_when_left_overcovers the resolver.test_a_placeholder_for_any_number_of_tokens_is_never_reportedand the unchangedtests/test_docs_knowledge_base_argv.py,tests/test_docs_review_loop.pyandtests/test_docs_command_resolver.pyresults show that other callers see no change.test_argv_lists_and_everything_added_to_them_are_collected,test_unresolved_fixture_argv_are_reported_with_their_source_line) reportdevops k8s deploy-stack infraanddevops k8s deploy-stack <stack>, element and append, at their lines. They do not report--stack <stack>, a list ending in*args, orcmd.extend(flags). A conditional with the unknown--yamlis reported and names it, and every alternative of a nested conditional resolves.devops docs checkexits 1 and namesfixture.py:43when the collector returns the broken fixture line (test_docs_check_reports_an_unresolved_source_argv). The Markdown checks are patched, so the call phase stays under 1 s.test_the_collector_reads_every_module_and_both_prefixesandtest_every_devops_argv_in_src_resolvesreplacetest_every_mcp_server_argv_resolves. They find at least 174 lists (179 today) inai/mcp/server.py,commands/ci.py,commands/devcontainer.py,commands/release.pyandcore/cli.py, and report none. The inlineconfig_outputconditional is collected as a choice.src_referencesfixture collects withsubprocess.Popenand_run_mcp_cmdpatched to raise, and the resolve test asserts that neither was called. The command trees are built in a module-scoped fixture, so each call phase stays under 1 s.collect_mcp_server_argv_references,check_mcp_server_argv,CONST_DEVOPS_ARGV_PREFIXand the now-unusedCONST_MCP_SERVER_MODULE. The collector's docstring states the branch-blind and single-token rules.roadmap_refineandroadmap_intakekeep their argv order:test_roadmap_refine_contract_and_argv, the newtest_roadmap_intake_argv_keeps_its_order_and_writes_only_on_confirm, and the in-processtests/test_roadmap_intake.pyMCP tests pass.devops k8s deploy-stack --stack llmin one string. Bothragpaths print it, andERRORS.rag.cannot_connectis deleted.test_an_unreachable_qdrant_tip_names_a_deploy_command_the_cli_acceptspasses the quoted command toresolve_devops_argvand getsNone.changelog.d/868.mdholds the### Fixedentries.CHANGELOG.mdanddocs/ROADMAP.mdare not edited.uv run devops cipasses.feat(release): v0.2.29 (#1455)