Skip to content

fix(agents): quiet extra_body tuning-key collisions#92288

Open
ai-hpc wants to merge 1 commit into
openclaw:mainfrom
ai-hpc:fix/deepseek-thinking-extra-body-collision
Open

fix(agents): quiet extra_body tuning-key collisions#92288
ai-hpc wants to merge 1 commit into
openclaw:mainfrom
ai-hpc:fix/deepseek-thinking-extra-body-collision

Conversation

@ai-hpc

@ai-hpc ai-hpc commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

This PR fixes noisy extra_body collision warnings for OpenAI-compatible requests.

  • Treats extra_body as the provider-specific escape hatch for intentional tuning-key overrides such as thinking.
  • Keeps warning coverage for framework-owned request scaffolding: messages, model, and stream.
  • Adds regression coverage for both cases.
  • Intentionally does not change provider payload precedence: extra_body still wins when configured.

Review focus: the warning boundary in src/agents/embedded-agent-runner/extra-params.ts.

Linked context

Closes #75040

Related #74403
Related #75085

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: OpenAI-compatible extra_body with thinking produced a warning on every request even though thinking is a provider tuning key intentionally overridden by user config.
  • Real environment tested: Linux source checkout on current upstream/main, Node v22.22.2, pnpm 11.2.2, embedded agent runner payload mutation path.
  • Exact steps or command run after this patch: OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=<tmp-cache> pnpm test src/agents/embedded-agent-runner-extraparams.test.ts with Node v22.22.2.
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output):
Test Files  1 passed (1)
Tests  138 passed (138)
Start at  01:25:57
Duration  50.85s
[test] passed 1 Vitest shard in 73.62s
  • Observed result after fix: extra_body.thinking overrides the payload thinking value without calling log.warn; overriding framework-managed model still warns.
  • What was not tested: A live DeepSeek or Ollama gateway request was not replayed.
  • Proof limitations or environment constraints: The issue's hard source-level symptom is the warning emitted by the embedded runner payload wrapper. The Ollama timeout/session impact in the issue body remains speculative and is not claimed as fixed here.
  • Before evidence (optional but encouraged):
FAIL  |agents| src/agents/embedded-agent-runner-extraparams.test.ts > applyExtraParamsToAgent > applies extra_body tuning-key overrides without warning
AssertionError: expected "warn" to not be called at all, but actually been called 1 times

Received:
  "extra_body overwriting request payload keys: thinking"

Tests and validation

  • git diff --check
  • OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=<tmp-cache> pnpm test src/agents/embedded-agent-runner-extraparams.test.ts
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/agents/embedded-agent-runner/extra-params.ts src/agents/embedded-agent-runner-extraparams.test.ts
  • pnpm check:import-cycles
  • pnpm lint:webhook:no-low-level-body-read
  • pnpm lint:auth:no-pairing-store-group
  • pnpm lint:auth:pairing-account-scope
  • pnpm check:media-download-helpers
  • pnpm check:runtime-sidecar-loaders

pnpm check:changed src/agents/embedded-agent-runner/extra-params.ts src/agents/embedded-agent-runner-extraparams.test.ts cleared guards and core typecheck, then tsgo:core:test ran silently for several minutes locally and was stopped. The focused test and targeted lint/type-adjacent guards above cover this change.

Risk checklist

Did user-visible behavior change? Yes

Did config, environment, or migration behavior change? No

Did security, auth, secrets, network, or tool execution behavior change? No

Highest-risk area: warning visibility for extra_body key collisions.

Risk mitigation: warning suppression is limited to non-framework tuning keys; framework-owned scaffold keys still warn and are covered by regression.

Current review state

Next action: maintainer review and CI.

Still waiting on: CI and any maintainer request for live provider replay.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Jun 11, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label Jun 11, 2026
@clawsweeper

clawsweeper Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed June 30, 2026, 7:29 PM ET / 23:29 UTC.

Summary
The PR narrows OpenAI-compatible extra_body collision warnings so provider tuning keys can override quietly while framework-managed request keys still warn.

PR surface: Source +6, Tests +62. Total +68 across 2 files.

Reproducibility: yes. for the source-level warning path: current main warns on every extra_body collision before applying the override, including thinking. I did not run tests or live replay provider timeouts because this review is read-only.

Review metrics: 1 noteworthy metric.

  • Managed warning set: 3 included, 1 generated key omitted. The exact managed-key list decides which existing generated request collisions remain visible after merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #75040
Summary: The linked issue is the canonical open report for the extra_body.thinking collision warning, and this PR is its current candidate fix.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🐚 platinum hermit
Patch quality: 🦐 gold shrimp
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Add tools to the managed collision warning set with adjacent regression coverage.

Risk before merge

  • [P1] Merging as submitted would make extra_body.tools overwrite OpenClaw-generated tool declarations without the warning users get on current main, making tool-loss debugging silent.
  • [P2] The linked issue's DeepSeek/Ollama timeout and stuck-session impact was not live-replayed here; the high-confidence proof is the source-level warning path.

Maintainer options:

  1. Preserve managed tool diagnostics (recommended)
    Add tools to the framework-managed collision set and cover extra_body.tools with a focused regression while keeping extra_body.thinking quiet.
  2. Accept quieter advanced overrides
    Maintainers can intentionally decide generated tool overrides are an advanced-user escape hatch, but that accepts quieter debugging for tool-loss cases.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Add `tools` to `FRAMEWORK_MANAGED_EXTRA_BODY_KEYS` and add a focused regression that `extra_body.tools` emits the framework-managed warning while `extra_body.thinking` remains quiet.

Next step before merge

  • [P2] A narrow mechanical repair can preserve generated-tool collision diagnostics without changing provider payload precedence or requiring a product decision.

Security
Cleared: The diff only changes TypeScript request-warning logic and adjacent tests; it does not touch workflows, dependencies, lockfiles, secrets, publishing, downloads, generated, or vendor code.

Review findings

  • [P2] Warn when extra_body replaces generated tools — src/agents/embedded-agent-runner/extra-params.ts:752
Review details

Best possible solution:

Keep the narrow warning-boundary fix, add tools to the managed collision set with a focused regression, and preserve extra_body payload precedence.

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

Yes for the source-level warning path: current main warns on every extra_body collision before applying the override, including thinking. I did not run tests or live replay provider timeouts because this review is read-only.

Is this the best way to solve the issue?

No as submitted. The warning-boundary layer is the right narrow place, but the managed set omits generated tools, which are created before the extra_body payload hook runs.

Full review comments:

  • [P2] Warn when extra_body replaces generated tools — src/agents/embedded-agent-runner/extra-params.ts:752
    buildParams creates params.tools from context.tools before this payload hook runs, but the new managed-key set omits tools. After this change, extra_body.tools can replace OpenClaw-generated tool declarations without the warning current main emits, making tool-loss debugging silent; include tools in the managed set and add a regression.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a841c2788202.

Label changes

Label justifications:

  • P2: This is a bounded agent/provider request-shaping bug fix with limited blast radius and a clear linked issue.
  • merge-risk: 🚨 compatibility: The diff changes diagnostics for existing extra_body configurations and currently hides generated-tool collisions that warn on main.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The author is a repository MEMBER, so the external-contributor real behavior proof gate does not apply; the PR body still includes useful focused before/after test output.
Evidence reviewed

PR surface:

Source +6, Tests +62. Total +68 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 3 +6
Tests 1 62 0 +62
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 71 3 +68

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/agents/embedded-agent-runner-extraparams.test.ts.
  • [P1] node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/agents/embedded-agent-runner/extra-params.ts src/agents/embedded-agent-runner-extraparams.test.ts.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • pick-cat: Current shallow blame for the extra_body wrapper and OpenAI completions payload construction points to this author, though the checkout history is grafted and limited. (role: recent area contributor; confidence: medium; commits: 169acd1e4ed4; files: src/agents/embedded-agent-runner/extra-params.ts, src/llm/providers/openai-completions.ts, src/agents/embedded-agent-runner-extraparams.test.ts)
  • Vincent Koc: Recent repository history for the same central files includes the latest release/current-main snapshot commit, but the local path history is shallow so routing confidence is lower. (role: release/history contributor; confidence: low; commits: e085fa1a3ffd, a841c2788202; files: src/agents/embedded-agent-runner/extra-params.ts, src/llm/providers/openai-completions.ts, src/agents/embedded-agent-runner-extraparams.test.ts)
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.

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.
Review history (1 earlier review cycle)
  • reviewed 2026-06-21T17:40:13.372Z sha 8a37391 :: needs changes before merge. :: [P2] Warn when extra_body replaces generated tools

@ai-hpc

ai-hpc commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 15, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S stale Marked as stale due to inactivity status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: extra_body overwriting request payload keys: thinking — framework-level thinking field collision affecting all providers

1 participant