Skip to content

flow next: find a PR pushed under a different public branch name - #15

Merged
TomasPalsson merged 2 commits into
mainfrom
fix/router-pr-by-upstream
Sep 29, 2026
Merged

TomasPalsson merged 2 commits into
mainfrom
fix/router-pr-by-upstream

Conversation

@TomasPalsson

@TomasPalsson TomasPalsson commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

What breaks

In stealth mode /flow:next ships with git push -u <remote> HEAD:<plain-name> and gh pr create --head <owner>:<plain-name>, often from a fork. The router's prNumber only runs gh pr view <local-branch>, so a PR opened from local flow/office-previews under the public head TomasPalsson:feat/storage-backed-office-previews is never found, and flow next stays in shippable ("no PR … opening it") after the PR exists.

After this change

prNumber still tries gh pr view <local-branch> first. When that finds nothing, it reads the branch's upstream (branch.<b>.merge, branch.<b>.remote), takes the owner from that remote's URL (git@host:Owner/Repo, https://host/Owner/Repo, ssh://git@host/Owner/Repo), and runs gh pr list --head <upstream-name> --state all, keeping only a PR whose head repository belongs to that owner. No upstream, no parseable owner, or any gh failure → no PR, as before.

--author @me was deliberately not used: in a transferred repository (LibreChat-AI/LibreChat) it returned no PRs at all, including the user's own.

Tests

  • TEST_ONLY=test_next.sh bash plugins/flow/scripts/tests/run.sh → 182 passed, 0 failed (178 before; new test failed first).
  • New test: no upstream → shippable; upstream with an unparseable remote URL → shippable; upstream on git@github.com:someone/repo.git with a stubbed gh → shipped, PR #77.
  • Real check: on the branch above, flow next now reports shipped with the opened PR's number. The https:// and ssh:// URL forms are covered by reading the regex only.

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