Repository navigation
fix(sandbox): select the correct Podman connection - #157694
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed September 25, 2026, 3:50 AM ET / 07:50 UTC (Revision 4). ClawSweeper reviewWhat this changesThe built-in Podman sandbox backend now selects an endpoint and SSH identity according to the installed Podman client, with regression tests and recovery instructions for existing containers. Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open. Current main and the latest release still select CONTAINER_HOST ahead of the connection chosen by newer Podman clients. The branch addresses that mismatch, and the MEMBER-authored PR body explicitly accepts the documented interruption and guarded recovery for existing sandboxes. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw uses the Podman CLI to create and run agent sandboxes. Environment selectors and the installed client determine the engine target; OpenClaw records that target and checks it before later container operations. flowchart LR
A[Podman environment selectors] --> C[Select endpoint and identity]
B[Installed client version] --> C
C --> D[Sandbox target fence]
E[Recorded sandbox target] --> D
D --> F[Podman container commands]
F --> G[Container and registry state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +20, Tests +396, Docs +41. Total +457 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the recorded-target fence and operator-confirmed scoped recovery, including the writable-layer warning, when landing the client-selection repair. Do we have a high-confidence way to reproduce the issue? Yes. With distinct HOST and named-connection targets on Podman 4.8 or newer, current main selects HOST while Podman selects CONNECTION; this review established the path from source and the upstream client contract, without running it locally. Is this the best way to solve the issue? Yes. The repair changes the existing Podman target owner, keeps the recorded-target fence, and provides a scoped recovery path for older entries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 67e17e56c331. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
f76b61e to
44cb55e
Compare
|
|
Merged via squash.
|
* fix(sandbox): keep Podman on the selected connection * test(sandbox): preserve Podman upgrade recovery coverage * test(sandbox): preserve state during Podman endpoint outages * test(sandbox): narrow mutated Podman arguments * test(sandbox): keep workspace snapshot sorting immutable Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
OpenClaw can inspect the engine selected by Podman, then bind sandbox commands to a different engine when both
CONTAINER_HOSTandCONTAINER_CONNECTIONare set. This fixes that split in endpoint ownership.User Impact
Sandbox commands use the endpoint and SSH identity selected by the installed Podman client. If the client version cannot be determined while both selectors compete, setup refuses the ambiguous selection; unset the unused selector or repair
podman --version.Existing sandboxes keep their recorded target. To recover after selection changes, restore the original endpoint and identity with
CONTAINER_CONNECTIONunset, then explicitly recreate the affected session before switching. Recreation removes the selected container's writable layer; preserve needed container data first. Mounted workspace files remain. The docs cover mixed-engine registries and unreachable original endpoints.Why This Change Was Made
Podman 4.7 prioritizes HOST presence; 4.8 and later prioritize a nonempty CONNECTION. The server version from
podman infocannot determine this client-side choice. The fix preserves raw selector values, probes the client only when needed, and binds the winning endpoint and identity.The target fence stays intact. Recovery uses the existing scoped recreation path, including the registry filtering already merged in #157808. No registry rewrite, automatic deletion, new configuration/API, or schema change.
Maintainer decision: accept the documented upgrade interruption and guarded, operator-confirmed recovery for source landing. The target fence and writable-layer warning remain required. The review's data-model migration checkbox is inapplicable: this patch changes no persisted format or schema; compatibility of existing registry entries is covered by the recovery proof.
Four files: production +30/-10 (net +20) to enforce the client contract; tests +426/-30 (net +396); docs +41.
Related: #156453
Evidence
Current source:
44cb55ecdce699d5829685df08a6be7d1caf240c.e2cae7cc. Five unchanged files retain 142 passing cases; the changed upgrade file passed both cases again at44cb55ec(20.09 s Vitest total; 21.80 s shard wall time; the two case timings total 1.846 s). Coverage includes client/server version differences, exact arguments and identity, invalid selections, Machine validation, and recovery with both targets registered.44cb55ec, Node 24.19.0/pnpm 12.4.2:pnpm test src/agents/sandbox/docker.test.ts --maxWorkers=1 --reporter=defaultpassed 42/42; file time 16.475 s, Vitest total 18.24 s, shard wall 19.97 s, full timed command 20.27 s. The upgrade file's focused Blacksmith measurements are above. Exact per-file attribution from the full hosted CI run is unavailable because its log archive failed with an HTTP/2 peer-cancel error. These focused figures are not inferred from whole-job duration. Maintainer disposition: retain that reporting limit and the completed CI result; no additional CI run or broad log sweep for this transport-only gap.e2cae7cc; the remaining 23 graphs passed atf1dbe1cd. Typed lint and all eight remaining guards passed at44cb55ec. Type evidence is staged across those heads, not a fresh full final-head run; the intervening edits changed only equivalent test expressions.44cb55ec, rootless Linux Podman 4.9.3, and two distinct stores. P8 verified mismatch/outage refusals preserved both registry rows, container IDs, and workspace hashes; restoring only the original API service recovered the same container. P9 verified the actual one-container preview, No-to-Yes confirmation, and 1 removed, 0 failed. Only the selected runtime/row was retired; the unrelated runtime and both workspaces survived, then the affected session was allocated on the new target. Owned resources and leases were cleaned up.The live evidence combines two fixtures, not one uninterrupted successful run. It exercises the real
registerSandboxCli/Commander/Clack command path, not root CLI startup or packaged installation. Podman Machine coverage is simulated. Independent source and terminal-evidence review covered the final candidate and composed live result.Fresh committed-branch autoreview passed on this head with no P0–P2 findings. The exact-head ClawSweeper review reports no source/security findings; its maintainer decision is resolved above. Full hosted CI passed on this exact head (123 successful jobs, 18 skipped); the aggregate CI, dependency-review and security-review gates are successful. No merge has been submitted.