Repository navigation
Keep children of a TTY-less runner away from the terminal - #27
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The central detachment regression test does not exercise detachment on headless CI runners.
1 open finding
What changed in this PR
Prevents non-TTY runners, particularly MCP operations, from hanging on hidden terminal prompts.
Changes:
- Detaches non-TTY subprocesses into independent Unix sessions.
- Disables Git terminal prompts and removes
GPG_TTY. - Adds documentation and regression tests.
| File | Description |
|---|---|
pkg/exec/runner.go |
Applies non-interactive environment and detachment. |
pkg/exec/runner_test.go |
Tests prompt environment and terminal isolation. |
pkg/exec/detach_unix.go |
Implements Unix session detachment. |
pkg/exec/detach_other.go |
Provides a non-Unix no-op. |
docs/architecture.md |
Documents subprocess terminal isolation. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
An MCP stack_create in a repo with commit.gpgsign on and an SSH signing key that wasn't loaded into ssh-agent never came back. Capture mode gives git a closed stdin, but ssh-keygen asks for the passphrase on /dev/tty (the controlling terminal), and every child inherits that from whatever terminal the MCP server was started in. So git sat on a prompt nobody could see or answer until someone killed ssh-keygen by hand. gpg's pinentry and git's own credential prompt can do exactly the same. A runner built without a TTY now starts each child in its own session (setsid), so there is no controlling terminal and opening /dev/tty fails; it also sets GIT_TERMINAL_PROMPT=0 and drops GPG_TTY. The prompt turns into an immediate error the tool can return instead of a hang. The CLI runner with a terminal is untouched, so a passphrase prompt in an ordinary git stack create still works as before.
DomBlack
force-pushed
the
detach-children-from-terminal
branch
from
October 9, 2026 16:59
3e285bc to
8c24522
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

An MCP
stack_createin a repo withcommit.gpgsignon and an SSH signing key that wasn't loaded into ssh-agent never came back. Capture mode gives git a closed stdin, but ssh-keygen asks for the passphrase on/dev/tty(the controlling terminal), and every child inherits that from whatever terminal the MCP server was started in. So git sat on a prompt nobody could see or answer until someone killed ssh-keygen by hand. gpg's pinentry and git's own credential prompt can do exactly the same.A runner built without a TTY now starts each child in its own session (setsid), so there is no controlling terminal and opening
/dev/ttyfails; it also setsGIT_TERMINAL_PROMPT=0and dropsGPG_TTY. The prompt turns into an immediate error the tool can return instead of a hang. The CLI runner with a terminal is untouched, so a passphrase prompt in an ordinarygit stack createstill works as before.