Skip to content

fix(install): drop remote/local detection, always try browser#52

Merged
lxcong merged 1 commit into
mainfrom
refactor/install-drop-detection
May 15, 2026
Merged

fix(install): drop remote/local detection, always try browser#52
lxcong merged 1 commit into
mainfrom
refactor/install-drop-detection

Conversation

@lxcong
Copy link
Copy Markdown
Contributor

@lxcong lxcong commented May 15, 2026

Summary

Installer was sniffing SSH env vars, ~/.openclaw, and \$DISPLAY to decide whether to pass --no-browser to @agentkey/cli --auth-login. Inspecting the v1.0 CLI source confirms this was unnecessary:

const { device_code, user_code, verification_uri, expires_in } = await res.json();
const authUrl = \`\${verification_uri}?code=\${user_code}\`;
console.log(\`  Open this URL to authorize:\`);   // ← always prints
console.log(\`  \${authUrl}\`);
// ...
if (!noBrowser) { /* best-effort open() */ }       // ← only this is gated

The CLI always prints the auth URL on stdout. --no-browser only adds a terminal QR and skips the open()/xdg-open()/start() attempt. The CLI's open-browser call is already best-effort — on a headless host it silently no-ops.

So the installer-side heuristic was:

  • redundant for the URL (CLI prints it either way)
  • harmful when it mis-detected (local users on a headless tmux pane or behind a mis-detected SSH session got the QR flow with no browser attempt at all, even though their machine could have opened one)

This was the root cause of the reported "no browser pops up on `curl … | bash`" symptom.

Fix

Drop the heuristic. Always call `npx -y @agentkey/cli --auth-login` (no `--no-browser`). The CLI tries `open` / `xdg-open` / `start`; if that fails the user has the URL right there in the terminal.

Removed

  • `detect_remote()` in `scripts/install.sh` / `Test-RemoteInstall` in `scripts/install.ps1`
  • `--remote` / `--local` / `-Remote` / `-Local` flags + their mutually-exclusive guard + `FORCE_REMOTE` / `FORCE_LOCAL` state
  • `--no-browser` passthrough to the CLI
  • "Installing over SSH, inside Docker, …" details section in README.md / docs/README_zh.md — replaced with a one-line callout under the advanced install options
  • Synopsis / help / behavior copy mentioning the old detection logic

Net: +24 / -174 lines.

Test plan

  • On macOS / Linux desktop: `curl -fsSL https://agentkey.app/install.sh | bash` — browser pops up; URL also visible in terminal as a fallback
  • In an SSH session: same one-liner — `xdg-open` no-ops on the remote host (no harm), URL is right there in terminal; copy it to a local browser to finish
  • Windows PowerShell: `irm https://agentkey.app/install.ps1 | iex` — `start` opens the default browser; URL also visible
  • `--skip-mcp` still skips the auth step
  • `bash -n scripts/install.sh` passes (verified)

🤖 Generated with Claude Code

The installer was sniffing SSH env vars, ~/.openclaw, and $DISPLAY to
decide whether to pass --no-browser to the CLI. But @agentkey/cli v1.0
already prints the auth URL on stdout in every mode — --no-browser only
adds a terminal QR and skips the open()/xdg-open()/start() attempt.

So the heuristic was both unnecessary (URL is always printed) and
harmful when it misfired (local users on a headless tmux pane or a
mis-detected SSH session got no browser open at all). Drop it.

The CLI's auto-open is best-effort; if it can't reach a display the
call no-ops and the user copies the URL from terminal output. That
covers SSH, Docker, OpenClaw, and any future headless environment
without any installer-side detection.

Removes:
  - detect_remote() in install.sh, Test-RemoteInstall in install.ps1
  - --remote / --local / -Remote / -Local flags + mutually-exclusive
    guard + FORCE_REMOTE / FORCE_LOCAL state
  - --no-browser passthrough to the CLI
  - "Installing over SSH..." details section in README.md +
    docs/README_zh.md (replaced with a one-line callout under
    advanced install options)
  - Synopsis / help / behavior copy mentioning the old detection

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lxcong
Copy link
Copy Markdown
Contributor Author

lxcong commented May 15, 2026

@claude review

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Claude security review requested by @lxcong. Running against HEAD 4bd780b28942675b91ba014e42696f0f77391082...

@claude
Copy link
Copy Markdown

claude Bot commented May 15, 2026

🤖 Claude security review — HEAD: 4bd780b

Scope: Documentation + installer scripts (4 files) — removes --remote/--local flag pair and detect_remote()/Test-RemoteInstall helpers; always calls --auth-login without --no-browser.

✅ No security or convention issues found.

Checklist summary:

  • Secrets/credentials: none detected in added lines.
  • Shell attack surface (install.sh): no eval/unquoted vars; the AUTH_ARGS array with variable expansion is replaced by a literal --auth-login string — strictly safer. SKILL_REPO="chainbase-labs/agentkey" invariant intact.
  • PowerShell attack surface (install.ps1): no Invoke-Expression on user input; $CliPackage is hardcoded; $SkillRepo = 'chainbase-labs/agentkey' invariant intact. Removing -Remote/-Local parameters and the mutual-exclusion guard is consistent with the new simplified model.
  • CI/workflow: no workflow files touched.
  • PR title: refactor(install): drop remote/local detection, always try browser — valid conventional-commit format.
  • Protected files: none of the managed files (version.txt, CHANGELOG.md, plugin.json version, .release-please-manifest.json) were touched.
  • Docs sync: README.md and docs/README_zh.md updated in tandem as required.

Review triggered by @lxcong
via @claude review.

@lxcong lxcong changed the title refactor(install): drop remote/local detection, always try browser fix(install): drop remote/local detection, always try browser May 15, 2026
@lxcong lxcong merged commit 26d220c into main May 15, 2026
2 checks passed
@lxcong lxcong deleted the refactor/install-drop-detection branch May 15, 2026 10:04
@lxcong lxcong mentioned this pull request May 15, 2026
lxcong added a commit that referenced this pull request May 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.7.2](v1.7.1...v1.7.2)
(2026-05-15)


### Bug Fixes

* **install:** drop remote/local detection, always try browser
([#52](#52))
([26d220c](26d220c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant