Skip to content

fix: don't put bwrap in its own pgrp in argv runner#153

Merged
jy-tan merged 1 commit intomainfrom
fix-pgid
Apr 30, 2026
Merged

fix: don't put bwrap in its own pgrp in argv runner#153
jy-tan merged 1 commit intomainfrom
fix-pgid

Conversation

@jy-tan
Copy link
Copy Markdown
Contributor

@jy-tan jy-tan commented Apr 30, 2026

Summary

The previous unification PR put bwrap into its own pgrp via Setpgid: true to support pgrp-broadcast on the 2nd Ctrl-C. This stole the controlling terminal's foreground from sandboxed TUIs (e.g. OpenCode, Claude Code), causing them to receive SIGTTIN and stop on startup. ps showed STAT=T/Tl and TPGID != PGID for the sandboxed subtree.

Drop Setpgid on bwrap and the now-unused PgrpBroadcast/killProcessGroup machinery. SIGKILL on the 2nd signal plus bwrap --die-with-parent is sufficient to tear down the subtree. ppoll+eventfd shutdown, SIGHUP handling, drain timeout, and the unified SignalForwarder are all retained.

Changes

  • internal/sandbox/runtime_exec_argv_linux.go: drop Setpgid: true on bwrap; replace killProcessGroup(...) with Process.Signal(SIGTERM) in the supervisor-died-first branch; update doc comment.
  • internal/sandbox/sigproxy.go: remove PgrpBroadcast field and killProcessGroup helper (no production callers).
  • internal/sandbox/sigproxy_test.go: drop Setpgid from test child and the deleted-helper test.
  • cmd/fence/main.go: clean up stale comment on startCommandWithSignalProxy.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

@jy-tan jy-tan merged commit d738225 into main Apr 30, 2026
6 checks passed
@jy-tan jy-tan deleted the fix-pgid branch April 30, 2026 08:06
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.

1 participant