Skip to content

feat: type reasoning items and fail closed on corrupt stored history (Phrase 3 of #335) - #384

Open
Zheng-Lu wants to merge 5 commits into
vllm-project:mainfrom
Zheng-Lu:feat/335-typed-reasoning
Open

Zheng-Lu wants to merge 5 commits into
vllm-project:mainfrom
Zheng-Lu:feat/335-typed-reasoning

Conversation

@Zheng-Lu

@Zheng-Lu Zheng-Lu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #335 (split from #350)

Summary

  • Replace the untyped JSON in ReasoningOutput with typed reasoning content, summaries and status, plus a bounded OpaqueReasoning string for encrypted_content: redacted Debug, 16 MiB ceiling. Public JSON field names are unchanged. The shared retained-response budget now charges reasoning parts and opaque bytes.
  • Keep the existing vLLM replay policy: plaintext is joined, summaries are left out of the upstream copy, and opaque-only continuation is rejected before inference.
  • Stop silently dropping stored context. Undecodable history rows, missing referenced rows, and malformed history references or response metadata now return typed storage errors. The errors never include stored values. SQL NULL keeps its legacy meaning.
  • Keep reasoning rows written by earlier releases continuable. When a stored reasoning row fails typed decoding, a bounded projection keeps its plaintext (as reasoning_text) and every summary, string opaque state and status that still decodes. Only rows that cannot be read even this way fail closed.

Compatibility: request input and upstream output now reject reasoning items that don't match the typed schema, for example a non-string encrypted_content or an unknown status; earlier releases accepted them. No migration is needed, and existing rows are not rewritten.

Test Plan

  • cargo test -p agentic-server-core -p agentic-server: 1,742 passed, 0 failed, 17 ignored. cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --check and pre-commit (including Rust file sizes) pass.
  • legacy_reasoning_rows_test.rs rewrites stored rows to shapes earlier releases accepted:
    • Each row decodes with its valid fields kept.
    • A previous_response_id continuation completes and replays the plaintext to vLLM as reasoning_text.
    • Negative control: with the projection disabled, both tests fail.
  • reasoning_types_test.rs covers schema rejection, nullability, exact opaque round trips, redaction and the size ceiling. storage_response_integrity_test.rs and the storage suites cover invalid rows, missing rows, bad references and bad metadata, all with redacted errors.
  • The existing recorder-generated OpenAI and gateway reasoning cassettes replay unchanged. No cassette was added or edited.

Signed-off-by: Zheng Lu <Lz429671594@gmail.com>
Signed-off-by: Zheng Lu <Lz429671594@gmail.com>
Signed-off-by: Zheng Lu <Lz429671594@gmail.com>
Signed-off-by: Zheng Lu <Lz429671594@gmail.com>
Rows written before typed reasoning may carry any content discriminator and
untyped summary, opaque state, or status values. Decode them through a bounded
projection that keeps every field that still decodes, so existing histories stay
continuable. Rows that cannot be read even this way still fail closed.

Signed-off-by: Zheng Lu <Lz429671594@gmail.com>
@Zheng-Lu Zheng-Lu changed the title Feat/335 typed reasoning feat: type reasoning items and fail closed on corrupt stored history Sep 25, 2026
@Zheng-Lu Zheng-Lu changed the title feat: type reasoning items and fail closed on corrupt stored history feat: type reasoning items and fail closed on corrupt stored history (Phrase 2 of #335) Sep 25, 2026
@Zheng-Lu Zheng-Lu changed the title feat: type reasoning items and fail closed on corrupt stored history (Phrase 2 of #335) feat: type reasoning items and fail closed on corrupt stored history (Phrase 3 of #335) Sep 25, 2026

This branch has not been deployed

No deployments
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