-
Notifications
You must be signed in to change notification settings - Fork 308
Description
Summary
CI failure in run #21219621737 caused by ANSI terminal escape sequences accidentally included in YAML workflow files. This issue was self-healing - the problematic commit was quickly superseded by subsequent commits that removed the escape codes.
Failure Details
- Run: 21219621737
- Commit: 80395ca
- PR: Enforce mandatory recompile in cli-version-checker workflow #11045 "Enforce mandatory recompile in cli-version-checker workflow"
- Failed Job:
js(JavaScript linting/validation) - Trigger: push to main
- Resolution: Self-healing - fixed in later commit c4a0b67
Root Cause Analysis
The commit introduced ANSI escape sequences ([m - color reset codes) into the compiled workflow YAML file:
Affected lines in .github/workflows/cli-version-checker.lock.yml:
- Line 810:
2. **REQUIRED**: Run 'make recompile' to update workflows (MUST be run after any constant changes)[m - Line 886:
- **SAVE TO CACHE**: Store help outputs (main and all subcommands) and version check results in cache-memory[m
The [m characters are ANSI escape codes (specifically, \x1b[m or ESC[m) used for resetting terminal colors. These were likely:
- Copied from colored terminal output
- Preserved by a text editor with ANSI code support
- Or generated by a script that outputs colored text
These escape codes are invisible in many editors but break YAML parsing, causing the js job to fail during workflow validation.
Investigation Findings
What happened:
- PR Enforce mandatory recompile in cli-version-checker workflow #11045 was merged at 17:39:40 (commit 80395ca)
- CI workflow ran and failed at ~17:42:12 (js job failure)
- Repository continued with normal development
- By commit c4a0b67 (17:41:51), the ANSI codes were gone
- Current main branch is clean (no ANSI escape sequences found)
Why it self-healed:
The repository appears to have a rapid commit cycle with multiple PRs being merged. The problematic YAML file was likely regenerated (via make recompile) by a subsequent PR that produced clean YAML without the escape codes.
Failed Jobs and Errors
Job: js (61050540090)
- Status: failure
- Likely error: YAML syntax validation failed due to unexpected characters
Note: Full job logs were inaccessible (403 permission error), but the diff analysis clearly shows the ANSI escape code injection.
Recommended Actions
Immediate (Already Resolved ✅)
- ✅ The issue self-resolved - current main branch has no ANSI escape sequences
- ✅ No manual intervention needed
Prevention (Future Improvements)
-
Add YAML validation to pre-commit hooks
# Check for ANSI escape sequences in YAML files git diff --cached --name-only | grep '\.ya\?ml$' | xargs grep -P '\\x1b\\[[0-9;]*m' && exit 1
-
Add CI validation step before JS job
- name: Check for ANSI escape sequences run: | if find .github/workflows -name "*.yml" -o -name "*.yaml" | xargs grep -P '\\x1b\\[[0-9;]*m'; then echo "ERROR: ANSI escape sequences found in YAML files" exit 1 fi
-
Update compiler to strip ANSI codes
- Modify the workflow compiler in
pkg/workflow/to automatically strip ANSI escape sequences - Add test cases that verify ANSI codes are removed during compilation
- Modify the workflow compiler in
-
Editor configuration guidance
- Document in CONTRIBUTING.md that editors should not preserve ANSI escape codes
- Recommend plaintext-only modes for editing YAML
Prevention Strategies
Root cause: Copy-paste operations from colored terminal output or ANSI-aware editors.
Prevention layers:
- Detection: Pre-commit hooks to catch ANSI codes before commit
- Validation: CI checks that fail fast on ANSI escape sequences
- Sanitization: Compiler automatically strips ANSI codes during workflow generation
- Education: Developer documentation about ANSI code hazards
AI Team Self-Improvement
Add to AGENTS.md or developer instructions:
### YAML File Editing - ANSI Escape Code Prevention
**CRITICAL**: When editing or generating YAML workflow files (`.github/workflows/*.yml`, `*.lock.yml`):
1. **NEVER copy-paste from colored terminal output** - Always use `--no-color` or `2>&1 | cat` to strip colors
2. **Validate YAML before committing** - Run `python3 -c "import yaml; yaml.safe_load(open('file.yml'))"` to check syntax
3. **Check for invisible characters** - Use `cat -A file.yml | grep '\[m'` to detect ANSI escape sequences
4. **Run make recompile** - Always recompile workflows after editing .md files to regenerate clean .lock.yml files
**Example of safe command usage**:
```bash
# ❌ BAD - May include ANSI color codes
npm view @github/copilot | tee output.txt
# ✅ GOOD - Strip colors before saving
npm view @github/copilot --no-color | tee output.txt
# OR
npm view @github/copilot 2>&1 | cat | tee output.txtDetection command:
# Check for ANSI escape sequences in workflow files
find .github/workflows -name "*.yml" -o -name "*.yaml" | xargs grep -P '\\x1b\\[[0-9;]*m'
## Historical Context
This is the **first recorded instance** of ANSI escape sequences breaking CI in this repository. The error pattern has been documented in `/tmp/gh-aw/cache-memory/patterns/ansi-escape-yaml.json` for future reference.
**Similar past failures**: None found in issue search
**Pattern signature**: `[m` characters at end of YAML string values, representing ANSI color reset codes (`\x1b[m`)
**Investigation data**: Full investigation details stored at `/tmp/gh-aw/cache-memory/investigations/2026-01-21-21219621737.json`
## Additional Notes
- This was a **transient failure** with automatic recovery
- No production impact (caught by CI before affecting end users)
- Demonstrates the value of CI validation catching subtle errors
- Highlights need for better ANSI code detection in the toolchain
> AI generated by [CI Failure Doctor](https://github.com/githubnext/gh-aw/actions/runs/21219703333)
>
> To add this workflow in your repository, run `gh aw add githubnext/agentics/workflows/ci-doctor.md@ea350161ad5dcc9624cf510f134c6a9e39a6f94d`. See [usage guide](https://githubnext.github.io/gh-aw/guides/packaging-imports/).
<!-- gh-aw-agentic-workflow: CI Failure Doctor, engine: copilot, run: https://github.com/githubnext/gh-aw/actions/runs/21219703333 -->