Parent: #151
Depends on: #152
Goal
Replay complete persisted reasoning items through previous_response_id and conversation continuations in original history order while adapting only the vLLM-bound request copy for vLLM's plaintext continuation capabilities.
Preconditions
Land #152 first so streamed first turns persist the same complete reasoning item as non-streamed first turns.
Scope
Persistence and rehydration
- Keep the complete typed reasoning item in stored response/conversation history.
- Preserve its position relative to assistant messages and function calls.
- Rehydrate historical reasoning before the next turn's new input.
- Preserve the original stored item unchanged, including
summary, encrypted_content, and status.
- Confirm
_agentic_item_kind never appears in serialized upstream JSON.
vLLM request preparation
Prepare only ctx.enriched_request.input (the vLLM-bound copy):
- Replay plaintext reasoning from
content[].text.
- Treat
encrypted_content: null as valid.
- When plaintext content and non-null encrypted state coexist, preserve the stored item but omit incompatible encrypted state from the vLLM-bound copy.
- If a reasoning item has non-null encrypted content but no plaintext content, return a clear
ExecutorError::InvalidRequest before request serialization/network I/O.
- Never substitute reasoning summaries for continuation state.
- Never attempt to decrypt opaque content.
- Apply the same validation before both streaming and non-streaming inference.
Ordering
Verify the second upstream request preserves this sequence when present:
- historical user input;
- historical reasoning item;
- historical assistant message;
- historical function call;
- new function call output;
- new user input.
The typed storage marker must not appear anywhere in that request.
Sensitive logging
- Remove the uncommitted raw request-body, response-body, error-body, and SSE-line trace statements in
executor/inference.rs.
- Retain safe structured diagnostics such as byte counts, response IDs, item types, status, URL, and whether authentication is configured.
- Do not add logs containing reasoning text or encrypted content.
Test plan
Extend the existing stateful Responses integration framework rather than creating a parallel harness:
Use the existing mock request recorder and literal hand-checked response fixtures. Do not hand-author replay cassettes.
Likely files
crates/agentic-server-core/src/executor/engine.rs
crates/agentic-server-core/src/executor/rehydrate.rs or a focused executor-side vLLM preparation helper
crates/agentic-server-core/src/executor/inference.rs
crates/agentic-server-core/src/types/io/input.rs only if a focused typed traversal helper is warranted
crates/agentic-server-core/tests/stateful_responses_integration.rs
- existing test support helpers
Avoid transport concerns in core wire types and avoid changing storage migrations.
Acceptance criteria
- Streamed and non-streamed continuations send equivalent complete historical reasoning items upstream.
- Plaintext reasoning reaches vLLM in correct history order.
- Stored summary and encrypted state remain lossless even when excluded from vLLM interpretation.
- Encrypted-only reasoning returns a clear 400-class invalid-request error before any vLLM call.
- Summaries are never promoted into continuation reasoning.
_agentic_item_kind never leaks upstream.
- Normal logs contain no reasoning text, encrypted content, or raw bodies.
- No schema migration or alternate reasoning-text persistence is introduced.
Related work
Verification
cargo test -p agentic-server-core --test stateful_responses_integration
cargo test -p agentic-server-core
cargo clippy -p agentic-server-core --all-targets -- -D warnings
cargo fmt -- --check
Report the exact commands and results.
Parent: #151
Depends on: #152
Goal
Replay complete persisted reasoning items through
previous_response_idand conversation continuations in original history order while adapting only the vLLM-bound request copy for vLLM's plaintext continuation capabilities.Preconditions
Land #152 first so streamed first turns persist the same complete reasoning item as non-streamed first turns.
Scope
Persistence and rehydration
summary,encrypted_content, andstatus._agentic_item_kindnever appears in serialized upstream JSON.vLLM request preparation
Prepare only
ctx.enriched_request.input(the vLLM-bound copy):content[].text.encrypted_content: nullas valid.ExecutorError::InvalidRequestbefore request serialization/network I/O.Ordering
Verify the second upstream request preserves this sequence when present:
The typed storage marker must not appear anywhere in that request.
Sensitive logging
executor/inference.rs.Test plan
Extend the existing stateful Responses integration framework rather than creating a parallel harness:
summary,encrypted_content, andstatusremain present after persistence/rehydration even when vLLM does not consume them;encrypted_content: nullreaches vLLM;_agentic_item_kindis absent recursively from upstream JSON.Use the existing mock request recorder and literal hand-checked response fixtures. Do not hand-author replay cassettes.
Likely files
crates/agentic-server-core/src/executor/engine.rscrates/agentic-server-core/src/executor/rehydrate.rsor a focused executor-side vLLM preparation helpercrates/agentic-server-core/src/executor/inference.rscrates/agentic-server-core/src/types/io/input.rsonly if a focused typed traversal helper is warrantedcrates/agentic-server-core/tests/stateful_responses_integration.rsAvoid transport concerns in core wire types and avoid changing storage migrations.
Acceptance criteria
_agentic_item_kindnever leaks upstream.Related work
reasoning.contextsemantics remain follow-up work.Verification
Report the exact commands and results.