Skip to content

fix: normalize Xiaomi array tool schemas#82575

Merged
steipete merged 1 commit into
mainfrom
fix/xiaomi-empty-array-items
May 16, 2026
Merged

fix: normalize Xiaomi array tool schemas#82575
steipete merged 1 commit into
mainfrom
fix/xiaomi-empty-array-items

Conversation

@steipete

@steipete steipete commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Mark Xiaomi MiMo resolved models with an internal empty-array-items compatibility flag.
  • Strip synthetic items: {} only at the final tool-schema normalization point, while preserving typed array items and annotation literals.
  • Add regressions for Xiaomi model compat, final OpenAI completions payload shape, __proto__ property preservation, boolean/null items, and default/enum literal preservation.

Verification

  • node scripts/run-vitest.mjs extensions/xiaomi/index.test.ts src/agents/pi-tools.schema.test.ts src/agents/openai-transport-stream.test.ts src/agents/openai-tool-schema.test.ts -> 6 files, 374 tests passed after rebase on latest origin/main.
  • node --import tsx scripts/generate-config-doc-baseline.ts --check -> OK docs/.generated/config-baseline.sha256.
  • git diff --check -> passed.
  • /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --parallel-tests "node scripts/run-vitest.mjs extensions/xiaomi/index.test.ts src/agents/pi-tools.schema.test.ts src/agents/openai-transport-stream.test.ts src/agents/openai-tool-schema.test.ts" -> clean, no accepted/actionable findings before the changelog-only rebase conflict resolution.

Real behavior proof

Behavior addressed: Xiaomi MiMo/OpenAI-compatible tool schemas no longer include synthetic empty array items objects that strict providers can reject.
Real environment tested: Local OpenClaw checkout on this branch plus Xiaomi standard OpenAI-compatible API at https://api.xiaomimimo.com/v1/chat/completions with model mimo-v2.5.
Exact steps or command run after this patch: Built the final OpenAI completions payload through OpenClaw's buildOpenAICompletionsParams regression, then sent the same omitted-empty-items tool schema shape to Xiaomi's live chat completions endpoint using the 1Password-stored Xiaomi MiMo API Key value without printing the secret.
Evidence after fix: Live output copied from terminal: no-tools request returned HTTP 200; live tool-schema request with parameters.properties.hints as { "type": "array" } and typed array items: { "type": "string" } returned HTTP 200; focused OpenClaw regression also asserted final payload hints equals { type: "array" } and typedHints keeps items: { type: "string" }.
Observed result after fix: Xiaomi accepted the compatible payload shape; OpenClaw's final OpenAI completions tool payload omits empty array items while preserving typed array items.
What was not tested: Xiaomi Token Plan endpoints; the available standard-console key returned 401 invalid key/no Token Plan subscription for token-plan-cn.xiaomimimo.com.

Fixes #82447

@steipete

Copy link
Copy Markdown
Contributor Author

Verification before merge:

  • node scripts/run-vitest.mjs extensions/xiaomi/index.test.ts src/agents/pi-tools.schema.test.ts src/agents/openai-transport-stream.test.ts src/agents/openai-tool-schema.test.ts -> 6 files, 366 tests passed.
  • node --import tsx scripts/generate-config-doc-baseline.ts --check -> OK docs/.generated/config-baseline.sha256.
  • git diff --check -> passed.
  • $codex-review helper with the same focused test command -> clean, no accepted/actionable findings.

Live proof:

  • Xiaomi standard endpoint https://api.xiaomimimo.com/v1/chat/completions, model mimo-v2.5, no-tools request -> HTTP 200.
  • Same endpoint/model with omitted-empty-items tool schema -> HTTP 200.

Known gap:

  • Xiaomi Token Plan endpoints were not verified; the available standard-console key returned 401/no Token Plan subscription for token-plan-cn.xiaomimimo.com.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: xiaomi size: M maintainer Maintainer-authored PR labels May 16, 2026
@steipete
steipete force-pushed the fix/xiaomi-empty-array-items branch from 70f0041 to 7f9183a Compare May 16, 2026 12:26
@steipete
steipete force-pushed the fix/xiaomi-empty-array-items branch from 7f9183a to 1b5d5e9 Compare May 16, 2026 12:28
@steipete

Copy link
Copy Markdown
Contributor Author

Updated verification after rebase on latest origin/main:

  • node scripts/run-vitest.mjs extensions/xiaomi/index.test.ts src/agents/pi-tools.schema.test.ts src/agents/openai-transport-stream.test.ts src/agents/openai-tool-schema.test.ts -> 6 files, 374 tests passed.
  • node --import tsx scripts/generate-config-doc-baseline.ts --check -> OK docs/.generated/config-baseline.sha256.
  • git diff --check -> passed.
  • $codex-review helper with the same focused test command -> clean before the changelog-only rebase conflict resolution.

Live proof remains unchanged:

  • Xiaomi standard endpoint https://api.xiaomimimo.com/v1/chat/completions, model mimo-v2.5, no-tools request -> HTTP 200.
  • Same endpoint/model with omitted-empty-items tool schema -> HTTP 200.

Known gap: Xiaomi Token Plan endpoints were not verified; the available standard-console key returned 401/no Token Plan subscription for token-plan-cn.xiaomimimo.com.

@steipete
steipete merged commit 862be9f into main May 16, 2026
123 of 126 checks passed
@clawsweeper

clawsweeper Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix: normalize Xiaomi array tool schemas This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete deleted the fix/xiaomi-empty-array-items branch May 16, 2026 12:34
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 20, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
qiaokuan1992 pushed a commit to qiaokuan1992/openclaw that referenced this pull request Jun 2, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 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 extensions: xiaomi maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI-compatible provider (Xiaomi MiMo v2.5) returns 400 after 2026.5.12 tool schema change (items field)

1 participant