Skip to content

[Bug]: chat.abort fails when called immediately after chat.send due to race condition #84176

Description

@YJUN0121

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When calling chat.abort immediately after chat.send (with the same runId), the abort operation sometimes fails because the abort controller has not been registered yet.

The issue occurs in src/gateway/server-methods/chat.ts (1927-1931):

const active = context.chatAbortControllers.get(runId);
if (!active) {
respond(true, { ok: true, aborted: false, runIds: [] });
return;
}

Steps to reproduce

  1. Call chat.send with multiple images for recognition
  2. Immediately call chat.abort with the same runId
  3. Observe that chat.abort returns {ok:true, aborted:false, runIds:[]} even though the run is still acticve

Expected behavior

The chat.abort call should successfully abort the chat run even when called immediately after chat.send. The abort controller registration and the abort operation should be properly synchronized to prevent this race condition.

Actual behavior

Sometimes calling chat.abort immediately after chat.send fails, which is an occasional behavior

OpenClaw version

2026.5.7

Operating system

Ubuntu 22.04

Install method

pnpm dev

Model

qwen3.7

Provider / routing chain

default config

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

P2Normal backlog priority with limited blast radius.bugSomething isn't workingclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions