Repository navigation
Preserve Unicode Git and GitHub names under legacy locales - #1907
Conversation
Architecture-Review: unchanged; filesystem paths and refs round-trip native Git bytes and GitHub keeps its UTF-8 transport. Co-Authored-By: Codex <noreply@openai.com>
…1504-1505-legacy-locale-v2
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the merge retains the existing Git and GitHub transport boundaries. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on 487048fe429f23ec53fc505b59509119b9be1d40, 94.2s: request_changes (0 critical, 1 important, 2 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| existing = _sync_task_narrative(wt, pr.body or "") if pr is not None else None | ||
| body = _pr_body(wt, head, config, existing) | ||
| force_lease = False | ||
| git_branch = os.fsdecode(branch.encode("utf-8", "surrogateescape")) |
There was a problem hiding this comment.
suggestion: Unicode↔Git-native name conversion is repeated by hand in five places
The same idiom is written out at five sites:
os.fsdecode(x.encode("utf-8", "surrogateescape"))at cli.py:712, cli.py:1853 and github.py:1479.- The reverse,
os.fsencode(x).decode("utf-8", "surrogateescape"), at worktree.py:308 and worktree.py:355.
branch() now returns either form depending on the native flag, so every new Git call that takes a task-branch name must remember to convert it. If one forgets, it crashes with UnicodeEncodeError under a legacy locale.
The same gap already exists for the configured base branch. The TOML-sourced base_branch reaches Git argv unconverted at config.py:75, 106 and 109, worktree.py:231 and cli.py:1277. These are outside this task's acceptance, but they belong to the same class.
Suggested fix: add a pair of helpers in worktree, for example git_name(unicode) -> native and unicode_name(native) -> unicode, and use them at all of these sites. That keeps the conversion in one place.
| if current != expected_head: | ||
| return current is None | ||
| ref = f"refs/heads/{branch}" | ||
| ref = os.fsdecode(f"refs/heads/{branch}".encode("utf-8", "surrogateescape")) |
There was a problem hiding this comment.
suggestion: No test runs delete_remote_branch under a legacy locale
The legacy-locale test calls cli._delete_tracking_ref and worktree.cleanup directly. It never goes through cmd_merge → _cleanup_remote_refs → github.delete_remote_branch, so the native-ref change at github.py:1479 has no test. If that conversion regresses, git push :refs/heads/lz/Łódź fails with UnicodeEncodeError at argv encoding. _cleanup_remote_refs only catches GhError and ProcTimeout, so the error escapes and aborts merge after the PR has already merged.
Add a narrow check for this path. One option: monkeypatch github._remote_branch_head and assert the argv bytes inside the legacy-locale subprocess.
Architecture-Review: unchanged; display encoding preserves the existing status and resolution interfaces. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 56fc575a86e59ec83951ab2a21eab904c99fbac7, 16.5s: approve (0 critical, 0 important, 1 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| from pathlib import Path | ||
| from loopzero import cli, worktree | ||
|
|
||
| cli._readiness = lambda *_, **__: cli.github.Readiness(False, ("check \\u0141 is pending",)) |
There was a problem hiding this comment.
suggestion: Legacy-locale test stubs out _readiness, so the real readiness path never runs with a Unicode branch
The subprocess replaces cli._readiness with a lambda that returns a fixed reason. That proves _print_display escapes the reason text. It does not check that the real readiness evaluation (check runs, review markers and branch-history lookups for lz/Łódź) works under LC_ALL=C. If that evaluation decoded or encoded the branch wrongly, this test would still pass. A smaller fix: keep the real _readiness and add fake GitHub responses so it returns a pending or blocking reason that includes the Unicode branch or a finding title. If that costs too much fixture setup, add a comment saying the stub only covers display escaping.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Keep Unicode branch names for GitHub lookups and pass native ref bytes to Git for reflog, guarded pushes, and cleanup. Decode GitHub CLI responses as UTF-8. This supersedes #1529.
Closes #1504
Closes #1505
Validation
Recorded for
56fc575a86e5uv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 06b72f82reports 8,125 source lines (−1) and 13,557 test lines (+38), both within caps.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review
The GitHub fixture retains the original REST argv, successful login, and missing-login assertions. The existing no-PR status test remains in place.