Skip to content

[CI Failure Doctor] Recurring CI failure: Check Go formatting step fails - 5th occurrence today #10004

@github-actions

Description

@github-actions

🏥 CI Failure Investigation - Run #29602

Summary

⚠️ RECURRING PATTERN - This is the 5th occurrence of this failure type today.

The CI workflow failed because Go code was not properly formatted before committing. The "Check Go formatting" step in the lint-go job detected unformatted Go files.

Failure Details

Root Cause Analysis

Primary Cause

The AI agent (Copilot) committed code changes without running the mandatory pre-commit command: make agent-finish (or at minimum make fmt).

Pattern Recognition

This failure matches the known pattern GO_FORMAT_CHECK_FAILED with high confidence:

  • Pattern first seen: 2026-01-14 06:08:42 UTC
  • Last occurrence (before this): 2026-01-14 07:51:41 UTC
  • Total occurrences today: 5
  • Pattern signature: lint-go job → Check Go formatting step failure

Why This Keeps Happening

  1. AI agents are not consistently following the documented workflow that requires running make agent-finish before every commit
  2. No automated enforcement - there are no pre-commit hooks or branch protection rules that enforce formatting
  3. False sense of completion - the AI agent successfully completes its task (e.g., doc changes) but doesn't realize it needs to format code

Suspicious Commit Characteristics

The PR #9997 only changed 2 files:

  • docs/src/content/docs/setup/quick-start.md (the intended documentation change)
  • .github/workflows/glossary-maintainer.lock.yml (regenerated workflow file)

However, the commit statistics show hundreds of Go files modified. This suggests either:

  • A merge commit that brought in unformatted changes from another branch
  • A grafted commit in a shallow clone

The formatting check caught the issue regardless of the source.

Failed Jobs and Errors

Job: lint-go

Status: ❌ Failed
Duration: ~17 seconds (22:38:03 - 22:38:20)
Failed Step: Check Go formatting (step 5)

Step Flow:

✅ 1. Set up job
✅ 2. Checkout code
✅ 3. Set up Go
✅ 4. Report Go cache status
❌ 5. Check Go formatting (FAILED)
⏭️ 6. Install golangci-lint (SKIPPED)
⏭️ 7. Run golangci-lint (SKIPPED)
⏭️ 8. Lint error messages (SKIPPED)

Expected Error (based on pattern):

❌ Code is not formatted. Run 'make fmt' to fix.
Unformatted files:
[list of files]

To fix this locally, run:
  make fmt

Investigation Findings

Historical Context

This is part of a systematic issue where AI agents repeatedly commit code without proper formatting:

Date Run ID Commit PR Author
2026-01-14 06:08 20984232736 b1b5f4b #9903 Copilot
2026-01-14 06:14 20984290612 99c636f #9894 Copilot
2026-01-14 06:28 20984405453 (unknown) (unknown) Copilot
2026-01-14 07:51 20986559929 (unknown) (unknown) Copilot
2026-01-14 22:37 21012388902 030f506 #9997 Copilot

Pattern: All failures are from Copilot (AI agent) commits.

Impact Assessment

  • Severity: Medium (doesn't break functionality, but blocks CI)
  • Impact: High (all CI checks fail, blocks other PRs, wastes CI resources)
  • Urgency: High (recurring issue needs systematic fix)
  • Time to fix: ~5 minutes (run make fmt and push)

Recommended Actions

Immediate Fix (For This Specific Failure)

# Fix the formatting issue
make fmt
git add .
git commit -m "Fix Go formatting"
git push

Short-term Prevention (Reduce Recurrence)

  • Strengthen AI agent instructions: Add more prominent warnings in AGENTS.md about mandatory make agent-finish
  • Add validation check: Create a reminder in the AI agent prompt about pre-commit requirements
  • Update PR template: Add a checklist item for make agent-finish

Long-term Solutions (Eliminate Recurrence)

  • Add pre-commit hooks: Install Git hooks that automatically run make fmt before commits

    # .git/hooks/pre-commit
    #!/bin/sh
    make fmt
    git add .
  • Auto-formatting PR workflow: Add a GitHub Action that automatically formats code and commits it

    name: Auto-format
    on: pull_request
    jobs:
      format:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - name: Format code
            run: make fmt
          - name: Commit changes
            run: |
              git config user.name "github-actions[bot]"
              git config user.email "github-actions[bot]@users.noreply.github.com"
              git add .
              git diff-index --quiet HEAD || git commit -m "Auto-format code"
              git push
  • Branch protection: Require the lint-go check to pass before allowing merges

  • AI agent improvements: Modify the AI agent's workflow to automatically run make agent-finish before creating PRs

Prevention Strategies

AI Team Self-Improvement

Add the following to AI agent instructions:

## MANDATORY PRE-COMMIT CHECKLIST

Before EVERY commit that modifies Go files (.go, go.mod, go.sum):

1. ✅ Run `make agent-finish` (runs build, test, recompile, fmt, lint)
2. ✅ Verify no errors from the above command
3. ✅ Only then commit and push

**CRITICAL**: This is NOT optional. CI will fail if you skip this step.

**Why this matters**: The formatting check is automatic and strict. Unformatted
code will cause CI to fail, blocking all other work and wasting resources.

**Remember**: `make agent-finish` is your friend - it catches issues BEFORE CI does.

Monitoring and Alerts

  • Alert threshold: If this pattern occurs more than 2 times per day, escalate to team
  • Current status: ⚠️ THRESHOLD EXCEEDED (5 occurrences today)
  • Recommendation: Implement automated fixes immediately

Historical Context

Similar past failures and their resolutions:

Lesson: This is not a new problem. Manual fixes are not sufficient - we need systematic prevention.

Related Files and Patterns

  • Pattern database: /tmp/gh-aw/cache-memory/patterns/go-formatting-failure.json
  • Investigation reports:
    • 2026-01-14-20984232736.json
    • 2026-01-14-20984290612.json
    • 2026-01-14-20984405453.json
    • 2026-01-14-20986559929.json
    • 2026-01-14-21012388902.json (this failure)

Conclusion

This failure is 100% preventable and is part of a recurring pattern. The root cause is clear: AI agents are not following the documented pre-commit workflow.

While individual fixes are quick (5 minutes), the recurring nature means we're wasting significant time and CI resources. Systematic prevention is urgently needed.


Investigation completed by CI Failure Doctor
Pattern: GO_FORMAT_CHECK_FAILED (confidence: high)
Auto-generated: 2026-01-14T22:45:00Z

AI generated by CI Failure Doctor

To add this workflow in your repository, run gh aw add githubnext/agentics/workflows/ci-doctor.md@ea350161ad5dcc9624cf510f134c6a9e39a6f94d. See usage guide.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions