[Codex Security] Workspace fails on Japanese Windows when Git commit subject contains non-ASCII characters

Open 💬 0 comments Opened Jun 24, 2026 by mtmtyu

What issue are you seeing?

When attempting to open the Codex Security workspace, workspace creation fails while inspecting the target repository’s Git metadata.

On Japanese Windows, opening a Codex Security workspace fails when the repository’s HEAD commit subject contains Japanese characters.

Codex Security runs Git through Python with text=True but without an explicit encoding. Git returns the commit subject as UTF-8, while Python decodes it using the Windows default encoding, CP932.

This first causes a UnicodeDecodeError. Because the subprocess reader then leaves stdout as None, a secondary AttributeError occurs.

Environment:
Windows 11 Pro, Japanese locale
Python preferred encoding: cp932
Codex Version 26.616.81150 • Released 2026/06/24
Codex Security plugin: 0.1.10
Example HEAD subject: docs: おすすめ機能のアルゴリズム仕様書を更新

Full error:

Exception in thread Thread-11 (_readerthread):
Traceback (most recent call last):
  File "C:\Users\<USER>\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\Lib\threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "C:\Users\<USER>\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\Lib\threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\<USER>\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\Lib\subprocess.py", line 1599, in _readerthread
    buffer.append(fh.read())
                  ^^^^^^^^^
UnicodeDecodeError: 'cp932' codec can't decode byte 0x83 in position 22: illegal multibyte sequence

Traceback (most recent call last):
  File "C:\Users\<USER>\.codex\plugins\cache\openai-curated-remote\codex-security\0.1.10\scripts\workbench_db.py", line 3643, in <module>
    main()
  File "C:\Users\<USER>\.codex\plugins\cache\openai-curated-remote\codex-security\0.1.10\scripts\workbench_db.py", line 3580, in main
    result = create_workspace(connection, args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<USER>\.codex\plugins\cache\openai-curated-remote\codex-security\0.1.10\scripts\workbench_db.py", line 1164, in create_workspace
    inspected = inspect_setup_values(
                ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<USER>\.codex\plugins\cache\openai-curated-remote\codex-security\0.1.10\scripts\workbench_db.py", line 873, in inspect_setup_values
    require_scannable_target(target)
  File "C:\Users\<USER>\.codex\plugins\cache\openai-curated-remote\codex-security\0.1.10\scripts\workbench_db.py", line 935, in require_scannable_target
    metadata = git_target_metadata(target)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<USER>\.codex\plugins\cache\openai-curated-remote\codex-security\0.1.10\scripts\workbench_target.py", line 441, in git_target_metadata
    "commitSubject": git_output(target, "show", "-s", "--format=%s", "HEAD"),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<USER>\.codex\plugins\cache\openai-curated-remote\codex-security\0.1.10\scripts\workbench_target.py", line 27, in git_output
    output = completed.stdout.strip()
             ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'strip'

What steps can reproduce the bug?

  1. Use Windows with a Japanese locale where Python’s preferred encoding is CP932.
  2. Create a Git repository.
  3. Create a commit whose subject contains Japanese characters.
  4. Run a Codex Security scan and attempt to open its workspace.
  5. Workspace creation fails while reading the HEAD commit subject.

Example PowerShell reproduction:

git init codex-security-encoding-repro
Set-Location codex-security-encoding-repro

Set-Content README.md "# Test"
git add README.md
git commit -m "docs: 日本語のコミットメッセージ"

python -c "import locale; print(locale.getpreferredencoding(False))"
# cp932

python -c "import subprocess; print(subprocess.run(['git', 'show', '-s', '--format=%s', 'HEAD'], capture_output=True, text=True).stdout)"

The final command raises:
UnicodeDecodeError: 'cp932' codec can't decode byte ...: illegal multibyte sequence

What is the expected behavior?

Codex Security should successfully open and scan repositories whose Git metadata contains non-ASCII characters, regardless of the Windows system locale.

Additional information

This appears related to #14311, which reports the same implicit text=True encoding problem in a different Codex Python component.

View original on GitHub ↗