Repository navigation
fix: forward toolsAllow through embedded runner call chain - #66710
KeWang0622 wants to merge 1 commit into
Conversation
…WithBackend runEmbeddedPiAgent accepted a toolsAllow parameter but never included it in the params object passed to runEmbeddedAttemptWithBackend. This caused sub-agents to receive the full 37k-token tool list instead of a filtered 3k-token subset, leading to 10x token bloat and 30s timeouts. The attempt layer (attempt.ts) already handles toolsAllow correctly for both tool filtering and prompt mode optimization -- it just never received the value from the orchestration layer. Fixes openclaw#66581 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Greptile SummaryFixes a missing Confidence Score: 5/5
Reviews (1): Last reviewed commit: "fix: forward toolsAllow from runEmbedded..." | Re-trigger Greptile |
|
Closing this as implemented after Codex review. Current What I checked:
So I’m closing this as already implemented rather than keeping a duplicate issue open. Review notes: reviewed against cc0f3e0e4036; fix evidence: release v2026.4.23, commit a9797214338b. |
When active-memory plugin invokes sub-agents with toolsAllow, the tools get filtered to [] in the embedded runner context. Strict OpenAI-compatible providers (DashScope/GLM, Kimi, vLLM) reject tools: [] with HTTP 400. Adds wrapStreamFnStripEmptyTools() as a payload interceptor that: - Strips tools entirely when array is empty - Strips tool_choice when tools is absent Consolidates openclaw#59898, openclaw#66710, openclaw#47947 into a single guard. Fixes openclaw#53174.
When active-memory plugin invokes sub-agents with toolsAllow, the tools get filtered to [] in the embedded runner context. Strict OpenAI-compatible providers (DashScope/GLM, Kimi, vLLM) reject tools: [] with HTTP 400. Adds wrapStreamFnStripEmptyTools() as a payload interceptor that: - Strips tools entirely when array is empty - Strips tool_choice when tools is absent Consolidates openclaw#59898, openclaw#66710, openclaw#47947 into a single guard. Fixes openclaw#53174.
Summary
runEmbeddedPiAgentaccepts atoolsAllowparameter but never forwarded it torunEmbeddedAttemptWithBackend, causing sub-agents to receive the full ~37k-token tool list instead of a filtered ~3k-token subsettoolsAllow: params.toolsAllowto the params object inrun.tsline 663attempt.ts) already handlestoolsAllowcorrectly for both tool filtering (lines 542-544) and prompt mode optimization (lines 708-710) -- it just never received the valueThe bug
When a caller sets
toolsAllow: ["exec", "read"]onrunEmbeddedPiAgent, the orchestration layer (run.ts) builds a ~90-field params object forrunEmbeddedAttemptWithBackendbut omitstoolsAllow. The attempt layer has the filtering logic but always seesundefined, 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
toolsAllowis forwarded when set (non-empty array)toolsAllowremainsundefinedwhen not set (backward compat)toolsAllowarray is forwarded without coercionFixes #66581
Complementary to #60842 (config-level allowlist operates at a different layer)
🤖 Generated with Claude Code