Fix Kimi Coding tool-call replay#82550
Conversation
|
Codex review: passed. Summary Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi-for-coding replay, and the linked report includes a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the narrow replay serialization fix once exact-head checks and merge gates pass, then split any remaining Kimi tool-call argument assembly failure into its own focused follow-up. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main drops or fails to synthesize reasoning_content for kimi-for-coding replay, and the linked report includes a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Is this the best way to solve the issue? Yes for the replay serialization bug: the PR extends provider-specific replay policy and the Kimi wrapper without weakening stock OpenAI sanitization. The later argument-assembly report should be a separate follow-up if it still reproduces. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5a14b1c5c5d7. |
|
/clawsweeper automerge |
|
🦞✅ Source: What merged:
Automerge notes:
The automerge loop is complete. Automerge progress:
|
fcc577e to
9a4605e
Compare
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605ee3843e2fdb9dd8d61b39400e58871923a. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605ee3843e2fdb9dd8d61b39400e58871923a Review: openclaw/openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605ee3843e2fdb9dd8d61b39400e58871923a. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605ee3843e2fdb9dd8d61b39400e58871923a Review: openclaw/openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR preserves Kimi Coding reasoning_content replay for OpenAI-compatible tool-call follow-up turns, extends replay model-id matching, adds Kimi wrapper/tests, and updates the changelog. - Reproducibility: yes. at source level: current main drops or fails to synthesize reasoning_content for kimi- ... es a concrete Kimi 400 after tool-call history. I did not run a live Kimi request in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 9a4605e. - Required merge gates passed before the squash merge. Prepared head SHA: 9a4605e Review: openclaw#82550 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary
Fixes #82161 by preserving Kimi Coding reasoning replay on OpenAI-compatible follow-up turns and by backfilling the blank
reasoning_contentplaceholder Kimi expects on assistant tool-call replay messages when thinking is enabled.Reproduction
I reproduced the issue against current
mainwith a source-level probe for{ provider: "kimi", api: "openai-completions", id: "kimi-for-coding" }. The failing behavior was thatbuildOpenAICompletionsParamsserialized the assistant tool-call replay withoutreasoning_content, even though the Kimi/Moonshot-compatible K2.6 route preserved it.I also ran the same reproduction path in Blacksmith Testbox before the fix. That Blacksmith source probe showed
assistantHasReasoningContent: falseforkimi-for-coding. The Blacksmith environment did not expose a live Kimi/Moonshot key, so live provider auth was blocked; the manual E2E proof below uses a local Kimi-compatible endpoint that rejects the same missing-field condition.Root Cause
kimi-for-codingwas not in the OpenAI-compatible reasoning replay allowlist used by the Chat Completions payload sanitizer, so the replay sanitizer stripped provider-ownedreasoning_contentbefore the next request. The Kimi provider wrapper also did not add the blankreasoning_contentplaceholder for assistant tool-call replay messages when OpenAI-compatible Kimi thinking was enabled.Fix
kimi-for-codingto the replay-required model ids in the OpenAI Chat Completions sanitizer and transcript policy.hf:moonshotai/kimi-k2-thinkingandxiaomi/mimo-v2.6-pro:cloud.reasoning_content: ""on assistant tool-call replay messages when thinking is enabled, and to strip replay reasoning fields when thinking is disabled.Verification
node scripts/run-vitest.mjs src/agents/openai-transport-stream.test.ts src/agents/transcript-policy.test.ts extensions/kimi-coding/stream.test.tslocally after rebasing ontoorigin/main(400 passed).git diff --check origin/main...HEAD.codex review --uncommittedbefore publishing: no actionable correctness findings.Real behavior proof
Behavior addressed: Kimi Coding OpenAI-compatible follow-up turns after tool use must include provider-owned assistant replay
reasoning_contentso Kimi does not reject the next request.Real environment tested: Blacksmith Testbox
tbx_01krr7g58dy8f2qcxd7vqxh01q, GitHub Actions run https://github.com/openclaw/openclaw/actions/runs/25960370706.Exact steps or command run after this patch:
node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --blacksmith-workflow .github/workflows/ci-check-testbox.yml --blacksmith-job check --blacksmith-ref main --timing-json --shell -- "... node scripts/run-vitest.mjs src/agents/openai-transport-stream.test.ts src/agents/transcript-policy.test.ts extensions/kimi-coding/stream.test.ts; ... manual Kimi-compatible loopback E2E ...".Evidence after fix: Blacksmith focused tests passed (
5 passed,396 passedat that pre-rebase base), then the manual E2E fake provider captured/v1/chat/completionswiththinking: { "type": "enabled" }and assistant replayreasoning_content: "".Observed result after fix: the fake Kimi-compatible endpoint returned
KIMI_REPLAY_OK; the same harness rejects the request if assistant tool-call replay is missingreasoning_content.What was not tested: a live Kimi API request, because the Blacksmith environment did not provide
KIMI_API_KEY,KIMICODE_API_KEY, orMOONSHOT_API_KEY.