fix(media): normalize Windows inbound paths case-insensitively#97630
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 10:30 PM ET / 02:30 UTC. Summary PR surface: Source +2, Tests +28. Total +30 across 3 files. Reproducibility: yes. at source level: current main and v2026.6.11 preserve Windows-drive casing before strict segment comparison, and the predecessor PR includes installed-Windows before-fix output. I did not run a Windows package repro in this read-only review. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the shared media-core normalizer once maintainers accept the SDK-visible Windows-drive case-insensitive semantics. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main and v2026.6.11 preserve Windows-drive casing before strict segment comparison, and the predecessor PR includes installed-Windows before-fix output. I did not run a Windows package repro in this read-only review. Is this the best way to solve the issue? Yes: the shared media-core normalizer is the best fix location because local media access, sandbox staging, media-understanding, iMessage, and SDK callers share this policy. Caller-specific folding would duplicate the invariant, while making POSIX paths case-insensitive would be too broad. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 816038e97a5d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2, Tests +28. Total +30 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Updated the PR body with branch-level Windows proof that imports this branch's @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Updated the PR body with a stronger branch-level Windows proof:
@clawsweeper re-review |
|
Added a small SDK-facing guardrail for the plugin-visible part of this change. New commit: What changed:
Validation: The PR body was also updated with the new HEAD and SDK-facing validation evidence. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Exact-head CI is now green for The SDK-facing guardrail is included in that commit via @clawsweeper re-review |
Related: #96024
What Problem This Solves
Fixes an issue where Windows users could have a valid inbound media file rejected when the configured media root and the reported file path use different casing for the drive path.
For example, a root configured as:
could fail to match an actual file path reported as:
Windows drive paths are normally case-insensitive, but
packages/media-core/src/inbound-path-policy.tsnormalizes separators and then compares root and candidate path segments strictly. That made the inbound media policy treat the same Windows path as outside the allowed root.Why This Change Was Made
The fix keeps the existing POSIX behavior unchanged while normalizing only absolute Windows drive paths to a shared casing before segment comparison.
This keeps the change narrow: it only affects paths matching the Windows drive absolute-path form, such as
C:/Users/Alice/Media. POSIX paths like/Users/Alice/Mediaremain case-sensitive.The affected call chain is:
This is the shared policy used by inbound media path validation, so fixing the normalization point avoids caller-specific Windows workarounds.
User Impact
Windows users can use local media roots even when the configured root and the file path reported by the runtime differ only by casing.
This prevents valid local media files from being rejected as outside the allowed inbound root. Linux and macOS-style POSIX path matching is unchanged.
Evidence
Branch-level Windows OpenClaw policy proof from this branch, run in a checked-out worktree at the PR head commit:
The stdin script imports and executes the patched OpenClaw policy from the checked-out PR branch:
Edited Windows terminal output, with only the local temp username/path identifier redacted:
Focused regression coverage was added for a mixed-case Windows drive root and candidate path:
Before this fix, that path pair could be rejected because the segment comparison saw
C:andc:as different strings. After this fix, the focused regression test confirms it is accepted.Windows PowerShell behavior proof from this branch:
SDK-facing contract coverage was added because this helper is also exposed through the public media runtime SDK barrel:
The SDK-facing regression test confirms plugin-visible callers get the same Windows-drive case-insensitive behavior through
src/plugin-sdk/media-runtime.ts.Validation:
AI assistance was used to prepare this PR.