Skip to content

[BUG] Cancel during response can blank conversation history (chat locks) #8153

@hannesrudolph

Description

@hannesrudolph

Type

Bug

Problem / Value

Cancelling a running response can leave the task in a broken state and wipe the stored conversation for that task. The chat box becomes unusable until the task is closed and reopened, disrupting work.

Context

Version: v3.22.5 • API Provider: anthropic • Model: sonnet-3.5.
Occurs when clicking Cancel during the model’s “thinking/streaming” phase. Intermittent but reproducible with timing. Affects anyone who cancels mid‑response.
Current behavior: the task may hang; the conversation history file is written as an empty list, and the chat input becomes unusable. Logs show “Found API conversation history file, but it’s empty (parsed as []).”

Expected behavior

Cancelling a task should not corrupt or clear the conversation history, and the chat should remain usable.

Reproduction

  1. Start a task with the model
  2. While the model is responding (especially during “thinking”)
  3. Click the Cancel button
  4. Observe the task may hang and the chat box becomes unusable
  5. Logs show the empty conversation history message

Constraints/Preferences

Use safe read‑modify‑write transactions (from PR #5332) for files defined in GlobalFileNames to prevent file corruption when in‑memory state is empty during a race condition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue/PR - TriageNew issue. Needs quick review to confirm validity and assign labels.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions