Skip to content

Linux sandbox: shell commands are killed after ~10 s (bwrap parent-death signal bound to an exited thread) #5176

Closed

Description

@AlexanderKalistratov

Describe the bug

On Linux with the sandbox enabled, a shell command that runs longer than ~10 s is killed
with SIGKILL. The tool reports exit code -1. There is no error message. The same command
passes without the sandbox, and it also passes with plain bwrap outside the CLI.

Affected version

1.0.98 (Linux x64). Ubuntu 24.04, kernel 6.8, bubblewrap 0.9.0.

Steps to reproduce the behavior

  1. Enable the sandbox (/sandbox, or "sandbox": {"enabled": true} in settings).
  2. Run:
    copilot -p 'Run this exact shell command once: date +%T; sleep 30; date +%T' --allow-all-tools
    
  3. Result: only the first date prints, then Failed with exit code -1 after ~10 s.

In -p mode it fails every time. In interactive sessions it fails only on some runs.

Expected behavior

The command runs to the end (exit 0 after ~30 s).

Additional context

Cause, from strace -f of the CLI:

<bwrap>   11:58:37.324667 prctl(PR_SET_PDEATHSIG, SIGKILL) = 0
<thread>  11:58:47.432660 exit(0)
<bwrap>   11:58:47.433353 +++ killed by SIGKILL +++

The CLI starts bwrap --die-with-parent from a worker (pool) thread. On Linux,
PR_SET_PDEATHSIG fires when the thread that forked the child exits, not when the
process exits. The runtime stops that thread after ~10 s idle, so the kernel kills bwrap
and the command. There is no kill() syscall and no OOM event.

Possible fixes: spawn bwrap from a long-lived thread, or watch the CLI process (for
example with a pidfd) instead of using --die-with-parent.

Workaround: put a small bwrap wrapper first in PATH. The wrapper starts the real bwrap
from its own process and kills it when the CLI process exits.

Activity

  1. added
    area:permissionsTool approval, security boundaries, sandbox mode, and directory restrictions
    area:platform-linuxLinux-specific: Wayland, X11, Ubuntu, Fedora, Alpine, ARM, terminal emulators
    on Oct 18, 2026
  2. self-assigned this
    on Oct 19, 2026
  3. caarlos0 commented on Oct 20, 2026

    @caarlos0
    Member

    will be fixed in the next version, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:permissionsTool approval, security boundaries, sandbox mode, and directory restrictionsarea:platform-linuxLinux-specific: Wayland, X11, Ubuntu, Fedora, Alpine, ARM, terminal emulators

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions