Skip to content

fix: align Xiaomi completions replay compat#91113

Merged
steipete merged 3 commits into
mainfrom
fix/xiaomi-completions-reasoning-content
Jun 7, 2026
Merged

fix: align Xiaomi completions replay compat#91113
steipete merged 3 commits into
mainfrom
fix/xiaomi-completions-reasoning-content

Conversation

@steipete

@steipete steipete commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • align provider-layer OpenAI Completions compat detection with the existing agent transport Xiaomi/MiMo defaults
  • treat documented xiaomimimo.com MiMo endpoints like DeepSeek-style reasoning endpoints for assistant replay
  • add a direct provider payload regression proving Xiaomi assistant tool history gets reasoning_content: ""

Fixes #91106.

Verification

  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/llm/providers/openai-completions.test.ts src/agents/openai-completions-compat.test.ts -> 40 tests passed
  • pnpm exec oxfmt --check --threads=1 src/llm/providers/openai-completions.ts src/llm/providers/openai-completions.test.ts
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/llm/providers/openai-completions.ts src/llm/providers/openai-completions.test.ts
  • pnpm tsgo:core
  • git diff --check
  • pnpm changed:lanes --json -> core + coreTests only
  • /Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode local -> clean, no accepted/actionable findings

API proof

Not tested

  • No live Xiaomi request was run. I checked 1Password via targeted metadata-only queries, but this op build has no search flag and I did not broadly enumerate vault contents. The after-fix regression captures the exact outbound provider payload before network dispatch.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jun 7, 2026
@clawsweeper

clawsweeper Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 7, 2026, 3:55 AM ET / 07:55 UTC.

Summary
The PR adds Xiaomi/MiMo detection to provider-layer OpenAI Completions compat so assistant tool-call replay gets reasoning_content: "", and adds a provider payload regression test.

PR surface: Source +3, Tests +76. Total +79 across 2 files.

Reproducibility: yes. for the source-level payload path: current main only enables provider replay injection for DeepSeek, while the sibling agent transport path already enables it for Xiaomi. A live Xiaomi 400 was not reproduced in this review.

Review metrics: 1 noteworthy metric.

  • Provider compat defaults: 2 changed for Xiaomi/MiMo detection. The PR changes generated provider request payload defaults, which unit tests cannot fully validate against the external Xiaomi API.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add redacted live Xiaomi multi-turn tool replay output, logs, terminal output, or a recording that shows the request succeeds after this patch.
  • Update the PR body after adding proof so ClawSweeper re-reviews automatically; if it does not, ask a maintainer to comment @clawsweeper re-review.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR includes official-docs evidence and a unit payload capture, but no live Xiaomi request was run; redacted real behavior proof is still needed before merge unless maintainers override it. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] No live Xiaomi multi-turn tool replay was run; the PR proves the outbound payload before network dispatch and cites official docs, but repository policy treats external API behavior as needing live proof when feasible.
  • [P1] Merging changes outgoing OpenAI-compatible payload defaults for Xiaomi/MiMo endpoints, so maintainers should intentionally accept the provider compatibility behavior before merge.

Maintainer options:

  1. Require live Xiaomi replay proof (recommended)
    Ask for a redacted terminal/log or recording of a real Xiaomi multi-turn tool-call replay showing the request succeeds after the payload change.
  2. Accept the docs-backed payload change
    A maintainer may choose to merge based on official Xiaomi docs plus the outbound-payload regression if live credentials are unavailable.
  3. Pause until provider ownership weighs in
    If maintainers are unsure about changing Xiaomi provider defaults without live proof, pause the PR for provider-owner review rather than asking for automated repair.

Next step before merge

  • [P1] Protected maintainer label plus missing live external-API proof make this a human merge decision, not an automated repair job.

Security
Cleared: The diff touches only provider compat detection and a unit test; it does not change dependencies, workflows, secrets, package metadata, or code-download surfaces.

Review details

Best possible solution:

Land the narrow compat alignment after maintainer acceptance or a redacted live Xiaomi multi-turn tool replay proves the external API path.

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

Yes for the source-level payload path: current main only enables provider replay injection for DeepSeek, while the sibling agent transport path already enables it for Xiaomi. A live Xiaomi 400 was not reproduced in this review.

Is this the best way to solve the issue?

Yes, this is an acceptable narrow fix for the documented xiaomimimo.com endpoint because the changed provider detectCompat function owns the affected payload path. A shared helper could reduce future drift, but it is not necessary for this small alignment.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This fixes a limited provider compatibility bug affecting Xiaomi/MiMo reasoning tool-history replay without broad core-runtime impact.
  • add merge-risk: 🚨 compatibility: The diff changes default outbound payload behavior for existing Xiaomi or xiaomimimo.com OpenAI-compatible provider configurations.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR includes official-docs evidence and a unit payload capture, but no live Xiaomi request was run; redacted real behavior proof is still needed before merge unless maintainers override it. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: This fixes a limited provider compatibility bug affecting Xiaomi/MiMo reasoning tool-history replay without broad core-runtime impact.
  • merge-risk: 🚨 compatibility: The diff changes default outbound payload behavior for existing Xiaomi or xiaomimimo.com OpenAI-compatible provider configurations.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR includes official-docs evidence and a unit payload capture, but no live Xiaomi request was run; redacted real behavior proof is still needed before merge unless maintainers override it. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +3, Tests +76. Total +79 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 11 8 +3
Tests 1 76 0 +76
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 87 8 +79

What I checked:

  • Repository policy read: Root review policy was read fully; it makes provider routing and external API behavior compatibility-sensitive and requires external API proof when feasible. (AGENTS.md:15, 589ea28dabc8)
  • Scoped agent guidance read: The only scoped AGENTS.md relevant to the sibling agent transport path is test-performance guidance and did not conflict with the review. (src/agents/AGENTS.md:1, 589ea28dabc8)
  • Current provider path misses Xiaomi: Current main's provider-layer detectCompat sets requiresReasoningContentOnAssistantMessages from isDeepSeek only, so Xiaomi provider-layer replay does not get the field by default. (src/llm/providers/openai-completions.ts:1290, 589ea28dabc8)
  • Replay injection call path: The provider payload builder only injects empty reasoning_content when the resolved compat flag is true and the model is reasoning-capable. (src/llm/providers/openai-completions.ts:1062, 589ea28dabc8)
  • Sibling agent transport already covers Xiaomi: The agent transport compat defaults classify Xiaomi endpoints as DeepSeek-style and require reasoning_content replay, confirming the invariant the PR is aligning with. (src/agents/openai-completions-compat.ts:75, 589ea28dabc8)
  • PR head changes provider compat defaults: The PR head adds isXiaomi for provider === "xiaomi" or xiaomimimo.com, then uses it for requiresReasoningContentOnAssistantMessages and thinkingFormat: "deepseek". (src/llm/providers/openai-completions.ts:1277, 50c79524037c)

Likely related people:

  • @vincentkoc: Git blame in the available checkout attributes the central provider detectCompat function and sibling agent compat defaults to ed7f259ce7; history is flattened, so this is a routing signal rather than blame. (role: recent area contributor; confidence: medium; commits: ed7f259ce794; files: src/llm/providers/openai-completions.ts, src/agents/openai-completions-compat.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.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 7, 2026
@steipete steipete force-pushed the fix/xiaomi-completions-reasoning-content branch from 50c7952 to d7d6b29 Compare June 7, 2026 07:56
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jun 7, 2026
@steipete

steipete commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for d7d6b291d792f8f87f66b1538cac303e1c52bc42.

What changed:

  • Xiaomi MiMo/OpenAI-compatible completions now uses DeepSeek-style thinking replay compatibility.
  • Assistant messages replayed after tool calls include reasoning_content: "", matching Xiaomi's documented pass-back requirement for reasoning models.
  • Added a provider payload regression that captures the outbound Xiaomi request and asserts the assistant replay shape.
  • After rebasing onto current origin/main, also fixed the unrelated script fixture lint blocker that was already present on the new base.

External API proof:

Local verification:

  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/llm/providers/openai-completions.test.ts src/agents/openai-completions-compat.test.ts -> 40 tests passed.
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.scripts.json scripts/e2e/lib/fixtures/workspace.mjs -> passed.
  • pnpm check:test-types -> passed.
  • pnpm tsgo:core -> passed.
  • pnpm exec oxfmt --check --threads=1 src/llm/providers/openai-completions.ts src/llm/providers/openai-completions.test.ts scripts/e2e/lib/fixtures/workspace.mjs -> passed.
  • git diff --check -> passed.
  • /Users/steipete/Projects/agent-skills/skills/autoreview/scripts/autoreview --mode branch --base origin/main -> clean, no accepted/actionable findings.

CI:

  • gh pr checks 91113 --watch --fail-fast -> all required checks passed, including check-lint, check-test-types, check-prod-types, build-artifacts, security checks, and changed-path checks.

What was not tested:

  • No live Xiaomi API request was run. I only attempted targeted 1Password lookup for a Xiaomi key and did not perform broad vault enumeration or print secrets; no usable Xiaomi credential was found in the allowed flow.

@steipete steipete merged commit d6dffd6 into main Jun 7, 2026
166 of 168 checks passed
@steipete steipete deleted the fix/xiaomi-completions-reasoning-content branch June 7, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR 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. scripts Repository scripts size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

1 participant