Skip to content

app: reopening a chat after a CLI turn starts a spurious "app closed unexpectedly" resume turn #2474

Open

Description

@AbirAbbas

Seen on macOS 15.6 while testing the #2472 idle sweep (since reverted in #2473). Engine: app/v3 2c717c0 (the #2472 merge commit), standalone codeaf app driven over its wire.

Steps:

  1. The app engine opens 5 chats. The idle sweep releases the 2 oldest after 10 minutes.
  2. codeaf chat --once (CLI, same home) runs a turn in the oldest, released chat. It exits 0 after 7.5 s.
  3. The app engine sends a message into that chat. That works (turn.done ok:true).

Unexpected: after reopening the chat, the app engine started a turn of its own, beginning "The app closed unexpectedly while you were in the middle of answering…". That costs a model call and adds an entry nobody asked for.

Likely: the app treats the CLI's finished turn (or its leftover markers) as an interrupted turn of its own and resumes it. This may also happen without #2472, any time the app reopens a background chat that another process ran a turn in. That hasn't been verified on pre-#2472 code.

Logs from the run: fds/live2.log and fds/live2/A.wire.jsonl in the push's working folder on the Mac.

Pre-existing on app/v3 without #2472: yes.

Binary: codeaf built from 95ead2951, which is app/v3 3a6aa31 + #2466 with no #2472; sha256 prefix 6b10751e4f34f0f4. This is the soak slot's engine. Run as a standalone codeaf app on a scratch home, driven over its wire:

  1. The app engine creates a chat with one message and never opens it as a view. Its first turn ends ok:true.
  2. The idle sweep releases it after 10 minutes, so its journal is no longer open in the app process.
  3. codeaf chat --once --session <its transcript> runs one turn in it from the CLI on the same home. The prompt asks for a shell command; with no approver attached the tool is blocked and the turn answers that. It exits 0 after 4.0 s.
  4. The app engine calls agents.open on the chat, with no send. About 1 s later it starts turn 2 on its own. The journal gets a user line "The app closed unexpectedly while you were in the middle of answering the person…" and then a "[carry on] codeaf's completion check read a clipped summary of this turn…" line. The turn runs for about 18 s of model calls and ends ok:true.
  5. A send afterwards runs normally as turn 3.

So reopening any background chat that another process ran a turn in starts this resume. An open is enough; no send is needed. #2472 only made this reachable for chats that were also open in the window. Logs: fds/resume1.log and fds/resume1/A.wire.jsonl in the push's working folder on the Mac.

Untested and worth checking first: the same path may trigger when a chat ran a turn on another computer (relay / "Continue here") and is then opened here. That would hit every relay user.

🤖 Generated with Claude Code

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