openclaw - 💡(How to fix) Fix Feature Request: Interruptible tool calls — agent unresponsive during long process(poll) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#50996Fetched 2026-04-08 01:05:45
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Timeline (top)
commented ×1

Error Message

If a tool call has been pending for more than N seconds and an inbound message arrives, auto-cancel the tool call with a timeout error and process the message instead.

Fix Action

Fix / Workaround

Current Workarounds

RAW_BUFFERClick to expand / collapse

Title: Feature Request: Interruptible tool calls — agent unresponsive during long process(poll)

Problem

When an agent calls process(action: "poll", timeout: 300000) to wait for a background process, the entire session is blocked for the duration. No incoming messages from the user can be processed until the tool call returns.

This means if a user messages the agent while it's waiting on a background task, they get no response — sometimes for 5+ minutes. The agent appears dead/unresponsive.

Current Workarounds

  1. Never use long poll timeouts (keep under 10s)
  2. Fire-and-forget background processes and rely on openclaw system event for completion notification
  3. Spawn sub-agents to do monitoring instead of polling in the main session
  4. Only check status on-demand when the user explicitly asks

These work but are fragile — they depend on the agent's prompt/instructions consistently avoiding long polls. A single long-running tool call can lock the session.

Proposed Solutions (any of these would help)

Option A: Interruptible tool calls If an inbound message arrives while a tool call is pending, cancel/abort the tool call, inject the message, and let the agent respond. The agent can re-invoke the tool later if needed.

Option B: Parallel message processing Allow the session to process incoming messages in parallel with pending tool calls. The agent would see the message in context and could respond while the tool is still running.

Option C: Auto-timeout with message priority If a tool call has been pending for more than N seconds and an inbound message arrives, auto-cancel the tool call with a timeout error and process the message instead.

Impact

This affects any agent that uses background processes (coding agents, scrapers, video generation, API calls that take >30s). The agent becomes completely unresponsive to the user during any long tool call, which breaks the conversational UX.

Environment

  • OpenClaw 2026.3.8
  • macOS (local gateway)
  • Telegram channel (user expects near-instant responses)

extent analysis

Fix Plan

To address the issue of the agent being unresponsive during long tool calls, we will implement Option A: Interruptible tool calls. This involves modifying the agent to cancel pending tool calls when an inbound message arrives, allowing the agent to respond promptly.

Step-by-Step Solution:

  1. Modify the process function to accept an additional interruptible parameter:

def process(action, timeout, interruptible=False): # Existing implementation pass

2. **Implement a message queue** to store incoming messages while a tool call is pending:
   ```python
import queue

message_queue = queue.Queue()
  1. Create a separate thread to monitor the message queue and cancel pending tool calls when a new message arrives:

import threading

def monitor_message_queue(): while True: message = message_queue.get() if message: # Cancel the pending tool call cancel_tool_call() # Process the incoming message process_incoming_message(message)

Start the message queue monitor thread

thread = threading.Thread(target=monitor_message_queue) thread.start()

4. **Modify the `cancel_tool_call` function** to abort the pending tool call:
   ```python
def cancel_tool_call():
    # Implementation to cancel the pending tool call
    pass
  1. Update the agent to use the modified process function and pass interruptible=True for long-running tool calls:

process(action="poll", timeout=300000, interruptible=True)


### Verification
To verify that the fix worked, test the agent with a long-running tool call and send an inbound message while the tool call is pending. The agent should respond to the message promptly and cancel the pending tool call.

### Extra Tips
* Ensure that the `cancel_tool_call` function is implemented correctly to avoid any unintended consequences.
* Consider adding a timeout for the message queue monitor thread to prevent it from running indefinitely.
* Test the fix thoroughly to ensure that it works as expected in different scenarios.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING