Skip to content

fix(opencode-go): strip Kimi reasoning replay fields#85377

Merged
steipete merged 1 commit into
mainfrom
codex/83812-opencode-go-kimi-reasoning-replay
May 22, 2026
Merged

fix(opencode-go): strip Kimi reasoning replay fields#85377
steipete merged 1 commit into
mainfrom
codex/83812-opencode-go-kimi-reasoning-replay

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • strip replay-only reasoning fields from OpenCode Go Kimi payload messages/input
  • remove replay-only thinking/reasoning content parts so Kimi OpenAI-compatible requests stay schema-clean
  • keep reasoning-only assistant turns non-empty with the existing omitted-reasoning text pattern

Fixes #83812.

Verification

  • /Users/steipete/.local/share/fnm/node-versions/v24.13.0/installation/bin/node ./node_modules/.bin/tsx -e "...stripOpencodeGoKimiReasoningPayload payload assertion..."
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode local

Behavior addressed: OpenCode Go kimi-k2.6 repeated turns no longer send unsupported reasoning replay fields or thinking/reasoning replay content parts to the provider.
Real environment tested: local OpenClaw checkout on Node 24.13.0 with the OpenCode Go sanitizer executed directly; GitHub CI will run the full repository gates.
Exact steps or command run after this patch: direct Node 24 tsx assertion of stripOpencodeGoKimiReasoningPayload, git diff --check, and Codex autoreview local mode.
Evidence after fix: the captured payload assertion removed reasoning, reasoning_effort, reasoningEffort, reasoning_details, reasoning_content, reasoning_text, type: "thinking", type: "redacted_thinking", and type: "reasoning" replay parts while preserving visible text.
Observed result after fix: direct assertion printed sanitizer ok; autoreview reported no accepted/actionable findings.
What was not tested: a live OpenCode Go request with real Kimi credentials; local Vitest prebundle did not reach test execution in this checkout, so CI remains the full automated gate.

@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

Latest ClawSweeper review: 2026-05-22 13:51 UTC / May 22, 2026, 9:51 AM 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 branch adds an OpenCode Go Kimi payload sanitizer, wires the Kimi stream wrapper to strip replay-only reasoning fields and content parts, adds focused sanitizer coverage, and updates the changelog.

Reproducibility: yes. source-reproducible: current main only strips root Kimi reasoning params, while the linked report shows provider rejection of replayed messages[].reasoning_details. A synthetic opencode-go/kimi-k2.6 payload with nested replay reasoning fields would remain dirty on current main.

PR rating
Overall: 🦐 gold shrimp
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Summary: The patch is narrow and review-clean, but merge confidence is capped because the only after-fix proof is synthetic sanitizer execution rather than a real provider path.

Rank-up moves:

  • Add redacted live proof, terminal output, logs, or a captured request payload from an opencode-go/kimi-k2.6 repeated-turn run after this patch; update the PR body afterward so ClawSweeper re-reviews, or ask a maintainer to comment @clawsweeper re-review if it does not.
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: The PR body reports a direct synthetic sanitizer assertion and explicitly says no live OpenCode Go request was tested, so real provider proof is still needed with private details redacted. 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

  • The PR body does not include a live OpenCode Go/kimi-k2.6 request or captured real provider payload after the patch, so schema acceptance is not proven against the actual provider.

Maintainer options:

  1. Decide the mitigation before merge
    Land the provider-local sanitizer with focused regression coverage after CI and redacted live or captured-payload proof show opencode-go/kimi-k2.6 repeated turns no longer send unsupported replay reasoning fields.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
The protected maintainer label and missing live provider proof make this a human review/validation item rather than an automated repair lane.

Security
Cleared: The diff adds local provider sanitizer logic, a focused test, and a changelog entry; it does not touch dependencies, CI, scripts, secrets, or package resolution.

Review details

Best possible solution:

Land the provider-local sanitizer with focused regression coverage after CI and redacted live or captured-payload proof show opencode-go/kimi-k2.6 repeated turns no longer send unsupported replay reasoning fields.

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

Yes, source-reproducible: current main only strips root Kimi reasoning params, while the linked report shows provider rejection of replayed messages[].reasoning_details. A synthetic opencode-go/kimi-k2.6 payload with nested replay reasoning fields would remain dirty on current main.

Is this the best way to solve the issue?

Yes, pending real provider proof: keeping the fix in the OpenCode Go provider wrapper matches the plugin ownership boundary and avoids changing shared Kimi/OpenAI replay policy for other providers.

Label changes:

  • add P1: The PR targets a linked provider/schema rejection that blocks opencode-go/kimi-k2.6 agent replies during repeated turns.
  • add rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🦪 silver shellfish, patch quality is 🐚 platinum hermit, and The patch is narrow and review-clean, but merge confidence is capped because the only after-fix proof is synthetic sanitizer execution rather than a real provider path.
  • 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 body reports a direct synthetic sanitizer assertion and explicitly says no live OpenCode Go request was tested, so real provider proof is still needed with private details redacted. 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.

Label justifications:

  • P1: The PR targets a linked provider/schema rejection that blocks opencode-go/kimi-k2.6 agent replies during repeated turns.
  • rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🦪 silver shellfish, patch quality is 🐚 platinum hermit, and The patch is narrow and review-clean, but merge confidence is capped because the only after-fix proof is synthetic sanitizer execution rather than a real provider path.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports a direct synthetic sanitizer assertion and explicitly says no live OpenCode Go request was tested, so real provider proof is still needed with private details redacted. 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.

Acceptance criteria:

  • Run the focused OpenCode Go sanitizer test after merge-base refresh.
  • Review CI for the changed plugin surface.
  • Capture redacted live OpenCode Go/kimi-k2.6 repeated-turn proof or the post-patch provider request payload.

What I checked:

Likely related people:

  • @vincentkoc: Git history shows recent work introducing or carrying forward the current OpenCode Go stream/catalog files and related provider replay-hook helpers. (role: recent area contributor; confidence: high; commits: b2dc4492f0e6, 39d2a719c964, 4c15f1310bd5; files: extensions/opencode-go/stream.ts, extensions/opencode-go/provider-catalog.ts, src/plugin-sdk/provider-stream-shared.ts)
  • @steipete: Git history shows Peter as committer on the current OpenCode Go file introduction/carry-forward commit, and this PR also comes from the same account for the affected path. (role: recent merger and adjacent owner; confidence: medium; commits: b2dc4492f0e6, 669402b0b92e; files: extensions/opencode-go/stream.ts, extensions/opencode-go/reasoning-sanitizer.ts, CHANGELOG.md)
  • @jalehman: History points to the provider replay runtime ownership refactor that moved this class of behavior into plugins, which is directly adjacent to this fix boundary. (role: adjacent architecture contributor; confidence: medium; commits: 799c6f40aa69; files: extensions/opencode-go/index.ts, src/plugin-sdk/provider-stream-shared.ts)

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

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

Copy link
Copy Markdown

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: 669402b0b9

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +38 to +41
record.content =
nextContent.length > 0
? nextContent
: [{ type: "text", text: OMITTED_ASSISTANT_REASONING_TEXT }];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Only inject omitted text when reasoning parts were removed

This branch rewrites every empty content array to "[assistant reasoning omitted]", even when the array was already empty and no reasoning replay item was stripped. In OpenClaw, empty assistant content is a legitimate replay state (for example silent/tool-call turns), and forcing synthetic text changes prompt semantics and can alter downstream model behavior for Kimi requests. The placeholder should be added only when this sanitizer actually removed reasoning-only parts from that specific message/content list.

Useful? React with 👍 / 👎.

@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. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 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.

@steipete steipete merged commit d22bcfc into main May 22, 2026
133 of 138 checks passed
@steipete steipete deleted the codex/83812-opencode-go-kimi-reasoning-replay branch May 22, 2026 16:13
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
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

extensions: opencode-go maintainer Maintainer-authored PR rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenCode Go / Kimi K2.6 sends unsupported reasoning_details in replayed messages

1 participant