Phase 4 minimal server - #5
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated no new comments.
Suppressed comments (2)
crates/server/src/lib.rs:321
persist()holdsself.inner's mutex across filesystem operations (create_dir_all,write,rename). This can block unrelated requests (including cancellation/admission bookkeeping) on slow disks and makes it easier to accidentally introduce deadlocks if future code callspersist()while holding the lock.
fn persist(&self) -> Result<(), Error> {
let guard = self.inner.lock();
let bytes = serde_json::to_vec_pretty(&guard.durable).map_err(state_err)?;
if let Some(parent) = self.state_path.parent() {
crates/server/src/lib.rs:735
- The SSE streaming path uses
unwrap()when serializing stream events. If serialization ever fails (e.g., a future event variant adds a non-serializable field), the handler will panic and crash the request/task. It’s safer to avoid panicking in request handlers and turn serialization failures into stream errors or explicit error events.
let rows = events
.into_iter()
.map(|event| Ok::<_, Infallible>(Event::default().json_data(event).unwrap()));
Ok(Sse::new(stream::iter(rows)).into_response())
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces Phase 4 ("minimal server") support to the project, adding a new HTTP inference server with OpenAI-compatible endpoints, authentication, and OpenAPI documentation. It updates the documentation to reflect the new server, adds a new
cusco-servercrate, and integrates the server into the CLI and development workflows. Several dependencies are added for HTTP and async support, and the executor is extended with a token-to-piece conversion.Major new features and updates:
Server implementation and integration:
cusco-servercrate implementing a minimal HTTP inference server, including OpenAI-compatible endpoints, authentication, durable state, scheduling, and OpenAPI documentation.servesubcommand, wiring up authentication, command-line options, and the inference engine. [1] [2] [3]LlamaEngineinference engine implementation that uses the existing executor for prompt generation.Documentation and workflow updates:
README.mdandAGENTS.mdto document the new Phase 4 server, its features, endpoints, and usage instructions. [1] [2] [3]compose.yamlto add aserver-reportservice for integration testing and reporting.Executor enhancements:
token_to_piecemethod to the executor and underlying FFI, enabling token-to-string conversion for streaming and OpenAI compatibility. [1] [2] [3] [4]Dependency and workspace changes:
axum,tokio,tower,uuid, etc.) to the workspace for server support. [1] [2] [3]These changes collectively establish a minimal but functional HTTP inference server, laying the groundwork for further production hardening and mapped execution in future phases.