openclaw - ✅(Solved) Fix [Bug]: Subagent tool calls never execute - accumulatedRuntimeMs always 0 [1 pull requests, 1 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#59393Fetched 2026-04-08 02:24:22
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2labeled ×2

Subagent tool calls are generated by the model but never executed. The subagent completes after one response turn with accumulatedRuntimeMs: 0.

Root Cause

Subagent tool calls are generated by the model but never executed. The subagent completes after one response turn with accumulatedRuntimeMs: 0.

PR fix notes

PR #59503: fix(gateway): allow silent scope upgrades for local loopback clients

Description (problem / solution / changelog)

Summary

  • Problem: sessions_spawn sub-agent connections fail 100% of the time with WebSocket close(1008) "pairing required" on v2026.4.1. The gateway-client connects from loopback with scopes: ["operator.write"], triggering a scope-upgrade pairing reason when pairedScopes is empty (post-v2026.3.31 device records). The connection is rejected because the pairing request is forced to be non-silent.

  • Root Cause: In src/gateway/server/ws-connection/message-handler.ts line 806–809, requestDevicePairing() contains a hard-coded ternary that forces silent: false whenever reason === "scope-upgrade", regardless of whether the client is a local loopback connection. This discards the return value of shouldAllowSilentLocalPairing(), which correctly returns true for local loopback clients requesting scope upgrades. The non-silent pairing request then requires interactive confirmation that headless gateway-clients cannot provide.

  • Fix: Remove the reason === "scope-upgrade" ? false override so that shouldAllowSilentLocalPairing() || allowSilentBootstrapPairing uniformly controls the silent flag for all pairing reasons. The existing shouldAllowSilentLocalPairing() guard already independently rejects remote clients (isLocalClient: false), browser-origin clients (hasBrowserOriginHeader: true), and metadata-upgrade reasons, so no security boundary is weakened.

  • What changed:

    • src/gateway/server/ws-connection/message-handler.ts: removed the reason === "scope-upgrade" ? false ternary override on the silent parameter of requestDevicePairing() (line 806–809, net −3 lines)
    • src/gateway/server/ws-connection/handshake-auth-helpers.test.ts: added 2 test cases confirming shouldAllowSilentLocalPairing() rejects scope-upgrade for remote clients and browser-origin local clients
  • What did NOT change (scope boundary):

    • shouldAllowSilentLocalPairing() implementation is untouched — its existing reason/client/origin checks are the sole authority
    • Remote client pairing behavior is unchanged (still requires interactive confirmation)
    • Browser-origin client pairing behavior is unchanged
    • metadata-upgrade pairing behavior is unchanged
    • Bootstrap token pairing logic is unchanged
    • No changes to callGateway(), callGatewayLeastPrivilege(), or scope resolution in method-scopes.ts
    • No changes to connect-policy.ts or Control UI pairing skip logic

Reproduction

  1. Install openclaw v2026.4.1
  2. Start gateway with default config
  3. In any agent session, call sessions_spawn with runtime: "subagent"
  4. Observe WebSocket close(1008) with "pairing required" in gateway logs
  5. Sub-agent never starts; 100% reproduction rate

Risk / Mitigation

  • Risk: Removing the scope-upgrade silent override could theoretically allow a local process to silently escalate scopes without user confirmation.
  • Mitigation: shouldAllowSilentLocalPairing() already gates silent pairing on isLocalClient && !hasBrowserOriginHeader (or Control UI / Webchat), which is the same trust boundary used for not-paired and role-upgrade reasons. Two new test cases explicitly verify that remote clients and browser-origin local clients are still rejected for scope-upgrade. The scope-upgrade silent override was an additional restriction that predates the shouldAllowSilentLocalPairing() guard and is now redundant.

Change Type (select all)

  • Bug fix

Scope (select all touched areas)

  • Gateway
  • Subagent / Sessions
  • Device Pairing / Auth

Linked Issue/PR

Fixes #59428 Related: #59092 (prior fix for role-upgrade path) Related: #59393 (may share root cause for subagent tool call failures)

Changed files

  • src/gateway/server/ws-connection/handshake-auth-helpers.test.ts (modified, +24/-0)
  • src/gateway/server/ws-connection/message-handler.ts (modified, +1/-4)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Summary

Subagent tool calls are generated by the model but never executed. The subagent completes after one response turn with accumulatedRuntimeMs: 0.

Steps to reproduce

Steps to Reproduce

  1. Spawn a subagent with sessions_spawn (runtime=subagent)
  2. Ask it to perform any task requiring tool use (read file, write file, exec)
  3. Observe: model generates tool calls, but they never execute
  4. Check ~/.openclaw/agents/main/sessions/*/runs.json - all runs show accumulatedRuntimeMs: 0

Expected behavior

Expected Behavior

Subagent tool calls should execute and return results to parent session.

Actual behavior

Actual Behavior

  • Tools are generated but discarded

OpenClaw version

OpenClaw 2026.3.31 (213a704)

Operating system

EndeavourOS

Install method

npm global

Model

Model: Kimi K2.5 (also tested OpenRouter Auto, same result)

Provider / routing chain

Discord channel

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The subagent tool calls are not executing due to a potential issue with the OpenClaw version or model configuration, and a workaround may involve checking the model's tool execution settings or updating the OpenClaw version.

Guidance

  • Verify that the sessions_spawn command is correctly configured to execute tool calls by checking the OpenClaw documentation and the model's settings.
  • Check the runs.json file for any error messages or indications of why the tool calls are not executing, and look for any patterns or common issues.
  • Test the subagent with a different model, such as OpenRouter Auto, to see if the issue is specific to the Kimi K2.5 model.
  • Review the OpenClaw version and consider updating to a newer version if available, as the current version (2026.3.31) may have a bug or issue causing the problem.

Example

No code snippet is provided as the issue does not include specific code details.

Notes

The issue may be specific to the OpenClaw version, model, or operating system, and further testing and debugging may be necessary to determine the root cause.

Recommendation

Apply workaround: Check the model's tool execution settings and update the OpenClaw version if necessary, as this may resolve the issue with subagent tool calls not executing.

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 - ✅(Solved) Fix [Bug]: Subagent tool calls never execute - accumulatedRuntimeMs always 0 [1 pull requests, 1 participants]