Skip to content

Commit 504f0df

Browse files
committed
fix(installer): handle headless onboarding tty
1 parent b77f36f commit 504f0df

5 files changed

Lines changed: 32 additions & 9 deletions

File tree

‎.github/workflows/website-installer-sync.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,9 @@ jobs:
7676
- name: install.sh in Docker
7777
run: |
7878
docker run --rm \
79-
-e OPENCLAW_NO_ONBOARD=1 \
80-
-e OPENCLAW_NO_PROMPT=1 \
8179
-v "$PWD/scripts/install.sh:/tmp/install.sh:ro" \
8280
node:24-bookworm-slim \
83-
bash -lc 'bash /tmp/install.sh --no-prompt --no-onboard --version latest && openclaw --version'
81+
bash -lc 'bash /tmp/install.sh --version latest && openclaw --version'
8482
8583
- name: install-cli.sh in Docker
8684
run: |

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Docs: https://docs.openclaw.ai
2626
- Providers/Ollama: treat Docker/OrbStack host aliases as local Ollama endpoints so `ollama-local` marker auth works when OpenClaw runs inside a VM/container and Ollama runs on the host. Fixes #84875.
2727
- QA-Lab: keep explicitly searchable/deferred OpenClaw dynamic tool rows report-only by default so tool-coverage gates do not treat mock discovery gaps as hard product failures. (#80319) Thanks @100yenadmin.
2828
- Agents/config: keep non-Google provider model refs from being rewritten by Google Gemini preview-id normalization. (#84762) Thanks @zhangguiping-xydt.
29+
- Installer: require a real controlling terminal before launching onboarding so headless `curl | bash` installs finish cleanly after installing the CLI.
2930
- Agents: cap heartbeat model bleed context hints by the stored session window when runtime model metadata is unavailable, so overflow recovery advice does not suggest a larger window than the active session actually has.
3031
- Control UI/Web Push: use `https://openclaw.ai` as the generated default VAPID subject instead of the old localhost mailbox so iOS PWA push setup uses an Apple-acceptable subject when `OPENCLAW_VAPID_SUBJECT` is unset. Fixes #83134. (#83317) Thanks @IWhatsskill.
3132
- Agents/Pi: keep embedded session transcript writes from tripping false takeover detection after packaged npm onboarding agent turns.

‎scripts/install.sh‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ is_non_interactive_shell() {
9090
return 1
9191
}
9292

93+
has_controlling_tty() {
94+
if [[ ! -r /dev/tty || ! -w /dev/tty ]]; then
95+
return 1
96+
fi
97+
if ! { : </dev/tty; } 2>/dev/null; then
98+
return 1
99+
fi
100+
return 0
101+
}
102+
93103
gum_is_tty() {
94104
if [[ -n "${NO_COLOR:-}" ]]; then
95105
return 1
@@ -100,7 +110,7 @@ gum_is_tty() {
100110
if [[ -t 2 || -t 1 ]]; then
101111
return 0
102112
fi
103-
if [[ -r /dev/tty && -w /dev/tty ]]; then
113+
if has_controlling_tty; then
104114
return 0
105115
fi
106116
return 1
@@ -1152,7 +1162,7 @@ is_promptable() {
11521162
if [[ "$NO_PROMPT" == "1" ]]; then
11531163
return 1
11541164
fi
1155-
if [[ -r /dev/tty && -w /dev/tty ]]; then
1165+
if has_controlling_tty; then
11561166
return 0
11571167
fi
11581168
return 1
@@ -2577,7 +2587,7 @@ run_bootstrap_onboarding_if_needed() {
25772587
return
25782588
fi
25792589

2580-
if [[ ! -r /dev/tty || ! -w /dev/tty ]]; then
2590+
if ! is_promptable; then
25812591
local user_claw
25822592
user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
25832593
ui_info "BOOTSTRAP.md found but no TTY; run ${user_claw} onboard to finish setup"
@@ -2962,7 +2972,7 @@ main() {
29622972
ui_kv "Switch to npm" "curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method npm"
29632973
elif [[ "$is_upgrade" == "true" ]]; then
29642974
ui_info "Upgrade complete"
2965-
if [[ -r /dev/tty && -w /dev/tty ]]; then
2975+
if has_controlling_tty || [[ "$NO_ONBOARD" == "1" || "$NO_PROMPT" == "1" ]]; then
29662976
local claw="${OPENCLAW_BIN:-}"
29672977
if [[ -z "$claw" ]]; then
29682978
claw="$(resolve_openclaw_bin || true)"
@@ -3010,7 +3020,7 @@ main() {
30103020
fi
30113021
ui_info "Starting setup"
30123022
echo ""
3013-
if [[ -r /dev/tty && -w /dev/tty ]]; then
3023+
if is_promptable; then
30143024
local claw="${OPENCLAW_BIN:-}"
30153025
if [[ -z "$claw" ]]; then
30163026
claw="$(resolve_openclaw_bin || true)"

‎test/scripts/install-sh.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,19 @@ describe("install.sh", () => {
431431
expect(script).toContain('corepack prepare "pnpm@${version}" --activate');
432432
expect(script).toContain('activate_repo_pnpm_version "$repo_dir"');
433433
});
434+
435+
it("does not treat /dev/tty permissions as a controlling terminal", () => {
436+
const result = runInstallShell(`
437+
set -euo pipefail
438+
source "${SCRIPT_PATH}"
439+
if has_controlling_tty; then echo "has_tty=1"; else echo "has_tty=0"; fi
440+
if is_promptable; then echo "promptable=1"; else echo "promptable=0"; fi
441+
`);
442+
443+
expect(result.status).toBe(0);
444+
expect(result.stdout).toContain("has_tty=0");
445+
expect(result.stdout).toContain("promptable=0");
446+
});
434447
});
435448

436449
describe("install.sh macOS Homebrew Node behavior", () => {

‎test/scripts/website-installer-sync-workflow.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ describe("website installer sync workflow", () => {
2323
it("verifies installers on Linux Docker plus native macOS and Windows runners", () => {
2424
expect(workflow).toContain("linux-docker:");
2525
expect(workflow).toContain("docker run --rm");
26-
expect(workflow).toContain("bash /tmp/install.sh --no-prompt --no-onboard");
26+
expect(workflow).toContain("bash /tmp/install.sh --version latest && openclaw --version");
27+
expect(workflow).not.toContain("bash /tmp/install.sh --no-prompt --no-onboard");
2728
expect(workflow).toContain("bash /tmp/install-cli.sh --prefix /tmp/openclaw");
2829
expect(workflow).toContain("macos-installer:");
2930
expect(workflow).toContain("runs-on: macos-latest");

0 commit comments

Comments
 (0)