[GH-ISSUE #1487] fix(windows): look up private runtimes by the path the OS distinguishes #506

Closed
opened 2026-10-15 18:25:41 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @cursor[bot] on GitHub (Oct 10, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1487

TL;DR: The Windows private-runtime lease map keys directories by path.toLowerCase(). Two directories the OS still distinguishes share one lease, and closing one drops the lookup for the other.

A path fold is standing in for resource identity. The fold is not the Windows case table, and it is not a handle.

Area

Process, runtime, or provider sessions

Observed behavior

WindowsPrivateRuntime.create stores the live runtime at runtimes.set(observation.path.toLowerCase(), runtime). windowsPrivateRuntime looks up the same fold. close deletes that key.

The map is the ownership registry: "an arbitrary pathname cannot grant authority." On a case-sensitive Windows directory, C:\work\Runtime and C:\work\runtime are different directories and different handles. The second create replaces the map entry. A later lookup of the first path returns the second runtime, so reads and writes go to the wrong lease. close on the second runtime deletes the only key, and the first runtime can no longer be found by path while its handle is still open.

toLowerCase() is also not the Windows path case table. Paths that Windows treats as the same directory can miss the map, and paths Windows treats as different can collide.

sameIdaHostPath documents a separate, explicit win32 compare. This map is the authority check for private files, not a display compare.

Expected behavior

The lease key should be an identity the native side already holds (the handle, or a file id from the private-runtime observation), so a second directory cannot replace the first and close cannot forget a runtime that is still open.

Where

  • src/windows/WindowsPrivateRuntime.ts — create, #remove, windowsPrivateRuntime
Originally created by @cursor[bot] on GitHub (Oct 10, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1487 **TL;DR:** The Windows private-runtime lease map keys directories by `path.toLowerCase()`. Two directories the OS still distinguishes share one lease, and closing one drops the lookup for the other. A path fold is standing in for resource identity. The fold is not the Windows case table, and it is not a handle. ### Area Process, runtime, or provider sessions ### Observed behavior `WindowsPrivateRuntime.create` stores the live runtime at `runtimes.set(observation.path.toLowerCase(), runtime)`. `windowsPrivateRuntime` looks up the same fold. `close` deletes that key. The map is the ownership registry: "an arbitrary pathname cannot grant authority." On a case-sensitive Windows directory, `C:\work\Runtime` and `C:\work\runtime` are different directories and different handles. The second `create` replaces the map entry. A later lookup of the first path returns the second runtime, so reads and writes go to the wrong lease. `close` on the second runtime deletes the only key, and the first runtime can no longer be found by path while its handle is still open. `toLowerCase()` is also not the Windows path case table. Paths that Windows treats as the same directory can miss the map, and paths Windows treats as different can collide. `sameIdaHostPath` documents a separate, explicit `win32` compare. This map is the authority check for private files, not a display compare. ### Expected behavior The lease key should be an identity the native side already holds (the handle, or a file id from the private-runtime observation), so a second directory cannot replace the first and close cannot forget a runtime that is still open. ### Where - `src/windows/WindowsPrivateRuntime.ts` — `create`, `#remove`, `windowsPrivateRuntime`
bsakaguchi 2026-10-15 18:25:41 +00:00
Author
Owner

@morluto commented on GitHub (Oct 10, 2026):

Thanks for reporting this. Closing as resolved on main. Private-runtime registration and removal are keyed by the observed volume/file identity. Path lookup matches an owned observed spelling exactly and refuses ambiguous or missing leases.

Merged fix. I checked the current source against this report; no tests or real-provider workflows were run for this closure pass.

<!-- gh-comment-id:6099805802 --> @morluto commented on GitHub (Oct 10, 2026): Thanks for reporting this. Closing as resolved on main. Private-runtime registration and removal are keyed by the observed volume/file identity. Path lookup matches an owned observed spelling exactly and refuses ambiguous or missing leases. [Merged fix](https://github.com/morluto/rea/commit/b4db35f092d7166aebdf4387b48f7652b1d1c3b6). I checked the current source against this report; no tests or real-provider workflows were run for this closure pass.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#506
No description provided.