Skip to content

Autofix: Race condition with autofix:clean label on bootstrap PRs #217

Description

@stranske

Summary

When a PR is created with just a bootstrap commit (minimal or no code), autofix runs and finds "no changes required". It then adds the `autofix:clean` label per line 878-880:

if (!changed) {
  desired.add(cleanLabel);  // cleanLabel = 'autofix:clean'
}

When the real code is pushed (with formatting issues), autofix re-runs but now sees the `autofix:clean` label and enters clean mode which only does a cosmetic sweep.

Root Cause

Timeline example from Manager-Database PR #55:

  1. 21:52:57 - Bootstrap commit created (empty/minimal code)
  2. 21:54:03 - First autofix runs, finds "no changes" → adds `autofix:clean` label
  3. 22:02:12 - Real code pushed with black formatting issues
  4. 22:02:34 - Second autofix runs, but now in clean mode (due to label) → finds "Clean-mode cosmetic sweep found no changes"
  5. Gate fails because black formatting issues were never fixed

Impact

  • PRs created by Codex agent often have this problem since they start with bootstrap commits
  • Users have to manually remove the `autofix:clean` label to trigger a full autofix

Proposed Fix

Option A: Do not add `autofix:clean` label when autofix finds no changes
Option B: Remove `autofix:clean` label when new commits are pushed
Option C: Detect bootstrap commits and skip label management

Related

Also related: Autofix only targets hardcoded paths (src, tests, tools, streamlit_app, .github/scripts) - projects with different structures like `api/`, `adapters/`, `etl/` are not checked.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions