fix(sandbox): gracefully handle Docker daemon unavailability when sandbox mode is off#73671
Conversation
Greptile SummaryThis PR adds graceful handling for Docker daemon unavailability across
Confidence Score: 3/5Not safe to merge as-is — the fix is incomplete and custom-image users will still see the crash it aims to prevent. One P1 defect: the non-default image path in src/agents/sandbox/docker.ts — the
|
|
Codex review: needs maintainer review before merge. What this changes: The PR exports a shared Docker-daemon-unavailable classifier, applies it to sandbox, browser, and doctor Docker image-inspect paths, and adds a default-image inspection regression test. Maintainer follow-up before merge: This is an active open implementation PR assigned to a maintainer, touches secops-owned sandbox failure semantics, and has an alternate open fix candidate; the remaining action is maintainer selection, review, and validation rather than an automated replacement PR. Best possible solution: Keep the PR open for maintainer and secops review, choose the intended fix shape for #73586, and land only after mode-off sessions are proven not to initialize Docker while sandbox-enabled sessions still surface Docker availability failures clearly. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 0544c6d493ff. |
9da403c to
25c740a
Compare
…port - Export from docker.ts, import in browser.ts and doctor-sandbox.ts - Eliminates byte-for-byte duplicated logic across three files - Addresses codex review feedback on PR openclaw#73671
20ea194 to
644cf0b
Compare
d644639 to
050b2f9
Compare
ensureDockerImage now tries to pull custom images and gracefully returns when the Docker daemon is down, instead of throwing 'Sandbox image not found'. This closes the gap identified in the PR review where only DEFAULT_SANDBOX_IMAGE was guarded.
…port - Export from docker.ts, import in browser.ts and doctor-sandbox.ts - Eliminates byte-for-byte duplicated logic across three files - Addresses codex review feedback on PR openclaw#73671
Introduced during isDockerDaemonUnavailable consolidation refactor. Fixes CI build failures from duplicate identifier declarations.
The duplicate import of SandboxConfig from types.js was causing a PARSE_ERROR (identifier already declared) that broke CI. Co-authored-by: Coder <coder@openclaw.ai>
- Remove silent pull-and-tag for DEFAULT_SANDBOX_IMAGE in ensureDockerImage The original error message correctly states OpenClaw won't substitute plain debian:bookworm-slim; silent substitution undermines this intent. Docker daemon unavailability is still handled gracefully in dockerImageExists(). - Consolidate mid-file type imports in browser.ts Move SandboxBrowserConfig to top-level import block alongside other types, eliminating the orphan import statement.
…socket paths Greptile review feedback: the bare string is a generic POSIX error. Now requires it to appear alongside '/var/run/docker' or 'docker.sock' to avoid false positives.
… isDockerDaemonUnavailable Greptile review: 'dial unix' already covers missing Docker socket case (e.g. 'dial unix /var/run/docker.sock: connect: no such file or directory'). The bare string is also too generic and could cause false positives.
050b2f9 to
378851c
Compare
Adds six missing entries for commits that landed without their own CHANGELOG.md update, picked from the last six hours of origin/main and attributed to the original contributors. Changes: - Control UI/i18n locale registry expansion + new docs glossaries (297f4c6, 0126692 by @vincentkoc). - Gateway/diagnostics opt-in startup timeline (097eed8, d001c34, e69da9d by @shakkernerd). Fixes: - Matrix `verify confirm-sas` cross-signing close (86956f7 by @nklock; #74542). - `openclaw status` channel context-window overrides (eb7d89f by @HemantSudarshan). - Sandbox Docker daemon graceful when sandbox mode is off (2dadc82 by @kaseonedge; #73671). - Control UI mobile chat settings persisted via Lit state (b1c5152 by @BunsDev). Skipped Peter-only commits with no external collaborator (per the maintainer-attribution rule against thanking @steipete) and the model list auth-index series (already covered by the existing "Models/UI: hide unauthenticated providers" entry).
…dbox mode is off (openclaw#73671) Merged via squash. Prepared head SHA: 378851c Co-authored-by: kaseonedge <15183881+kaseonedge@users.noreply.github.com> Co-authored-by: sallyom <11166065+sallyom@users.noreply.github.com> Reviewed-by: @sallyom
Adds six missing entries for commits that landed without their own CHANGELOG.md update, picked from the last six hours of origin/main and attributed to the original contributors. Changes: - Control UI/i18n locale registry expansion + new docs glossaries (297f4c6, 0126692 by @vincentkoc). - Gateway/diagnostics opt-in startup timeline (097eed8, d001c34, e69da9d by @shakkernerd). Fixes: - Matrix `verify confirm-sas` cross-signing close (86956f7 by @nklock; openclaw#74542). - `openclaw status` channel context-window overrides (eb7d89f by @HemantSudarshan). - Sandbox Docker daemon graceful when sandbox mode is off (2dadc82 by @kaseonedge; openclaw#73671). - Control UI mobile chat settings persisted via Lit state (b1c5152 by @BunsDev). Skipped Peter-only commits with no external collaborator (per the maintainer-attribution rule against thanking @steipete) and the model list auth-index series (already covered by the existing "Models/UI: hide unauthenticated providers" entry).
…dbox mode is off (openclaw#73671) Merged via squash. Prepared head SHA: 378851c Co-authored-by: kaseonedge <15183881+kaseonedge@users.noreply.github.com> Co-authored-by: sallyom <11166065+sallyom@users.noreply.github.com> Reviewed-by: @sallyom
Adds six missing entries for commits that landed without their own CHANGELOG.md update, picked from the last six hours of origin/main and attributed to the original contributors. Changes: - Control UI/i18n locale registry expansion + new docs glossaries (3562a87, ffe547a by @vincentkoc). - Gateway/diagnostics opt-in startup timeline (b6df431, e7119aa, ca63cda by @shakkernerd). Fixes: - Matrix `verify confirm-sas` cross-signing close (6dda69a by @nklock; openclaw#74542). - `openclaw status` channel context-window overrides (1b3a248 by @HemantSudarshan). - Sandbox Docker daemon graceful when sandbox mode is off (0336aa2 by @kaseonedge; openclaw#73671). - Control UI mobile chat settings persisted via Lit state (25b2db8 by @BunsDev). Skipped Peter-only commits with no external collaborator (per the maintainer-attribution rule against thanking @steipete) and the model list auth-index series (already covered by the existing "Models/UI: hide unauthenticated providers" entry).
Bug #73586
When
sandbox.mode: "off"is configured, session startup still triggers a Docker capability probe (docker image inspect) that fails when the Docker daemon is unavailable:Root Cause
dockerImageExists()insrc/agents/sandbox/docker.tsthrew when Docker daemon was unavailable, even thoughresolveSandboxContextcorrectly returnsnullforsandbox.mode="off". The probe error bubbled up during session startup.Fix
Added
isDockerDaemonUnavailable()helper to detect Docker connectivity errors (missing socket, connection refused, etc.) and returnfalsegracefully instead of throwing. Applied to:dockerImageExists()— returns false when daemon is downensureDockerImage()— skips pull when daemon is unavailableensureSandboxBrowserImage()in browser.ts — same graceful handlingdockerImageExists()in doctor-sandbox.ts — same graceful handlingFiles Changed
src/agents/sandbox/docker.ts(+17 lines)src/agents/sandbox/browser.ts(+17 lines)src/commands/doctor-sandbox.ts(+10 lines)Testing