Skip to content

fix(agents): strip empty tools/tool_choice from embedded runner payloads - #70790

Closed
kiranvk-2011 wants to merge 3 commits into
openclaw:mainfrom
kiranvk-2011:fix/consolidated-empty-tools-handling
Closed

kiranvk-2011 wants to merge 3 commits into
openclaw:mainfrom
kiranvk-2011:fix/consolidated-empty-tools-handling

Conversation

@kiranvk-2011

Copy link
Copy Markdown
Contributor

Problem

When the active-memory plugin invokes sub-agents with toolsAllow: ["memory_search", "memory_get"], these tools are unavailable in the embedded runner context and get filtered down to an empty array tools: []. Strict OpenAI-compatible providers (DashScope/GLM, Kimi, vLLM) reject this with:

400 [] is too short - 'tools'

This affects any sub-agent flow (active-memory, cron, etc.) using DashScope/GLM or similar providers through the embedded runner.

Root Cause Chain

This bug has been tracked across multiple issues and partial-fix PRs:

  1. [Bug] /btw command fails with ModelStudio provider: 400 [] is too short - 'tools' #53174 (closed) — Original bug report: /btw command fails with ModelStudio provider: 400 [] is too short - 'tools'
  2. fix(agents): handle explicit empty tool lists in system prompt #59898 (open) — Attempted a system-prompt guard for empty tool lists
  3. fix: forward toolsAllow through embedded runner call chain #66710 (open) — Forwarding toolsAllow through the embedded runner call chain
  4. fix: strip tool_choice from payload when tools array is empty #47947 (open) — Stripping tool_choice when tools array is empty
  5. toolsAllow parameter not forwarded to runEmbeddedAttemptWithBackend #66581 (open) — toolsAllow parameter not forwarded to runEmbeddedAttemptWithBackend
  6. Active Memory sub-agent receives all tools instead of toolsAllow filter (toolsAllow not forwarded in runEmbeddedPiAgent) #69892 (open) — Active Memory sub-agent receives all tools instead of toolsAllow filter (toolsAllow not forwarded in runEmbeddedPiAgent)

Solution

Consolidates all three open PRs (#59898, #66710, #47947) into a single, minimal payload interceptor at the stream-resolution layer — src/agents/pi-embedded-runner/stream-resolution.ts.

Adds wrapStreamFnStripEmptyTools() which:

  • Strips tools entirely when the array is empty (length === 0) — correct behavior for tool-less requests per the OpenAI API spec
  • Strips tool_choice simultaneously when tools is absent — some providers reject tool_choice without a corresponding tools array (fix: strip tool_choice from payload when tools array is empty #47947)
  • Wraps both the boundary-aware and custom stream function paths, covering all HTTP/embedded stream transports

Why This Approach

Change

 src/agents/pi-embedded-runner/stream-resolution.ts
+  wrapStreamFnStripEmptyTools() — payload interceptor that strips empty tools
+  arrays and orphaned tool_choice from outgoing HTTP payloads

+  // Wrap with empty-tools guard for boundary-aware stream
+  return wrapStreamFnStripEmptyTools(boundaryAwareStreamFn);
+
+  // Wrap with empty-tools guard for custom stream function as well.
+  return wrapStreamFnStripEmptyTools(currentStreamFn);

Verification

  • Built and deployed via custom GitHub Actions runner (ghcr.io/kiranvk-2011/openclaw:0.0.0-emptytools-fix)
  • Active-memory plugin queries succeed with bailian/glm-5 (DashScope provider) — no more 400 rejection
  • Gateway health check passes with all 8 plugins loaded (including active-memory)
  • Telegram connectivity verified on test instance

🤖 AI-assisted PR — lightly tested. Built and validated via CI + test container deployment.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Apr 23, 2026
@greptile-apps

greptile-apps Bot commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds wrapStreamFnStripEmptyTools() as a payload interceptor in stream-resolution.ts to strip tools: [] and orphaned tool_choice from outgoing HTTP payloads, fixing 400 rejection errors from strict OpenAI-compatible providers (DashScope/GLM, Kimi, vLLM).

  • The session-http-fallback code path (line 113) returns currentStreamFn unwrapped when shouldUseWebSocketTransport=true but wsApiKey is absent — this branch is not protected and will still trigger provider 400 errors in that configuration.

Confidence Score: 4/5

Safe to merge with the understanding that the session-http-fallback path remains unprotected — a one-line fix covers the gap.

The core fix is sound and well-targeted. One code path (shouldUseWebSocketTransport=true with no wsApiKey) escapes the wrapper and still exposes tools: [] to strict providers, which is an incomplete fix for the stated goal.

src/agents/pi-embedded-runner/stream-resolution.ts — the session-http-fallback branch at line 113 needs wrapStreamFnStripEmptyTools.

Comments Outside Diff (1)

  1. src/agents/pi-embedded-runner/stream-resolution.ts, line 105-113 (link)

    P1 session-http-fallback path not wrapped

    When shouldUseWebSocketTransport is true but wsApiKey is absent, the function returns currentStreamFn at line 113 before reaching the wrapStreamFnStripEmptyTools call at line 131. The PR description claims to cover "all HTTP/embedded stream transports," but this "session-http-fallback" branch (as named in describeEmbeddedAgentStreamStrategy) is unprotected and will still send tools: [] to any strict provider that happens to fall into this code path.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/agents/pi-embedded-runner/stream-resolution.ts
    Line: 105-113
    
    Comment:
    **`session-http-fallback` path not wrapped**
    
    When `shouldUseWebSocketTransport` is `true` but `wsApiKey` is absent, the function returns `currentStreamFn` at line 113 before reaching the `wrapStreamFnStripEmptyTools` call at line 131. The PR description claims to cover "all HTTP/embedded stream transports," but this `"session-http-fallback"` branch (as named in `describeEmbeddedAgentStreamStrategy`) is unprotected and will still send `tools: []` to any strict provider that happens to fall into this code path.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-runner/stream-resolution.ts
Line: 105-113

Comment:
**`session-http-fallback` path not wrapped**

When `shouldUseWebSocketTransport` is `true` but `wsApiKey` is absent, the function returns `currentStreamFn` at line 113 before reaching the `wrapStreamFnStripEmptyTools` call at line 131. The PR description claims to cover "all HTTP/embedded stream transports," but this `"session-http-fallback"` branch (as named in `describeEmbeddedAgentStreamStrategy`) is unprotected and will still send `tools: []` to any strict provider that happens to fall into this code path.

```suggestion
    return params.wsApiKey
      ? createOpenAIWebSocketStreamFn(params.wsApiKey, params.sessionId, {
          signal: params.signal,
          managerOptions: {
            request: getModelProviderRequestTransport(params.model),
          },
        })
      : wrapStreamFnStripEmptyTools(currentStreamFn);
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(agents): strip empty tools/tool_choi..." | Re-trigger Greptile

Re-review progress:

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2f4ceeb52

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

*/
function wrapStreamFnStripEmptyTools(base: StreamFn): StreamFn {
return (model, context, options) => {
return base(model, context, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve receiver when invoking wrapped custom stream functions

This wrapper changes custom currentStreamFn execution from a direct return to an unbound call (base(model, ...)), which drops call-site this. Any session-provided stream function implemented as an object method (reading instance state via this) will now fail or read undefined state in embedded runs, whereas it worked before when the function was returned unchanged. Call the wrapped function with the original receiver (for example via .call) or avoid wrapping arbitrary custom stream functions.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The StreamFn type (from @mariozechner/pi-agent-core) is defined as a standalone function type: type StreamFn = (...args: Parameters<typeof streamSimple>) => ReturnType<typeof streamSimple>. All streamFn assignments in the codebase use standalone functions (createOpenAIWebSocketStreamFn, createBoundaryAwareStreamFnForModel, streamSimple, etc.), never methods with a receiver. The existing wrapper in this same file (resolveEmbeddedAgentStreamFn, lines 89-100) already uses the same unbound call pattern for inner(), establishing this as the accepted convention. This wrapper follows the same pattern.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59fd1a49d3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

*/
function wrapStreamFnStripEmptyTools(base: StreamFn): StreamFn {
return (model, context, options) => {
return base(model, context, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bind wrapped stream calls to preserve custom receiver

wrapStreamFnStripEmptyTools calls base(model, context, ...) as an unbound function, so wrapped custom stream functions lose their call-site this. Fresh evidence: this commit now routes both the websocket HTTP fallback branch and the final custom-stream return path through this wrapper, so session stream methods that read instance state via this can now throw or behave incorrectly where they previously worked when returned directly.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my reply above — StreamFn is a standalone function type, not a method. The existing wrapper pattern in this file already calls inner() unbound. This is the established convention and the type system enforces standalone functions. No custom receiver is used anywhere in the codebase for StreamFn implementations.

@joeykrug

joeykrug commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Would be good to get this merged. This issue is causing active memory to break. Edit: while this is I believe one issue causing active memory to break, it’s not the sole one

@clawsweeper

clawsweeper Bot commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

Latest ClawSweeper review: 2026-05-20 17:49 UTC / May 20, 2026, 1:49 PM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The PR adds a stream-resolution payload wrapper that strips empty tools arrays and orphaned tool_choice fields from selected embedded-runner stream payloads, plus updates one test expectation.

Reproducibility: yes. at source level: Active Memory passes toolsAllow into runEmbeddedPiAgent, and current OpenAI-compatible transport can emit params.tools = [] when tool history exists but current context.tools is absent. I did not run a live DashScope/GLM, Kimi, or vLLM reproduction.

PR rating
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Summary: Useful fix direction, but missing real behavior proof, merge conflicts, and incomplete current-main stream coverage keep it below merge quality.

Rank-up moves:

  • Add redacted strict-provider proof such as terminal output, logs, a recording, or an artifact showing the fixed provider request path after this patch.
  • Rebase on current main and cover provider-owned, PI-native, boundary-aware, and custom embedded stream branches with focused payload assertions.
  • Confirm the sanitizer runs after wrappers that can add tool_choice or parallel_tool_calls.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Needs real behavior proof before merge: Missing: the PR body claims container/Telegram validation, but no inspectable redacted logs, terminal output, screenshot, recording, or linked artifact shows the after-fix strict-provider path; update the PR body with proof to trigger re-review, redacting private details.

Mantis proof suggestion
A real Telegram Active Memory run against a strict OpenAI-compatible provider is the claimed user path and would provide useful transport proof. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

telegram live: verify active-memory sub-agent on a strict OpenAI-compatible provider succeeds without sending tools: [] or orphaned tool_choice.

Risk before merge

  • Provider-owned and PI-native/auth-profile branches on current main can bypass the sanitizer if this PR is rebased in its current shape.
  • The sanitizer must run after any later wrapper that can add tool_choice or parallel_tool_calls, otherwise strict providers may still see orphaned tool-related fields.
  • The PR body claims strict-provider Telegram/container validation, but no inspectable redacted output or artifact is available.
  • The branch is currently merge-conflicted against main, so the older diff cannot be merged as-is.

Maintainer options:

  1. Rebase around current stream resolution (recommended)
    Update the branch so the sanitizer composes safely with provider-owned, PI-native, boundary-aware, custom, auth-profile, and extra-param wrapper paths, then add payload assertions and redacted strict-provider proof.
  2. Pause until proof exists
    Leave the PR unmerged until the contributor or a maintainer supplies inspectable proof for the strict-provider Active Memory path and resolves the current merge conflict.

Next step before merge
Manual review is needed because the contributor must rebase the conflicted branch and supply real strict-provider proof; automation should not repair while the external proof gate is missing.

Security
Cleared: The diff only changes in-process agent payload shaping and tests, with no dependency, CI, permission, secret, download, or package-resolution changes.

Review findings

  • [P2] Wrap every embedded stream branch with the sanitizer — src/agents/pi-embedded-runner/stream-resolution.ts:117-124
Review details

Best possible solution:

Land a rebased embedded-runner payload sanitizer that covers provider-owned, PI-native, boundary-aware, and custom stream paths, runs at the final payload boundary, and includes focused payload assertions plus redacted strict-provider proof.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: Active Memory passes toolsAllow into runEmbeddedPiAgent, and current OpenAI-compatible transport can emit params.tools = [] when tool history exists but current context.tools is absent. I did not run a live DashScope/GLM, Kimi, or vLLM reproduction.

Is this the best way to solve the issue?

No, not yet. A payload-level sanitizer is the right shape, but this branch is stale/conflicted, misses current-main stream branches, and lacks inspectable after-fix strict-provider proof.

Label justifications:

  • P2: This is a normal-priority provider compatibility fix for embedded agent payloads with a real but bounded Active Memory/sub-agent blast radius.
  • merge-risk: 🚨 auth-provider: The PR rebases across provider-owned, PI-native, OAuth/auth-profile, and resolved API-key stream branches where an incomplete composition could break provider routing or credentials.
  • rating: 🧂 unranked krab: Current PR rating is 🧂 unranked krab because proof is 🧂 unranked krab, patch quality is 🦐 gold shrimp, and Useful fix direction, but missing real behavior proof, merge conflicts, and incomplete current-main stream coverage keep it below merge quality.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Missing: the PR body claims container/Telegram validation, but no inspectable redacted logs, terminal output, screenshot, recording, or linked artifact shows the after-fix strict-provider path; update the PR body with proof to trigger re-review, redacting private details.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The claimed affected flow is Active Memory through Telegram, so a short redacted Telegram transcript plus logs would materially demonstrate the user-visible fix.

Full review comments:

  • [P2] Wrap every embedded stream branch with the sanitizer — src/agents/pi-embedded-runner/stream-resolution.ts:117-124
    The new guard only covers later fallback/custom stream paths, but current main passes providerStreamFn into resolveEmbeddedAgentStreamFn and also has PI-native/auth-profile branches that return before those paths. A rebase that keeps this shape can still send tools: [] or orphaned tool_choice to strict OpenAI-compatible providers through reachable embedded-runner streams.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.9

Acceptance criteria:

  • node scripts/run-vitest.mjs src/agents/pi-embedded-runner/stream-resolution.test.ts
  • node scripts/run-vitest.mjs src/agents/pi-embedded-runner/run/attempt.test.ts
  • Redacted live strict-provider Active Memory proof through the embedded runner

What I checked:

  • PR diff adds a partial sanitizer: The PR adds wrapStreamFnStripEmptyTools() and composes it around the later boundary-aware/custom paths, but the branch predates current main's newer stream-resolution branches. (src/agents/pi-embedded-runner/stream-resolution.ts:117, 28cae76e214a)
  • Current main has early provider-owned and PI-native returns: resolveEmbeddedAgentStreamFn returns provider-owned streams at the top and returns PI-native Codex Responses streams before the boundary-aware fallback, so a sanitizer applied only to later returns does not cover all embedded stream paths. (src/agents/pi-embedded-runner/stream-resolution.ts:123, a13468320c63)
  • Provider streams are normal embedded-runner inputs: The attempt path registers a provider stream and passes it into resolveEmbeddedAgentStreamFn, making the provider-owned branch reachable during normal embedded runs. (src/agents/pi-embedded-runner/run/attempt.ts:2646, a13468320c63)
  • Current main can still build tools: []: The OpenAI-compatible completions transport sets params.tools = [] when there is tool history but no current context.tools, matching the strict-provider failure shape described by the PR. (src/agents/openai-transport-stream.ts:3360, a13468320c63)
  • Active Memory uses the embedded runner allowlist path: Active Memory calls runEmbeddedPiAgent with toolsAllow: [...params.config.toolsAllow], matching the reported sub-agent reproduction chain. (extensions/active-memory/index.ts:2553, a13468320c63)
  • Live PR state blocks merge: GitHub reports the PR as CONFLICTING/DIRTY, and the latest proof check is failing because no inspectable real behavior proof has been posted. (28cae76e214a)

Likely related people:

  • openperf: Auth-wrapper work in stream-resolution.ts changed provider-owned and boundary-aware embedded stream composition around the same return paths this PR must now rebase over. (role: recent stream-resolution contributor; confidence: high; commits: 16fd9a9d5973; files: src/agents/pi-embedded-runner/stream-resolution.ts)
  • steipete: Recent commits touched OpenAI-compatible payload compatibility and no-tool completions behavior in the same provider wrapper surface. (role: provider payload compatibility contributor; confidence: high; commits: 772034d74107, 325d9ca7cb94, d5eec80e3403; files: src/agents/pi-embedded-runner/extra-params.ts, src/agents/pi-embedded-runner/openai-stream-wrappers.ts)
  • vincentkoc: Prompt-cache boundary work introduced and extended the embedded stream-resolution and boundary-shaping behavior that this PR composes with. (role: introduced adjacent stream boundary behavior; confidence: medium; commits: fd0156132779, c76646adb135; files: src/agents/pi-embedded-runner/stream-resolution.ts, src/agents/pi-embedded-runner/run/attempt.ts)
  • joshavant: Recent Codex reasoning replay work touched stream-resolution.ts after the PR branch and is relevant to rebasing the PI-native/auth-profile paths safely. (role: recent adjacent owner; confidence: medium; commits: a54c73687f58; files: src/agents/pi-embedded-runner/stream-resolution.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against a13468320c63.

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.
…guard

The test previously expected custom currentStreamFn to pass through
unchanged (same reference). Now that wrapStreamFnStripEmptyTools wraps
all stream functions, update the assertion to expect a different reference.
Greptile review finding: when shouldUseWebSocketTransport=true but
wsApiKey is absent, currentStreamFn was returned unwrapped, bypassing
the empty-tools interceptor. Wrap it consistently.
@kiranvk-2011
kiranvk-2011 force-pushed the fix/consolidated-empty-tools-handling branch from 17a6cb8 to 28cae76 Compare May 4, 2026 11:50
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels May 20, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 20, 2026
steipete pushed a commit to rendrag-git/openclaw that referenced this pull request May 23, 2026
… endpoints

Strict OpenAI-compatible servers (vLLM, LocalAI, llama.cpp, LM Studio) and
current OpenAI itself reject requests containing tools: []. Strip the empty
tools array (and the orphan tool_choice) from outbound chat-completions
payloads when usesExplicitProxyLikeEndpoint is true. Native OpenAI/Azure/
OpenRouter routes are byte-identical.

Supersedes openclaw#70790 at the canonical payload builder seam so the gateway,
embedded runner, and public plugin-SDK consumers (zai/xiaomi/deepseek) all
benefit.
steipete pushed a commit that referenced this pull request May 23, 2026
… endpoints

Strict OpenAI-compatible servers (vLLM, LocalAI, llama.cpp, LM Studio) and
current OpenAI itself reject requests containing tools: []. Strip the empty
tools array (and the orphan tool_choice) from outbound chat-completions
payloads when usesExplicitProxyLikeEndpoint is true. Native OpenAI/Azure/
OpenRouter routes are byte-identical.

Supersedes #70790 at the canonical payload builder seam so the gateway,
embedded runner, and public plugin-SDK consumers (zai/xiaomi/deepseek) all
benefit.

Copy link
Copy Markdown
Contributor

Thanks for digging into this. I landed the fix via #85835 instead because it patches the canonical buildOpenAICompletionsParams payload builder rather than only the embedded-runner stream wrapper, so the gateway/direct transport and SDK consumers get the same empty-tools behavior.

Landed on main in 69e8039. Closing this as superseded by #85835.

@steipete steipete closed this May 23, 2026
steipete pushed a commit that referenced this pull request May 24, 2026
… endpoints

Strict OpenAI-compatible servers (vLLM, LocalAI, llama.cpp, LM Studio) and
current OpenAI itself reject requests containing tools: []. Strip the empty
tools array (and the orphan tool_choice) from outbound chat-completions
payloads when usesExplicitProxyLikeEndpoint is true. Native OpenAI/Azure/
OpenRouter routes are byte-identical.

Supersedes #70790 at the canonical payload builder seam so the gateway,
embedded runner, and public plugin-SDK consumers (zai/xiaomi/deepseek) all
benefit.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
… endpoints

Strict OpenAI-compatible servers (vLLM, LocalAI, llama.cpp, LM Studio) and
current OpenAI itself reject requests containing tools: []. Strip the empty
tools array (and the orphan tool_choice) from outbound chat-completions
payloads when usesExplicitProxyLikeEndpoint is true. Native OpenAI/Azure/
OpenRouter routes are byte-identical.

Supersedes openclaw#70790 at the canonical payload builder seam so the gateway,
embedded runner, and public plugin-SDK consumers (zai/xiaomi/deepseek) all
benefit.
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
… endpoints

Strict OpenAI-compatible servers (vLLM, LocalAI, llama.cpp, LM Studio) and
current OpenAI itself reject requests containing tools: []. Strip the empty
tools array (and the orphan tool_choice) from outbound chat-completions
payloads when usesExplicitProxyLikeEndpoint is true. Native OpenAI/Azure/
OpenRouter routes are byte-identical.

Supersedes openclaw#70790 at the canonical payload builder seam so the gateway,
embedded runner, and public plugin-SDK consumers (zai/xiaomi/deepseek) all
benefit.
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
… endpoints

Strict OpenAI-compatible servers (vLLM, LocalAI, llama.cpp, LM Studio) and
current OpenAI itself reject requests containing tools: []. Strip the empty
tools array (and the orphan tool_choice) from outbound chat-completions
payloads when usesExplicitProxyLikeEndpoint is true. Native OpenAI/Azure/
OpenRouter routes are byte-identical.

Supersedes openclaw#70790 at the canonical payload builder seam so the gateway,
embedded runner, and public plugin-SDK consumers (zai/xiaomi/deepseek) all
benefit.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
… endpoints

Strict OpenAI-compatible servers (vLLM, LocalAI, llama.cpp, LM Studio) and
current OpenAI itself reject requests containing tools: []. Strip the empty
tools array (and the orphan tool_choice) from outbound chat-completions
payloads when usesExplicitProxyLikeEndpoint is true. Native OpenAI/Azure/
OpenRouter routes are byte-identical.

Supersedes openclaw#70790 at the canonical payload builder seam so the gateway,
embedded runner, and public plugin-SDK consumers (zai/xiaomi/deepseek) all
benefit.

This branch had an error being deployed

1 failed deployment
qa-live-shared — 28cae76e Deployed May 20, 2026 by clawsweeper[bot] via Run agentic native Telegram proof #35405
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants