Repository navigation
[yamllint-fixer] Fix yamllint truthy warnings: quote ambiguous YAML env scalars - #76100
Conversation
appendEnvVarLine emitted step env values like "True"/"Yes"/"Off" (from authored engine.env frontmatter, e.g. mini-swe-agent's LITELLM_LOCAL_MODEL_COST_MAP: "True") unquoted, letting YAML resolve them as booleans/null and silently changing the literal string GitHub Actions exposes to the step, while also tripping yamllint's truthy rule. yamlStringValue now quotes plain scalars that are YAML boolean/null synonyms, except canonical lowercase true/false which already round-trip correctly and are the only values this repo's yamllint config allows. Closes #41507 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found two follow-ups:
- Add regression coverage for the new YAML ambiguous-scalar quoting and canonical boolean exception.
- Regenerate the two affected checked-in mini-swe-agent lock files so merged workflows receive the fix.
No critical or high-severity correctness/security issue found in the changed implementation.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again
| // would otherwise be parsed as a non-string scalar, silently changing the | ||
| // value GitHub Actions exposes to the step (and tripping yamllint's truthy | ||
| // rule). Quote them so they round-trip as the literal string. | ||
| if isYAMLAmbiguousPlainScalar(value) { |
There was a problem hiding this comment.
The new ambiguous-scalar branch has no regression tests, so a change to the keyword set or canonical true/false exception could silently break YAML string preservation.
💡 Add focused table cases
Extend TestYamlStringValue with mixed-case boolean/null synonyms and explicit assertions that lowercase true/false remain unquoted. This locks down both the new quoting behavior and the intentional exception.
| // value GitHub Actions exposes to the step (and tripping yamllint's truthy | ||
| // rule). Quote them so they round-trip as the literal string. | ||
| if isYAMLAmbiguousPlainScalar(value) { | ||
| return strconv.Quote(value) |
There was a problem hiding this comment.
This compiler change leaves the two checked-in mini-swe-agent lock files stale, so the repository's generated workflows will continue emitting the incorrect unquoted value after this PR merges.
💡 Regenerate affected locks
Run gh aw compile (or the repository's drift target) and commit the resulting engine-conformance-mini-swe-agent.lock.yml and smoke-mini-swe-agent.lock.yml updates, unless generated locks are intentionally refreshed only in a coordinated follow-up.
There was a problem hiding this comment.
🟡 Changes recommended
Missing regression tests for boolean/null keyword quoting and the reported environment-rendering case leave existing tests unable to detect removal of the fix.
1 open issue
What changed in this PR
This PR reduces yamllint truthy warnings in gh-aw’s generated workflows by preserving ambiguous boolean/null environment values as quoted strings.
Changes:
- Adds case-insensitive detection and quoting for YAML boolean/null keywords.
- Keeps canonical lowercase
trueandfalseunchanged to avoid unnecessary generated-file changes. - Leaves generated
.lock.ymlfiles unchanged; regeneration is deferred.
| File | Description |
|---|---|
pkg/workflow/engine_helpers.go |
Quotes ambiguous YAML environment scalars using a new detection helper. |
Review effort: Balanced (auto)
| if isYAMLAmbiguousPlainScalar(value) { | ||
| return strconv.Quote(value) |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. Requesting changes for two reasons: the lock files are stale, and the new branch has no test.
Blocking: stale lock files. Recompiling with this PR's code changes engine-conformance-mini-swe-agent.lock.yml and smoke-mini-swe-agent.lock.yml, but this PR does not include them. The check-workflow-drift CI job (scripts/check-workflow-drift.sh) compiles every workflow and fails when any lock file differs from disk. Run make recompile and commit the two regenerated files.
Should fix: no test for the new branch. See the inline comment on lines 441-443. The strconv.Quote return is never hit by the tests the PR cites.
Minor: comment accuracy. See the inline comment on line 453. I checked go-yaml v3: it resolves only True/TRUE/Null/~, not Yes/On/Off. The list is correct for YAML 1.1 (yamllint and PyYAML), but the comment should say so.
📋 Key Themes & Highlights
Key Themes
- Stale generated output: the fix is correct, but the regenerated lock files are missing
- Coverage gap: the new quoting branch is untested
- Comment precision: the parser claim overstates go-yaml behaviour
Positive Highlights
- ✅ Root-cause fix in
yamlStringValueinstead of patching the two lock files by hand - ✅ Excluding canonical lowercase
true/falseavoids noisy diffs across all workflows, with a clear rationale in the comment - ✅ The change is one file, gofmt-clean, and
gh aw compilesucceeds for all 365 workflows
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.3K
Comment /matt to run again
| return "'" + strings.ReplaceAll(value, "'", "''") + "'" | ||
| } | ||
|
|
||
| // yamlAmbiguousPlainScalars lists case-insensitive plain scalars that YAML |
There was a problem hiding this comment.
[/diagnosing-bugs] The doc comment says these scalars are resolved to a boolean or null by "go-yaml ... and GitHub Actions' own YAML parser". I checked go-yaml v3 (gopkg.in/yaml.v3, used in this repo): it resolves only True/TRUE to bool and Null/~ to nil. Yes, On, Off, No, Y and N stay strings there. The list matches YAML 1.1 keywords (what yamllint and PyYAML use), so the fix is correct for the yamllint case, but the comment overstates parser behaviour.
💡 Suggested comment
// yamlAmbiguousPlainScalars lists case-insensitive plain scalars that YAML 1.1
// parsers (as used by yamllint and PyYAML) resolve to a boolean or null value.@copilot please address this.
| // would otherwise be parsed as a non-string scalar, silently changing the | ||
| // value GitHub Actions exposes to the step (and tripping yamllint's truthy | ||
| // rule). Quote them so they round-trip as the literal string. | ||
| if isYAMLAmbiguousPlainScalar(value) { |
There was a problem hiding this comment.
[/tdd] The new quoting branch in yamlStringValue (lines 441-443) has no test. The targeted tests the PR cites (TestYamlStringValue, TestAppendEnvVarLine) never execute it: a coverage run over them shows the strconv.Quote return at line 442 with zero hits. A regression here would silently reintroduce the bug.
💡 Suggested test cases
Add rows to TestYamlStringValue for True, off, and ~, plus a negative case for canonical true that must stay unquoted:
{name: "yaml bool synonym True quoted", input: "True", expected: `"True"`},
{name: "yaml bool synonym off quoted", input: "off", expected: `"off"`},
{name: "canonical true left unquoted", input: "true", expected: "true"},@copilot please address this.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed the linked CGO failure by blocking |
|
🎉 This pull request is included in a new release. Release: |

Summary
Reduces yamllint noise in generated
*.lock.ymlfiles by fixing a root cause in the GoYAML generator code: step-level
env:values that are YAML boolean/null synonyms in anon-canonical casing (e.g.
True,Yes,Off) were emitted unquoted, letting YAMLresolve them as a boolean/null instead of the literal authored string.
yamllint config used:
{extends: default, rules: {line-length: disable, document-start: disable, truthy: {check-keys: false}, comments: {require-starting-space: true, min-spaces-from-content: 1}}}Results
Warning breakdown
Both warnings were
truthy value should be one of [false, true]onLITELLM_LOCAL_MODEL_COST_MAP: Trueinengine-conformance-mini-swe-agent.lock.ymlandsmoke-mini-swe-agent.lock.yml.Root cause
.github/workflows/shared/mini-swe-agent.mddeclaresengine.behaviors.execution.env.LITELLM_LOCAL_MODEL_COST_MAP: "True"— explicitly quoted in the frontmatter to preserve the literal string"True". This flows throughBehaviorDefinedEngine.buildBehaviorDefinedExecutionEnvintoFormatStepWithCommandAndEnv→appendEnvVarLine→yamlStringValue(pkg/workflow/engine_helpers.go), which only quoted values containing": "or a leading{/[. A plain scalar likeTruewas passed through unquoted, so YAML (and yamllint's truthy rule) saw it as a boolean rather than a string — a correctness issue beyond lint noise, since GitHub Actions would stringify the resolved boolean as lowercase"true", silently diverging from the authored value.Changes
pkg/workflow/engine_helpers.go:yamlStringValuenow quotes plain scalars that areYAML boolean/null synonyms (
True,TRUE,yes,No,On,Off,Y,N,null,~, case-insensitive), via a newisYAMLAmbiguousPlainScalarhelper. Canonicallowercase
true/falseare excluded since they already round-trip correctly unquotedand are the only values this repo's yamllint config allows for the truthy rule — quoting
them would add diff noise across nearly every workflow without fixing anything.
Notes
.lock.ymlfiles are not included in this PR.Run
gh aw compileafter merging to regenerate them with the improvements (only the twomini-swe-agentworkflows change).go build ./..., theTestYamlStringValue,TestAppendEnvVarLine, andTestFormatStepWithCommandAndEnv*unit tests, and a fullgh-aw compileacross all 365workflows (365 succeeded, 0 new warnings).
🤖 Generated with [Claude Code]((claude.com/redacted)