Skip to content

fix(finale): add mergeability gate when CI checks are not reported - #320

Merged
em-redhat merged 3 commits into
unbound-force:mainfrom
em-redhat:opsx/finale-check-mergeability
Jul 7, 2026
Merged

em-redhat merged 3 commits into
unbound-force:mainfrom
em-redhat:opsx/finale-check-mergeability

Conversation

@em-redhat

Copy link
Copy Markdown
Contributor

Summary

When /finale runs gh pr checks --watch and gets "no checks
reported," it currently accepts this at face value and proceeds
to the summary step. This is incorrect when a merge conflict is
blocking CI from starting -- the agent fabricates a plausible
but wrong explanation instead of surfacing the actual blocker.

This change adds a mergeability gate to /finale step 6 that
investigates why no checks were reported before drawing
conclusions:

  • Step 6a (Mergeability Gate): Queries gh pr view --json mergeable,mergeStateStatus to detect merge conflicts,
    unknown state, or confirmed mergeability
  • Step 6b (Conflict Recovery): When a conflict is detected,
    offers three options: rebase and re-push, stop for manual
    resolution, or continue with explicit warning
  • Step 6c (Workflow Cross-Reference): When mergeable but no
    checks ran, cross-references .github/workflows/ to
    distinguish "no CI configured" from "checks blocked by
    other causes"
  • Step 8 (Summary): Warns when CI was skipped due to merge
    conflict

Fixes #291

How to Test

  1. Read .opencode/commands/finale.md and verify steps
    6a/6b/6c exist with the documented behavior
  2. Run go test -race -count=1 ./... -- all packages pass,
    including scaffold drift detection
  3. Create a PR with a known merge conflict and run /finale
    -- the agent should detect the conflict and offer recovery
    options

How to Demo

  1. On any hero repo with CI configured, create a branch that
    conflicts with main (e.g., edit the same line in a shared
    file on both branches)
  2. Push the branch and run /finale
  3. Observe that step 6 now detects the merge conflict and
    presents three recovery options instead of silently
    proceeding

Key Files Changed

  • .opencode/commands/finale.md -- Added steps 6a/6b/6c
    (mergeability gate, conflict recovery, workflow
    cross-reference) and step 8 conflict warning
  • internal/scaffold/assets/opencode/commands/finale.md --
    Synced scaffold asset
  • openspec/changes/finale-check-mergeability/ -- Change
    artifacts (proposal, design, specs, tasks)

This PR was generated by /finale (AI-assisted).

- Add step 6a: query PR mergeability via gh pr view
  when gh pr checks returns "no checks reported"
- Add step 6b: conflict recovery options (rebase,
  manual resolve, continue with warning)
- Add step 6c: workflow file cross-reference to
  distinguish "no CI" from "checks blocked"
- Update step 8 summary to warn when CI was skipped
- Sync scaffold asset to match source
- Add OpenSpec change artifacts (proposal, design,
  specs, tasks)

Fixes unbound-force#291

Assisted-by: claude-opus
Generated with AI assistance (claude-opus)
Comment thread .opencode/commands/finale.md Resolved
Comment thread .opencode/commands/finale.md Resolved
Comment thread .opencode/commands/finale.md Resolved
Comment thread .opencode/commands/finale.md Resolved
Comment thread .opencode/commands/finale.md Resolved
…r-vaughan

- Use dynamic target branch resolution instead of
  hardcoded origin/main (respects fork detection and
  PR baseRefName)
- Add merge-based conflict resolution option that
  avoids force push for restricted environments
- Require explicit user confirmation before executing
  rebase or merge operations
- Replace gh pr checks --watch with bash poll loop
  after conflict resolution to avoid wasting tokens
- Move force-push and rebase mandates to Guardrails
  section for stronger instruction adherence
- Update FR-002 spec to reflect 4-option recovery
  flow and dynamic branch resolution

Assisted-by: claude-opus
Generated with AI assistance (claude-opus)
@em-redhat
em-redhat requested a review from trevor-vaughan July 3, 2026 07:34
em-redhat added a commit that referenced this pull request Jul 6, 2026
- Add option 5 to step 6b conflict recovery menu: spawn
  cobalt-crush-dev sub-agent for AI-assisted resolution
- Include mergeability gate (6a), conflict recovery (6b),
  and workflow cross-reference (6c) from PR #320 baseline
- Add user approval gate, failure handling with merge abort,
  and post-resolution CI polling
- Add guardrails for force push safety and sub-agent approval
- Sync embedded scaffold asset
- Create OpenSpec change artifacts (proposal, design, specs,
  tasks)

Closes #325

Assisted-by: claude-opus-4
Generated with AI assistance (claude-opus-4)
…ergeability

# Conflicts:
#	.opencode/commands/finale.md
#	internal/scaffold/assets/opencode/commands/finale.md

@trevor-vaughan trevor-vaughan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@em-redhat
em-redhat merged commit 67b4972 into unbound-force:main Jul 7, 2026
14 checks passed
@em-redhat
em-redhat deleted the opsx/finale-check-mergeability branch July 7, 2026 12:28
@em-redhat em-redhat moved this from In Review 👀 to Done ✔️ in Unbound Force Planning Jul 7, 2026
jflowers added a commit to jflowers/unbound-force that referenced this pull request Oct 24, 2026
…sync docs record

Council iteration 2 advisories: add the missing uf_finale_base_state
terminal-write hygiene test (ninth tool in the Requirement 1 suite),
record the DE-007 layer-3 round-trip N/A on task 3.2, correct the D8
cross-reference enumeration to twelve sibling changes (grep widened to
pre-rename `/finale` spellings and step-count phrasings), state the
absent-sync-base-checkpoint fallback in step 4, and sync the
user-facing record (usage.md, CHANGELOG, gate issues unbound-force#810/unbound-force#320) to the
both-codes base-state soft gate.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
jflowers added a commit that referenced this pull request Oct 24, 2026
…sync docs record

Council iteration 2 advisories: add the missing uf_finale_base_state
terminal-write hygiene test (ninth tool in the Requirement 1 suite),
record the DE-007 layer-3 round-trip N/A on task 3.2, correct the D8
cross-reference enumeration to twelve sibling changes (grep widened to
pre-rename `/finale` spellings and step-count phrasings), state the
absent-sync-base-checkpoint fallback in step 4, and sync the
user-facing record (usage.md, CHANGELOG, gate issues #810/#320) to the
both-codes base-state soft gate.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

finale: gh pr checks misinterpreted when checks await conflict resolution

2 participants