Skip to content

fix: make AEC step in setup.sh gracefully degrade when Chrome is missing - #27

Merged
ZouR-Ma merged 7 commits into
stepfun-ai:mainfrom
knqiufan:fix/setup-aec-optional
Jul 15, 2026
Merged

ZouR-Ma merged 7 commits into
stepfun-ai:mainfrom
knqiufan:fix/setup-aec-optional

Conversation

@knqiufan

@knqiufan knqiufan commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #26

setup.sh previously treated missing Chrome/Chromium as a fatal error at step [4/7] AEC, calling exit 1 and aborting the entire installation. This blocked steps 5-7 (build, launcher, install) from running, making it impossible to install step on:

  • Headless Linux servers without Chrome
  • CI/Docker environments
  • Any system where Chrome is not installed, even if the user only needs text mode (step exec)

Additionally, the --skip-chrome-install flag was only checked on macOS and completely ignored on Linux.

Changes

  • Graceful degradation: When Chrome is not found, the AEC step now warns the user and runs step aec off instead of aborting. The setup continues normally through build, launcher, and install.
  • macOS auto-install preserved: On macOS without --skip-chrome-install, the script still attempts brew install --cask google-chrome, but no longer aborts if Homebrew is missing or the install fails.
  • Platform-specific guidance: Shows install instructions for the detected OS so users can enable AEC later with step aec on.
  • Updated header comment: The step 4 description now reflects the new behavior ("gracefully skip otherwise").

Before / After

Scenario Before After
Linux, no Chrome exit 1 at step 4 — setup aborted Warns, runs step aec off, continues
Linux, no Chrome, --skip-chrome-install exit 1 at step 4 (flag ignored) Same as above (flag is macOS-only)
macOS, no Chrome, --skip-chrome-install exit 1 at step 4 Warns, runs step aec off, continues
macOS, no Chrome, no Homebrew exit 1 at step 4 Warns, runs step aec off, continues
Chrome present (any OS) step aec on ✓ step aec on ✓ (unchanged)

Test plan

  • Run bash scripts/setup.sh on Linux without Chrome — verify setup completes and step --version works
  • Run bash scripts/setup.sh on Linux with Chrome — verify AEC is enabled
  • Run bash scripts/setup.sh --skip-chrome-install on macOS without Chrome — verify setup completes with AEC disabled
  • Run bash scripts/setup.sh on macOS without Chrome (with Homebrew) — verify Chrome auto-install is attempted, AEC enabled on success

@ZouR-Ma

ZouR-Ma commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the contribution!

To get this ready to merge:

  • Reference an issue in the description with Closes #<number> (our link-check CI requires it; open one first if needed).
  • Make sure pnpm check passes locally (lint, type-check, dependency/dead-code guards, formatting, and tests — also enforced in CI).

Full conventions:
https://github.com/stepfun-ai/Step-Realtime-CLI/blob/main/CONTRIBUTING.md

Previously, setup.sh would exit 1 at step [4/7] AEC if Chrome/Chromium
was not found, blocking the entire installation (build, launcher, install
steps 5-7 never run). The --skip-chrome-install flag was also only
checked on macOS and ignored on Linux.

Now the AEC step:
- Warns the user that AEC will be disabled when Chrome is not found
- Runs step aec off instead of aborting
- Continues with the rest of the setup (build, launcher, install)
- On macOS, still attempts auto-install via Homebrew unless
  --skip-chrome-install is passed (but no longer aborts on failure)
- Shows platform-specific install instructions so users can enable
  AEC later with step aec on

Fixes stepfun-ai/Step-Code#26
@knqiufan
knqiufan force-pushed the fix/setup-aec-optional branch from 7856edb to 3f19811 Compare June 21, 2026 06:41
@github-actions github-actions Bot added the area/build scripts, .github, package.json, tsconfig, lockfile label Jun 21, 2026
@knqiufan

knqiufan commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @ZouR-Ma for the review guidance!

Ready for review when you have a moment.

@ZouR-Ma

ZouR-Ma commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this PR — the problem is well-identified: headless servers and CI environments used to die at step [4/7] with exit 1, blocking installation even for text-mode-only users, and the fix also covers --skip-chrome-install being ignored on Linux. We agree with the approach: the README already documents that voice falls back to system audio drivers when AEC is off and that AEC isn't needed with headphones, so "warn + step aec off + continue" brings the installer in line with the product's existing degradation design — and it degrades loudly (platform-specific install guidance plus a pointer to step aec on), not silently. One thing must be fixed before this lands:

  1. (Must) The script still aborts when the brew install fails. scripts/setup.sh runs under set -euo pipefail, so the bare brew install --cask google-chrome call in the macOS branch kills the whole script on any failure (network hiccup, cask error, cancelled authorization) — which contradicts the "no longer aborts if … the install fails" promise in the PR description. A one-line fix does it: brew install --cask google-chrome || warn "Chrome install failed — continuing without AEC"; on failure AEC_AVAILABLE stays 0 and the flow lands on the aec-off branch as intended. Acceptance criterion: simulate a brew failure on macOS and confirm the script completes all 7 steps ending with AEC off.

Also, all four checkboxes in the test plan are still unchecked — setup.sh isn't covered by CI, so this change rides entirely on manual verification. Please run at least the headline "Lin

Keep the installer usable when Homebrew cannot install Chrome by disabling AEC and completing setup.
@knqiufan

Copy link
Copy Markdown
Contributor Author

Fixed in 1aacd4a.

  • brew install --cask google-chrome now handles a non-zero exit with a warning, so under set -euo pipefail the installer continues with AEC_AVAILABLE=0 and executes step aec off.
  • Added scripts/setup.test.ts. On Bash-capable platforms it simulates Darwin with a failing brew, then asserts the flow reaches step [7/7] with AEC skipped and records step aec off.

Validation:

  • pnpm test -- scripts/setup.test.ts passes on Windows (the Bash simulation is skipped because this machine has neither Bash nor WSL).
  • lint, dependency guard, dead-code, TypeScript, and formatting checks pass.
  • Full pnpm check remains blocked locally by 10 existing Windows symlink tests that fail with EPERM; the updated installer test passes within that run.

knqiufan added 3 commits July 11, 2026 21:05
Ensure the failing-Homebrew scenario cannot use Chrome preinstalled on macOS runners.
Keep the Homebrew failure regression independent of CI runner browsers and test process environment.
Make the Homebrew failure regression deterministic across macOS runner browser installations.
@ZouR-Ma

ZouR-Ma commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Re-review passed — this is ready to land. The brew guard is exactly right: on failure AEC_AVAILABLE stays 0 and the flow lands on the aec-off branch, no longer fighting set -euo pipefail. What stands out is scripts/setup.test.ts: this repo previously had zero automated coverage for setup.sh, and now there's an end-to-end regression test (a shimmed brew that force-fails, asserting the script completes all 7 steps and runs aec off) that permanently locks down the exact scenario from the last round. The file lands inside vitest's existing include pattern and the bash-dependent case is correctly skipped on Windows — well thought through.

One small wording issue we'll take care of directly on this branch (maintainer edit) so it doesn't cost you another round: after a failed brew install the script still re-runs Chrome detection, and that branch prints "Chrome install succeeded but binary not detected" — misleading right after brew reported a failure. We'll move the re-detection inside the success branch and adjust the test assertion accordingly.

Thanks for the fast turnaround across both rounds — merging once CI reruns on that touch-up.

ZouR-Ma added 2 commits July 15, 2026 10:49
After a failed brew install the script re-ran detect_chrome and printed
"Chrome install succeeded but binary not detected", which is misleading
right after the failure warning. Move the re-detection into the success
branch and update the tripwire assertion in setup.test.ts.

@ZouR-Ma ZouR-Ma left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review passed: the brew guard fix is verified, the new setup.test.ts end-to-end regression locks down the failure scenario, and the wording touch-up landed on this branch. All required checks are green on the merged state. Approving.

@ZouR-Ma
ZouR-Ma merged commit f2316f4 into stepfun-ai:main Jul 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build scripts, .github, package.json, tsconfig, lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setup.sh fails on Linux without Chrome even with --skip-chrome-install; AEC should be optional

2 participants