Skip to content

[Bug]: Offline file draft can overwrite a peer correction after reconnect #38319

Open

Description

@albertoangulo

Area

apps/web — Files source editor / autosave after reconnect

Reproduction observed

Published runtime 0.1.10, macOS arm64, browser client, disposable local server/workspace with filesystem read/write access. Repeated twice on 17 November 2026, with distinct synthetic notes. No model turn or real customer data was involved.

  1. Open an existing Markdown file in the Files source editor. Make an edit and wait for it to save.
  2. Stop the server with SIGTERM, leaving the browser tab/editor mounted. Observe reconnecting.
  3. Add a distinctive client note while disconnected. The disk file remains unchanged.
  4. Independently append a different peer correction to the disk file.
  5. Restart the same server/state directory/port. Let the existing browser reconnect without reloading it.
  6. The disk still contains the peer correction at this point; the editor retains the disconnected draft.
  7. Continue typing in the editor and let autosave settle.

The resulting disk file contains the disconnected draft and later client typing, but removes the peer correction. No conflict was visible in these two runs. Reconnecting alone did not remove it. An explicit manual merge through the UI subsequently restored both corrections.

Expected

Keep the disconnected draft and the changed source available for an explicit conflict/merge decision before publishing the stale draft over a known changed file.

Independent disk observations from the second run

Stage Bytes SHA-256
Peer correction saved while client disconnected 281 bf5221a4dabd99b1fa619d2501dd45b53c4ebd367d0887864be14fb1689e77d5
After reconnect, before further typing 281 same peer bytes
After further typing/autosave 317 d80d43471ff4a63eeee3f04ee058a4fbbae2cc46b8787452ea879357d6a94c8c

The distinctive peer line was absent after the last step; both client lines were present. This is changed disk content, not only a stale preview.

Source inspection and related work

The runtime walkthrough used the published package; the inspected source reference was 1da3f3f3702841a604f76d460b2e5710838a812e, without claiming all distributed bytes equal that checkout. Hosted source reads on 17 November at main fd7d2aec5e437eea0d644fe47c3645efcc7cb4b9 found the contract, file-save sessions/coordinator, query state and WorkspaceFileSystem files byte-identical to that inspected reference. The write input carries cwd/path/contents, not an expected source identity. No new runtime/UI reproduction was run on that main commit.

Closed issue36663 concerns a confirmed overlay hiding successful external reads after a failed confirmation read, without claimed disk corruption. Open PR32853 addresses partial failed filesystem writes. This report concerns a successful autosave of an older client draft after a peer edit. Those are adjacent cases; please triage any duplicate I missed.

This is one bounded bug report, not a proposed editor/architecture rewrite or a claim of universal atomic compare-and-swap against arbitrary filesystem writers. Found during an agent-operated editing/recovery walkthrough. No code PR or fix is claimed.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions