bug(compute-driver): lifecycle RPCs carry a name field that cannot identify a sandbox
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 活跃
- 技术栈
- rust
调研方向
Start with the lifecycle request definitions in proto/compute_driver.proto, then read DriverSandbox.workspace and the ComputeManager::stop_sandbox call site in crates/openshell-server/src/compute/mod.rs. Review #3253, #3254, #3278, and #3305 before determining the contract direction. Done means the four lifecycle requests and ListSandboxesRequest are consistent, the rationale is documented, and a two-workspace same-name regression protects at least one driver.
由索引模型根据 Issue 内容生成。
描述
User Story
As a compute-driver implementer, I want the driver-facing lifecycle RPCs to carry a sandbox reference sufficient to identify exactly one sandbox, so that I do not have to choose between trusting sandbox_id blindly and resolving an ambiguous name.
Problem Statement
StopSandboxRequest, StartSandboxRequest, DeleteSandboxRequest, and GetSandboxRequest in proto/compute_driver.proto carry {sandbox_id, name}. The name field is the plain sandbox name (object_name()), which is unique per workspace, not globally. No workspace accompanies it, so name alone cannot identify a sandbox.
This is inconsistent with the rest of the same contract:
| Driver RPC | Carries workspace |
|---|---|
CreateSandbox |
Yes, via DriverSandbox.workspace |
EnsureWorkspace / DeleteWorkspace |
Yes, workspace |
GetSandbox |
No |
StopSandbox |
No |
StartSandbox |
No |
DeleteSandbox |
No |
ListSandboxes |
No (empty request) |
DriverSandbox.workspace (proto/compute_driver.proto:163-165) is documented as "Used by drivers to construct collision-safe resource names and labels in shared-namespace mode." The contract therefore supplies workspace at create time specifically for collision safety, then withholds it on every subsequent lookup of the same resource.
The gateway holds the workspace at each of these call sites. ComputeManager::stop_sandbox(workspace, name) uses it to resolve the sandbox from the store, then constructs StopSandboxRequest { sandbox_id, name: sandbox_name } without it (crates/openshell-server/src/compute/mod.rs:1239, call site at :1346).
Impact / Why This Matters
Two drivers shipped the predictable bug. #3254 (VM) and #3253 (MXC) both fell back to name-only resolution when sandbox_id was absent, and both could act on a same-named sandbox in another workspace. These were fixed in #3305 and #3278 by making sandbox_id strictly authoritative.
Docker, Podman, and Kubernetes avoided the same bug only incidentally, by threading workspace into runtime identity at create time (container_name(workspace, name, id), managed_namespace(gateway_id, workspace)). That is a per-driver convention, not a contract guarantee. VM and MXC key their registries on id alone, which is why they were the two affected drivers.
The current workaround — id-authoritative resolution implemented separately in each driver — fixes the two known instances. It does not prevent the next driver from reading name and reaching the same conclusion, because the field is still present and still appears usable.
proto/compute_driver.proto is explicitly a gateway/compute-driver extension contract for independently versioned external drivers. An external implementer reading {sandbox_id, name} has no way to learn that name is insufficient, and no workspace available to reconcile or garbage-collect platform state against.
Acceptance Criteria
- A decision is recorded on whether the driver lifecycle sandbox reference is ID-only or
(sandbox_id, workspace, name). -
StopSandboxRequest,StartSandboxRequest,DeleteSandboxRequest, andGetSandboxRequestreflect that decision consistently. -
ListSandboxesRequestis addressed under the same decision. -
proto/compute_driver.protodocuments why the driver boundary differs from the public(workspace, name)contract, perproto/README.mdconventions. - At least one driver enforces the resulting contract with a regression covering two workspaces that share a sandbox name.
- The id-authoritative fixes in #3305 and #3278 remain correct under the chosen option.
Reproduction Steps
This is a contract defect rather than a runtime failure on current main; both known runtime instances are now fixed. To observe the underdetermined reference:
- Read
message StopSandboxRequestatproto/compute_driver.proto:398. It declaressandbox_idandnameonly. - Read
DriverSandbox.workspaceatproto/compute_driver.proto:163-165, supplied toCreateSandboxfor collision-safe naming. - Read
ComputeManager::stop_sandboxatcrates/openshell-server/src/compute/mod.rs:1239. It receivesworkspace, resolves the sandbox withget_message_by_name::<Sandbox>(workspace, name), then builds the driver request at:1346without the workspace. - Create two sandboxes with the same name in different workspaces. The driver receives the same
namevalue for both; onlysandbox_iddistinguishes them.
For the empirical form of the defect, see the pre-fix behavior described in #3253 and #3254.
Environment
- OpenShell:
mainat 7139df8ca - OS: not environment-specific
- Runtime, deployment, or integration:
proto/compute_driver.protoextension contract; observed inopenshell-driver-vmandopenshell-driver-mxc, contract applies to all compute drivers
Notes
Two coherent resolutions exist and this issue does not choose between them:
Option A — drop name. Make these RPCs ID-only. sandbox_id is globally unique and stable, which is sufficient for lookup and consistent with the "immutable IDs remain internal to compute-driver boundaries" line drawn in #3050/#3272. Drivers needing a human-readable name already receive it at create.
Option B — complete the reference. Add workspace to the four requests, populated from the record the gateway has already resolved. sandbox_id stays authoritative for lookup; (workspace, name) becomes a complete secondary reference for reconciliation, labelling, and cross-checking.
Surface ownership sits with @drew, who is currently considering the compute-driver direction. This issue records the inconsistency and the open decision; it does not propose a resolution.
Parent: #2565, which scopes extension contracts including compute drivers. #3050 (closed by #3272) performed the equivalent review for the public gateway RPCs and standardized them on (workspace, name); the compute-driver surface was intentionally left on internal IDs and has not been revisited since.
Related: #3253, #3254, #3278, #3305.
- 主要语言
- Rust
- 星标
- 8.7k
- 派生
- 1.3k
- 平均合并
- 2 天 6 小时
- 30 天内合并 PR
- 301
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/OpenShell 的其他 Issue
-
area:docs
难度 1/5 1 小时以内 新手友好度 88/100
-
state:triage-needed
难度 2/5 1-3 小时 新手友好度 82/100
-
area:cli state:validated
难度 2/5 1-3 小时 新手友好度 72/100
-
state:triage-needed
难度 1/5 1 小时以内 新手友好度 90/100
-
area:build spike state:review-ready state:stale
难度 2/5 半天 新手友好度 68/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
-
bug core
难度 2/5 1-3 小时 新手友好度 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW 未关闭fuzz
难度 2/5 1-3 小时 新手友好度 82/100
ClickHouse/ClickHouse#122114 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
linebender/vello_svg#90 ·
-
难度 2/5 1-3 小时 新手友好度 74/100