Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Summary
New UF command .opencode/commands/uf.fix-ci.md, invoked as /uf.fix-ci [PR_NUMBER]: diagnoses failing CI checks on an open PR, runs a gated fix loop (diagnose → fix → commit → push → re-poll), rebases the head branch onto base when the PR is conflicted or behind, and verifies CI ends green.
Why
/uf.finalestep 7 only detects failing checks after PR creation and offers "Investigate the failure" — nothing carries the fix through./uf.address-feedbackfixes reviewer feedback, not red checks./uf.rebase-pr(uf.rebase-pr: port global resolve-branch-conflict command (rebase conflicted PR head onto base) #851) rebases a conflicted PR but does not address failing checks.- Fixing a red PR today is a manual loop:
gh pr checks, log spelunking, edit, push, watch — exactly the mechanical workflow UF automates.
Command behavior
- Arguments: PR number optional; omitted → auto-detect the open PR for the current branch. Invalid → STOP.
- Prerequisites:
which gh,gh auth status. - Fetch PR state:
gh pr view <N> --json number,state,headRefName,baseRefName,mergeable,mergeStateStatus,headRepository,baseRepositoryplusgh pr checks <N>. STOP if CLOSED/MERGED or all checks pass. - Diagnose: for each failed check, fetch failure logs (
gh run view <run-id> --log-failed); classify root cause: code failure (build/test/lint), stale branch (base moved), conflict, or flaky/infra. - Rebase branch (conflicted or behind):
git_fetch <BASE_REMOTE>→git_rebase <BASE_REMOTE>/<BASE_BRANCH>; resolve flagged files preserving author intent; on ambiguity STOP and offergit_rebase_abort. MUST NEVER merge base into head — rebase only. This rule is absolute. - Gated fix loop: present diagnosis + proposed fix plan; human confirms via question tool. Then fix → conventional commit → push (
git_push, orgit_push_force_with_leaseafter a rebase since history was rewritten) → re-poll CI. Max-iteration cap (3); STOP on cap or unfixable failure. - Flaky/infra path: when logs indicate flakiness or infra failure, offer
gh run rerun --failedinstead of a code change. - Final verification:
uf_finale_ci_polluntil green or timeout; report final status. MUST NOT merge, approve, or close the PR.
Scope
-
.opencode/commands/uf.fix-ci.mdfollowinguf.review-pr.mdconventions (frontmatter,<protect>, session-resume guard, progress checkpoints, TodoWrite) - Prefer existing plugin tools (
uf_finale_ci_poll,git_fetch,git_rebase,git_rebase_abort,git_push,git_push_force_with_lease) over raw bash - Fix commits pass
/uf.review-councilbefore push (uf.address-feedback §4.3 precedent), once per iteration after all fixes are committed - Scaffold mirror
internal/scaffold/assets/opencode/commands/uf.fix-ci.md(drift tests stay green) -
AGENTS.mdPR Review Commands table:/uf.fix-ci [N]— Post-PR — diagnose + fix failing checks -
docs/usage.mdcommand reference entry -
make checkgreen
Notes
- Complements
/uf.rebase-pr(uf.rebase-pr: port global resolve-branch-conflict command (rebase conflicted PR head onto base) #851): shares its rebase conventions (fork-aware remote resolution, force-with-lease, never touch protected branches) but stays self-contained — fix-ci's rebase is one branch of a diagnose-fix flow. - Never-merge guardrail mirrors
uf.finale's "NEVER merge the PR".
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Type
Projects
- StatusShow more project fieldsNo status
Activity
docs(uf-fix-ci): propose post-PR CI repair command (rebase only, neve…
docs(uf-fix-ci): propose post-PR CI repair command (rebase only, neve…