Repository navigation
serve: /v1/responses keeps its responses: store, previous_response_id and background, in a bounded store - #968
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: cross-origin browser clients cannot use the new response deletion route.
Must fix
1. Allow DELETE in the shared CORS preflight
crates/serve/src/api.rs:1636 adds DELETE, but api.rs:1533 permits only GET, POST, OPTIONS. A cross-origin browser deletion triggers OPTIONS and then fails the method check. The browser never sends DELETE.
Adding the method now avoids client workarounds for the new endpoint. Replace cors_preflight below, update its doc sentence, and extend the existing OPTIONS test to assert that DELETE is allowed.
pub(crate) fn cors_preflight() -> [(&'static str, String); 2] {
[
(
"Access-Control-Allow-Methods",
"GET, POST, DELETE, OPTIONS".to_owned(),
),
("Access-Control-Allow-Headers", "*".to_owned()),
]
}Checked
Duplicates: 47 introduced or renamed definitions checked; no duplicated owner. Dryer reported no pairs.
Complexity: api::route rose from 28 to 29 through one route arm; harmless dispatch growth.
Silent failure: 11 sites followed. Wrong field types return 400; internal response builders and the route guard establish the defaulted fields; clone failure in the test panics.
Tests: mutation checks by inspection covered 11 new or changed tests. Dropped eviction, admission, history reservation, cancellation, persistence, failure reporting, metadata, and refusal branches reach assertions. No assertion checks DELETE preflight.
Gates: no numeric pins moved; stored-state refusal cases now have positive behavior tests.
Escape catalog: no C1–C4 pattern matched.
Notes
Static review; no build or gates run here. The reported card run lacks both measured commit hashes and the exact model file. New tests have no FAIL-first evidence in the PR body.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
… and background, in a bounded store
A response is kept unless the request sends store: false. GET
/v1/responses/{id} reads it, DELETE drops it, and previous_response_id
continues its conversation (its input and output items, not its
instructions). background: true answers queued at once and generates on a
thread of its own; POST /v1/responses/{id}/cancel ends a running one as a
client gone ends a request. The store holds at most 1,024 responses and
256 MiB of their JSON and drops the oldest finished one first; a running
background response is never dropped.
b5cc46b to
09f823d
Compare
There was a problem hiding this comment.
Since the last review: item 1 is fixed. api.rs:1533 permits DELETE, and api.rs:6470 checks the preflight header.
Verdict: CLEAN: the previous CORS blocker is fixed, and no new defect was found in the interdiff.
Checked
Duplicates: 0 new definitions in the interdiff; the shared cors_preflight remains the owner. Dryer reported no pairs.
Complexity: crapper flagged api::route, 28 → 29, for one harmless dispatch arm already reviewed; the interdiff adds no branch.
Silent failure: 0 new defaulting or discarded-error sites.
Tests: mutation inspection protects api.rs:1533. Removing DELETE from the method list makes the added assertion at api.rs:6470 false.
Gates: no pins, tolerances, test cases or lint levels relaxed.
Correctness: OPTIONS uses the shared headers for both response path spellings. DELETE still requires a valid key when authentication is configured. No inference hot path changes.
Escape catalog: no C1–C4 patterns matched.
Notes
Static review; no builds or gates run here. The reported GPU runs lack both measured commit hashes and the exact model file. The PR body has no FAIL-first output for the added assertion.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
/v1/responses가store,previous_response_id,background를 받고 저장한 응답을 조회, 삭제, 취소할 수 있게 했습니다.What and why
/v1/responsesrefusedprevious_response_id,store: trueandbackground: trueby name, so a client could not continue a conversation by id or run a long generation in the background. This PR keeps each response in a bounded in-memory store.storedefaults to true, as in the OpenAI API.GET /v1/responses/{id}reads a stored response andDELETEdrops it.previous_response_idcontinues the stored conversation (its input and output, not itsinstructions)./v1/responses/input_tokenscounts the continued conversation the same way.background: trueanswersqueuedat once and generates on its own thread. The client pollsGETuntil the response iscompletedorfailed, or ends it withPOST /v1/responses/{id}/cancel. While running background responses fill either bound below, a new background request gets 503 withRetry-After.previous_response_idthat names no stored response,conversation, anitem_referenceitem, andbackgroundtogether withstore: falseorstream: true.docs/serving.mdlists the new routes and the bounds, and the refused list now names only what is still refused.Release notes: Added:
/v1/responseskeeps its responses (store,previous_response_id,background) withGET,DELETEandcancel, in a store bounded to 1,024 responses and 256 MiB.Code shape
The review reads these first. A box left unticked needs one line of why.
copying it (
AGENTS.md"Common code first",docs/rust-quality.mdR14). Where I found an existing copy, Inamed it below.
(tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
tools/check-comments.sh).PIN(YYYY-MM-DD):and its reason.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none.What I ran
Real
bloomery-serveon a DGX Spark (Qwen3.8 FP4-Local with its MTP draft), started withbloomery-serve -m <FP4-Local folder> --parallel 1 --ctx-size 16896. A client sent the requests below (greedy,reasoning.effort: none) and printed one line per check:The GPU gates for the serve crate on the same card:
BLOOMERY_BOX_LOCAL=1 just gate-serveon a DGX Spark exits 0, with the serve crate's lib and integration binaries allok:Hardware (if the change is for a machine)
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.