Repository navigation
feat(inference-api): first-class OpenResponses with front-door state - #281
michaelneale wants to merge 3 commits into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Skippy Lab Qualification: PassedCommit: Native Spark lab qualification. Latest successful main: run 46152803372, attempt 1, commit
TPS comes from three separate warmed, uncached probes at concurrency 1, each generating exactly 128 tokens. The scored correctness answers and each probe's 64-token warmup are excluded. Each rate is total tokens / total server-reported phase time, not an average of request rates. Client elapsed times and raw responses are retained in throughput-probe.json. These bounded samples are not sustained benchmarks or controlled speedup comparisons. Legacy short-answer receipts and missing or invalid probe evidence show as Unavailable. Deltas use unrounded rates from matching PR-profile smoke receipts on the latest successful main run, including the nightly smoke evidence. Positive means faster. Changed workload inputs, different serving host classes, unequal phase token counts or missing evidence show Unavailable. Physical Spark placement and runtime conditions can differ; deltas are descriptive, not controlled speedup claims. Smoke checks cover GPU startup, deterministic endpoint repeats and bounded streaming. They do not establish an AgentX performance score. Nightly history and saved performance baselines are published separately; a saved baseline can be older than the latest successful main run used here. Native build and qualification output streams into each configuration’s Actions log, with per-attempt copies in Saved evidence. Any capture gaps are reported in the log and saved diagnostics. GitHub evidence copies expire after 30 days. |
i386
left a comment
There was a problem hiding this comment.
Verified at head 754ef54c7048bac65400cfa3aae4c06f8b71ab1f (single squashed commit, 51 files, +13,635/−913). Content verified end to end; no blocking findings. I am not approving — the owner's manual read gates approval, and the branch conflicts with main.
Front-door state split — the load-bearing claim verifies. InferenceFrontendConfig::default() carries response_store: None; embedded backends (embedded.rs builds config from default() plus an optional lifecycle observer only) are stateless and every previous_response_id 404s. Standalone serving opts in via with_configured_response_storage() in instrumented_openai_router. Pinned by default_frontend_is_stateless_for_backends_behind_another_front_door.
Env switch fails closed — SKIPPY_RESPONSE_STORAGE accepts only the explicit on/off words; empty is unset, and any unrecognized value turns storage off with a warning.
Caller scope — caller_scope_for_http_peer grants LocalHost only to a direct loopback peer (IPv4-mapped IPv6 handled) with no forwarding header present; all six headers (forwarded, x-forwarded-for, x-real-ip, via, cf-connecting-ip, true-client-ip) deny on presence alone, value-independent. Store lookups are scope-keyed, so proxied or unknown peers cannot read or write local state; tests pin denial on both read and write.
WebSocket — reject_cross_origin_upgrade runs before the upgrade: a browser Origin must equal Host (case-insensitive) or resolve to localhost/loopback; non-http(s) schemes and authorities containing / or @ are refused; cross-origin gets 403 before any session state exists. Absent Origin (non-browser client) is allowed, which is standard.
Compaction — sealed with ChaCha20Poly1305 under a process-local OS-CSPRNG key; nonce-prefixed sealed payloads; summary size bounded.
Store bounded — 30-minute TTL, 128 responses and 64 MiB per caller, 256 callers and 256 MiB global; branches share parent chains in memory but are charged the full transcript at admission.
Other — retention controls (store/background) validated pre-dispatch with the backend provably never called on invalid input; strict json_schema enforces grammar⊕schema mutual exclusion, object shape, and a non-empty name through the bounded native parser. The tool-emulation rework is genuinely absent as described — only responses/tools.rs and the max-tool-call limit tests are touched; serving-layer emulation files are untouched.
Evidence — the body's validation run cites 754ef54, which is the head. CI at head is green: 8/8 qualification lanes (including qwen36), Same-repository CI, and both commit-status gates; skipped lanes are the path-profile routing, not failures. This resolves my objections to #3105 — the evidence is at head and real lanes ran.
Gates before merge: (1) conflicts with main across Cargo.lock, the inference-api lib/responses/router files, guardrails tests and serving files — rebase required, and main's rewritten tool emulation (recurrent checkpoint prefixes) is the semantic overlap to recheck on rebase; (2) the documented embedder behavior change means the mesh consumer must pin and verify when #3105 closes in favor of this; (3) owner approval per standing policy.
Port the OpenResponses implementation from Mesh-LLM/mesh-llm#3105 into skippy-inference-api so standalone Skippy and embedding hosts share one implementation: - typed Responses resources, lifecycle and SSE events - previous_response_id continuation with a bounded, caller-scoped store - /v1/responses/compact and the Responses WebSocket transport - strict json_schema structured output in skippy-serving Conversation state lives only at the front door a client connects to. InferenceFrontendConfig::default() is now stateless, so embedded backends started with start_openai_backend* never store or resolve turns. Standalone `skippy serve` opts in through with_configured_response_storage(), which SKIPPY_RESPONSE_STORAGE=off disables. Hardening: - Via, CF-Connecting-IP and True-Client-IP join the proxy headers that deny the host-local caller scope. - Responses WebSocket upgrades with a cross-origin browser Origin get 403.
754ef54 to
387b51d
Compare
i386
left a comment
There was a problem hiding this comment.
🤖 Rebased head verified — approving.
Re-checked at 387b51d (rebased onto 87bee44), local gates green in a clean worktree with the pinned toolchain (cargo/rustc 1.99.1, clippy 0.1.99):
cargo fmt -p skippy-api -p skippy-inference-api -p skippy-serving --check→ cleancargo check --locked --offline -p skippy-api -p skippy-inference-api -p skippy-serving --features skippy-api/dynamic-native-runtime→ exit 0cargo clippy ... --all-targets -- -D warnings→ exit 0cargo test --locked --offline -p skippy-api -p skippy-inference-api --features skippy-api/dynamic-native-runtime→ exit 0cargo test -p skippy-serving --lib readiness::tests→ 4 passed. (embedded::testsneedsSKIPPY_NATIVE_RUNTIME_BUNDLE_DIR; 5 native-runtime tests fail here for that reason, 6 non-native pass — environmental, same in any checkout.)
What the rebase had to change, and where I checked it lands correctly:
router/generation.rs: the/v1/responseshandler stays relocated torouter/responses.rs; the old copy is gone, so main's recurrent-decode edit from #280 has no site left there and #280's content is intact at the head.- The relocated handler and
responses/execution.rsnow go throughrequest_context(&InferenceLifecycleContext, ..)rather than a bare request id, so responses turns inherit the receipts work (#180): the turn'sreceiptand the host-minted exchange id are published on the backend context, and stream usage observation is set. That is the right direction — the earlier hardcoded construction dropped both. - Three test literals (
router/max_tool_calls_tests.rs,router/responses_websocket/tests.rs) pick up the newreceiptfield.
Scope of this approval: source read plus local build/lint/test evidence on macOS. No GPU/model qualification here — that is the pending qualification (qwen36-35b-a3b-split) lane, which auto-merge will wait on.
Follow-through outside this diff: once mesh #3105 closes in favor of this, mesh needs its pin bump, as noted on the earlier review.
…n live models Lab qualification now posts to /v1/responses on every admitted model: - a strict json_schema request with a prompt that asks for anything but JSON, non-streaming and over SSE; the output must parse and match the schema exactly, and the SSE deltas must equal the completed response; - a two-turn previous_response_id continuation that must recall the first turn. The compliance kit has a single schema fixture, so a 17/17 run did not show that decoding is enforced. Unconstrained, the same prompt returns a poem and fails this check.
Mesh's ingress accepts Responses WebSocket upgrades itself and needs the same browser-origin rule as skippy serve. Export it as responses::websocket_origin_allowed instead of copying it.
Original problem
Skippy's
/v1/responsesis a stateless translation onto Chat Completions. It has noprevious_response_id, no/v1/responses/compact, no WebSocket transport, and no strict structured output. Standaloneskippy servepasses 1/17 of the official OpenResponses compliance kit.Mesh-LLM/mesh-llm#3105 built a full implementation, but inside a Mesh-only crate (
mesh-openresponses). That copied private Skippy helpers and left two Responses protocol layers. The agreed direction is one implementation in Skippy that Mesh consumes, as it already does for the OpenAI handling. #3105 will be closed in favour of this PR plus a Mesh pin bump.Fix
This ports #3105's Responses code, which originally lived in
skippy/crates/, onto skippy main.skippy-inference-api::responsesnow covers:previous_response_idcontinuation over a bounded, caller-scopedResponseStore/v1/responses/compactResponsesSessionskippy-servingbrings back strictjson_schemastructured output (frontend/request/structured_output).Architecture
Conversation state lives only at the front door a client connects to.
InferenceFrontendConfig::default()is now stateless. Embedded backends started withstart_openai_backend*never store or resolve turns: they reportstore: falseand everyprevious_response_idis not found. That is the path Mesh providers use, so a provider can never hold state for traffic another ingress prepared.skippy serve(instrumented_openai_router) opts in withwith_configured_response_storage().SKIPPY_RESPONSE_STORAGE=offdisables it.ResponseStorethere. It sends expanded, stateless turns to its backends.Hardening on top of #3105:
Via,CF-Connecting-IPandTrue-Client-IPnow joinForwarded,X-Forwarded-ForandX-Real-IPas proxy headers. Any of them denies the host-local caller scope.Originthat is neither loopback nor the same asHostgets 403.Not included: #3105's tool-emulation rework. Main's tool emulation has since been rewritten (recurrent checkpoint prefixes), and the two conflict. If it's still needed, it will be a separate PR.
Compatibility
InferenceFrontendConfig::default()no longer creates a store. Hosts that want continuation must callwith_response_storeorwith_configured_response_storage.InferenceFrontendConfig::with_configured_response_storageandresponses::RESPONSE_STORAGE_ENV(SKIPPY_RESPONSE_STORAGE). Theresponses::*session, store and stream types are now public.chacha20poly1305, which seals compaction items. The key is process-local.Validation
All runs were at
754ef54on an M5 Max.cargo fmt --all --check: ok.cargo clippy --workspace --all-targets --no-default-features -- -D warnings: ok.cargo test --workspace --no-default-features --no-fail-fast: 5064 passed, 0 failed.just embedding-contract-check: fmt, check--lockedand clippy pass. 5skippy-serving embedded::testsfail locally with "set SKIPPY_NATIVE_RUNTIME_BUNDLE_DIR". They need a native runtime bundle, and CI provides one.just build, thenskippy serve --model-path Qwen2.5-VL-3B-Instruct-Q4_K_M.gguf --mmproj mmproj-…-Q8_0.gguf(Metal):dce9ddb,bin/compliance-test.ts): 17/17. Before this change standalone was 1/17.X-Forwarded-For: \xff,ViaorCF-Connecting-IPreturned 404.Origin: http://evil.examplereturned 403;http://localhost:3000returned 101.json_schemareturned 3/3 schema-valid objects.SKIPPY_RESPONSE_STORAGE=off:store: false, and continuation returned 404.Acceptance criteria