Repository navigation
feat(commands): add /uf.fix-ci to diagnose and fix failing PR checks - #868
Conversation
jflowers
left a comment
There was a problem hiding this comment.
Review: REQUEST CHANGES
Note: The review council's verdict is REQUEST CHANGES, but GitHub does not allow a REQUEST_CHANGES review event from the PR author, so this review is posted as a comment. The verdict and all findings stand as written.
The review council dispatched 5 reviewers: architect, curator, guard, and testing completed; the adversary (security) run failed with a retryable child-session error and did not vote. Verdict: REQUEST CHANGES — 11 findings: 1 HIGH, 7 MEDIUM, 3 LOW.
Blocking issue
Iteration-budget exhaustion dead-end (HIGH — architect and guard independently): the iteration counter is durable checkpoint state, cleared only in Phase 6 (clear_progress), but every budget-exhaustion exit STOPs before Phase 6 without clearing it. Re-invoking the command recovers ITERATION=3 and immediately re-stops at the Phase 4.0 resume cap, so the recovery that design R4 documents ("continue with a fresh budget") cannot occur, and no manual reset path exists. The PR's own committed learning (.uf/dewey/learnings/command-design-20261029T060637-jay-flowers.md) records this defect.
Recommended fixes (bounded; no architectural rework)
- Clear the iteration counter on the exhaustion exits — or write an exhausted-state marker the next invocation treats as a fresh budget — and align R4/Phase 6.1 with the implemented behavior.
- Correct design D3:
gh pr viewexposes nobaseRepositoryfield; BASE_REPOSITORY derives from the PRurl(FR-002, Phase 1.2), and the remote preference has three tiers. - Add the three FR-002 pinned invocations (
gh pr view <PR_NUMBER> --json number,state,headRefName,baseRefName,mergeable,mergeStateStatus,headRepository,isCrossRepository,url;gh pr checks <PR_NUMBER> --json name,state,bucket,link;gh run view <RUN_ID> --repo <BASE_REPOSITORY> --log-failed) to the d1 choreography-pins clause inTestCommandContracts_FixCiCommandStructure— the mirror must stay byte-identical, so this structural test is the only joint-drift guard, and #861 will rewire exactly these lines. - Add
cmd/unbound-force/main_test.goto the proposal's "Files modified" impact inventory. - (LOW, optional) Reconsider the tutorial decline against sibling
/uf.rebase-pr(#855), and extend the forbidden-verb net with the rawgit mergeform andgh pr update-branch.
Notes
- All 17 CI checks pass or skip; pre-flight (ci-aware) found every detected tool CI-covered — no local execution needed.
- The adversary run's failure means adversary-grade security scrutiny (secrets, CVEs, error handling) was not applied. Guard confirmed the never-merge and force-with-lease guardrails are present. Re-run the adversary review after the fixes.
- Issue #858 acceptance criteria: 6/6 covered.
This review was generated by /uf.review-pr (AI-assisted).
… budget
The iteration counter was cleared only in Phase 6, so every
exhaustion exit (4.0 cap check, 4.3 council exhaustion, 4.5
still-red) left ITERATION=3 persisted and a re-invocation
re-stopped at the resume cap - design R4's fresh-budget
recovery was unreachable. Exhaustion exits now record
{"iteration": 3, "budget_exhausted": true}; Phase 4.0 recovery
consumes the marker atomically ({"iteration": 0,
"budget_exhausted": false}) and starts a fresh budget while
mid-invocation resumes inherit the count unchanged; increments
record the full two-field shape (the checkpoint shallow-merges
data); the Phase 1.2 early-green STOP now clears stale loop
state; 4.3, 4.5, 6.1, and Guardrails 5 state the implemented
semantics. Mirror kept byte-identical.
Addresses PR unbound-force#868 review feedback from @jflowers.
Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
design.md: D3 corrected to the implemented fetch (gh pr view exposes no baseRepository field; BASE_REPOSITORY derives from the PR url; three-tier BASE_REMOTE preference) and D8/R4 now document the exhaustion marker and fresh-budget semantics. proposal.md: Dependencies records the unbound-force#861 blocking disposition for further raw-gh-fetch command surface; the impact inventory adds cmd/unbound-force/main_test.go (asset count 75->76, validity range [70,74]->[71,75]); the tutorial disposition now references filed issue unbound-force#870 (re-disposed on review, mirroring the /uf.rebase-pr precedent unbound-force#855). Addresses PR unbound-force#868 review feedback from @jflowers. Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
… net The d1 choreography-pins clause now pins the three FR-002 declared invocations verbatim (gh pr view --json ..., gh pr checks --json name,state,bucket,link, and gh run view <RUN_ID> --repo <BASE_REPOSITORY> --log-failed), so the unbound-force#861 rewire of those lines becomes a deliberate, test-visible change on both command copies. The forbidden-verb net adds gh pr update-branch and raw git merge, the latter matched with a boundary regex that rejects hyphenated non-merge subcommands such as git merge-base. Addresses PR unbound-force#868 review feedback from @jflowers. Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
Five learnings distilled from the PR unbound-force#868 round-2 review council (correlation bdfa0501, verdict APPROVE WITH ADVISORIES): - command-design: multi-layer invocation shape threading — a governing rule change must be grepped through every operative writer site, including terminal CHECKPOINT markers that claim parity with an operative step. - command-design: grep every writer site when changing a prescribed data shape; parity claims anchor stale shapes as if correct. - content-pipeline: family-relative disposition rationale carries an implicit expiry — anchor a revisit trigger to the premise-changing event rather than sync-scoped carriers. - command-contract-tests: count pins derived from contiguous grep occurrences undercount when blockquote line-wraps interpose '>' — whitespace normalization preserves the marker. - command-contract-tests: pin the fix's own mechanism in the same commit, deriving clause inventories from post-fix normative text. Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
…r merge) OpenSpec change artifacts for /uf.fix-ci from issue unbound-force#858: the post-PR command that diagnoses failing CI checks from fetched log evidence, classifies each failure as exactly one of code failure, stale branch, conflict, or flaky/infra, rebases the head branch onto base when conflicted or behind (never merging), runs a human-gated fix loop with a review-council gate before any push, offers reruns for flaky/infra failures, and verifies CI ends green. Review council approved the artifacts on iteration 2 (APPROVE WITH ADVISORIES) after the five iteration-1 findings were applied per the human's apply-all decision. Assisted-by: glm-5 Generated with AI assistance (glm-5)
- thread the mandatory human question-tool gate before the rebase (FR-004 requirement + scenario, proposal sequence, task 1.4) and add the FR-006 council gate to FR-005's canonical iteration sequence - record the raw-gh fetch trade-off honestly in design D1 and the proposal's Principle VI assessment (documented deviation, no false PASS claim); file companion issue unbound-force#861 (fetch_pr_review_context extension) and bind it in a new Dependencies section alongside the unbound-force#850 cross-spec coordination note - pin the gh invocations once across FR-002, the proposal, and task 1.2: gh pr view field list with url-derived base repository (gh exposes no baseRepository field), gh pr checks --json name,state,link - extend documentation coverage per FR-012 and tasks 3.1-3.4: AGENTS.md structure count, QUICKSTART.md count, architecture.md Scaffolded Files entry, CHANGELOG.md surface, FR-012 citations and the 3.4->3.3 dependency - task 1.6 cites FR-013/D6 for the rerun offer gate; task 4.3 verifies the honest constitution VI statement
Post-PR CI failures required manual diagnosis and a hand-run fix-commit-push-repoll sequence. Automating that loop behind explicit gates removes the error-prone manual choreography and enforces rebase-only recovery (never merge) so history stays linear and CI re-runs on a clean head. - .opencode/commands/uf.fix-ci.md: /uf.fix-ci [PR_NUMBER] diagnoses failing checks on an open PR and runs a gated fix loop (diagnose -> fix -> commit -> push -> re-poll) with rebase-only conflict recovery and CI re-verification - Byte-identical scaffold mirror (internal/scaffold/assets/opencode/commands/uf.fix-ci.md) with structural pin tests (cmd/unbound-force/main_test.go, internal/scaffold/command_contract_test.go, scaffold_test.go) - Documentation: AGENTS.md, docs/usage.md, docs/architecture.md, QUICKSTART.md, CHANGELOG.md (docs-gate issues unbound-force#862 and unbound-force/website#342 filed) - OpenSpec change artifacts (openspec/changes/uf-fix-ci, 19/19 tasks complete; spec review APPROVE WITH ADVISORIES iter 4, code review APPROVE WITH ADVISORIES iter 2) - 11 Dewey learnings captured during the workflow Assisted-by: glm-5 Generated with AI assistance (glm-5)
… budget
The iteration counter was cleared only in Phase 6, so every
exhaustion exit (4.0 cap check, 4.3 council exhaustion, 4.5
still-red) left ITERATION=3 persisted and a re-invocation
re-stopped at the resume cap - design R4's fresh-budget
recovery was unreachable. Exhaustion exits now record
{"iteration": 3, "budget_exhausted": true}; Phase 4.0 recovery
consumes the marker atomically ({"iteration": 0,
"budget_exhausted": false}) and starts a fresh budget while
mid-invocation resumes inherit the count unchanged; increments
record the full two-field shape (the checkpoint shallow-merges
data); the Phase 1.2 early-green STOP now clears stale loop
state; 4.3, 4.5, 6.1, and Guardrails 5 state the implemented
semantics. Mirror kept byte-identical.
Addresses PR unbound-force#868 review feedback from @jflowers.
Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
design.md: D3 corrected to the implemented fetch (gh pr view exposes no baseRepository field; BASE_REPOSITORY derives from the PR url; three-tier BASE_REMOTE preference) and D8/R4 now document the exhaustion marker and fresh-budget semantics. proposal.md: Dependencies records the unbound-force#861 blocking disposition for further raw-gh-fetch command surface; the impact inventory adds cmd/unbound-force/main_test.go (asset count 75->76, validity range [70,74]->[71,75]); the tutorial disposition now references filed issue unbound-force#870 (re-disposed on review, mirroring the /uf.rebase-pr precedent unbound-force#855). Addresses PR unbound-force#868 review feedback from @jflowers. Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
… net The d1 choreography-pins clause now pins the three FR-002 declared invocations verbatim (gh pr view --json ..., gh pr checks --json name,state,bucket,link, and gh run view <RUN_ID> --repo <BASE_REPOSITORY> --log-failed), so the unbound-force#861 rewire of those lines becomes a deliberate, test-visible change on both command copies. The forbidden-verb net adds gh pr update-branch and raw git merge, the latter matched with a boundary regex that rejects hyphenated non-merge subcommands such as git merge-base. Addresses PR unbound-force#868 review feedback from @jflowers. Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
Ten learnings from the PR 868 review and feedback workflows: four from the /uf.review-pr retrospective (code review, command contract tests, content pipeline, retrospective practice) and six from the /uf.address-feedback Tier 2 panels (checkpoint shallow-merge gotcha, feedback-triage patterns, determinism pin-verification pattern). Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
Five learnings distilled from the PR unbound-force#868 round-2 review council (correlation bdfa0501, verdict APPROVE WITH ADVISORIES): - command-design: multi-layer invocation shape threading — a governing rule change must be grepped through every operative writer site, including terminal CHECKPOINT markers that claim parity with an operative step. - command-design: grep every writer site when changing a prescribed data shape; parity claims anchor stale shapes as if correct. - content-pipeline: family-relative disposition rationale carries an implicit expiry — anchor a revisit trigger to the premise-changing event rather than sync-scoped carriers. - command-contract-tests: count pins derived from contiguous grep occurrences undercount when blockquote line-wraps interpose '>' — whitespace normalization preserves the marker. - command-contract-tests: pin the fix's own mechanism in the same commit, deriving clause inventories from post-fix normative text. Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
18d9938 to
0683ff2
Compare
… budget
The iteration counter was cleared only in Phase 6, so every
exhaustion exit (4.0 cap check, 4.3 council exhaustion, 4.5
still-red) left ITERATION=3 persisted and a re-invocation
re-stopped at the resume cap - design R4's fresh-budget
recovery was unreachable. Exhaustion exits now record
{"iteration": 3, "budget_exhausted": true}; Phase 4.0 recovery
consumes the marker atomically ({"iteration": 0,
"budget_exhausted": false}) and starts a fresh budget while
mid-invocation resumes inherit the count unchanged; increments
record the full two-field shape (the checkpoint shallow-merges
data); the Phase 1.2 early-green STOP now clears stale loop
state; 4.3, 4.5, 6.1, and Guardrails 5 state the implemented
semantics. Mirror kept byte-identical.
Addresses PR #868 review feedback from @jflowers.
Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
design.md: D3 corrected to the implemented fetch (gh pr view exposes no baseRepository field; BASE_REPOSITORY derives from the PR url; three-tier BASE_REMOTE preference) and D8/R4 now document the exhaustion marker and fresh-budget semantics. proposal.md: Dependencies records the #861 blocking disposition for further raw-gh-fetch command surface; the impact inventory adds cmd/unbound-force/main_test.go (asset count 75->76, validity range [70,74]->[71,75]); the tutorial disposition now references filed issue #870 (re-disposed on review, mirroring the /uf.rebase-pr precedent #855). Addresses PR #868 review feedback from @jflowers. Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
… net The d1 choreography-pins clause now pins the three FR-002 declared invocations verbatim (gh pr view --json ..., gh pr checks --json name,state,bucket,link, and gh run view <RUN_ID> --repo <BASE_REPOSITORY> --log-failed), so the #861 rewire of those lines becomes a deliberate, test-visible change on both command copies. The forbidden-verb net adds gh pr update-branch and raw git merge, the latter matched with a boundary regex that rejects hyphenated non-merge subcommands such as git merge-base. Addresses PR #868 review feedback from @jflowers. Signed-off-by: Jay Flowers <[email protected]> Assisted-by: glm-5
Summary
Closes #858
Implemented OpenSpec change
uf-fix-ci: the new post-PR command/uf.fix-ci [PR_NUMBER]that carries a red PR to green end to end. The command (canonical.opencode/commands/uf.fix-ci.md) resolves the target PR (auto-detected when the number is omitted), fetches PR state and the check suite through pinned gh JSON invocations, and STOPs early on CLOSED/MERGED PRs or all-green checks. It diagnoses each failing check from fetched log evidence (gh run view --log-failed) and classifies the root cause as exactly one of code failure, stale branch, conflict, or flaky/infra. A MANDATORY GATE presents the full diagnosis and repair plan through the question tool before any mutation executes. Conflicted or behind branches are rebased onto base (git_fetch → git_rebase, conflict-marker scanning, force-with-lease push) — the never-merge rule is absolute and contract-pinned. Code fixes run through a gated loop — fix, conventionalfix:commit, a/uf.review-councilgate once per iteration, push, CI re-poll — capped at 3 durable iterations; flaky/infra classifications offergh run rerun --failedinstead of a code change; final verification polls CI viauf_finale_ci_polluntil green or timeout. Terminal guardrails forbid merging, approving, or closing the PR.Also ships the byte-identical scaffold mirror (
internal/scaffold/assets/opencode/commands/uf.fix-ci.md), theexpectedAssetPathsmanifest update plus structural pin test ininternal/scaffold(drift, manifest, reverse-drift, and command-contract pins), documentation across AGENTS.md, docs/usage.md, docs/architecture.md, QUICKSTART.md, and CHANGELOG.md, and the two documentation-gate issues (#862 and unbound-force/website#342). All 19 tasks across 4 phases complete.How to Verify
openspec validate uf-fix-ci --type change --strict— warnings-only result (single benign originating_issue WARNING, zero ERRORs).make check— fully green: lint (go vet + golangci-lint),go test -race -count=1 ./..., build, scope-based coverage-gate, and the TypeScript plugin suite.go test ./internal/scaffold/...— drift (TestEmbeddedAssets_MatchSource/TestCanonicalSources_AreEmbedded), manifest (TestAssetPaths_MatchExpected), reverse-drift, and the new structural pin test (TestCommandContracts_FixCiCommandStructure: 14 MANDATORY GATEs, never-merge wording,git_mergeabsent, pinned gh invocations, 3-iteration cap,uf_finale_ci_pollandgh run rerun --failed) all pass.cmp .opencode/commands/uf.fix-ci.md internal/scaffold/assets/opencode/commands/uf.fix-ci.md— byte-identical (no output)./uf.fix-ci <N>on an open PR with failing checks — verify the diagnosis MANDATORY GATE presents before any mutation executes, the rebase path never offers merge, fix commits pass the/uf.review-councilgate before push, and CI is polled to a final green/red report.Test Results
make checkfully green (verified twice at the phase-4 checkpoint): lint, go test -race -count=1, build, coverage-gate, and plugin-test — 39 test files, 1263 tests passing, TypeScript plugin coverage 95.35% statements against the 94% governance floor.Review
Notes
fetch_pr_review_contextwith PR-repair fields.uf/dewey/learnings/)