Skip to content

[yamllint-fixer] Fix yamllint truthy warnings: quote ambiguous YAML env scalars - #76100

Merged
pelikhan merged 3 commits into
mainfrom
fix/yamllint-truthy-env-quoting-84e2eff70fcba556
Nov 9, 2026
Merged

pelikhan merged 3 commits into
mainfrom
fix/yamllint-truthy-env-quoting-84e2eff70fcba556

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Reduces yamllint noise in generated *.lock.yml files by fixing a root cause in the Go
YAML generator code: step-level env: values that are YAML boolean/null synonyms in a
non-canonical casing (e.g. True, Yes, Off) were emitted unquoted, letting YAML
resolve 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

Metric Before After Reduction
Total warnings 2 0 2 (100%)

Warning breakdown

Category Before After
truthy 2 0

Both warnings were truthy value should be one of [false, true] on
LITELLM_LOCAL_MODEL_COST_MAP: True in engine-conformance-mini-swe-agent.lock.yml and
smoke-mini-swe-agent.lock.yml.

Root cause

.github/workflows/shared/mini-swe-agent.md declares engine.behaviors.execution.env.LITELLM_LOCAL_MODEL_COST_MAP: "True" — explicitly quoted in the frontmatter to preserve the literal string "True". This flows through BehaviorDefinedEngine.buildBehaviorDefinedExecutionEnv into FormatStepWithCommandAndEnv → appendEnvVarLine → yamlStringValue (pkg/workflow/engine_helpers.go), which only quoted values containing ": " or a leading {/[. A plain scalar like True was 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: yamlStringValue now quotes plain scalars that are
    YAML boolean/null synonyms (True, TRUE, yes, No, On, Off, Y, N, null,
    ~, case-insensitive), via a new isYAMLAmbiguousPlainScalar helper. Canonical
    lowercase true/false are excluded since they already round-trip correctly unquoted
    and 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

  • The generated .lock.yml files are not included in this PR.
    Run gh aw compile after merging to regenerate them with the improvements (only the two
    mini-swe-agent workflows change).
  • Verified with go build ./..., the TestYamlStringValue, TestAppendEnvVarLine, and
    TestFormatStepWithCommandAndEnv* unit tests, and a full gh-aw compile across all 365
    workflows (365 succeeded, 0 new warnings).
  • Closes Reduce yamllint noise in generated *.lock.yml #41507

🤖 Generated with [Claude Code]((claude.com/redacted)

Generated by 🧹 Daily yamllint Fixer · claude · agent · ~212 AIC · ⌖ ~1 AIC · ⊞ 4.3K · ◷

  • expires on Nov 15, 2026, 6:59 PM UTC-08:00

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>
@pelikhan
pelikhan marked this pull request as ready for review November 9, 2026 03:08
Copilot AI adaptive review requested due to automatic review settings November 9, 2026 03:08
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ 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: reported_no_action

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.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.6K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

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.

Generated from PR Specification Reviewer · gpt56 · ~2 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 1.7K · ◷

Generated by PR Specification Reviewer for #76100

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76100

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@pelikhan

pelikhan commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-09T03:11:49Z
review_event: COMMENT
top_themes: [missing regression coverage, stale generated lock files]
files_reviewed: [pkg/workflow/engine_helpers.go]
comment_count: 2

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 true and false unchanged to avoid unnecessary generated-file changes.
  • Leaves generated .lock.yml files 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)

Comment on lines +441 to +442
if isYAMLAmbiguousPlainScalar(value) {
return strconv.Quote(value)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 yamlStringValue instead of patching the two lock files by hand
  • ✅ Excluding canonical lowercase true/false avoids noisy diffs across all workflows, with a clear rationale in the comment
  • ✅ The change is one file, gofmt-clean, and gh aw compile succeeds 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copilot AI and others added 2 commits November 9, 2026 03:32
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

@copilot fix https://github.com/github/gh-aw/actions/runs/42554753329/job/128957985808?pr=76100

Fixed the linked CGO failure by blocking harness.decision and durable-session events from Aider shell output, and added the requested YAML scalar and env-rendering regression tests. Targeted tests and the final impacted-test gate pass. Changes are in 0c29536 (with the regenerated env locks in b9fd19b).

Copilot AI requested a review from pelikhan November 9, 2026 03:49
@pelikhan
pelikhan merged commit ac838b1 into main Nov 9, 2026
46 checks passed
@pelikhan
pelikhan deleted the fix/yamllint-truthy-env-quoting-84e2eff70fcba556 branch November 9, 2026 03:52
@github-actions

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v1.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce yamllint noise in generated *.lock.yml

3 participants