Skip to content

Conversation

@yimingll
Copy link

Summary

Fix undo/revert not working on Windows when project contains non-ASCII filenames (e.g., Chinese, Japanese, Korean characters).

Problem

On Windows, Bun's dollar template literal incorrectly handles variable interpolation, replacing variables with placeholders like ?__bunstr_0 instead of actual values. This causes:

  1. git add . to silently fail adding non-ASCII filenames to snapshot
  2. git checkout / git ls-tree to fail finding files during revert
  3. Undo command only reverts conversation but not code changes

Root Cause

The Bun shell template on Windows fails to interpolate variables correctly.

Solution

Replace all dollar template calls with Bun.spawn() which correctly passes arguments as an array, bypassing shell interpolation issues.

Testing

Tested on Windows 11 with project containing Chinese filenames:

  • git add correctly adds non-ASCII files to snapshot
  • git write-tree returns correct tree hash including all files
  • Undo correctly reverts file changes
  • No regression on ASCII-only filenames

Related Issues

On Windows, Bun's $ template literal incorrectly handles variable interpolation,
replacing variables with placeholders like ?__bunstr_0 instead of actual values.

This causes:
- git add . to silently fail adding non-ASCII filenames to snapshot
- git checkout / git ls-tree to fail finding files during revert
- Undo command only reverts conversation but not code changes

Solution: Replace all $ template calls with Bun.spawn() which correctly
passes arguments as an array, bypassing shell interpolation issues.

Tested on Windows 11 with Chinese filenames - undo now correctly reverts files.
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

PR #9408: test(snapshot): add extended test cases for revert functionality

This PR is related as it addresses snapshot and revert functionality testing, which is directly relevant to the snapshot/revert issues being fixed in PR #9844.

However, this appears to be a test PR rather than a fix for the same issue, so it's more of a complementary PR than a true duplicate.

No duplicate PRs found addressing the same Windows non-ASCII filename snapshot issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant