Skip to content

fix(vscode): support workspace review before first commit - #515

Merged
lizhengfeng101 merged 1 commit into
alibaba:mainfrom
LKL-ZREO:codex/fix-vscode-unborn-head
Jul 27, 2026
Merged

fix(vscode): support workspace review before first commit#515
lizhengfeng101 merged 1 commit into
alibaba:mainfrom
LKL-ZREO:codex/fix-vscode-unborn-head

Conversation

@LKL-ZREO

@LKL-ZREO LKL-ZREO commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Description

Workspace review currently fails in a newly initialized Git repository before its first commit. git diff --name-status HEAD cannot resolve an unborn HEAD; because it runs inside Promise.all, the rejection also discards the successfully collected untracked files and clears workspaceFiles. As a result, the VS Code extension disables starting a review even when the repository contains staged or untracked changes.

This change:

  • treats a failed HEAD diff as unavailable and reuses the existing cached diff fallback;
  • continues to include untracked files in workspace review;
  • preserves the existing behavior for repositories with commits;
  • aligns VS Code workspace discovery with the CLI's existing fallback semantics;
  • adds regression coverage using a real Git repository without any commits.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

Automated checks:

  • yarn install --frozen-lockfile
  • yarn lint
  • yarn compile
  • yarn build
  • Regression test for staged and untracked files before the first commit
  • All other VS Code test suites pass locally

The full test run on Windows has one pre-existing failure in
CliService.isAvailable related to spawning npm; this is unrelated to this
change and is being addressed by #490. The new regression test passes, and the
remaining 88 tests pass locally.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective
  • I have updated the documentation accordingly (not applicable: no user-facing API or workflow change)
  • I have signed the CLA

Related Issues

N/A. Follow-up to #334.

@CLAassistant

CLAassistant commented Jul 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: No comments generated. Looks good to me.

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@lizhengfeng101
lizhengfeng101 merged commit 90d9786 into alibaba:main Jul 27, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants