Skip to content

bug: API conversation history file truncated to empty array during task resume #4311

@KJ7LNW

Description

@KJ7LNW

When resuming a task while opening and closing orchestrator tasks, the API conversation history file is sometimes truncated to an empty array [].

I am speculating that there was a race condition which caused multiple simultaneous writes to api_conversation_history.json when I was clicking between tasks, and #3772 will probably fix this because it is atomic and has a lock to prevent simultaneous activity on the same file.

Error

mainThreadExtensionService.ts:78 [RooVeterinaryInc.roo-cline]Unexpected: No existing API conversation history
mainThreadExtensionService.ts:79 Error: Unexpected: No existing API conversation history
    at _Task.resumeTaskFromHistory (vscode-file://vscode…task/Task.ts:922:10)
log.ts:460   ERR An unknown error occurred. Please consult the log for more details.

Debug Information

Added debug logging shows that the file exists but contains an empty array:

[Roo-Debug] readApiMessages: Found API conversation history file, but it's empty. TaskId: 33369d03-10fb-436e-a708-ec3cdde71d80, Path: ~/.config/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/tasks/33369d03-10fb-436e-a708-ec3cdde71d80/api_conversation_history.json

Reproduction Steps

  1. Open a task
  2. Open an orchestrator task from within that task
  3. Close the orchestrator task
  4. Attempt to resume the original task

Potential Fix

PR #3772 (#3772) may address this issue, though the exact cause is still unknown.

Impact

This causes task resumption to fail with the error "Unexpected: No existing API conversation history" and prevents users from continuing their work.

Metadata

Metadata

Assignees

Labels

Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions