Skip to content

Fail closed when the Devin sandbox is unavailable - #12

Merged
TheOnlyFusionCube merged 1 commit into
TheOnlyFusionCube:mainfrom
hessabi:fix/sandbox-fail-closed
Oct 23, 2026
Merged

TheOnlyFusionCube merged 1 commit into
TheOnlyFusionCube:mainfrom
hessabi:fix/sandbox-fail-closed

Conversation

@hessabi

@hessabi hessabi commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Proposal 3 in #4.

What was wrong: runDevinJob retried a failed sandboxed review without --sandbox, in normal mode, whenever a broad regex matched the error output. That silently downgraded the isolation the caller asked for. Devin's docs say an unavailable sandbox fails closed.

What changed

  • Removed the retry. A failed sandboxed run stays failed, with exactly one devin -p invocation.
  • New exported sandboxFailureHint({ platform, stderr }) in lib/devin.mjs. When a failed sandboxed run's stderr looks sandbox-related, the output gets a platform-aware message with a link to https://docs.devin.ai/cli/sandbox. Devin's own stderr lines are kept.
    • Native Windows: use WSL2.
    • Linux: install bubblewrap (bwrap) and socat.
    • macOS: Seatbelt needs no install.
  • The hint is decided from stderr only, since stdout is model output and can mention "sandbox" legitimately.
  • The job is recorded as failed. For sandbox failures the companion also exits 1, and with --json the hint goes to stderr too. Ordinary failures keep their current exit behavior; changing that would be a separate PR.
  • The stop review gate already fails open on a non-zero exit. It still warns rather than blocking, and it never reruns without the sandbox.
  • README and AGENTS.md now describe the fail-closed behavior.

Not included:

  • A Windows pre-flight check, since Devin already hard-fails there.
  • A bypass flag.

How tested

  • node --test: 39 pass, 0 fail.
  • 11 new tests in tests/sandbox.test.mjs, using the fake devin fixture with sandbox-style stderr (bwrap missing, a Seatbelt error, seccomp):
    • Exactly one -p run, with --sandbox, and a failed job with the hint.
    • Per-platform hint unit tests.
    • No hint for non-sandbox failures, or when --sandbox wasn't requested.
    • The stop gate fails open.
  • Reverting only the companion change makes 4 of the new tests fail.

runDevinJob retried a failed sandboxed review without --sandbox in
normal mode, triggered by a broad regex over stderr and stdout. That
silently downgraded the isolation the caller asked for.

Remove the retry. A failed sandboxed run now stays failed, the
companion exits non-zero, and sandbox-looking stderr gets an
actionable, platform-aware hint (WSL2 on Windows, bubblewrap and
socat on Linux, Seatbelt on macOS) with a link to the Devin sandbox
docs. The stop review gate still fails open with a warning and does
not rerun unsandboxed. README and AGENTS.md now describe the fail
closed behavior. Tests cover bwrap and Seatbelt failures (single
sandboxed run, failed job, hint), per-platform hints, non-sandbox
failures, and the gate.

Proposal 3 in TheOnlyFusionCube#4.

@TheOnlyFusionCube TheOnlyFusionCube left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified fail-closed sandbox behavior (39 passed). Clean implementation of Proposal 3.

@TheOnlyFusionCube
TheOnlyFusionCube merged commit 6891fbe into TheOnlyFusionCube:main Oct 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants