feat(sandbox): stop generating client-side default names so unnamed creations can use warm pools (ENG-3931)#190
Conversation
…reations can use warm pools (ENG-3931) Co-Authored-By: cploujoux <cploujoux@blaxel.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🧪 Testing GuideWhat this PR addressesThe SDK was generating a client-side default name ( Steps to reproduce the original issue
What to verify (expected behavior)
Note Posted by PR Testing Guide · Tag @mendral-app with feedback. |
|
✅ Linked to Linear issue ENG-3931 — status: In Review The PR is now attached to the issue and will auto-close it when merged. Note Posted by Linear Issue Enforcer · Tag @mendral-app with feedback. |
…ENG-3931) Co-Authored-By: cploujoux <cploujoux@blaxel.ai>
Summary
Warm sandbox pools (ENG-3889) only serve creations where
metadata.nameis absent. ButSandboxInstance.create/SyncSandboxInstance.creategenerated a client-side default name (sandbox-<8 hex>) whenever the caller omitted one, so every unnamed SDK creation reached the API with a name and silently fell back to the slow classic path.This drops the client-side default name. When the caller doesn't provide a name we now send the create request without
metadata.nameand let the server assign one; the server-assigned name is surfaced on the returned instance as before.Because the generated
Metadata.to_dict()always emitsname, a small helper serializes the body and strips the key when unnamed:create_sandbox's generated client already accepts adictbody, so no generated code changes. The same change is applied to both the async (default/) and sync (sync/) implementations.Notes:
create_if_not_existsstill requires a name (unchanged) — it needs one for its existence check.Test
Added unit tests in
tests/core/test_sandbox.py(async + sync) asserting the create body omitsmetadata.namefor unnamed / raw-model creations, keeps a caller-provided name, and surfaces the server-assigned name.Same change made in the TypeScript SDK: blaxel-ai/sdk-typescript#(companion PR).
Link to Devin session: https://app.devin.ai/sessions/652893c91fb340faa3d0064943629994
Requested by: @cploujoux
Note
Removes client-side default name generation (
sandbox-<hex>) fromSandboxInstance.createandSyncSandboxInstance.create, so that unnamed sandbox creations reach the API withoutmetadata.nameand can be served by warm sandbox pools. A_create_bodyhelper strips thenamekey from the serialized dict when no name was provided.Written by Mendral for commit a764b9c.