Skip to content

fix: do not store a store=false continuation of a stored response - #387

Merged
franciscojavierarceo merged 2 commits into
vllm-project:mainfrom
StevenWang-CY:fix-responses-store-false-continuation
Sep 27, 2026
Merged

franciscojavierarceo merged 2 commits into
vllm-project:mainfrom
StevenWang-CY:fix-responses-store-false-continuation

Conversation

@StevenWang-CY

@StevenWang-CY StevenWang-CY commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

should_persist in executor/persist.rs treated previous_response_id as a reason to write. On the no-session HTTP path a store: false request that continued a stored response was therefore persisted durably as a row without a snapshot. The id it returned resolved as previous_response_id on the next request, and GET /v1/responses/{id} answered 409 no retrievable payload instead of 404. ADR-02, TERMINOLOGY.md and the README all state that store: false disables durable response storage, and the guarding test is named ..._hydrates_but_does_not_persist. #257 fixed the same contract for WebSocket sessions and explicitly left the no-session HTTP policy unchanged, so this is the HTTP half of #238.

The fix drops the previous_response_id term, so store governs the no-session path. The child is still hydrated from the stored parent and answers normally; it just leaves no row, so its id can be neither retrieved nor continued, which is the OpenAI behavior for store: false. Nothing else changes:

  • Session continuations still reach the handler through continuation.is_some(), which keeps store: false checkpoints connection-local (fix: honor WebSocket response storage with bounded sessions #257).
  • Explicit conversation_id requests stay durable.
  • WebSocket generate: false prewarm calls persist_turn directly and never consulted this predicate.
  • The predicate gates every write: persist_if_needed, shared by the JSON, SSE and split-execution commit paths, and the public persist_response/persist_turn steps of ADR-03, so a consumer composing the steps gets the same contract as execute.

docs/api/index.md states the contract next to the routing rule, and ARCHITECTURE.md notes it on the persist.rs entry.

Test Plan

Red on unmodified main (280f798), green with this change, with only the test files applied to a worktree at main and the workspace crates rebuilt from that worktree:

  • test_store_false_with_previous_response_id_hydrates_but_does_not_persist passed on main for the wrong reason: the mock queue held two replies, so the third continuation failed from queue exhaustion, not from a missing response. It now queues a third reply, asserts the continuation fails with the storage not-found error before any inference runs, and continues the stored parent as a control that consumes that third reply. On main the continuation succeeds.
  • New store_false_continuation_of_a_stored_response_is_not_retained drives the gateway over HTTP: a stored parent, a store: false child that the upstream request shows was hydrated from it, then GET of the child and a continuation from it both answer 404 with no upstream call, while the parent is still retrieved byte-for-byte and continued. On main the GET answers 409 and the continuation succeeds.
  • New test_public_persist_steps_honor_the_storage_policy drives rehydrate_conversation, persist_response and persist_turn directly for a store: false and a store: true continuation of a stored parent and checks whether each produced id resolves as previous_response_id. On main both store: false ids resolve.
  • Against the agentic-server binary built from this commit, with a stdlib mock upstream and a SQLite file: the same sequence through the real HTTP stack ends with the responses table holding the parent and the stored sibling only, and both misses answer 404 not_found.
  • pre-commit run --all-files (including rust-file-sizes with RUST_FILE_SIZE_BASE=origin/main), cargo fmt -- --check, cargo clippy --all-targets -- -D warnings, and cargo test --no-fail-fast across the workspace pass on the exact commit from a clean worktree.

The no-session executor path persisted every request that carried a
previous_response_id, so a store=false continuation of a stored response
was written durably as a row without a snapshot. Its id then resolved as
previous_response_id and GET /v1/responses/{id} answered 409 instead of
404, although ADR-02, TERMINOLOGY and the README state that store=false
disables storage. PR vllm-project#257 made session continuations honor store and
left the HTTP path unchanged (vllm-project#238).

store now governs the no-session path: the child is still hydrated from
the stored parent but leaves no row, so it can be neither retrieved nor
continued. Session continuations still reach the handler, which keeps
store=false checkpoints connection-local, and explicit conversations
stay durable.

The existing regression test passed for the wrong reason: its third
continuation failed because the mock queue was empty, not because the
child was unstored. It now queues a third reply, asserts the not-found
error and the upstream request count, and continues the stored parent as
a control. A new HTTP test covers retrieval and continuation of the
unstored child through the gateway.

Signed-off-by: Chuyue Wang <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The public persist_response path can still persist a no-session store: false continuation.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes HTTP store: false continuations so they hydrate stored history without creating durable response rows. A critical consistency issue remains in the public persist_response path.

Changes:

  • Updates persistence gating.
  • Adds core and HTTP regression coverage.
  • Documents the storage contract.
File Summary
docs/​api/​index.md Documents unstored continuation behavior.
crates/​agentic-server/​tests/​response_retrieval_test.rs Tests HTTP retrieval and continuation failures.
crates/​agentic-server-core/​tests/​stateful_responses_integration.rs Verifies hydration without persistence.
crates/​agentic-server-core/​src/​executor/​persist.rs Updates persistence eligibility.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

persist_response and persist_turn are the composable persist step of
ADR-03 and are re-exported for consumers that assemble the executor
steps themselves. Both wrote unconditionally, so a no-session
store=false context still produced a durable row through them while
execute and commit refused it.

Both steps now return early when should_persist is false. Session
contexts still reach their handler, which keeps store=false checkpoints
connection-local, so WebSocket generate=false prewarm is unchanged.

The new test drives rehydrate_conversation, persist_response and
persist_turn directly for a store=false and a store=true continuation
and checks whether the produced id resolves as previous_response_id.

Signed-off-by: Chuyue Wang <[email protected]>
@StevenWang-CY

Copy link
Copy Markdown
Contributor Author

@franciscojavierarceo when you have a moment, could you take a look? CI is green and the Copilot finding is addressed in 6dca512.

@franciscojavierarceo
franciscojavierarceo merged commit 9b765a0 into vllm-project:main Sep 27, 2026
19 checks passed
haoshan98 added a commit that referenced this pull request Sep 30, 2026
## Summary

Several user-facing docs had fallen behind `main` or contradicted each
other and the code. This PR brings them in line with what has shipped.
It changes documentation only.


**Corrected claims**
- README listed the Messages API as "🚧 Planned" while another README
section documents `/v1/messages`. It is now listed as shipped; only
stateful Messages stays planned.
- README and `docs/index.md` advertised "Background execution" and
gateway-executed file search. Neither exists yet: background mode is
#357, and `file_search` declarations parse but are dropped before
inference (`tool/normalize.rs`). Both claims are removed.
- `docs/api/index.md` quoted fixed WebSocket and executor limits (256
KiB SSE lines, 1 MiB events and response budget). These now come from
the configurable `[responses]` settings, which default to 16 MiB and 8
MiB.
- `docs/api/index.md` listed only some of the conditions that route a
Responses request through the executor. The list now also includes
non-function tools, `multi_agent.enabled`, and tool-search state,
matching `handler/http/responses.rs`.
- CHANGELOG listed Tavily under 0.8.0, but it merged on Sep 28, after
the Sep 19 release. The two Tavily entries move to `[Unreleased]`.

**Newly documented features**
- README: a multi-agent Responses section with an example and the
gateway's limits (`store: true`, HTTP/SSE only, default of 3 concurrent
subagents, no `max_tool_calls` or reasoning summaries). Also new rows in
the API table for `/v1/responses/compact`, the full Conversations
routes, `/v1/messages` with `/v1/messages/count_tokens`, and
Swagger/OpenAPI (`ENABLE_OPENAPI_DOCS`). The features list, diagram, and
tool ownership table now include MCP, the code interpreter, Claude Code,
compaction, and OpenTelemetry.
- `docs/api/index.md`: new sections for `GET
/v1/responses/{response_id}`, multi-agent, Conversations, and Messages.
- CHANGELOG `[Unreleased]` was empty. It now has entries for #345, #347,
#349, #351/#370, #354, #368, #369, #372/#373, #380, and #387.

**Roadmap**
- ROADMAP.md marks multi-agent HTTP execution as shipped, with WebSocket
injection (#300) and stateless requests (#393) still open. It adds a
status note for Messages, a code interpreter entry, and a file search
item linking #34 and #356.
- README "Roadmap at a Glance" checks off Messages and Conversations and
adds unchecked items for multi-agent, file search, and stateful
Messages.

**Smaller fixes**
- The repository layout in README and AGENTS.md now lists
`agentic-llm-d`, `agentic-cli-docs`, and `python/agentic_api/`.
- ARCHITECTURE.md's list of multi-agent rejections now includes
`max_tool_calls`, matching `executor/rehydrate.rs`.
- `mkdocs.yaml` adds the existing but unlinked `design/shell-tool.md` to
the nav.

**Not changed:** the README's "Rust 1.85+" badge is wrong (1.85 cannot
build the lockfile, see #377), but #379 already updates it to 1.88 along
with `rust-version` and a CI check, so this PR leaves it alone to avoid
a conflict.

Signed-off-by: haoshan98 <[email protected]>
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.

3 participants