fix(codex): compare status metadata project as canonical normalized paths (#459) - #511
Open
chemica-tan wants to merge 1 commit into
Open
fix(codex): compare status metadata project as canonical normalized paths (#459)#511chemica-tan wants to merge 1 commit into
chemica-tan wants to merge 1 commit into
Conversation
…aths The bridge records its meta project via Node's path.resolve (C:\x\y on Windows) while delivery.sh callers pass Git Bash spellings (/c/x/y or C:/x/y), so the verbatim compare from f6a8bcb (fujibee#232) labeled every live bridge "stale pidfile (metadata mismatch)" on Windows. Reuse the project-identity machinery the launcher already relies on (agmsg_canonical_path + agmsg_normalize_project_path) on both sides. Read-only status path; kill/spawn gating is unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PwnD2ZoEN1adKuqfbeBKg5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #459.
Mechanism
The bridge records its
projectthrough Node'spath.resolve()— on Windows that is the native spelling (C:\work\proj). Callers ofdelivery.sh statuspass the Git Bash spelling (/c/work/projorC:/work/proj). The verbatim compare in_delivery.sh([ "$meta_project" != "$project" ]) therefore labels every live bridgestale pidfile (metadata mismatch)on Windows.Because this compare runs before the liveness check, it also masks the
kill -0blindness reported in #415 (and being worked on in #505): on a vanilla Windows install, status never even reaches the liveness layer. Both layers need fixing forstatusto be truthful on Windows; this PR is the metadata layer only.Change
Compare canonical normalized forms instead, reusing the existing helpers (
agmsg_canonical_path+agmsg_normalize_project_pathfromlib/resolve-project.sh) — the same normalization the rest of the tree already uses for project identity. 10 lines, no new dependencies.Known trade-off inherited from the reused normalizer (documented in
lib/resolve-project.sh): the drive reinterpretation is form-based, not platform-gated, so on POSIX two genuinely distinct paths/c/fooand/C/foocan normalize to the same drive-like spelling and would compare equal here. In this call site that can only affect the status label; a platform-gated equality comparator would remove the trade-off if you prefer that.Write-side normalization (making the bridge record the Git Bash spelling) was considered and rejected: it would not repair meta files written by bridges already in the field, and the read side would still need tolerance for them.
Tests
metadata project spelling variant is not a mismatch— trailing-slash variant of the same directory; runs on all platforms.metadata project in native Windows spelling is not a mismatch— the exactcygpath -wshape the bridge writes; Windows-only (skips elsewhere).The existing genuinely-different-directory fixture still reports a mismatch after this change. Restore-to-FAIL verified on this branch: with the
_delivery.shhunk reverted, both new tests fail.Exact commands:
Note the current windows-latest CI job runs only the Windows-filtered cases of
tests/test_install.bats, sotest_delivery.batsdoes not execute on Windows in CI — the Windows-spelling result above is from the stated Windows/Git Bash machine; the spelling-variant test runs on the Ubuntu/macOS shards.Verification
Measured on Windows 11 + Git Bash (MSYS2 3.4.7) against codex-cli 0.144.6; this diff has been running in our downstream deployment since 2026-07-21. Not measured on macOS/Linux — there the compare is unchanged for identical spellings, and the trailing-slash test covers the canonicalization path on all platforms.
Note on #505
#505 touches the line just below this hunk (
kill -0→_agmsg_pid_alive). The two text changes are independent and rebase trivially in either order.🤖 Generated with Claude Code
https://claude.ai/code/session_01EjjWN3rwUxE6qWBicECXHC