Skip to content

Windows: path_identity atomic replace (ReplaceFileW) fails beyond MAX_PATH, host request marker replacement returns store_transient #2926

Description

@mblua

Situation

On Windows, path_identity::replace_regular_file_atomic / atomic_replace_existing (src-tauri/src/path_identity.rs:1361-1394) passes both raw paths to ReplaceFileW, which is limited to MAX_PATH. The temp file is created next to the marker (:1426-1431), so a long outbox root pushes it past the limit.

Impact

Replacing a host request with its marker (src-tauri/src/phone/mailbox.rs:4773) fails beyond MAX_PATH, and the error is mapped to store_transient. Host PTY requests in long outbox roots never get marker-replaced.

Evidence

Found while planning #2923: the forced-long fixture failed at this step (mailbox.rs:16198) before reaching the #2923 defect. Confirmed from source by the adversarial reviewer. #2923 deliberately leaves this out of scope.

Why / how

It is the same class of defect as #2923, in a second helper. It needs long-path handling for both ReplaceFileW arguments in path_identity.rs, plus a regression test. The design is decided in that issue's plan.

Activity

  1. added
    bugSomething isn't working
    windowsAffected platform: the behaviour occurs on or is specific to Windows
    on Oct 6, 2026
  2. mblua commented on Oct 7, 2026

    @mblua
    OwnerAuthor

    Technical score (task-technical-scoring): Scope 3 (one helper + test) · Diagnosis 2 (cause stated, confirmed in #2923) · Domain 8 (Win32 path/UTF-16 rules) · Ambiguity 4 (pattern already decided in #2923: canonical parent + original leaf) · Blast 8 (shared atomic-replace helper) · Dependencies 2 · Verification 9 (forced-long fixture, negative control required) · State 2 · Concurrency 3 · Environment 7 (Windows-only, TEMP length). Raw 48 → final 21. Band 1-25 → Lite (tests change, so not Express). Veto: Verification >= 8 → Grinch also reviews the proof. Author: ac-dev-rust-v4; reviewer: ac-dev-rust-grinch-v4; no digest. Excluded as ceremony: issue, branch, PR, CI, reviews.

  3. mblua commented on Oct 7, 2026

    @mblua
    OwnerAuthor

    Step 7.5: user approved plan D:/0_repos/AgentsCommander_iac/.ac/plans/2926-path-identity-replacefile-long-path/plan-v3-path-identity-replacefile-long-path.md, Plan-Revision r1 (Grinch PLAN_APPROVED r1). No build requested.

  4. mblua commented on Oct 7, 2026

    @mblua
    OwnerAuthor

    Delivered in PR #2934, merged to main as afbffb8. Change: src-tauri/src/path_identity.rs only (+82): atomic_replace_existing canonicalizes the parent of both paths and keeps the original leaf before ReplaceFileW; new test atomic_regular_replacement_supports_long_windows_paths (negative control failed on main, passes with fix). Reviews: Grinch PLAN_APPROVED r1 and PASS on implementation + proof; user approved plan. CI green after one rerun of an unrelated timing test. No build was requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwindowsAffected platform: the behaviour occurs on or is specific to Windows

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions