fix(driver-docker): scope pending sandbox matching by id and workspace - #3240
fix(driver-docker): scope pending sandbox matching by id and workspace#3240letv1nnn wants to merge 1 commit into
Conversation
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
The complete Docker-driver patch is project-valid and the initial code review found no blocking issues. The authoritative-id lookup, ambiguous name-only rejection, workspace-scoped reservation, and regression coverage form a proportionate fix for the linked bug.
Blocking findings:
- No blocking findings remain
Carried findings:
- None
Non-blocking suggestions:
- None
Gator metadata
- Validation: Localized Docker-driver correctness fix linked to issue #3234 with a concrete user path and regression coverage
- Docs: Not needed because this corrects internal driver identity matching without changing a supported user-facing workflow
- Checks: DCO and vouch pass; current-head branch checks await authorized test dispatch
- E2E: Required for Docker sandbox lifecycle behavior; dispatch pending
- Head SHA:
6e63b1a0060249c30bb85935dd622509367e05fb - Base SHA:
8af79a7f4b68abf09299371f20987fde90667139 - Merge base SHA:
118b250f015af84ce4a225cd45d1ce7b64bb54cb - Patch ID:
ce6704dce29ac63e7974a5d7d3e31b9ecd874c35 - Gator payload:
8 - Review mode:
initial - Previous reviewed SHA: none
- Review budget exhausted: no
- Maintainer decision required: no
- Next state:
gator:in-review
|
/ok to test 6e63b1a |
|
Label |
Summary
Pending-sandbox lookups in the Docker compute driver matched on
sandbox_idORsandbox_name. Sandbox names are unique per workspace, not globally, so a lifecycle request carrying a correct id could resolve to a different sandbox that happened to share a name in another workspace — evicting its pending record and aborting its in-flight provisioning task. This makessandbox_idauthoritative, rejects ambiguous name-only lookups instead of lettingHashMapiteration order pick a victim, and scopes the reserve-time name-conflict check by workspace.Related Issue
Fixes #3234
Changes
pending_sandbox_matcheswithresolve_pending_id, which resolves a lifecycle request to at most one pending sandbox id:sandbox_idis authoritative — when supplied, the name is never consulted as an alternative. Previously an id that was absent from the pending map fell through to a name match.FailedPreconditionwhen more than one pending sandbox shares the name. The driver request carries no workspace, so the match is genuinely ambiguous and the previous behavior depended onHashMapiteration order.sandbox.id.Resultthroughpending_snapshot,remove_pending_sandbox, and their callers inget_sandbox_snapshot,delete_sandbox_inner, andstop_sandbox_inner.reserve_pending_sandboxname-conflict check by workspace. Creating a sandbox nameddemoin workspacebetawhile ademoin workspacealphawas still provisioning previously failed withAlreadyExists. Duplicate ids are still rejected unconditionally. This usesDriverSandbox.workspace, which the driver already receives — no proto change.Behavior change
An ambiguous name-only
DeleteSandbox/StopSandbox/GetSandboxnow returnsFailedPreconditionrather than acting on an arbitrary match. The gateway always sends a non-emptysandbox_id(crates/openshell-server/src/compute/mod.rs), so this path is reachable only by direct driver RPCs.Out of scope
workspaceto the driver-facingDeleteSandboxRequest/StopSandboxRequest/StartSandboxRequest. It would let the name fallback disambiguate instead of erroring, but it touches five driver crates and the driver proto contract, so it belongs in its own change. The publicDeleteSandboxRequestinproto/openshell.protoalready carriesworkspace; the driver-facing message inproto/compute_driver.protodoes not.crates/openshell-driver-vm(driver.rs:1391,:1471,:1536,:1617) andcrates/openshell-driver-mxc(driver.rs:345) resolve in-memory records by name with the same weakness. Podman and Kubernetes are unaffected — they resolve against platform labels. I have reviewed the matching shape in those drivers but not traced their full call paths; filing separately rather than expanding this PR.Testing
mise run pre-commitpassesChecklist