PEN-128: add daemon OpenAI-compatible adapter#83
Conversation
Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Code Review
This pull request refactors the daemon to use the shared OpenAiCompatibleProvider from mizan-providers instead of a manual implementation, and adds support for an optional local_provider_api_key configuration. Feedback highlights a critical issue where the switch to the new provider removed the request timeout, potentially allowing a hung local provider to block the entire daemon; wrapping the call in a 30-second timeout is recommended.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| ); | ||
|
|
||
| parse_chat_completion_response(&body, request.model.clone()) | ||
| provider.chat_completions(&context, job.request.clone()).await |
There was a problem hiding this comment.
Missing Request Timeout
Previously, call_local_provider used a reqwest::Client configured with a 30-second timeout. With the switch to OpenAiCompatibleProvider, it now uses a static reqwest::Client with no timeout configured.
Since the daemon runs sequentially in a single-task loop (handling heartbeats and job execution in the same loop), a hung or extremely slow local provider request will block the entire daemon. This stops heartbeats from being sent and prevents any new jobs from being processed.
Wrapping the provider call in a tokio::time::timeout restores the 30-second timeout safety net.
timeout(
Duration::from_secs(30),
provider.chat_completions(&context, job.request.clone()),
)
.await
.map_err(|_| AppError::infrastructure("local provider request timed out"))?Co-authored-by: multica-agent <github@multica.ai>
|
Addressed the daemon provider timeout review by wrapping the local OpenAI-compatible provider call in a 30s timeout. Also fixed the formatting diff that broke the previous Rust CI run; latest Rust CI is green. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a947574e9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| [dependencies] | ||
| clap = { version = "4", features = ["derive"] } | ||
| mizan-core = { path = "../mizan-core" } | ||
| mizan-providers = { path = "../mizan-providers" } |
There was a problem hiding this comment.
Regenerate Cargo.lock for the daemon dependency changes
Adding this new daemon dependency without committing the matching Cargo.lock update leaves the lockfile's mizan-daemon entry without mizan-providers or the newly added uuid dependency. I checked cargo check --help, where --locked is documented as asserting that Cargo.lock remains unchanged, so locked/frozen or reproducible build environments will need to modify the committed lockfile and can fail; please regenerate and commit Cargo.lock with these new daemon deps.
Useful? React with 👍 / 👎.
Summary
Closes PEN-128.
Related to #69.
mizan-daemonso daemon dispatch normalizes chat completions and usage the same way as route-backed providers.local_provider_api_keysupport while allowing no-auth local model servers.Validation
git diff --checkcargo fmt --check/cargo test -p mizan-providers -p mizan-daemonbecausecargo,rustc, andrustfmtare not installed in this runtime.