fix: do not store a store=false continuation of a stored response #387
This predicate is not the only exported persistence entrypoint: persist_response is re-exported from executor/mod.rs and directly calls persist_prepared_response without consulting should_persist. A consumer composing the documented public executor steps can still pass a no-session store: false context with previous_response_id and create the very durable row this change claims to forbid. Apply the same policy in persist_response (or make that API explicitly bypass request storage semantics) so the contract is consistent for all public paths.
<!-- ccr-overview-v2 -->
Copilot review overview
🟡 Changes recommended
The public persist_response path can still persist a no-session store: false continuation.
Review effort: Lite
Findings: 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture>
<details open>
<summary><strong>Open (1)</strong></summary>
</details>
<details>
<summary><strong>What changed in this PR</strong></summary>
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:
| 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. |
</details>
---
💡 <a href="/vllm-project/agentic-api/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
Valid, thanks. persist_response and persist_turn wrote unconditionally, so the composable steps disagreed with execute and commit. Both public steps now return early when should_persist is false (6dca512); session contexts still reach their handler, so WebSocket generate: false prewarm is unchanged. test_public_persist_steps_honor_the_storage_policy drives rehydrate_conversation → persist_response / persist_turn for store: false and store: true continuations and checks whether the id resolves as previous_response_id; on main both store: false ids resolve.
@franciscojavierarceo when you have a moment, could you take a look? CI is green and the Copilot finding is addressed in 6dca512.
Approved these changes.
franciscojavierarceo
StevenWang-CY
Summary
should_persistinexecutor/persist.rstreatedprevious_response_idas a reason to write. On the no-session HTTP path astore: falserequest that continued a stored response was therefore persisted durably as a row without a snapshot. The id it returned resolved asprevious_response_idon the next request, andGET /v1/responses/{id}answered409 no retrievable payloadinstead of404. ADR-02,TERMINOLOGY.mdand the README all state thatstore: falsedisables 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_idterm, sostoregoverns 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 forstore: false. Nothing else changes:continuation.is_some(), which keepsstore: falsecheckpoints connection-local (#257).conversation_idrequests stay durable.generate: falseprewarm callspersist_turndirectly and never consulted this predicate.persist_if_needed, shared by the JSON, SSE and split-executioncommitpaths, and the publicpersist_response/persist_turnsteps of ADR-03, so a consumer composing the steps gets the same contract asexecute.docs/api/index.mdstates the contract next to the routing rule, andARCHITECTURE.mdnotes it on thepersist.rsentry.Test Plan
Red on unmodified
main(280f798), green with this change, with only the test files applied to a worktree atmainand the workspace crates rebuilt from that worktree:test_store_false_with_previous_response_id_hydrates_but_does_not_persistpassed onmainfor 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. Onmainthe continuation succeeds.store_false_continuation_of_a_stored_response_is_not_retaineddrives the gateway over HTTP: a stored parent, astore: falsechild that the upstream request shows was hydrated from it, thenGETof the child and a continuation from it both answer404with no upstream call, while the parent is still retrieved byte-for-byte and continued. OnmaintheGETanswers409and the continuation succeeds.test_public_persist_steps_honor_the_storage_policydrivesrehydrate_conversation,persist_responseandpersist_turndirectly for astore: falseand astore: truecontinuation of a stored parent and checks whether each produced id resolves asprevious_response_id. Onmainbothstore: falseids resolve.agentic-serverbinary built from this commit, with a stdlib mock upstream and a SQLite file: the same sequence through the real HTTP stack ends with theresponsestable holding the parent and the stored sibling only, and both misses answer404 not_found.pre-commit run --all-files(includingrust-file-sizeswithRUST_FILE_SIZE_BASE=origin/main),cargo fmt -- --check,cargo clippy --all-targets -- -D warnings, andcargo test --no-fail-fastacross the workspace pass on the exact commit from a clean worktree.