Repository navigation
fix(deploy): install.sh's yes/no prompts take the answer typed - #249
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gusfcarvalho
approved these changes
Oct 28, 2026
gusfcarvalho
left a comment
Contributor
There was a problem hiding this comment.
ccf-review: APPROVE
no findings.
gusfcarvalho
added a commit
that referenced
this pull request
Oct 29, 2026
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.
Task: install.sh ignores every y/n answer (lead brief, 2026-10-28).
The bug
Running v0.2.1's
install.shon a host that already hasagent.yamland a refresh token, "Replace it? [y/N]" kept the config whatever was typed, and nothing else was asked.confirm()declareslocal answerand callsask answer ….ask()also declares a localanswer, so itsprintf -v "$var"(withvar=answer) set ask's own local. confirm always saw an empty answer, which meant its default every time:setting(ask v) and the token prompts (ask token,ask claude_token) didn't hit this, but any caller whose variable matched one of ask's local names would have.The fix
ask()'s locals are now_ask_var _ask_prompt _ask_silent _ask_reply, names no caller uses, and one comment line says why. I checked everyaskcaller:confirm(answer, the bug),setting(v),token,claude_token.The test seam
${FACTORY_INSTALL_TTY:-/dev/tty}. The comment saying it is forinstallsh_test.gocomes afterset -euo, so--helpdoesn't print it.askopens it once, on fd 9, so a file of answers is read line by line. The fd is fixed rather thanexec {fd}<because macOS's/bin/bashis 3.2.have_ttychecks the same path, or the fd once it is open.host init's stdin is the same path (<"$tty") instead of a literal/dev/tty. Otherwise a test run without a controlling terminal would fail on the redirect. In real use it is the same/dev/tty.read -pprints the prompt, instead of/dev/tty. So nothing in the seam touches/dev/tty.TestInstallScriptAsksincmd/factory-agent/installsh_test.gouses a tempHOMEwith anagent.yamland a refresh token, the existing fail-loud stubs, no--quietand a file of answers:yto Replace, a dispatcher and Enter for the other 13 settings,yto Write, then Enter for both logins. The config is replaced, a.bak-…copy holds the old one, and the new one loads withconfig.Load(with the defaults).host initruns without--yesand no login runs.n) and kept on Enter, both--dry-run: the config is untouched and there is no backup.yto Replace, the settings, thennto Write. The script fails with "not written; nothing was changed", and the config is untouched with no backup.The test never reaches the network or the real
HOME.Verification
answer, seam kept), replaced and not written fail: both exit 0 and keep the config. With the fix they pass. The kept cases pass either way, as they should, since "no" was the buggy answer too.go build ./...andGOOS=linux go build ./...pass.test -z "$(gofmt -l internal cmd api)"passes.shellcheck deploy/install.shis clean.go test ./cmd/factory-agent -run TestInstallScriptpasses.make -k reviewable: lint has 0 issues, openapi lint passes, catalog checks pass and every test package passes, except the known local macOS failureinternal/agent/host/provisionTestBaseScriptRuns.Self-review
One lenient pass with ccf-review core+go: approve. One nit, deferred and recorded in the
lisa-selfreviewnote: fd 9 stays open for later commands. None of them reads it, and launchd/systemd don't pass it to supervise.Dropped, with reasons
None.
🤖 Generated with Claude Code