Skip to content

Canceling API Retry Creates Phantom Subtask and Checkpoint Initialization Loop #4602

@hannesrudolph

Description

@hannesrudolph

App Version

v3.3.1 (or latest)

API Provider

Not Applicable / Other

Model Used

N/A

🔁 Steps to Reproduce

  1. Setup: macOS, Roo Code extension (latest), default settings with checkpoints enabled
  2. Start a task that makes an API call:
    • Open Roo Code and enter a prompt that will require an API call
    • Example: "Create a new React component"
  3. Force API failure to trigger retry:
    • Disconnect network/WiFi after the task starts
    • Wait for the API call to fail and enter retry state (you'll see retry messages)
  4. Cancel during retry:
    • While the retry is happening, click the X button in the task header
    • Alternative: Click the "Terminate" button if in resume_task state

Result Path 1 (Incorrect Subtask Display):

  • Task shows "Subtask Results" section
  • Contains error: "Task error: It was stopped and canceled by the user."
  • This happens even though the task was NOT a subtask

Result Path 2 (Checkpoint Warning):

  • Task shows blank screen with spinner
  • Message: "Still initializing checkpoint... If this takes too long, you can disable checkpoints in settings and restart your task."
  • Clicking "Terminate" corrupts the task (cannot re-enter)
  • Clicking "X" button returns to the failed API call state

💥 Outcome Summary

Expected task to be cleanly canceled, but got either "Subtask Results" error display for non-subtask or stuck checkpoint initialization spinner.

📄 Relevant Logs or Errors (Optional)

Root Cause Analysis

Issue 1: Incorrect "Subtask Results" Display

Location: src/core/webview/webviewMessageHandler.ts:200

case "clearTask":
    // This unconditionally calls finishSubTask even for non-subtasks
    await provider.finishSubTask(t("common:tasks.canceled"))
    await provider.postStateToWebview()
    break

Issue 2: Checkpoint Warning During Transitions

Location: webview-ui/src/components/chat/ChatView.tsx:1145-1161

  • Checkpoint warning timer starts when task exists but has no messages
  • During cancellation/retry, task state is in flux causing false positive

Proposed Fix

// In webviewMessageHandler.ts
case "clearTask":
    const currentCline = provider.getCurrentCline()
    // Check if there's actually a parent task in the stack
    if (provider.getClineStack().length > 1) {
        await provider.finishSubTask(t("common:tasks.canceled"))
    } else {
        // Regular task - just clear it
        await provider.clearTask()
    }
    await provider.postStateToWebview()
    break

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - Unassigned / ActionableClear and approved. Available for contributors to pick up.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions