From 57db4e81b1077fba93a028087a9edf9bdd60bbcd Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Thu, 21 May 2026 00:09:32 -0400 Subject: [PATCH] [INITIAL] Delegate to gh pr checkout instead of silently continuing When a PR ref doesn't look like a ghstack reference (i.e., it lacks the /head suffix pattern), we previously just logged a warning and continued execution, which would likely fail or produce confusing results. Now we log that we're delegating, invoke `gh pr checkout` to handle the non-ghstack PR, and return early. [ghstack-poisoned] --- src/ghstack/checkout.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ghstack/checkout.py b/src/ghstack/checkout.py index 72fd152..2023b3a 100644 --- a/src/ghstack/checkout.py +++ b/src/ghstack/checkout.py @@ -52,8 +52,11 @@ async def main( orig_ref = re.sub(r"/head$", "/orig", head_ref) if orig_ref == head_ref: logging.warning( - "The ref {} doesn't look like a ghstack reference".format(head_ref) + "The ref {} doesn't look like a ghstack reference; " + "delegating to gh pr checkout".format(head_ref) ) + await sh.ash("gh", "pr", "checkout", pull_request.lstrip("#")) + return # TODO: Handle remotes correctly too (so this subsumes hub)