#2066

Windows: Space Git history/binding fails when the user profile path contains non-ASCII characters (Git output decoded with the locale codec)

Openmevironopened 26d ago

Environment

  • Eigent Desktop 1.0.6 (Windows installer, Eigent.Setup.1.0.6.exe)
  • Windows 11 Pro, build 26300, system locale ru-RU
  • Bundled Git 2.55.0.windows.3 (resources/prebuilt/mingit/cmd/git.exe)
  • Windows profile path contains non-ASCII characters: C:\Users\Алексей

Summary

With a non-ASCII user profile path, every Git-backed workspace operation fails. The Git repository for a Space can never be initialized, so the Space never gets a bound local workspace: GET /spaces/{space_id}/workspace-configuration keeps answering 404 workspace_binding_not_found, and the Space settings page renders only section headers with empty values (Draft version, Profile, Approval mode, Track Space in Git, Remote access policy, Model, Reasoning effort).

This affects any Windows user whose profile directory is not ASCII (Cyrillic, Greek, CJK, accented Latin, ...), which is a large share of non-English installations.

Steps to reproduce

  1. Use a Windows account whose profile path contains non-ASCII characters, e.g. C:\Users\Алексей.
  2. Launch Eigent 1.0.6, create a Space (blank) and open its Space settings tab.

Actual result

  • Backend log: GitBackendError: Git init did not create the expected repo
  • POST /workspace/scratch → 409 workspace_version_history_init_failed
  • GET /spaces/{space_id}/workspace-configuration → 404 workspace_binding_not_found
  • Space settings page: section titles are rendered, values are empty. No space_<id> folder is ever created under the Brain workspace.

Expected result

The Space gets bound and its version history is initialized, regardless of the user name.

Root cause

app/workspace_git/backend.py runs Git with LC_ALL=C and then reads its stdout in text mode without an explicit encoding (encoding=None), so Python decodes it with the system locale codec (cp1251 here):

# app/workspace_git/backend.py, _run() (~line 1779)
completed = subprocess.run(
    command,
    check=False,
    capture_output=True,
    text=not preserve_newlines,
    encoding=None if preserve_newlines else encoding,   # None -> locale codec
    ...
)

Git emits the repository path in UTF-8, so the decoded string is mojibake and the ownership check in probe() fails:

# app/workspace_git/backend.py, probe() (~line 394)
repository_root = Path(top.stdout.strip()).expanduser().resolve()
owns_root = repository_root == requested   # False for C:\Users\Алексей\...

init_repository() then raises (~line 438):

if not after.is_repository or not after.owns_requested_root:
    raise GitBackendError("Git init did not create the expected repo")

and app/controller/workspace_controller.py (~lines 291-298) converts it into 409 workspace_version_history_init_failed.

Evidence

Reproduced outside the app with the bundled Git and the backend virtualenv interpreter:

locale encoding : cp1251
raw bytes       : b'C:/Users/\xd0\xa0\xd1\x92\xd0\xa0\xc2\xbb...'   (double-encoded)
match (locale)  : False

--- with PYTHONUTF8=1 (Python UTF-8 mode) ---
raw bytes       : b'C:/Users/\xd0\x90\xd0\xbb\xd0\xb5\xd0\xba...'   (correct UTF-8)
match (locale)  : True

Setting the user environment variable PYTHONUTF8=1 and restarting the app fixes the failure completely: the Space is bound, the Git repository is created, and the empty root commit Initialize Eigent Space version history is present. The Space settings page then loads all values.

Suggested fix

  • Pass encoding="utf-8", errors="replace" to the Git subprocess calls (both subprocess.run in _run() and the direct subprocess.Popen call sites in the same module), or run the backend in UTF-8 mode — the Electron host already sets PYTHONIOENCODING=utf-8 but not PYTHONUTF8, and PYTHONIOENCODING does not affect subprocess text mode.
  • Compare the resolved paths case-insensitively (e.g. os.path.normcase) before treating a repository as not owned.

Workaround for users

Set PYTHONUTF8=1 as a user environment variable and restart Eigent.

Activity

0

No activity yet.