Repository navigation
Description
Problem
devops infra apply stops at the fresh check when the person runs the apply in a color terminal and the plan came from a run with no terminal. The fresh check then shows more unchecked tasks than the plan, and the apply stops with "unchecked tasks: the plan has ..., the fresh check has ...".
Seen on 2026-11-13: an agent made a plan of ansible/playbooks/13_crash_capture.yaml for one host with no TERM in its environment. The plan shows 2 unchecked tasks. The owner ran the apply of that plan in the VS Code terminal (TERM=xterm-256color). The fresh check shows 7 unchecked tasks. The job events of both runs hold the same skip results. The only difference is that the stdout of each event in the fresh check starts with \x1b[0;36m and ends with \x1b[0m.
Cause
_is_check_mode_skip (src/devops_cli/infra/plan.py) reads the skip result after => in the event stdout as JSON. With the color codes, json.loads fails, and the function counts the skip as a check-mode skip (the safe side). Thus a skip by a false when counts as unchecked in a color terminal and not in a run without a terminal. ansible-runner gives ansible-playbook a pseudo-terminal, so Ansible colors its output when TERM names a color terminal. _PLAN_ENV does not set ANSIBLE_NOCOLOR.
Proposed fix
Set ANSIBLE_NOCOLOR=True in the environment of every plan, fresh check and run, so the event text is the same in each caller environment. Keep the safe side for a result that does not read.
Acceptance criteria
- A test runs the plan parser on the job events of a skip by a false
whenwith and without the color codes instdoutand gets the same plan. It fails onmain(devops ci fail-to-pass). - A test finds
ANSIBLE_NOCOLORin the environment of the plan run and of the apply runs. - A plan made with no
TERMand its apply in a terminal withTERM=xterm-256colorpass the fresh check.
Workaround
Run the plan and the apply in the same kind of terminal, or run the apply with env -u TERM -u COLORTERM. ANSIBLE_NOCOLOR=1 in the caller environment does not help: the runner environment is an allowlist that passes TERM and COLORTERM and drops ANSIBLE_NOCOLOR, so the fix sets it in _PLAN_ENV.
Existing tool considered
Ansible has the setting ANSIBLE_NOCOLOR (nocolor in ansible.cfg). No new tool. Cost: about 40,000 tokens, 30 minutes elapsed.
Activity
devops-cli-service commentedon Nov 13, 2026
Both items use the check-mode plan, but 5124 adds the plan feature and this candidate fixes its color-dependent parsing.dan-petty commentedon Nov 13, 2026
The workaround in the body does not work. A second apply with
ANSIBLE_NOCOLOR=1in the caller environment stopped the same way. The runner environment is an allowlist (src/devops_cli/core/process.py, near line 97): it passesTERMandCOLORTERMfrom the caller and dropsANSIBLE_NOCOLOR. Thecommandartifact of the apply holdsTERMandCOLORTERM; the plan's has neither. So the fix must putANSIBLE_NOCOLORin_PLAN_ENV, which the run adds after the allowlist. The workaround until then: run the apply withenv -u TERM -u COLORTERM, which gives the runner the same environment as the plan.chore(main): release 0.127.1 (#5403)
devops-cli-service commentedon Nov 13, 2026
Released in v0.127.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.127.1
devops-cli-service commentedon Nov 13, 2026
Live since 2026-11-13 12:38 UTC