feat(translator,executor): preserve Kimi reasoning as canonical reasoning_content - #2
Conversation
warelik
left a comment
There was a problem hiding this comment.
AO review: approved (posted as COMMENT; GitHub rejects APPROVE on ones own PR).
Verified at head ff4aeeb:
shouldMapClaudeThinkingToReasoningKimi branch matches the signature-package semantics exactly:DecideSignatureCompatibilityForModelreturns Preserve for Kimi-native signatures and DropSignature for everything else (unsigned, Claude, Gemini, GPT, malformed) with the documented rationale that Kimi never validates replayed thinking signatures. The mapping accumulates only the thinking text, which is correct because Kimi reasoning continuity travels in OpenAI-stylereasoning_content. GPT and unknown targets keep the strict GPT-signature path unchanged, and the compat wrapper (preserveThinkingBlocks=true) still maps everything as before — verified both wrappers.- The carry-over gate skip via
isKimiReasoningTargetis consistent with the translator change: on Kimi targets priorreasoning_contentstays in the assistant message (canonical container) instead of being relocated into a system instruction. Model-name matching (kimi/moonshot/k2/k3) resolves the test modelkimi-k3correctly. - The variadic
preserveThinkingBlocks ...boolhack is now an explicit bool; the rename has no stragglers (single call site, build green). - The carry_over.go doc-comment fix is accurate against sdk/translator/registry.go (normalizers run after native translation).
- Assistant-only gating (injection guard) and redacted_thinking exclusion are intact. CI green.
This lands the Plus half of stock issues #5159/#5160 and directly serves stable cross-provider failover into Kimi without dropping recoverable thinking — mission-aligned, with no degradation to GPT/unknown targets.
One optional coverage note (non-blocking): the Kimi degradation table could add a GPT-format-signature case and a Kimi-native Preserve case, though the decision function treats all mismatched signatures uniformly so the current cases pin the behavior adequately.
5c9496d to
6a27105
Compare
warelik
left a comment
There was a problem hiding this comment.
AO review: changes requested (posted as COMMENT; GitHub rejects REQUEST_CHANGES on ones own PR).
The implementation itself was already reviewed and approved, but this PR is no longer mergeable or needed in its current form:
- GitHub reports
mergeable: false,mergeable_state: dirty. The head is 165 commits behind the PR-recorded base (a229fd79) and 168 behind the currentwarelik/mission-integrationtip (d34e87df), while only 4 commits ahead. - Those four changes have already landed in the base through their canonical commits/merges: carry-over (
c75a7d6b/ mergede336cca), Kimi reasoning preservation (ff4aeeb2/ merge7c08f6b4), and the no-fabricated-reasoning fix (70f7a097). Every file in this PR overlaps changes already present in the base. - The current head is therefore replaying duplicate patches over a base that already contains the work, which explains the dirty merge. The only workflow attached to this head is the agents-md guard; no build/test run was created for this recomposed head.
Please close this PR as already integrated, or rebase it onto the current base and drop all commits already present (which should leave no diff). There is no code correction to make to the reviewed Kimi/carry-over logic itself; this is a branch-state blocker.
6a27105 to
d34e87d
Compare
|
Closed as already integrated: the PR branch was rebased onto the current base and all four commits were found to be present through canonical commits/merges. The branch now points to the base commit with no unique diff. |
Summary
internal/translator/openai/claude/openai_claude_request.goshouldMapClaudeThinkingToReasoning: when the target model is a Kimi model, degrade Claude thinking blocks to unsignedreasoning_contentinstead of dropping foreign or unsigned signed blocks. GPT and unknown targets keep the existing strict behavior.internal/runtime/executor/helps/codex_multi_agent_v2.goTranslateRequestWithAPIKeyModelCompatibility: skipCarryOverThinkingToSystemfor Kimi targets so priorreasoning_contentstays in assistant messages rather than being moved into a system message.internal/runtime/executor/helps/carry_over.go: fix plugin-payload doc comment.internal/runtime/executor/kimi_executor.gofallbackAssistantReasoning: do not copy visible assistantcontentintoreasoning_contentfor tool-call messages; fabricates hidden reasoning and risks self-reflection loops.Upstream counterpart
kaitranntt#222
Test plan
go build -o /tmp/cli-proxy-api ./cmd/servergreengo test ./...green (8624 passed)Stock issues
Decision
reports/kimi-fallback-reasoning-decision.md