Skip to content

fix(installer): macOS onboarding cannot install plugins after the shell installer - #200257

Closed
miguelbranco80 wants to merge 1 commit into
openclaw:mainfrom
raw-labs:fix/installer-real-tty-handoff
Closed

miguelbranco80 wants to merge 1 commit into
openclaw:mainfrom
raw-labs:fix/installer-real-tty-handoff

Conversation

@miguelbranco80

Copy link
Copy Markdown
Contributor

Closes #200244
Supersedes #200247

What Problem This Solves

Fixes: first-run macOS onboarding fails with Install failed: Codex (npm view failed … Assertion failed: (err) == (0)) when OpenClaw is installed with curl -fsSL https://openclaw.ai/install.sh | bash.

User Impact

macOS users who install with the shell installer can finish onboarding, including plugin installs, without leaving the wizard. Upgrades that run openclaw doctor --fix and openclaw plugins update --all from the installer get the same fix. Linux and Windows behavior is unchanged. No settings or migration are needed.

Why This Change Was Made

curl | bash gives the installer a pipe for stdin, so before onboarding it reattached stdin with exec </dev/tty. OpenClaw starts npm and other helpers detached, in a new session, so it can clean up their process trees. On macOS, /dev/tty refers to "the calling process's terminal" every time it is used. A detached Node child has no terminal, so its startup terminal check fails and Node aborts. On Linux, opening /dev/tty binds to the real device, so the same path works.

The installer now hands OpenClaw the terminal's own device, such as /dev/ttys003, resolved with ps -o tty=. It falls back to /dev/tty when that is unavailable. This fixes every detached child at the one place the /dev/tty alias was created, so the roughly 80 killProcessTree call sites do not need individual stdin workarounds. That is why this replaces #200247, which patched six npm call sites.

Evidence

  • Real product path on macOS 26.6.2 arm64, Node 24.22.1, installed OpenClaw 2026.11.4. I piped a script into /bin/bash, like curl | bash. It sources this branch's install.sh, runs the handoff, then openclaw plugins install npm:@openclaw/[email protected] with throwaway state:
  • Minimal probe (a detached Node child with inherited stdin): /dev/tty exits with SIGABRT. The real /dev/ttysNNN device, normal terminal stdin, and /dev/tty without detaching all exit 0.
  • Tests: test/scripts/install-sh.test.ts passes 233 of 233. That includes a new test for the device lookup: the reported device when ps gives one, and /dev/tty when ps prints ?? or fails. The handoff and stdin-routing tests are updated. Format and lint are clean, and bash -n passes under macOS /bin/bash 3.2.
  • Review: local autoreview (Codex gpt-6.1-sol, branch mode, P0–P2, with src/process/exec-runner.ts as source context) on head 6161543 against base 2435c1f was scoped-clean, with no findings. The branch was then rebased onto bd25e9e, which does not touch installer files, so the patch is unchanged.
  • Gap: I did not click through the interactive wizard end to end, and shellcheck was not run locally; CI runs it.

The shell installer reattached stdin with `/dev/tty` before running
onboarding, Doctor, and plugin updates. macOS resolves `/dev/tty`
against the caller's session on every use. OpenClaw starts npm and
other helpers detached (in a new session) for process-tree cleanup, so
a Node grandchild that inherited `/dev/tty` aborted at startup with
`Assertion failed: (err) == (0)`, and first-run onboarding could not
install the Codex plugin.

Pass the controlling terminal's own device (for example
`/dev/ttys003`), resolved with `ps`, and fall back to `/dev/tty` when
it cannot be resolved. Linux was unaffected, because opening `/dev/tty`
there binds to the real device.

Fixes openclaw#200244
@clawsweeper

clawsweeper Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Nov 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 16, 2026
@clawsweeper

clawsweeper Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The installer gives OpenClaw the terminal’s concrete device instead of the /dev/tty alias when handing off interactive input.

Example: On macOS 26.6.2 with Node 24.22.1, install @openclaw/[email protected] after a piped shell-installer handoff.

  • Before: The detached npm child inherits /dev/tty, aborts during Node initialization, and plugin installation fails.
  • After: With stdin opened from /dev/ttys007, the contributor records Installed plugin: codex.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and source-consistent, with meaningful real CLI evidence, but upgrade validation and the exact-head CI gate remain incomplete.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A macOS user installing through the shell installer cannot finish the selected Codex setup route because plugin installation aborts.
Reason: The patch restores intended onboarding behavior through the existing installer owner without changing settings, public APIs, or process-cleanup policy.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR addresses a concrete stable-release onboarding failure with a focused fix at the installer boundary; no introduced correctness defect was found.

Priority: P0
Reviewed head: da4fc503a2b5578d0e4cf2a78bac592826257f75

Before merge

  • Add real behavior proof - The contributor records the changed handoff followed by real OpenClaw plugin installation on macOS 26.6.2, Node 24.22.1, and OpenClaw 2026.11.4, with failure before and success afterward; the changed upgrade Doctor and plugin-update handoffs lack an existing-state upgrade run. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted terminal output of a latest-stable macOS installer upgrade completing Doctor and plugin updates with existing settings intact; the supplied helper tests also do not demonstrate a native base-failing/head-passing regression.
Agent review details

How this fits together

The shell installer prepares stdin for onboarding and upgrade commands; plugin installation then reaches npm through the shared process runner, which detaches children for process-tree cleanup.

flowchart TD
  A[Piped shell installer] --> B[Terminal device selection]
  B --> C[Onboarding or upgrade commands]
  C --> D[Plugin installation]
  D --> E[Shared process runner]
  E --> F[Detached npm child]
Loading

Technical review

Best possible solution:

Keep terminal-device selection in the installer so the existing onboarding wizard can install plugins without requiring terminal recovery.

Do we have a high-confidence way to reproduce the issue?

The linked report provides a controlled macOS reproduction and native assertion, and current main retains the matching detached-child and inherited-stdin path; this read-only review executed no product code.

Is this the best way to solve the issue?

Resolving the concrete terminal at the installer fixes the descriptor producer, covers the affected handoffs, and preserves interactive input and process-tree cleanup without adding caller-specific npm workarounds.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bd25e9ef60cc.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Sebastien Tardif: Raw commit 1fa1507 adds scripts/install.sh:147 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1fa1507fc4f9; files: scripts/install.sh)
  • Peter Steinberger: Raw commit 504f0df adds scripts/install.sh:93 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 504f0dfa36be; files: scripts/install.sh)

PR surface

Tests +17, Other +13. Total +30 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 19 2 +17
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 17 4 +13
Total 2 36 6 +30

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #200244
Summary: The canonical issue and both open repair candidates concern detached macOS npm children inheriting the installer’s /dev/tty descriptor.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P0: The first-run UX override applies: the selected provider setup fails inside onboarding and recovery requires leaving the wizard to enter a terminal command.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P0: The first-run UX override applies: the selected provider setup fails inside onboarding and recovery requires leaving the wizard to enter a terminal command.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 16, 2026, 4:15 PM ET / 21:15 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenClaw macOS onboarding crashes when detached npm inherits /dev/tty

1 participant