Stop the post-start hook prompting and hanging ddev start - #22
Open
mortona42 wants to merge 1 commit into
Open
Conversation
The README says the post-start hook runs `ddev claude-update` in report-only mode, but the hook passed no flags and the command's "am I interactive?" guard was only `[ -t 0 ]`. Inside a DDEV `exec-host` hook stdin is still a tty, so the guard passed and the command printed its `[i/p/c]` menu and blocked on `read` -- freezing the `ddev start` that spawned it (and, when the start was triggered implicitly, the `ddev claude` behind it). Answering did not free it: `[i]` shells out to a nested `ddev exec` and `[p]` `exec`s `ddev restart --no-cache`, both from inside a start still in progress. CI never caught it because bats runs with stdin on a pipe, where the old guard happened to do the right thing. - Pass `-n` in the hook so the documented report-only behaviour is what the hook actually asks for, rather than a side effect of tty detection. - Require a tty on stdout as well as stdin before prompting, so any other caller that captures our output degrades to a report instead of hanging. - Let DDEV_CLAUDE_CODE_AUTOUPDATE override `-n`, so opting into auto-updates still works now that the hook passes that flag. - Cover the env-var-beats-`-n` path in tests/test.bats. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018SEQ1aLYbhpWkgNNhTXcE4
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.
Fixes #21.
From claude:
The README says the post-start hook runs
ddev claude-updatein report-only mode, but the hook passed no flags and the command's "am I interactive?" guard was only[ -t 0 ]. Inside a DDEVexec-hosthook stdin is still a tty, so the guard passed and the command printed its[i/p/c]menu and blocked onread-- freezing theddev startthat spawned it (and, when the start was triggered implicitly, theddev claudebehind it). Answering did not free it:[i]shells out to a nestedddev execand[p]execsddev restart --no-cache, both from inside a start still in progress.CI never caught it because bats runs with stdin on a pipe, where the old guard happened to do the right thing.
-nin the hook so the documented report-only behaviour is what the hook actually asks for, rather than a side effect of tty detection.-n, so opting into auto-updates still works now that the hook passes that flag.-npath in tests/test.bats.The Issue
How This PR Solves The Issue
Manual Testing Instructions
Automated Testing Overview
Release/Deployment Notes