openclaw - ✅(Solved) Fix toolsAllow parameter not forwarded to runEmbeddedAttemptWithBackend [1 pull requests, 1 comments, 2 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#66581Fetched 2026-04-15 06:25:33
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1mentioned ×1referenced ×1

Error Message

  • Verified via monkey-patched dist/pi-embedded-runner-CefZK1Pt.js with console.error diagnostics at three checkpoints (function entry, runEmbeddedAttempt, tool filter)

Root Cause

In pi-embedded-runner (current CefZK1Pt hash), runEmbeddedPiAgent calls runEmbeddedAttemptWithBackend with ~50 explicitly listed parameters around line 8283, but toolsAllow is not included in the list.

// runEmbeddedPiAgent correctly receives toolsAllow
async function runEmbeddedPiAgent(params) {
  // params.toolsAllow = ["memory_search", "memory_get"] ✅

  // ...later...

  // BUG: toolsAllow is missing from this call
  const attempt = await runEmbeddedAttemptWithBackend({
    sessionId: params.sessionId,
    sessionKey: resolvedSessionKey,
    // ... ~50 params listed ...
    bootstrapPromptWarningSignature: ...
    // toolsAllow: params.toolsAllow,  ← MISSING
  });

  // Inside runEmbeddedAttemptWithBackend → runEmbeddedAttempt(params):
  // params.toolsAllow = undefined ❌
  // → toolsRaw = allTools (no filter applied)
}

Fix Action

Fix

Add toolsAllow: params.toolsAllow to the runEmbeddedAttemptWithBackend call in runEmbeddedPiAgent:

  const attempt = await runEmbeddedAttemptWithBackend({
    sessionId: params.sessionId,
    // ...existing params...
+   toolsAllow: params.toolsAllow,
    bootstrapPromptWarningSignaturesSeen,
    bootstrapPromptWarningSignature: ...
  });

PR fix notes

PR #66710: fix: forward toolsAllow through embedded runner call chain

Description (problem / solution / changelog)

Summary

  • runEmbeddedPiAgent accepts a toolsAllow parameter but never forwarded it to runEmbeddedAttemptWithBackend, causing sub-agents to receive the full ~37k-token tool list instead of a filtered ~3k-token subset
  • Added the missing toolsAllow: params.toolsAllow to the params object in run.ts line 663
  • The attempt layer (attempt.ts) already handles toolsAllow correctly for both tool filtering (lines 542-544) and prompt mode optimization (lines 708-710) -- it just never received the value

The bug

When a caller sets toolsAllow: ["exec", "read"] on runEmbeddedPiAgent, the orchestration layer (run.ts) builds a ~90-field params object for runEmbeddedAttemptWithBackend but omits toolsAllow. The attempt layer has the filtering logic but always sees undefined, so every sub-agent gets ALL tools. This causes 10x token bloat and 30s timeouts on constrained runs.

Fix

One line: toolsAllow: params.toolsAllow, added to the params object at the call site.

Test plan

  • New test: toolsAllow is forwarded when set (non-empty array)
  • New test: toolsAllow remains undefined when not set (backward compat)
  • New test: empty toolsAllow array is forwarded without coercion
  • Existing overflow compaction tests pass (13/13)
  • Existing attempt tests pass (95/95)
  • Pre-commit hooks pass (type check, lint, import cycles, conflict markers)

Fixes #66581 Complementary to #60842 (config-level allowlist operates at a different layer)

🤖 Generated with Claude Code

Changed files

  • src/agents/pi-embedded-runner/run.tools-allow-forwarding.test.ts (added, +64/-0)
  • src/agents/pi-embedded-runner/run.ts (modified, +1/-0)

Code Example

// runEmbeddedPiAgent correctly receives toolsAllow
async function runEmbeddedPiAgent(params) {
  // params.toolsAllow = ["memory_search", "memory_get"] ✅

  // ...later...

  // BUG: toolsAllow is missing from this call
  const attempt = await runEmbeddedAttemptWithBackend({
    sessionId: params.sessionId,
    sessionKey: resolvedSessionKey,
    // ... ~50 params listed ...
    bootstrapPromptWarningSignature: ...
    // toolsAllow: params.toolsAllow,  ← MISSING
  });

  // Inside runEmbeddedAttemptWithBackend → runEmbeddedAttempt(params):
  // params.toolsAllow = undefined ❌
  // → toolsRaw = allTools (no filter applied)
}

---

TOKEN-ENTRY (runEmbeddedPiAgent): toolsAllow=["memory_search","memory_get"]TOKEN-FILTER (runEmbeddedAttempt): toolsAllow=undefined allTools=68TOKEN-DIAG:  systemPromptChars=23610 customTools=68 toolsAllow=undefined
API usage:   input_tokens=37,303 (StepFun step-3.5-flash)

---

const attempt = await runEmbeddedAttemptWithBackend({
    sessionId: params.sessionId,
    // ...existing params...
+   toolsAllow: params.toolsAllow,
    bootstrapPromptWarningSignaturesSeen,
    bootstrapPromptWarningSignature: ...
  });
RAW_BUFFERClick to expand / collapse

Bug Description

runEmbeddedPiAgent accepts a toolsAllow parameter (used by active-memory plugin and sessions_spawn to restrict available tools for sub-agents), but never forwards it to runEmbeddedAttemptWithBackend. As a result, sub-agents receive ALL configured tools regardless of the toolsAllow filter.

Root Cause

In pi-embedded-runner (current CefZK1Pt hash), runEmbeddedPiAgent calls runEmbeddedAttemptWithBackend with ~50 explicitly listed parameters around line 8283, but toolsAllow is not included in the list.

// runEmbeddedPiAgent correctly receives toolsAllow
async function runEmbeddedPiAgent(params) {
  // params.toolsAllow = ["memory_search", "memory_get"] ✅

  // ...later...

  // BUG: toolsAllow is missing from this call
  const attempt = await runEmbeddedAttemptWithBackend({
    sessionId: params.sessionId,
    sessionKey: resolvedSessionKey,
    // ... ~50 params listed ...
    bootstrapPromptWarningSignature: ...
    // toolsAllow: params.toolsAllow,  ← MISSING
  });

  // Inside runEmbeddedAttemptWithBackend → runEmbeddedAttempt(params):
  // params.toolsAllow = undefined ❌
  // → toolsRaw = allTools (no filter applied)
}

Impact

Active Memory Plugin

  • active-memory passes toolsAllow: ["memory_search", "memory_get"] to restrict sub-agent to only memory tools
  • Due to this bug, the sub-agent receives all 68+ tools (50+ feishu plugin tools, built-in tools, etc.)
  • System prompt balloons from ~3,600 chars → 23,610 chars (~8,000 tokens)
  • Tool schemas add another ~12,000-15,000 tokens
  • Total API input: ~37,000 tokens per call (should be ~3,000)
  • Each call takes 25-30 seconds (vs expected <5 seconds), frequently timing out at 30s

Verified with instrumented dist

TOKEN-ENTRY (runEmbeddedPiAgent): toolsAllow=["memory_search","memory_get"] ✅
TOKEN-FILTER (runEmbeddedAttempt): toolsAllow=undefined allTools=68 ❌
TOKEN-DIAG:  systemPromptChars=23610 customTools=68 toolsAllow=undefined
API usage:   input_tokens=37,303 (StepFun step-3.5-flash)

Other Affected Features

  • sessions_spawn with runtime="subagent" and toolsAllow - same issue if toolsAllow is passed through the same path
  • Any plugin or feature that relies on toolsAllow to restrict sub-agent tool access

Environment

  • OpenClaw version: 2026.4.12
  • active-memory plugin config: queryMode: "recent", model: "stepfun/step-3.5-flash-2603"
  • Verified via monkey-patched dist/pi-embedded-runner-CefZK1Pt.js with console.error diagnostics at three checkpoints (function entry, runEmbeddedAttempt, tool filter)

Fix

Add toolsAllow: params.toolsAllow to the runEmbeddedAttemptWithBackend call in runEmbeddedPiAgent:

  const attempt = await runEmbeddedAttemptWithBackend({
    sessionId: params.sessionId,
    // ...existing params...
+   toolsAllow: params.toolsAllow,
    bootstrapPromptWarningSignaturesSeen,
    bootstrapPromptWarningSignature: ...
  });

Related

  • #65998 - MCP tool schemas bypass toolsAllow (different but related filtering issue)
  • #66157 - Active-memory timeout with queryMode="message" (symptom, likely caused by this bug)

extent analysis

TL;DR

The most likely fix is to add the toolsAllow parameter to the runEmbeddedAttemptWithBackend call in runEmbeddedPiAgent to ensure sub-agents receive only the allowed tools.

Guidance

  • Verify that the toolsAllow parameter is being passed correctly to runEmbeddedPiAgent and that it is not being overwritten or lost before the runEmbeddedAttemptWithBackend call.
  • Check the runEmbeddedAttemptWithBackend function to ensure it handles the toolsAllow parameter correctly and applies the filter as expected.
  • Test the fix with the active-memory plugin and sessions_spawn feature to ensure the issue is resolved and sub-agents receive only the allowed tools.
  • Review related issues (#65998 and #66157) to ensure this fix does not introduce any new problems or regressions.

Example

The fix can be applied by adding the following line to the runEmbeddedAttemptWithBackend call:

const attempt = await runEmbeddedAttemptWithBackend({
  // ... existing params ...
  toolsAllow: params.toolsAllow,
  // ... existing params ...
});

Notes

This fix assumes that the toolsAllow parameter is being passed correctly to runEmbeddedPiAgent and that the runEmbeddedAttemptWithBackend function is designed to handle this parameter. Additional testing and verification may be necessary to ensure the fix is complete and does not introduce any new issues.

Recommendation

Apply the workaround by adding the toolsAllow parameter to the runEmbeddedAttemptWithBackend call in runEmbeddedPiAgent, as this directly addresses the identified issue and should resolve the problem with sub-agents receiving all configured tools.

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 toolsAllow parameter not forwarded to runEmbeddedAttemptWithBackend [1 pull requests, 1 comments, 2 participants]