[ax] Do not prompt or auto-create config on non-TTY - #8454
Merged
Conversation
This was referenced Sep 4, 2026
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.
Why
Running
rector processwith norector.phpin a non-interactive context (piped, CI, an agent) currently:No "rector.php" config found. Should we generate it for you? [yes]:into the output, thenyesand silently writes arector.phpinto the project - a file the caller never asked for.Symfony still treats a closed STDIN as interactive here, so the prompt is emitted and defaulted rather than skipped. For an agent this is a surprising side effect plus confusing prompt noise (and a hang risk when stdin is a pty with no human to answer).
What
Guard the prompt on a non-TTY STDIN: emit a clear, actionable message and return - no prompt, no unrequested file.
rector.phpwritten; the run falls through to the existing "no rules" handling.stream_isattysignal used in [ax] Disable progress bar when output is not a TTY #8444 / [ax] Never emit ANSI when output is not a TTY, even with --ansi #8453 (STDIN here, since the prompt reads stdin).Trade-off: this drops the convenience of auto-scaffolding a config in non-interactive contexts. That silent write is the bug being fixed.
Verification
rector process src --dry-run < /dev/nullin a dir with no config:rector.phpcreated[WARNING] No "rector.php" config found. Create one, or pass "--config <path>.", no file createdEnv-dependent (reads the real STDIN stream), so verified via the CLI rather than a unit test.