Skip to content

fix: surface docker's error when it rejects a .deva mount - #489

Merged
lroolle merged 1 commit into
mainfrom
fix/silent-exit-bad-mount
Jul 27, 2026
Merged

fix: surface docker's error when it rejects a .deva mount#489
lroolle merged 1 commit into
mainfrom
fix/silent-exit-bad-mount

Conversation

@lroolle

@lroolle lroolle commented Jul 27, 2026

Copy link
Copy Markdown
Member

Independent of the feature stack -- branched off main, mergeable on its own.

A .deva file with a mount docker rejects made deva.sh die silently: "Creating
persistent container: " and nothing else. No container, no error.

deva.sh, persistent-container path (the default; ephemeral is opt-in):

error_output=$(docker "${DOCKER_ARGS[@]}" tail -f /dev/null 2>&1)
docker_exit=$?              # under set -euo pipefail: NEVER reached
if [ $docker_exit -ne 0 ]; then ...   # dead code on failure

Under set -euo pipefail a failing command-substitution assignment aborts the
script AT the assignment, so the entire author-written error block never runs.
It was unreachable on the one path it exists for. Bind sources resolve on the
HOST fs (deva talks to the host daemon), so any VOLUME= docker rejects lands
exactly here.

Keeping the assignment left of || suspends set -e and captures the real exit;
the existing handler then prints docker's own stderr.

Test plan

  • repro with .deva VOLUME=/tmp:/mnt/bad:rx
    before: exit 125, output ends at "Creating persistent container", silent
    after: exit 1, "docker: Error response from daemon: invalid mode: rx"
  • success path unaffected (container created and attached)
  • full local suite green (9/9), shellcheck --severity=error clean

Closes #484

A .deva VOLUME docker refuses made deva.sh die silently -- "Creating
persistent container: <name>" and nothing else. Under set -euo pipefail
a failing command-substitution assignment aborts AT the assignment, so
docker_exit=$? and the entire error block below it were dead code on
the one path they exist for.

Keep the assignment left of `||` to suspend set -e and capture the real
exit; the existing handler then prints docker's own stderr.

Repro: .deva with VOLUME=/tmp:/mnt/bad:rx
  before: exit 125, no message
  after:  exit 1, "docker: Error response from daemon: invalid mode: rx"

The ephemeral path was already safe (if ! docker ...).

Closes #484
Copilot AI review requested due to automatic review settings July 27, 2026 09:03
@claude-yolo

claude-yolo Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 1s —— View job


I'll analyze this and get back to you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a silent failure in deva.sh’s persistent-container creation path by ensuring Docker errors (e.g., invalid mount options from a .deva file) are captured and printed even under set -euo pipefail.

Changes:

  • Make the docker ... command-substitution assignment non-fatal under set -e by placing it in an || list and capturing the real exit status.
  • Preserve and surface Docker’s stderr via the existing error handling block (instead of aborting before it runs).
  • Add an in-line comment documenting why the || docker_exit=$? pattern is required here.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lroolle
lroolle merged commit cd43120 into main Jul 27, 2026
5 of 6 checks passed
@lroolle
lroolle deleted the fix/silent-exit-bad-mount branch July 27, 2026 09:26
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.

fix: deva.sh exits silently when docker rejects a .deva mount

2 participants