fix(docker): reclaim sandbox token files on out-of-band removal - #3220
Conversation
|
Label |
|
/ok to test b0118ac |
PR Review StatusThis focused Docker lifecycle fix is project-valid through linked bug #3041. The initial independent code review found no blocking issues, and no Fern docs update is needed because the change restores internal token-file cleanup without changing a published user interface. Action required: A maintainer must dispatch Blocking findings:
Carried findings:
Non-blocking suggestions:
Gator metadata
|
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
b0118ac to
097e5ba
Compare
|
/ok to test 097e5ba |
|
Label |
PR Review StatusThe follow-up review of the rebased patch found no blocking issues. The author-only delta only relocates the existing regression tests relative to upstream additions; the token-file cleanup fix and its coverage remain intact. Action required: Wait for current-head Branch E2E Checks run Blocking findings:
Carried findings:
Gator metadata
|
Monitoring CompleteMonitoring is complete because this PR has merged. Final status: The focused Docker token-file cleanup fix was reviewed with no blocking findings, the required Branch Checks, Helm Lint, Trivy Changes, and E2E gates completed successfully, and maintainer approval was present before merge. I removed the active Gator metadata
|
Summary
delete_sandbox_innerskipped per-sandbox token file cleanup on one exit path — Docker reports no container and no in-memory pending record survives — leaving the sandbox's gateway JWT on disk indefinitely. Every other exit path in that function already cleans up. This adds the missing call plus regression coverage.Related Issue
Fixes #3041
Changes
crates/openshell-driver-docker/src/lib.rs: callcleanup_sandbox_token_file_for_deletein the "container gone, no pending record" branch ofdelete_sandbox_inner._for_deleterather than_by_idbecause delete accepts a name with no id (require_sandbox_identifierrequires only one of the two). With an empty id,sandbox_token_pathresolves to<namespace>/sandbox.jwt, whose parent is the shared namespace directory._for_deleteguards on!sandbox_id.is_empty().Ok(false)return: nothing was removed from Docker, so no deletion is claimed and noDeletedwatch event fires.crates/openshell-driver-docker/src/tests.rs: two regression tests, plus a loopback stub that answers Docker'sGET /containers/jsonwith[]so the branch is reachable without a daemon.crates/openshell-driver-docker/Cargo.toml/Cargo.lock: enabletemp-env'sasync_closurefeature. The syncwith_varscannot wrap an async test body, and the tests needXDG_STATE_HOMEscoped to a tempdir.Left alone deliberately: the adjacent
summary_container_target→Nonebranch returnsOk(pending.is_some())without removing the container. That one is a live container being silently abandoned, not a token leak — adding cleanup there would revoke a running sandbox's credential. Worth its own issue;stop_sandbox_innerhandles the identical case withErr(Status::not_found).Testing
mise run pre-commitpassesChecklist