fix: auto-trust handles all prompt scenarios cleanly - #98
Merged
Conversation
The watcher now receives expectChannels based on spawn args instead of always watching for both prompts: - Trust prompt: always expected (CC may ask for any directory) - Channels prompt: only when --dangerously-load-development-channels used This means the watcher disposes immediately after answering the expected prompts instead of waiting for the 30s timeout. Timeout also reduced from 30s to 15s since prompts appear within the first few seconds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aterrylu
force-pushed
the
terry/auto-trust-v2
branch
from
March 31, 2026 04:29
c385178 to
6803873
Compare
nox-0x
approved these changes
Mar 31, 2026
nox-0x
left a comment
Collaborator
There was a problem hiding this comment.
Clean fix — building the expected-prompt list from spawn args avoids unnecessary PTY watching and the 30s timeout hang when only one prompt fires. Logic is sound: trust is always included, channels conditional, closure captures correct array length. 15s timeout is a reasonable reduction. Good work.
aterrylu
added a commit
that referenced
this pull request
Apr 3, 2026
Rewrites the startup watcher to be simpler and more reliable: - Multiple needle variants per prompt (with/without spaces) for robustness across terminal widths - 5-Enter burst at 50/200/500/1000/2000ms on detection — covers timing variations where the TUI isn't ready - Mark answered immediately on detection (no race condition from buffer clearing) - Don't clear buffer — both prompts can be detected in same chunk - Timeout logs unanswered prompts for diagnostics - PTY write failure stops further retries Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aterrylu
added a commit
that referenced
this pull request
Apr 3, 2026
fix: auto-trust handles all prompt scenarios cleanly (#98) Rewrites the startup watcher to be simpler and more reliable: - Multiple needle variants per prompt (with/without spaces) for robustness across terminal widths - 5-Enter burst at 50/200/500/1000/2000ms on detection — covers timing variations where the TUI isn't ready - Mark answered immediately on detection (no race condition from buffer clearing) - Don't clear buffer — both prompts can be detected in same chunk - Timeout logs unanswered prompts for diagnostics - PTY write failure stops further retries Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Improves the auto-trust watcher to only watch for prompts that will actually appear, disposing immediately instead of waiting for the 30s timeout.
Problem
The watcher always expected both prompts (trust + channels), so when only one appeared, it waited the full 30s timeout before cleaning up. Noisy logs and unnecessary PTY watching.
Fix
attachStartupWatcher(pty, expectChannels)now receives a boolean based on whether--dangerously-load-development-channelsis in the spawn args. The watcher only watches for prompts that are expected:Timeout reduced from 30s → 15s.
🤖 Generated with Claude Code