Skip to content

fix(claude-pty): acknowledge bypass mode so the first unattended launch doesn't hang - #418

Open
Ivancheng7 wants to merge 1 commit into
xvirobotics:mainfrom
Ivancheng7:fix/pty-acknowledge-bypass-mode
Open

Ivancheng7 wants to merge 1 commit into
xvirobotics:mainfrom
Ivancheng7:fix/pty-acknowledge-bypass-mode

Conversation

@Ivancheng7

Copy link
Copy Markdown
Contributor

Problem

The PTY engine always launches claude with --dangerously-skip-permissions, but the generated per-turn settings.json did 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:

"permissions": { "defaultMode": "bypassPermissions" },
"skipDangerousModePermissionPrompt": true

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.

…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

No deployments
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