[anneal] Add playground Rust server - #3540
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## Gklylrwoplohejnfq3oo4uymvshcq3o62 #3540 +/- ##
==================================================================
Coverage 91.85% 91.85%
==================================================================
Files 20 20
Lines 6093 6093
==================================================================
Hits 5597 5597
Misses 496 496 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0bfeaf4 to
f10d929
Compare
8031649 to
0a09e52
Compare
gherrit-pr-id: Gzpgd7p6so5xn3tfstq45vnmycc7weotp
f10d929 to
7250609
Compare
0a09e52 to
bdaf71d
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7250609b11
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| GarbageCollection => { | ||
| active_executions | ||
| .retain(|_id, (_, tx)| tx.as_ref().is_some_and(|tx| !tx.is_closed())); |
There was a problem hiding this comment.
Keep closed-stdin executions alive during GC
When a client sends wsExecuteStdinClose, the entry's stdin sender is set to None to close stdin; on the next 30-second GC pass this predicate removes every None entry. Removing the entry drops the stored DropGuard, which cancels the execution token, so any websocket run or Anneal verification that closes stdin but continues for more than 30 seconds is aborted despite the much longer session timeout. Keep closed-stdin executions in the map until their task actually finishes, or track completion separately.
Useful? React with 👍 / 👎.
| fn record_websocket_error(error: String) { | ||
| *WS_ERRORS.lock().unwrap_or_else(|e| e.into_inner()).entry(error).or_default() += 1; |
There was a problem hiding this comment.
Bound stored WebSocket error keys
The public /nowebsocket endpoint records the client-provided error string as a permanent key in this global map, so repeated requests with unique or large error values grow memory for the lifetime of the server. In a public deployment, a client can use this unauthenticated endpoint to cause unbounded memory growth; truncate and cap the stored keys, or aggregate unknown errors instead.
Useful? React with 👍 / 👎.
| pub(crate) tests: bool, | ||
| #[serde(default)] | ||
| pub(crate) backtrace: bool, | ||
| pub(crate) code: String, |
There was a problem hiding this comment.
Accept multi-file HTTP code payloads
The Rust Playground HTTP API also accepts code as an array of {name, content} files, but this server models it as a plain String. Any existing client or frontend path that submits multi-file snippets to /compile or /execute will now fail JSON deserialization before reaching the orchestrator; keep the untagged single-or-multiple code type and lower each file into the sandbox instead of only accepting one string.
Useful? React with 👍 / 👎.
| cargo_anneal_verify_ms_found = cargo_anneal_verify_ms.is_some(), | ||
| "[anneal-prewarm] stable Anneal prewarm finished" | ||
| ); | ||
| *self.coordinator.lock().await = Some(coordinator); |
There was a problem hiding this comment.
Release prewarm container when limits are tight
When PLAYGROUND_ANNEAL_PREWARM_STABLE is enabled, this stores a live coordinator that keeps its Docker container permit indefinitely until a WebSocket happens to consume it. With the intended small deployment settings such as PLAYGROUND_COORDINATORS_LIMIT=1, that cached prewarm occupies the only container slot and does not listen for container_requested, so HTTP requests and metadata cache refreshes can time out or hang waiting for a permit. Idle or drop the prewarm when another request needs capacity.
Useful? React with 👍 / 👎.
Latest Update: v12 — Compare vs v11
📚 Full Patch History
Links show the diff between the row version and the column version.
⬇️ Download this PR
Branch
git fetch origin refs/heads/Gzpgd7p6so5xn3tfstq45vnmycc7weotp && git checkout -b pr-Gzpgd7p6so5xn3tfstq45vnmycc7weotp FETCH_HEADCheckout
git fetch origin refs/heads/Gzpgd7p6so5xn3tfstq45vnmycc7weotp && git checkout FETCH_HEADCherry Pick
git fetch origin refs/heads/Gzpgd7p6so5xn3tfstq45vnmycc7weotp && git cherry-pick FETCH_HEADPull
Stacked PRs enabled by GHerrit.