Repository navigation
Conversation
…ry remote Git status and the ref list reported hasPrimaryRemote only when a remote was named origin. In a clone made with --origin <name>, or after renaming origin, the Git menu hid Push and Create PR and offered "Publish repository" instead, even though the push path already falls back to the first remote through resolvePrimaryRemoteName. Report a primary remote whenever any remote exists, which matches the remote that push resolves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps STATUS_ORIGIN_EXISTS_CACHE_TTL so the change does not conflict with open PRs that edit the neighboring constants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This small server-side fix aligns remote detection with the existing push fallback, allowing repositories with a non-origin remote to use the existing Push and Create PR actions instead of being treated as unpublished. Cache behavior and no-remote handling remain unchanged, and a focused regression test covers the affected case. Notes:
You can add or adjust custom eligibility rules. Learn more. |
Contributor
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Git status and the ref list report
hasPrimaryRemoteonly when a remote is namedorigin. A repo cloned withgit clone --origin github, or one whereoriginwas renamed, has a remote but getsfalse. On an unpushed branch the Git action menu then has no Push or Create PR entries, and the quick action becomes "Publish repository", which creates a new hosted repository and adds anoriginremote.The server can already push in this setup.
pushCurrentBranchpicks the remote withresolvePushRemoteName, which falls back throughresolvePrimaryRemoteNameto the first remote when there is noorigin. Only the flag the client reads still requiresorigin.Repro on main: clone any repo with
--origin github, create a branch, commit, and open the project. The Git control offers "Publish repository".Change
In
GitVcsDriverCore.ts:git remoteand reports a primary remote when any name is listed, instead ofgit remote get-url origin. The uncached path uses the existinglistRemoteNames. The cache keeps its TTL and invalidation and is renamed fromoriginExistsCachetoprimaryRemoteExistsCache.hasPrimaryRemote: remoteNames.length > 0instead ofremoteNames.includes("origin").This is the same rule
resolvePrimaryRemoteNameuses for push:originif it exists, otherwise the first remotegit remotelists. With several remotes and noorigin, push keeps its current choice (branch.<name>.pushRemote, thenremote.pushDefault, then that first remote); this PR does not change it. A repo with no remotes still reportsfalse, so "Publish repository" still shows there. No web, contract or schema change.Scope and approval
Small focused fix of a contract mismatch: the server reports "no primary remote" for a repo it will push to. #15373 reported this setup (the only remote is named
fork), and the maintainer triage on 2026-10-03 called it "a real lookup bug". It closed on 2026-10-18 with #20412, which fixed the PR lookup and fork detection for the only remote. This PR fixes the menu gate for the same setup.#642 added the
origingate when push and PR creation neededorigin. They no longer do, as above. The open fork-checkout report #17314 describes other callers that resolve a "primary remote"; this change makes the menu gate agree with the existing push rule (resolvePrimaryRemoteName) rather than adding a new rule.Prior PRs: none attempted this change. #15403 (closed) changed only the PR lookup in
GitManager.ts.Verification
New test in
apps/server/src/vcs/GitVcsDriverCore.test.ts, "treats a repository's only non-origin remote as its primary remote": a repo whose only remote isgithubmust reporthasOriginRemotefrom status details andhasPrimaryRemotefromlistRefs. Each assertion fails on main by itself (expected false to equal true) and passes on this branch.Other checks from
apps/serveron Linux x64, Node 24.22.0:vp test runonGitVcsDriverCore.test.ts,GitManager.test.ts,GitWorkflowService.test.tsandSourceControlRepositoryService.test.ts: 4 files, 384 tests passed.tsc-rs --noEmit: exit 0.vp fmt --checkandvp linton both files: clean (two existing lint warnings on lines this PR does not touch).Browser check: a real Chromium at 1440x900 against a dev build (
scripts/dev-runner.ts dev) with fresh state. First the build was main, then this branch. The project is a clone whose only remote isgithub(URLhttps://github.com/demo/demo-project.git, rewritten to a local bare repo), with one unpushed commit onfeature/greeting.Before, main: the quick action is "Publish repository" and the menu offers only Commit and Publish repository.
After, this branch: the quick action is "Push & create PR" and the menu has Commit, Push and Create PR.
Clicking Push on the branch build pushed to the existing
githubremote and set the upstream togithub/feature/greeting. It did not create anoriginremote.Not checked:
refs/remotes/origin/HEAD, so in these repos no branch is marked default. That is a separate change.Production fix, tests, PR description and images written with Claude Opus 5.5 in T3 Code Nightly.
🤖 Generated with Claude Opus 5.5 in T3 Code Nightly