Skip to content

Closing an untouched untitled note can delete text written into it at the same moment #23772

Open

Description

@AmoabaKelvin

What happens

  1. Create a new untitled markdown note and don't type in it.
  2. Close its tab at the same moment an agent or another program writes text into its untitled.md.

Actual: if the write lands between Orca checking that the file is still empty and Orca deleting it, the new text is deleted.
Expected: closing an untitled note never deletes a file that has content.

The window is one file operation long: very short on a local disk, longer over SSH or to a remote Orca host. Found in review of #23768; not reproduced in practice.

Why

Acceptance

  • The untitled-note cleanup never deletes a file that has content, even when a write lands while the tab is closing.
  • Works for local, SSH and remote Orca hosts, including a host running an older Orca version.
  • Closing an untouched note that is still empty still removes it, as does Don't Save on a never-saved note.
  • A test that fails if the fix is reverted.

Activity

  1. added
    bug
    and removed on Sep 29, 2026
  2. 2SinceJuly commented on Nov 27, 2026

    @2SinceJuly
    Contributor

    Took this one as the same fix as #23771 — they are two ends of one defect.

    Opened PR #51147. The cleanup no longer checks size and deletes as two requests: files.deleteIfUnchanged pins the empty bytes and, on the machine that owns the file, unlinks it while the checked file's handle is still open, so a write that lands in between can never be what gets deleted. A host that cannot guard the delete (older paired server, or an SSH-owned worktree) keeps the empty placeholder instead of deleting something it could not verify.

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

    bugfile-editor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions