feat(translator,executor): preserve Kimi reasoning as canonical reasoning_content - #222
Open
warelik wants to merge 4 commits into
Open
feat(translator,executor): preserve Kimi reasoning as canonical reasoning_content#222warelik wants to merge 4 commits into
warelik wants to merge 4 commits into
Conversation
warelik
commented
Aug 22, 2026
warelik
left a comment
Contributor
Author
There was a problem hiding this comment.
AO review: approved (posted as COMMENT; GitHub rejects APPROVE on ones own PR).
This is a batch sync of the mission-integration branch into main (126 commits / 123 files). Verified composition and head state:
- Constituent work already reviewed per-PR: the merges cover PRs #188-#218 (failover/cooldown fixes, signature hardening, thinking-replay and cache-control fixes, carry-over feature, configurable cooldown knobs, management endpoints), each of which went through its own review cycle on this repo.
- Spot-checked integration integrity at head ff4aeeb: the cache-determinism files from #213 (session_id_cache.go, user_id_cache.go) are byte-identical to the approved #213 head; cloak_utils.go differs only in a doc comment; the carry-over feature files match the approved #216 state.
- Net-new content is the head commit (Kimi reasoning preservation) — same SHA as the warelik fork PR #2 reviewed today: translator degrades Claude thinking to canonical
reasoning_contenton Kimi targets viaDecideSignatureCompatibilityForModel(Preserve/DropSignature only), carry-over gate skips Kimi so reasoning stays in the canonical container, GPT/unknown strict paths and the compat wrapper unchanged. Byte-identical files confirmed across forks. - CI is meaningful here: the build check runs
go build ./cmd/serverplus the fullgo test ./...suite — green at this head.
Carried-forward non-blocking items (already raised on their owning PRs, none block this sync): (1) translator.carry-over-thinking-in-system is still absent from config.example.yaml while the #217 knobs are documented; (2) the unreachable content: [] branch in carry_over.go; (3) optional extra Kimi signature test cases.
3 tasks
warelik
added a commit
to warelik/CLIProxyAPIPlus
that referenced
this pull request
Aug 22, 2026
…soning as canonical reasoning_content
Add config-gated carryOverThinkingInSystem that moves previous assistant reasoning_content into a labeled system message for OpenAI chat targets that lack a canonical thought field. Defaults off to preserve protocol purity.
Extract unsigned assistant thinking into the source system field before registry translation so plugin NormalizeRequest hooks run. Signed thinking with compatible signatures stays in place and maps to reasoning_content as before.
…ning_content - openai_claude_request.go: target-aware thinking mapping; Kimi degrades signed/unsigned Claude thinking to reasoning_content, GPT keeps strict. - codex_multi_agent_v2.go: skip CarryOverThinkingToSystem for Kimi targets so prior reasoning stays in canonical reasoning_content. - carry_over.go: fix plugin-payload doc comment. Tests pin Kimi degradation and carry-over skip.
fallbackAssistantReasoning previously copied assistant content into reasoning_content for tool-call messages when no prior reasoning existed. That fabricates hidden reasoning from visible text and risks self-reflection loops on replay. It now returns [reasoning unavailable] unless a usable prior reasoning_content exists. Decision: reports/kimi-fallback-reasoning-decision.md
warelik
force-pushed
the
ao/airouters-16-kimi-reasoning
branch
2 times, most recently
from
August 22, 2026 06:16
6a27105 to
d34e87d
Compare
warelik
added a commit
to warelik/CLIProxyAPIPlus
that referenced
this pull request
Aug 22, 2026
…soning as canonical reasoning_content (updated head)
warelik
force-pushed
the
ao/airouters-16-kimi-reasoning
branch
from
August 22, 2026 06:28
d758a28 to
6a27105
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserves Kimi reasoning as canonical
reasoning_contentwhen translating Claude requests to OpenAI-compatible targets.internal/translator/openai/claude/openai_claude_request.goshouldMapClaudeThinkingToReasoning: when target is a Kimi model, degrade Claude thinking blocks to unsignedreasoning_contentinstead of dropping foreign or unsigned signed blocks. GPT and unknown targets keep 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: carry-over helper for reasoning and 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.Dependency note
The Kimi preservation work is built on top of the carry-over feature:
c75a7d6bfeat(executor): carry prior reasoning into system instructions— addsCarryOverThinkingInSystem,internal/runtime/executor/helps/carry_over.go, and theTranslatorConfigstruct ininternal/config.0d97093drefactor(helps): route claude carry-over through registry— refactors carry-over throughcarryOverClaudeSourceand updatescodex_multi_agent_v2.go.ff4aeeb2feat(translator,executor): preserve Kimi reasoning as canonical reasoning_content— adds Kimi-aware thinking mapping and the carry-over skip.70f7a097fix(executor): do not fabricate Kimi reasoning from visible content— removes the content-to-reasoning fallback for tool-call messages.e0e1d512(prompt-cache context inopenai_claude_request.go) was folded as needed for the Kimi hunk; the prompt-cache feature itself is not part of this change.Test plan
go build ./...greengo test ./...greenStock issues
Decision
reports/kimi-fallback-reasoning-decision.mdIntegration counterpart
warelik#2