fix(codex): compare status metadata project as canonical normalized paths (#459) - #511
fix(codex): compare status metadata project as canonical normalized paths (#459)#511chemica-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
|
The production change reads correctly and we found nothing blocking in it. The helper order is sound — The blocker is verification rather than code. The regression this fixes is the native Windows spelling, and that path has not actually been executed anywhere. The test you added for it is guarded by Could you run the Windows-targeted test on the Windows 11 + Git Bash host you reported from and paste the output here? A single run is enough. If that host is not available, say so and we will record the Windows path as unverified rather than block on it — we just do not want the check mark to imply coverage it does not have. |
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