Skip to content

fix(chat): persist assistant reasoning_content across turns - #154

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-e72d
Draft

fix(chat): persist assistant reasoning_content across turns#154
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-e72d

Conversation

@cursor

@cursor cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown

Summary

  • DeepSeek thinking-mode APIs return HTTP 400 when a later request includes tools but prior assistant messages omit reasoning_content.
  • SkillLite already kept the field in memory during one agent turn, then dropped it on transcript persist/reload. The next skilllite chat / desktop turn in the same session rebuilt history without the field.
  • Fix: store optional reasoning_content on transcript assistant Message rows, restore it in transcript_entry_to_message, and keep outbound OpenAI JSON echoing it.

Trigger: configure a DeepSeek thinking model, run skilllite chat --session s --message "..." (tools are sent), then a second turn on the same session. Before the fix the second request omitted reasoning_content and the API rejected it.

session_key path traversal was also reported in this sweep; that issue is already covered by open PR #126 and was not re-opened.

Task Linkage

  • Task ID: TASK-2026-071
  • Task folder: tasks/TASK-2026-071-persist-reasoning-content/

Injected Specs

  • spec/verification-integrity.md
  • spec/task-artifact-language.md
  • spec/architecture-boundaries.md (reviewed; no dependency/layering change)
  • spec/security-nonnegotiables.md (not a sandbox/security policy change)
  • spec/testing-policy.md
  • spec/docs-sync.md (N/A — crash/API-contract fix, no command/env/docs change)
  • spec/rust-conventions.md
  • spec/structured-signal-first.md
  • spec/capability-gap-evolution.md

Validation Evidence

  • Commands executed:
    • cargo test -p skilllite-executor --lib reasoning2 passed
    • cargo test -p skilllite-agent reasoning — reload + OpenAI echo tests passed
    • cargo test -p skilllite-agent250 passed; 0 failed
    • cargo fmt --check
    • cargo clippy --all-targets -- -D warnings
    • cargo test — workspace crates ok
    • python3 scripts/validate_tasks.pyTask validation passed (71 task directories checked).
  • Key results:
    • Legacy transcript rows without the field still deserialize as None.
    • Reloaded assistant messages include CJK reasoning_content.
    • openai_api_message echoes the field on assistant payloads.

Regression Scope

  • Areas likely affected:
    • Chat transcript persist/reload and DeepSeek thinking multi-turn follow-ups.
  • Explicit non-goals:

Docs Sync (EN/ZH)

  • Not needed
  • Updated EN + ZH docs
  • Files:
    • N/A

Review Checklist

  • Acceptance criteria in tasks/TASK-2026-071-persist-reasoning-content/TASK.md satisfied
  • tasks/TASK-2026-071-persist-reasoning-content/STATUS.md updated with latest progress
  • tasks/TASK-2026-071-persist-reasoning-content/REVIEW.md includes merge readiness decision
  • tasks/board.md status is up to date
Open in Web View Automation 

DeepSeek thinking mode returns HTTP 400 when a tools-enabled follow-up
omits prior assistant reasoning_content. Store the field on transcript
Message rows and restore it when reloading history.

Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant