openclaw - 💡(How to fix) Fix Sub-agent embedded run timeout does not release CommandLane, causing all subsequent webchat messages to be queued indefinitely [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

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#49398Fetched 2026-04-08 00:55:34
View on GitHub
Comments
2
Participants
3
Timeline
2
Reactions
0
Author
Timeline (top)
commented ×2

Error Message

2026-03-18T10:32:32.270+08:00 WARN {"subsystem":"agent/embedded"}: embedded run timeout: runId=e46b5240-2845-4a2f-9d7b-4b8b81d60984 sessionId=cc465d4c-a521-4921-9feb-4510704105d5 timeoutMs=120000
2026-03-18T10:32:35.893+08:00 WARN {"subsystem":"agent/embedded"}: Profile friday:default timed out. Trying next account...

The sub-agent session cc465d4c shows:

  • spawnDepth: 1, subagentRole: "leaf", spawnedBy: "agent:main:main"
  • Last entry: openclaw:prompt-error with "error": "aborted", followed by an assistant message with empty content: []
  • After abort, the parent session's webchat messages are accepted but never processed

Root Cause

Looking at the gateway source, CommandLane manages concurrency for agent runs. When an embedded sub-agent run times out and is aborted, the lane slot occupied by that run appears to not be properly released. The embedded run timeout warning fires, but the lane's active count is not decremented, so the parent session's lane remains "full" and new messages are enqueued but never dequeued.

Potentially related functions:

  • enqueueCommandInLane / CommandLane (manages run concurrency)
  • stopSubagentsForRequester / abortEmbeddedPiRun (abort logic)
  • waitForActiveEmbeddedRuns / getActiveEmbeddedRunCount (tracking active runs)

Fix Action

Workaround

Restart the gateway service:

systemctl --user restart openclaw-gateway

This clears the stuck lane state and allows messages to be processed again.

Code Example

2026-03-18T10:32:32.270+08:00 WARN {"subsystem":"agent/embedded"}: embedded run timeout: runId=e46b5240-2845-4a2f-9d7b-4b8b81d60984 sessionId=cc465d4c-a521-4921-9feb-4510704105d5 timeoutMs=120000
2026-03-18T10:32:35.893+08:00 WARN {"subsystem":"agent/embedded"}: Profile friday:default timed out. Trying next account...

---

systemctl --user restart openclaw-gateway
RAW_BUFFERClick to expand / collapse

Bug Description

When a spawned sub-agent (embedded run) times out, the parent agent's CommandLane lock is not released. This causes all subsequent messages sent to the parent session (via webchat) to be queued indefinitely — the webchat shows a permanent loading spinner and never receives a response.

The only workaround is to restart the gateway (systemctl --user restart openclaw-gateway), which clears the stuck lane state.

Steps to Reproduce

  1. Send a message to the webchat that triggers a sub-agent spawn (e.g., a research task that uses smart_fetch or serper_search)
  2. The sub-agent encounters a timeout (e.g., smart_fetch on a slow/blocked URL)
  3. The embedded run times out after timeoutMs=120000 (2 minutes)
  4. Send any new message to the same webchat session
  5. Expected: Message is processed and a response is returned
  6. Actual: Message is silently queued; webchat shows loading spinner forever. No response is ever delivered.

Logs

2026-03-18T10:32:32.270+08:00 WARN {"subsystem":"agent/embedded"}: embedded run timeout: runId=e46b5240-2845-4a2f-9d7b-4b8b81d60984 sessionId=cc465d4c-a521-4921-9feb-4510704105d5 timeoutMs=120000
2026-03-18T10:32:35.893+08:00 WARN {"subsystem":"agent/embedded"}: Profile friday:default timed out. Trying next account...

The sub-agent session cc465d4c shows:

  • spawnDepth: 1, subagentRole: "leaf", spawnedBy: "agent:main:main"
  • Last entry: openclaw:prompt-error with "error": "aborted", followed by an assistant message with empty content: []
  • After abort, the parent session's webchat messages are accepted but never processed

Environment

  • OpenClaw version: 2026.3.13 (61d171a)
  • OS: Linux (WSL2 Ubuntu 24.04) on Windows
  • Node: 22.22.1
  • Gateway mode: local, systemd managed
  • LLM provider: Friday (OpenAI-compatible), model aws.claude-opus-4.6
  • Agent config: Default main agent with embedded sub-agent spawning enabled

Workaround

Restart the gateway service:

systemctl --user restart openclaw-gateway

This clears the stuck lane state and allows messages to be processed again.

Analysis

Looking at the gateway source, CommandLane manages concurrency for agent runs. When an embedded sub-agent run times out and is aborted, the lane slot occupied by that run appears to not be properly released. The embedded run timeout warning fires, but the lane's active count is not decremented, so the parent session's lane remains "full" and new messages are enqueued but never dequeued.

Potentially related functions:

  • enqueueCommandInLane / CommandLane (manages run concurrency)
  • stopSubagentsForRequester / abortEmbeddedPiRun (abort logic)
  • waitForActiveEmbeddedRuns / getActiveEmbeddedRunCount (tracking active runs)

extent analysis

Fix Plan

To resolve the issue of the parent agent's CommandLane lock not being released after a spawned sub-agent times out, we need to ensure that the lane slot is properly released when an embedded sub-agent run is aborted.

Here are the steps to fix the issue:

  • Modify the abortEmbeddedPiRun function to decrement the active count of the lane when an embedded run is aborted.
  • Update the stopSubagentsForRequester function to release the lane slot when stopping sub-agents for a requester.
  • Add error handling to the enqueueCommandInLane function to handle cases where the lane is full due to a stuck sub-agent run.

Example code changes:

// In abortEmbeddedPiRun function
async function abortEmbeddedPiRun(runId) {
  // ... existing code ...
  // Decrement the active count of the lane
  await commandLane.decrementActiveCount(runId);
  // ... existing code ...
}

// In stopSubagentsForRequester function
async function stopSubagentsForRequester(requesterId) {
  // ... existing code ...
  // Release the lane slot when stopping sub-agents for a requester
  await commandLane.releaseLaneSlot(requesterId);
  // ... existing code ...
}

// In enqueueCommandInLane function
async function enqueueCommandInLane(command) {
  // ... existing code ...
  // Add error handling to handle cases where the lane is full
  try {
    await commandLane.enqueueCommand(command);
  } catch (error) {
    if (error.code === 'LANE_FULL') {
      // Handle lane full error, e.g., release stuck sub-agent run
      await commandLane.releaseStuckRun();
    } else {
      throw error;
    }
  }
  // ... existing code ...
}

Verification

To verify that the fix worked, follow these steps:

  • Send a message to the webchat that triggers a sub-agent spawn.
  • Wait for the sub-agent to time out.
  • Send a new message to the same webchat session.
  • Verify that the message is processed and a response is returned.

Extra Tips

  • Make sure to test the fix thoroughly to ensure that it resolves the issue without introducing any new problems.
  • Consider adding logging to track lane slot releases and errors to help with debugging.
  • Review the code changes to ensure they align with the existing codebase and follow best practices.

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

openclaw - 💡(How to fix) Fix Sub-agent embedded run timeout does not release CommandLane, causing all subsequent webchat messages to be queued indefinitely [2 comments, 3 participants]