Repository navigation
fix(agent-runtime): preserve DeepSeek reasoning across compaction - #400
Merged
Merged
Conversation
Context compaction dropped assistant thinking, and history rebuild omitted thinkingSignature, so post-compaction Completions requests echoed empty reasoning fields. OpenCode/third-party DeepSeek relays reject that with 400 (vastsa#296). Retain recent thinking in checkpoint details, restore signatures on reload, and use a documented non-empty placeholder for non-official DeepSeek rows while keeping official empty-string backfill (vastsa#223). Fixes vastsa#296
Restore NUL separators in mutation grace keys, stamp retained thinking with live model identity and a non-empty content stand-in so transformMessages / convertMessages no longer drop reasoning-only turns, and keep reasoning-only assistants in the pi-ai patch. Strengthen vastsa#296 convertMessages proof; note deferred live OpenCode verification.
Align the compaction retained-reasoning wire fixture to one reasoning field so history-wide backfill does not add a placeholder alongside real content, and point the OpenCode header wiring scan at subagent-model-binding.
Owner
|
Reviewed and merged. The original three contributor commits are preserved, with landing commit 7a66949 added to scope thinkingSignature and retained-reasoning replay to compatible OpenAI Completions models; Anthropic and other providers keep their existing behavior. Validation on the integrated main: pnpm build:js, pnpm lint, agent-runtime typecheck, 452 agent-runtime tests, 658 shared tests, and pnpm test:e2e (21/21 passed; two live-model checks skipped because PI_DESKTOP_TEST_API_KEY is unset). The repository Vercel check remains red because deployment authorization is required. Live OpenCode/aggregator verification for E2E-005E remains deferred. |
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
reasoning_textin the thinking mode must be passed back to the API. #296): retain recent thinking in checkpointdetails.retainedReasoning, restorethinkingSignatureon history rebuild, and use a documented non-empty placeholder for non-official DeepSeek Completions rows while officialdeepseek.comkeeps empty-string fill ([Bug] 修复 reasoning_content 传回错误 #223).\0separators in mutation grace keys; stamp retained turns with live model identity + non-empty content stand-in sotransformMessages/convertMessageskeep reasoning-only assistants; keep reasoning-only assistants in the pi-ai patch; strengthen convertMessages/compaction wire proof.requiresNonEmptyReasoningReplay.Fixes #296
Test plan
packages/agent-runtimevitest:reasoning-replay,reasoning-content-backfill,session-context,provider-bindingpackages/sharedvitest:provider-presets