Skip to content

fix(orch): prefer active PR over branch history - #684

Open
rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/orch-reused-branch-frontier
Open

rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/orch-reused-branch-frontier

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 16, 2026 •

Copy link
Copy Markdown

After a stacker closes an obsolete PR and creates a replacement from the same branch, orch frontier set rejects that branch because its all-state forge query returns both PRs. The suggested recovery, closing stale PRs, cannot clear the error because closed rows are still included.

Prefer the sole OPEN PR when selecting a branch anchor. Retain closed and merged anchors when no active PR exists, and continue rejecting multiple active PRs. Both GitHub and Origin use the same policy. Regenerate the Claude Code harness.

Verification: real local Git stacks with fixture forge executables reproduce two baseline failures (GitHub and Origin), with 19 controls passing. Fixed source passes all 72 native script tests using Bun 1.4.3 with a 30-second per-test timeout. Coverage includes closed and merged branch history, active ambiguity, historical chain anchors, and optional frontier pins. Strict typecheck, plugin validator, generated harness check, and diff whitespace check pass. No hosted mutations or credentials are used by tests.

AI assistance: Codex implementation and local verification.


Note

Medium Risk
Changes how orch frontier set resolves branch anchors in the PR base chain; incorrect selection could mis-pin the frontier, but behavior is narrow and covered by new tests.

Overview
Frontier resolution no longer treats every PR returned by an all-states --head query as competing anchors on the same branch. branchPullRequest now picks the sole OPEN PR when one exists (e.g. after closing an obsolete PR and opening a replacement on the same branch), and only falls back to closed/merged rows when there is no active PR—preserving historical chain anchors after stack surgery.

The multiple PR error applies to that candidate set (multiple open PRs still fail). Tests cover GitHub and Origin for replacement PRs alongside closed/merged history and for rejecting two open PRs on one branch.

Reviewed by Cursor Bugbot for commit 0dc8625. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Rudy Celekli <rudycelekli@users.noreply.github.com>
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