fix(claude-pty): acknowledge bypass mode so the first unattended launch doesn't hang - #418
Open
Ivancheng7 wants to merge 1 commit into
Open
Ivancheng7 wants to merge 1 commit into
Ivancheng7 wants to merge 1 commit into
Conversation
…ch doesn't hang The PTY always launches claude with --dangerously-skip-permissions, but the generated settings file did not record the matching acknowledgement. On a first run (no stored acknowledgement yet) Claude Code stops on an interactive dangerous-mode screen and waits for a keypress that never comes in an unattended environment — the turn hangs with no output. writeSettings() now writes permissions.defaultMode = bypassPermissions and skipDangerousModePermissionPrompt = true into the ephemeral per-turn settings file. This grants nothing beyond the launch flag; it only records that the already-selected mode was acknowledged. Test: the generated settings carry the acknowledgement and keep the Stop hook.
This branch has not been deployed
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.
Problem
The PTY engine always launches
claudewith--dangerously-skip-permissions, but the generated per-turnsettings.jsondid not record the matching acknowledgement. On a first unattended run Claude Code stops on the interactive dangerous-mode screen and waits for a keypress — the turn hangs with no output. This is what makes a fresh Windows (or any headless) install appear to "start and then do nothing".Change
writeSettings()now writes, next to the Stop hook:This grants nothing beyond the launch flag — it only records the acknowledgement for the mode that was already selected, so startup is not blocked.
Tests
tests/claude-pty-settings.test.ts(new): the generated settings carry the acknowledgement and keep the Stop hook.Full local suite: no new failures.