fix: auto-accept Bypass Permissions dialog so readiness isn't stuck#20
Open
kaibyao wants to merge 1 commit into
Open
fix: auto-accept Bypass Permissions dialog so readiness isn't stuck#20kaibyao wants to merge 1 commit into
kaibyao wants to merge 1 commit into
Conversation
`--dangerously-skip-permissions` shows two sequential first-run TUI dialogs, not one. clarp auto-confirmed workspace trust but had no handler for the second "Bypass Permissions mode" warning, whose default-highlighted option is "No, exit". Claude sat at that dialog forever, never started a session, never wrote its PID status file, so clarp's supervisor never observed readiness and failed after 120s (num_turns:0, empty session_id). Generalize the single-shot trust detector into createStartupPromptDetector, which reports both dialogs (each once). On the bypass dialog, select "2. Yes, I accept" by writing "2\r" — the digit avoids the leading ESC of an arrow-key sequence, which the dialog treats as "Esc to cancel". Claude-Session: https://claude.ai/code/session_01TAxUbT4zmnXv8LiipMk7ii
kaibyao
force-pushed
the
fix/readiness-timeout
branch
from
July 20, 2026 16:57
f1cc6e0 to
cd63cbd
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.
Problem
Every
clarp -p --dangerously-skip-permissionsinvocation dies after exactly 120s with a readiness timeout, even in a fresh empty dir.duration_ms≈120000,num_turns:0, emptysession_id— Claude never takes a turn. Nativeclaude -pruns fine in the same environment.Root cause
--dangerously-skip-permissionsshows two sequential first-run TUI dialogs, not one:\r, default option = "Yes, I trust this folder"). ✅1. No, exit:Claude sat at dialog #2 forever, never started a session, never wrote its
~/.claude/sessions/<pid>.jsonstatus file. clarp's PTY supervisor polls that file for a status transition to observe readiness — the transition never came, so it timed out afterSTARTUP_READY_TIMEOUT_MS(120s). Nativeclaude -pskips the interactive dialog entirely, which is why it worked.Fix
Generalize the single-shot workspace-trust detector into
createStartupPromptDetector, which reports both dialogs (each at most once). On the bypass dialog, select2. Yes, I acceptby writing2\r.Writing the digit avoids the leading
ESCbyte of an arrow-key sequence (\x1b[B) — the dialog shows "Esc to cancel", and a lone/slow ESC registers as cancel and quits (observed: exit code 1).Verification
mktemp -d+--dangerously-skip-permissions: Claude now becomes ready and completes the turn (produces output, SSE streams). No more 120s hang.https://claude.ai/code/session_01TAxUbT4zmnXv8LiipMk7ii