Summary
PR fetching and review execution are coupled in confusing ways:
inspect pr <n> local mode asks gh pr view for baseRefName and headRefName, then analyzes base..head locally. If the head branch is not fetched locally, analysis fails with a revspec error.
inspect pr <n> --remote owner/repo means “fetch PR files through the GitHub API.”
inspect review <n> --remote owner/repo means “submit hosted review to the inspect API,” requiring inspect login / INSPECT_API_KEY.
This makes the useful combination “fetch a PR from GitHub, then review locally with my local LLM provider” hard or impossible from the CLI.
Actual behavior
Local PR mode can fail for unfetched branches:
$ inspect pr 12345
error: git error: revspec '<head-branch-name>' not found
The workaround is manual git plumbing such as:
git fetch origin pull/12345/head:inspect-pr-12345
But switching to --remote changes behavior depending on the command. For inspect pr, it fetches contents through GitHub. For inspect review, it routes to hosted review rather than local review.
Expected behavior
Separate these concerns explicitly:
- PR content source: local refs vs GitHub API vs explicit base/head SHAs.
- Review engine: local LLM provider vs hosted inspect API.
Possible CLI shape:
inspect pr 123 --fetch github --remote owner/repo
inspect review 123 --fetch github --remote owner/repo --provider anthropic
inspect review 123 --engine hosted --remote owner/repo
Also, local inspect pr <n> could use gh pr view --json baseRefOid,headRefOid and either:
- analyze by SHA if both objects are present, or
- fetch
pull/<n>/head automatically, or
- produce an actionable message with the exact fetch command.
Likely cause
inspect pr local mode uses branch names from gh pr view --json baseRefName,headRefName and feeds them directly into DiffScope::Range. inspect review overloads --remote to mean hosted review.
Relevant code:
crates/inspect-cli/src/commands/pr.rs: local PR mode
crates/inspect-cli/src/commands/review.rs: if args.remote.is_some() { return run_remote(args).await; }
Summary
PR fetching and review execution are coupled in confusing ways:
inspect pr <n>local mode asksgh pr viewforbaseRefNameandheadRefName, then analyzesbase..headlocally. If the head branch is not fetched locally, analysis fails with a revspec error.inspect pr <n> --remote owner/repomeans “fetch PR files through the GitHub API.”inspect review <n> --remote owner/repomeans “submit hosted review to the inspect API,” requiringinspect login/INSPECT_API_KEY.This makes the useful combination “fetch a PR from GitHub, then review locally with my local LLM provider” hard or impossible from the CLI.
Actual behavior
Local PR mode can fail for unfetched branches:
The workaround is manual git plumbing such as:
But switching to
--remotechanges behavior depending on the command. Forinspect pr, it fetches contents through GitHub. Forinspect review, it routes to hosted review rather than local review.Expected behavior
Separate these concerns explicitly:
Possible CLI shape:
Also, local
inspect pr <n>could usegh pr view --json baseRefOid,headRefOidand either:pull/<n>/headautomatically, orLikely cause
inspect prlocal mode uses branch names fromgh pr view --json baseRefName,headRefNameand feeds them directly intoDiffScope::Range.inspect reviewoverloads--remoteto mean hosted review.Relevant code:
crates/inspect-cli/src/commands/pr.rs: local PR modecrates/inspect-cli/src/commands/review.rs:if args.remote.is_some() { return run_remote(args).await; }