Skip to content

fix(server): preserve reasoning_content in chat history - #268

Merged
sizzlecar merged 2 commits into
mainfrom
fix/reasoning-content-compatibility
Sep 5, 2026
Merged

sizzlecar merged 2 commits into
mainfrom
fix/reasoning-content-compatibility

Conversation

@sizzlecar

Copy link
Copy Markdown
Owner

Clients that replay assistant history using reasoning_content currently lose that text because Ferrum only deserializes reasoning. This affects multi-turn tool histories whose model template retains prior reasoning. The same integration failure was reported in vLLM #38488; vLLM already fixed its input normalization in #42664.

Normalize either input name into Ferrum's existing reasoning field. A canonical string wins, including an empty string; missing or null canonical input falls back to the alias. Validate the selected value as string or null. Preserve each model template's history behavior and keep response messages and SSE deltas on the existing canonical field.

The change is limited to the Chat HTTP wire boundary. ferrum run uses its own typed history path and is unaffected.

Validation on macOS after integrating onto main including #267:

  • 22 related Rust tests passed, covering alias normalization, precedence, invalid input, serialization, HTTP-to-Qwen3.6-template tool history in sync and streaming requests, and templates that intentionally omit reasoning.
  • cargo fmt --all -- --check
  • cargo check --workspace --all-targets
  • cargo test --workspace --all-targets: 2727 passed, 0 failed, 61 ignored.
  • cargo clippy --workspace --all-targets -- -A warnings
  • cargo check --workspace --all-targets --features metal
  • Independent integration review and diff check passed.

The local build reused a shared Cargo target directory with incremental compilation and dev/test debug information disabled. Ignored cases were not validated. HTTP tests use a capturing engine: they establish protocol and template behavior, not model answer quality or measured performance. Metal validation is a compile check. CUDA compilation is covered by the repository CI with its pinned native operator set.

@sizzlecar
sizzlecar merged commit 39f9317 into main Sep 5, 2026
3 checks passed
@sizzlecar
sizzlecar deleted the fix/reasoning-content-compatibility branch September 10, 2026 03:38
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