Repository navigation
Find a PR by the name its branch was pushed under - #920
Conversation
Under the default push.default, gh resolves no push destination for a branch whose upstream goes by another name, so it queries the local name and misses. The fallback fails closed rather than guess: a default-branch or other-repository upstream yields nothing, since a branch cut from origin/main tracks main without being its PR. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
PR Summary by QodoDetect GitHub PRs by tracked remote branch name
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Code Review by Qodo
1. Git tests bypass the process limit
|
|
|
||
| namespace Capacitor.Cli.Tests.Unit.PrDetection; | ||
|
|
||
| public class TrackedBranchTests { |
There was a problem hiding this comment.
1. Git tests bypass the process limit 📘 Rule violation ▣ Testability
TrackedBranchTests creates repositories through GitRepo.CreateWithCommit() but declares the class without [ParallelLimiter<SubprocessLimit>]. Its setup and several tests execute real git children, so parallel test execution bypasses the suite-wide subprocess pool.
Agent Prompt
## Issue description
`TrackedBranchTests` runs real Git subprocesses without participating in the test suite's shared subprocess limit.
## Fix Focus Areas
- test/Capacitor.Cli.Tests.Unit/PrDetection/TrackedBranchTests.cs[5-5]
## Recommended Fix
Add `[ParallelLimiter<SubprocessLimit>]` immediately above the test class so all tests in the fixture draw from the shared subprocess pool.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| /// cannot resolve a push destination and falls back to the local name. Real git answers the | ||
| /// branch-config probes; only gh is faked. | ||
| /// </summary> | ||
| public class RepositoryDetectionTrackedBranchTests { |
There was a problem hiding this comment.
2. Repository tests evade the process cap 📘 Rule violation ▣ Testability
RepositoryDetectionTrackedBranchTests declares no [ParallelLimiter<SubprocessLimit>] despite using GitRepo.CreateWithCommit() and forwarding non-gh commands to RepositoryDetection.DefaultRunner. Repository setup, the push-destination assertion, and detection probes therefore launch real git children outside the shared concurrency pool.
Agent Prompt
## Issue description
`RepositoryDetectionTrackedBranchTests` executes real Git commands without participating in the test suite's shared subprocess limit.
## Fix Focus Areas
- test/Capacitor.Cli.Tests.Unit/RepositoryDetectionTrackedBranchTests.cs[12-12]
## Recommended Fix
Add `[ParallelLimiter<SubprocessLimit>]` immediately above the test class so its repository setup and detection probes use the shared subprocess pool.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f23a7657e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!CommandArgument.IsPlain(host) || !CommandArgument.IsPlain(owner) | ||
| || !CommandArgument.IsPlain(repo) || !CommandArgument.IsPlain(branch)) { |
There was a problem hiding this comment.
Allow valid dot-prefixed repository names
For a valid GitHub repository whose name begins with a dot—most notably an organization’s .github repository—GitUrlParser supplies .github here, but IsPlain(repo) rejects it and the fallback never invokes gh, so PRs pushed under another branch name remain undetected. The local gh pr view --help describes --repo [HOST/]OWNER/REPO; because the constructed argument begins with the host, a dot at the start of the repository component cannot be interpreted as an option. Validate the composite repository argument separately rather than applying the branch-leading-character restriction to every component.
Useful? React with 👍 / 👎.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
No shell is involved, so the argument gate only has to stop a value splitting or re-quoting: rejecting '%' or a leading dot cost an organisation's .github repository its fallback. gh reads an all-digit selector as a PR number, so a branch named 123 asked for PR #123 and the head check then refused the answer — a round trip spent to learn nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Closes #896 — AI-2714
What & why
A session whose branch was pushed under another name was never linked to its PR. An argument-free
gh pr viewlooks for the branch git would push to, and under the defaultpush.default=simpleabranch whose upstream goes by another name has no push destination — so gh queries the local name
and finds nothing, once a minute, for the life of the PR. On a miss, detection now asks for the
tracked remote branch by name, pinned to the session's repository with
--repo, and takes only asame-repository head of exactly that name.
Where to look
The fallback fails closed rather than guess: an upstream on another repository's remote, the
remote's default branch, or a remote whose default is unknown yields nothing, because a branch cut
from
origin/maintracksmainwithout being its PR. A branch tracking a long-lived non-defaultbranch (
develop, with an opendevelop→mainPR) is still linked to that PR, which is whatghitself does under
push.default=upstream. GitLab keeps querying by the local branch name.Verification
gh pr view desktop-remote-control-slice2 --repo github.com/kurrent-io/kcap-cli --json number,headRefName,isCrossRepositoryreturns #874 — the lookup the issue's session needed, and thecommand shape the fallback builds. The new tests drive real git repositories with only
ghfaked,and assert the precondition gh trips on (
git rev-parse --symbolic-full-name '@{push}'exitsnon-zero) so they cannot pass vacuously; each guard was watched failing before its code existed.
Capacitor.Cli.Tests.Unitdotnet publish -c Releasescripts/check-linear-ids.sh🤖 Generated with Claude Code