Skip to content

feat(cli): add /autofix-pr to check out a PR, fix failures, push back#165

Merged
emal-avala merged 4 commits intomainfrom
feat/cmd-autofix-pr
Apr 23, 2026
Merged

feat(cli): add /autofix-pr to check out a PR, fix failures, push back#165
emal-avala merged 4 commits intomainfrom
feat/cmd-autofix-pr

Conversation

@emal-avala
Copy link
Copy Markdown
Member

Summary

Adds `/autofix-pr [number]` — end-to-end CI rescue in one command.

Flow:

  1. Confirm PR is open (`gh pr view`)
  2. Create isolated worktree, checkout PR head
  3. Detect toolchain (Cargo / npm / pyproject / go), run lint + test gate
  4. Triage failures: formatter (safe), test fails (root-cause), type errors (honor types)
  5. Apply minimal fixes, re-run gate after each one
  6. Commit + push back to PR head

Guardrails in the prompt:

  • worktree isolation (doesn't touch current tree)
  • never force-push, never skip hooks
  • never modify tests to make them pass — fix the code or flag the test
  • never touch `.github/workflows/**`
  • don't cast to bypass type errors

Why

"CI failed, go make it green" is a common ask. Without a skill, the agent often short-cuts: batches speculative edits, force-pushes, or edits tests to match broken behavior. This codifies the right sequence and the guardrails that keep it honest.

Leans on the existing `worktree` tool and the established lint/test conventions in AGENTS.md.

Test plan

  • `cargo fmt --all` clean
  • `cargo check` passes
  • `cargo clippy --no-deps` clean
  • Manual: `/autofix-pr ` on a PR with a clippy violation → worktree created, fix applied, commit pushed
  • Manual: `/autofix-pr ` on a PR with a failing assertion → flags the test as possibly wrong, doesn't delete it

`/autofix-pr [number]` triggers an end-to-end CI rescue workflow:
worktree checkout → lint+test → triage failures → minimal fixes →
verify → commit + push.

Hard rules baked into the prompt:
- work inside a git worktree (don't touch current tree)
- re-run the gate after each fix, don't batch speculative edits
- never force-push, never skip hooks
- never modify tests to make them pass — fix the code they test, or
  flag the test as wrong and stop
- never touch .github/workflows/** as part of an autofix
- honor the types, don't cast to bypass type errors
- detect project toolchain from AGENTS.md / CONTRIBUTING.md first,
  fall back to defaults per language

Defaults to the current branch's PR; `/autofix-pr <n>` targets a
specific PR number.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@emal-avala emal-avala merged commit b25abe1 into main Apr 23, 2026
13 of 14 checks passed
@emal-avala emal-avala deleted the feat/cmd-autofix-pr branch April 23, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant