Skip to content

Handle unborn branches in VCS status#3046

Open
zzjin wants to merge 1 commit into
pingdotgg:mainfrom
zzjin:fix-unborn-branch-remote-status
Open

Handle unborn branches in VCS status#3046
zzjin wants to merge 1 commit into
pingdotgg:mainfrom
zzjin:fix-unborn-branch-remote-status

Conversation

@zzjin

@zzjin zzjin commented Jun 11, 2026

Copy link
Copy Markdown

Summary

  • read the current branch for remote status with git symbolic-ref so newly initialized repositories without commits are supported
  • preserve detached HEAD handling by treating it as no branch instead of turning the commit hash into a branch name
  • update telemetry branch collection to tolerate unborn branches and detached HEADs

Closes #3045.

Testing

  • pnpm fmt:check
  • pnpm --filter t3 test -- GitVcsDriverCore.test.ts

Note: local verification emitted the repository's existing unsupported-engine warning because this environment uses Node v26.1.0 while the root package requests Node ^24.13.1.


Open in Devin Review

Note

Medium Risk
Changes how branch is derived for remote status (null on detached HEAD vs "HEAD") and alters git failure paths; limited scope but may affect UI or consumers of statusDetailsRemote.

Overview
Remote VCS status and Alchemy telemetry now resolve the current branch with git symbolic-ref --quiet --short HEAD instead of git rev-parse --abbrev-ref HEAD, so freshly initialized repos with no commits (unborn branches) still report a branch name.

In readStatusDetailsRemote, when symbolic-ref fails, the driver checks git rev-parse --verify --quiet HEAD and only errors if both fail; otherwise it treats the repo as valid (e.g. unborn). Detached HEAD is reported as branch: null rather than the string "HEAD".

A new integration test covers statusDetailsRemote on an initialized repo with no commits.

Reviewed by Cursor Bugbot for commit a53c8a0. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Handle unborn branches in VCS status by switching to git symbolic-ref

  • Replaces git rev-parse --abbrev-ref HEAD with git symbolic-ref --quiet --short HEAD in GitVcsDriverCore.ts for branch discovery, which correctly handles unborn branches (repos with no commits).
  • When symbolic-ref fails (e.g. detached HEAD), a fallback git rev-parse --verify --quiet HEAD check runs; only if both fail does the function return an error. Branch is set to null when symbolic-ref fails but HEAD is still valid.
  • Adds a test case for empty repositories in GitVcsDriverCore.test.ts asserting isRepo: true, branch equals the symbolic-ref output, and hasUpstream: false.
  • Behavioral Change: statusDetailsRemote no longer errors on detached HEAD or unborn branches; it now returns branch: null in those cases instead.

Macroscope summarized a53c8a0.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 80323818-0b2e-4dc3-9985-3226a17deada

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jun 11, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c6e560c. Configure here.

Comment thread .repos/alchemy-effect/packages/alchemy/src/Telemetry/Attributes.ts Outdated
Comment thread .repos/alchemy-effect/packages/alchemy/src/Telemetry/Attributes.ts Outdated
Comment thread .repos/alchemy-effect/packages/alchemy/src/Telemetry/Attributes.ts
@macroscopeapp

macroscopeapp Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

Unable to check for correctness in a53c8a0. This PR changes runtime behavior for how VCS status handles unborn branches (returning valid status instead of erroring). There is also an unresolved review comment about Windows compatibility in the telemetry file that should be addressed before merging.

You can customize Macroscope's approvability policy. Learn more.

@zzjin zzjin force-pushed the fix-unborn-branch-remote-status branch from c6e560c to a53c8a0 Compare June 11, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VCS remote status fails in newly initialized repositories with no commits

1 participant