Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
refactor: simplify PR lookup to single remote with better 404 hint (#1927)
worktrunk-bot7462f1376c73
diff --git a/src/git/remote_ref/github.rs b/src/git/remote_ref/github.rsindex 897632b1c..22efc0922 100644--- a/src/git/remote_ref/github.rs+++ b/src/git/remote_ref/github.rs@@ -118,7 +118,16 @@ fn fetch_pr_info(pr_number: u32, repo: &Repository) -> anyhow::Result<RemoteRefIif !output.status.success() {if let Ok(error_response) = serde_json::from_slice::<GhApiErrorResponse>(&output.stdout) {match error_response.status.as_str() {- "404" => bail!("PR #{} not found", pr_number),+ "404" => {+ bail!(+ "PR #{pr_number} not found on {}/{} ({remote}). \+ If the PR is on a different repository, \+ run `gh repo set-default` to set the default \+ or configure a different primary remote.",+ parsed.owner(),+ parsed.repo(),+ );+ }"401" => bail!("GitHub CLI not authenticated; run gh auth login"),"403" => {let message_lower = error_response.message.to_lowercase();diff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_not_found.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_not_found.snapindex 86c2223d2..e5191f1a3 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_not_found.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_not_found.snap@@ -45,4 +45,4 @@ exit_code: 1----- stderr -----[36m◎[39m [36mFetching PR #9999...[39m-[31m✗[39m [31mPR #9999 not found[39m+[31m✗[39m [31mPR #9999 not found on owner/test-repo (origin). If the PR is on a different repository, run `gh repo set-default` to set the default or configure a different primary remote.[39m