Skip to content

fix(sandbox): select the correct Podman connection - #157694

Merged
vincentkoc merged 5 commits into
mainfrom
fix/podman-client-selector-precedence-20260925
Sep 25, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
fix/podman-client-selector-precedence-20260925

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

OpenClaw can inspect the engine selected by Podman, then bind sandbox commands to a different engine when both CONTAINER_HOST and CONTAINER_CONNECTION are 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_CONNECTION unset, 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 info cannot 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.

  • Focused tests: 144 tests across six files passed at e2cae7cc. Five unchanged files retain 142 passing cases; the changed upgrade file passed both cases again at 44cb55ec (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.
  • Test cost: single-file Blacksmith measurement at 44cb55ec, Node 24.19.0/pnpm 12.4.2: pnpm test src/agents/sandbox/docker.test.ts --maxWorkers=1 --reporter=default passed 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.
  • Static checks: four-path guards/format, core typecheck, and two test type graphs passed at e2cae7cc; the remaining 23 graphs passed at f1dbe1cd. Typed lint and all eight remaining guards passed at 44cb55ec. Type evidence is staged across those heads, not a fresh full final-head run; the intervening edits changed only equivalent test expressions.
  • Real recovery: composed P8 + P9 proof used unchanged 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.

@vincentkoc vincentkoc self-assigned this Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M labels Sep 24, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 25, 2026, 3:50 AM ET / 07:50 UTC (Revision 4).

ClawSweeper review

What this changes

The 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
Reviewed head: 44cb55ecdce699d5829685df08a6be7d1caf240c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused repair and detailed real recovery evidence support a good PR; test-cost reporting remains incomplete.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body reports after-fix rootless Linux Podman 4.9.3 evidence through the registered sandbox CLI: mismatch and outage preserved existing rows and containers, followed by confirmed retirement of one selected container and allocation on the new target. That covers compatibility of existing stored targets through guarded recovery. The linked hosted logs could not be fetched in this review because the log host was blocked by the reviewer network; this is a reviewer inspection limit, and the prior exact-head review classified the detailed proof as sufficient.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body reports after-fix rootless Linux Podman 4.9.3 evidence through the registered sandbox CLI: mismatch and outage preserved existing rows and containers, followed by confirmed retirement of one selected container and allocation on the new target. That covers compatibility of existing stored targets through guarded recovery. The linked hosted logs could not be fetched in this review because the log host was blocked by the reviewer network; this is a reviewer inspection limit, and the prior exact-head review classified the detailed proof as sufficient.
Evidence reviewed 12 items Current main still has the mismatch: The live main revision still trims both selectors and prefers a nonempty CONTAINER_HOST, even when a newer Podman client selects CONTAINER_CONNECTION.
Latest release has the old selection order: The reported latest release, v2026.9.6, also selects CONTAINER_HOST first.
Podman 4.8 dependency contract: The upstream client selects a nonempty CONTAINER_CONNECTION before CONTAINER_HOST and takes the named destination's URI and identity.
Findings None None.
Security None None.

How this fits together

OpenClaw 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]
Loading

Before merge

  • Complete next step (P2) - Add the measured one-worker runtime for the changed docker.test.ts file and CI seconds for both materially changed test files to the PR body when the running check finishes.
Agent review details

Security

None.

PR surface

Source +20, Tests +396, Docs +41. Total +457 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 30 10 +20
Tests 2 426 30 +396
Docs 1 41 0 +41
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 497 40 +457

Review metrics

Metric Value Why it matters
Production and test growth production +20 net; tests +396 net The production growth enforces the stated client-selection contract and is accompanied by selector and upgrade coverage.
Upgrade test cost 20.09 s test duration; 21.80 s shard wall The reported recovery-test cost is material to per-PR CI; the other changed test file still needs its measured cost.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/agents/sandbox/podman-runtime.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: canonical
Canonical: #157694
Summary: The merged related PR enables scoped recovery across targets; this PR remains the distinct connection-selection fix.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The fix addresses a concrete Podman sandbox mismatch with limited configuration-specific impact.
  • merge-risk: 🚨 compatibility: Existing HOST-pinned registry entries can refuse use after upgrade until the operator follows the explicitly accepted recovery procedure.
  • merge-risk: 🚨 availability: Recovery can pause an affected sandbox while its original endpoint is unreachable, a limitation explicitly accepted in the PR body.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports after-fix rootless Linux Podman 4.9.3 evidence through the registered sandbox CLI: mismatch and outage preserved existing rows and containers, followed by confirmed retirement of one selected container and allocation on the new target. That covers compatibility of existing stored targets through guarded recovery. The linked hosted logs could not be fetched in this review because the log host was blocked by the reviewer network; this is a reviewer inspection limit, and the prior exact-head review classified the detailed proof as sufficient.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports after-fix rootless Linux Podman 4.9.3 evidence through the registered sandbox CLI: mismatch and outage preserved existing rows and containers, followed by confirmed retirement of one selected container and allocation on the new target. That covers compatibility of existing stored targets through guarded recovery. The linked hosted logs could not be fetched in this review because the log host was blocked by the reviewer network; this is a reviewer inspection limit, and the prior exact-head review classified the detailed proof as sufficient.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed September 24, 2026, 7:55 PM ET / 23:55 UTC sha unknown :: blocked before merge. :: [P1] Provide recovery for existing HOST-pinned sandboxes
  • reviewed 2026-09-25T06:16:30.278Z sha 44cb55e :: blocked before merge. :: none
  • reviewed 2026-09-25T07:42:04.688Z sha 44cb55e :: blocked before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/podman-client-selector-precedence-20260925 branch from f76b61e to 44cb55e Compare September 25, 2026 06:04
@vincentkoc vincentkoc changed the title fix(sandbox): keep Podman on the selected connection fix(sandbox): select the correct Podman connection Sep 25, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 25, 2026 07:36
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 44cb55ecdce699d5829685df08a6be7d1caf240c
  • Maintainer: @vincentkoc
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox/podman-runtime.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@vincentkoc
vincentkoc merged commit 041bbac into main Sep 25, 2026
295 of 297 checks passed
@vincentkoc
vincentkoc deleted the fix/podman-client-selector-precedence-20260925 branch September 25, 2026 08:10
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant