Skip to content

Quit: hold the quit while a send runs, so text typed during a slow send is saved #206

Closed

Description

@AojdevStudio

Problem

A normal quit or a window close waits up to 1.5 s for the window to save its drafts (FLUSH_WAIT in src-tauri/src/studio/quit.rs). The window first waits for each send on its way, then saves each changed screen. During a send, the window does not save the screen it is sending from. If that save ran, the screen's draft would have two owners: the send, and the save.

So if a send takes longer than 1.5 s, text the person typed during it is lost when the quit goes through. A send normally ends in milliseconds. It runs longer only when copying large pictures, or while it waits for the update pass.

#201 ships with this as a known limit. A fix that saved during the send was tried in 964383e and reverted. It kept one draft under two screens, and it brought a sent picture back after a relaunch (#205).

Fix

Rust holds a quit for as long as a send runs, then gives the window its 1.5 s to save. The window would tell Rust when a send starts and ends, and the quit hold in quit.rs would wait on that before its timer starts. Keep a ceiling, so a hung send cannot block a quit forever.

Test

A window test with a held send, text typed during it, and a quit. The text is saved once, under its own screen, after the send answers. A Rust test checks that the hold waits for a send in flight and still ends at its ceiling.

Activity

  1. pullfrog commented on Nov 8, 2026

    @pullfrog

    Implementation plan

    1. Build on feat(studio): the window works on the sidecar's committed chats, and the claude -p runner is gone #201’s branch once it lands: QuitFlush::hold currently emits studio://flush and starts the 1.5 s timeout immediately. Studio drafts: one owner for the draft and the outgoing message #205 is related but explicitly excludes the quit wait; it is not a duplicate.
    2. Register each send with Rust before asynchronous send work begins, and release it on every success or failure path. Coordinate registration with quit so a send cannot slip between the idle check and the flush; handle overlapping sends and a missing window without leaving quit blocked.
    3. Hold close and quit until registered sends finish or a bounded ceiling expires, then request the existing flush and allow its full 1.5 s. Preserve the existing shared handling of repeated close and quit requests. Do not save the sending screen concurrently with its send.
    4. Add a window regression test for a held send and edits made during it, checking that the later draft is saved once under the right screen without resurrecting sent pictures. Add Rust tests for send completion, the ceiling, registration races, and repeated quit requests. Document that a send exceeding the ceiling can still lose unsaved edits.

    Pullfrog  | Implement a fix ➔ | View workflow run | via Pullfrog | Using gpt-6.1-terra | 𝕏

  2. added
    bugSomething isn't working
    rustPull requests that update rust code
    on Nov 8, 2026
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 workingrustPull requests that update rust code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions