Repository navigation
Description
Problem Description
devops infra apply does not run the last host of a run of hosts that have no disruptive class. The limit of that run is a comma list of hosts with :!<offline group> at the end. Ansible splits a pattern that has a comma on the commas only, so the last term is <last host>:!offline. That term matches no host. Ansible ignores it with a warning and runs only the other hosts. The !offline exclusion then applies to no host of the run.
Code:
host_patterninsrc/devops_cli/infra/plan.py:164appendsf":!{offline_group}"to the limit._apply_togetherinsrc/devops_cli/infra/apply.py:553gives it",".join(host.host for host in hosts).devops infra plan --limit a,bgoes through the same function (plan.py:592), so a plan with a comma limit has the same problem.- The dry-run text in
src/devops_cli/infra/infra_plans.py:281shows the same pattern.
Ansible source (ansible/inventory/manager.py, split_host_pattern): "If it's got commas in it, we'll treat it as a straightforward comma-separated list of patterns." A colon is a separator only in a pattern with no comma. The Ansible documentation prefers the comma.
Reproduction Steps
- Plan the playbook
ansible/playbooks/02_nvidia.yamlof dan-petty/homelab with--limit gpu_nodes. The group has 4 hosts, and none of them has a disruptive change. - Apply the plan with
devops infra apply. - Read the
commandandstdoutfiles of the runner artifacts of the apply.
Expected vs Actual Behavior
Expected: the run reaches each host of the plan, and never a host of the offline group.
Actual (apply bc18ea1590e2472bb1b59929494e08c3 of plan ac4b4b84017e..., 2026-11-18):
- The command was
ansible-playbook -v -i ansible/inventory/hosts.yaml ... --limit <gpu-node-1>,<gpu-node-2>,<gpu-node-3>,<gpu-node-4>:!offline ansible/playbooks/02_nvidia.yaml. - Ansible said
Could not match supplied host pattern, ignoring: <gpu-node-4>:!offline. - The
PLAY RECAPlists 3 hosts. The apply said that the run did not reach<gpu-node-4>, so that host did not get the change.
Proposed Fix
Make host_pattern use the separator that Ansible reads for the given limit: , when the limit has a comma, else :. This needs no new dependency.
Acceptance Criteria
- A test of
host_pattern("a,b", "offline")gives a pattern in whicha,band!offlineare each one term. It fails onmain(devops ci fail-to-pass). - A test of
host_pattern("gpu_nodes", "offline")keeps a pattern that excludes the offline group. - An apply test with a fake runner: a run together of 2 or more hosts gets a limit in which each host is one term.
- The dry-run text of
infra_plans.pyshows the new pattern.
Logs, Traces, or Terminal Output
Runner artifacts: .data/infra/dan-petty/homelab/plans/<plan id>/applies/<apply id>/artifacts/<ident>/{command,stdout}.
Alternatives check of 2026-11-19: none.
Tool: none found.
Reason: Searches found no open tool or library for this need: it is a defect in the project's own host_pattern helper, fixed by appending Ansible's documented comma-or-colon separator and adding no dependency.
Lacks:
- No external tool builds the ansible limit pattern
- Separator choice must follow whether the limit has a comma
- Dry-run text and apply command must share one separator rule
- Fix stays inside the existing helper with no new dependency
Proposed design
Problem statement
The apply and plan commands can skip the last host of a comma limit. host_pattern appends :!<offline group> to the limit. Ansible splits a comma limit on commas only, so the last term <last host>:!offline matches no host. The offline exclusion then applies to no host of the run. The fix appends a comma when the limit has a comma and a colon when it has no comma.
Acceptance criteria
Requirement: Comma limit uses a comma before the offline exclusion
host_pattern SHALL append the offline exclusion as its own comma-separated term when the limit contains a comma.
Scenario: Comma-separated limit
- WHEN A test in
tests/infra/test_plan.pycallshost_pattern('a,b', 'offline'), anduv run devops ci fail-to-pass --base origin/mainruns the test before the fix. - THEN The test asserts
a,b,!offline, and the same test fails onmain.
Requirement: Single group uses a colon before the offline exclusion
host_pattern SHALL append the offline exclusion with a colon when the limit contains no comma.
Scenario: Single group limit
- WHEN A test in
tests/infra/test_plan.pycallshost_pattern('gpu_nodes', 'offline'). - THEN The test asserts
gpu_nodes:!offline, so the pattern excludes the offline group.
Requirement: Together run has one term for each host
An apply of hosts with no disruptive class SHALL pass a limit in which each host and the offline exclusion are separate terms.
Scenario: Together run with a fake runner
- WHEN An apply test with a fake runner calls
_apply_togetherfor the hostsaandb, which have no disruptive class. - THEN The fake runner receives the limit
a,b,!offline, and the test asserts that each host is one term.
Requirement: Dry-run text uses the fixed separator
The dry-run text of src/devops_cli/infra/infra_plans.py SHALL show the same separator rule that the real run uses.
Scenario: Dry run with two together hosts
- WHEN A test of the dry-run text builds it for a together run of the hosts
aandb. - THEN The text shows
a,b,!<offline group>and nota,b:!<offline group>.
Requirement: Plan command uses the fixed pattern for a comma limit
devops infra plan --limit a,b SHALL pass a limit in which each host and the offline exclusion are separate terms.
Scenario: Plan command with a comma limit
- WHEN A test in
tests/commands/test_infra_plan.pyinvokes the plan command with--limit a,band a fake runner. - THEN The fake runner receives
a,b,!offlineas its--limitvalue.
Existing Tool Considered
The alternatives check of 2026-11-19 in the issue body records the verdict none; it names no tool. The change edits the existing host_pattern helper and adds no dependency. The change builds no new component, so no separate build cost applies.
Key questions
- Which separator should
host_patternappend to the offline group?: Append,when the limit has a comma. Append:when the limit has no comma. (best practice) [sources: src/devops_cli/infra/plan.py:164, src/devops_cli/infra/apply.py:555]- Chosen: Comma when the limit has a comma, else colon. The appened term uses the separator that Ansible reads for that limit, so each host stays one term.
- Rejected: Always colon. A comma limit ends with
<last host>:!offline, which Ansible cannot match. - Rejected: Always comma. It changes the syntax for a limit with no comma and is wider than the defect.
- Does
devops infra plan --limit a,buse the samehost_patternfunction?: Yes.plan.pycallshost_pattern(request.limit, ansible.offline_group)at line 592. [sources: src/devops_cli/infra/plan.py:592, src/devops_cli/infra/plan.py:164] - Does
_apply_togetherpass its together host list throughhost_pattern?: Yes._apply_togethercallscontext.run.run(host_pattern(names, context.offline_group), check_mode=False)at line 555. [sources: src/devops_cli/infra/apply.py:551, src/devops_cli/infra/apply.py:555, src/devops_cli/infra/plan.py:164] - How should the dry-run text show the fixed pattern?: Use the same separator rule as
host_pattern:,before the offline exclusion when the together list has a comma, else:. (best practice) [sources: src/devops_cli/infra/infra_plans.py:281, src/devops_cli/infra/plan.py:164]- Chosen: Use the same separator rule. The dry-run text then matches the command that the apply runs.
- Rejected: Leave
:!in the dry-run text. It shows a pattern that Ansible cannot match for a comma list.
- Does the fix need a new dependency?: No. The fix edits the existing
host_patternhelper and adds no dependency. [sources: src/devops_cli/infra/plan.py:164]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 18, 2026
A host is silently skipped from an apply, leaving it without the intended change and creating inconsistent state.Both handle the offline group during devops infra apply, but 5455 fixes the health gate alert query while this fixes the host pattern separator.devops-cli-service commentedon Nov 18, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
devops-cli-service commentedon Nov 19, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (3)
Searches run:
devops-cli-service commentedon Nov 19, 2026
Status set to Ready at 29e3a03 (see proposed design in issue body).
devops-cli-service commentedon Nov 19, 2026
Plan state: branch
fix/6337-apply-skips-the-last-host-of, draft pull request #6387. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
A model review of the plan found these points. They stop no draft, and a person judges them:
spec_delta_wrongat spec infra-apply (Each host of the together run is one term of the limit): The added requirement says every together run names each host and the offline exclusion as separate comma-separated terms, but the plan keeps a colon when the together run holds one host (decision 3 and the unchanged apply snapshot), so the archived requirement would be false for the existing one-host together run. Evidence: "The limit of the run of the hosts with no disruptive class SHALL name each host and the offline exclusion as separate comma-separated terms"false_premiseat proposal (feasibility): The feasibility note says the plan dry run shows the limit with!offline, but the dry run builds the pattern with the literal<offline group>placeholder, as the plan's own quote ofinfra_plans.py:182shows. Evidence: "--dry-runmust show--limit '<gpu-node-a>,<gpu-node-b>,!offline'"4 remaining items
fix(infra): Fix the offline separator of host_pattern (#6337)
wip: 1 of 2 tasks of group 2, Show the fixed separator in the dry run…
fix(infra): Show the fixed separator in the dry run of the plan comma…
fix(infra): Show the fixed separator in the dry run of the apply comm…
fix(infra): Read the hosts of a comma limit in the fake runner (#6337)
docs(openspec): archive the change (#6337)
devops-cli-service commentedon Nov 19, 2026
Pull request #6387 is ready for review. The checks passed.
Spend: 105 model requests, 5031253 input tokens, 87043 output tokens.
devops-cli-service commentedon Nov 19, 2026
Released in v0.179.5: https://github.com/dan-petty/devops-cli/releases/tag/v0.179.5
devops-cli-service commentedon Nov 19, 2026
Live since 2026-11-19 11:42 UTC