Skip to content

fix(bootstraps): keep the user key out of hand-offs, persist BAND_BASE_URL, OpenClaw consent and gateway fixes - #41

Open
nir-singher-band wants to merge 5 commits into
mainfrom
fix/pr347-bootstrap-review
Open

nir-singher-band wants to merge 5 commits into
mainfrom
fix/pr347-bootstrap-review

Conversation

@nir-singher-band

@nir-singher-band nir-singher-band commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Bootstrap fixes found while reviewing the personal-agent docs (thenvoi/fern#347). Each fix was smoke-run in a clean container with stub binaries: the old script reproduced the bug and the new one fixed it. The OpenClaw changes were also run against the real openclaw CLI at 2026.7.35 and 2026.9.8.

  • All bootstraps: the user API key no longer reaches the hand-off process (hermes chat, claude /add-band, openclaw). Before, a full-access BAND_USER_API_KEY exported by the web-app command stayed in the agent session's environment.
  • OpenClaw:
    • plugins install passes --accept-capabilities when the CLI offers it, detected from --help. OpenClaw 2026.8.1 and later otherwise abort with requires capability consent under curl | bash.
    • When no gateway service is installed, gateway restart exits 1 with Gateway service disabled.. The bootstrap now treats that as success, prints the gateway install / gateway run hints and exits 0. Any other restart failure still fails.
    • Default name is OpenClaw Agent (<host> <timestamp>).
    • Removed a stale thenvoi.com schema comment.
    • README and manifest now point to band-sdk-typescript/plugins/openclaw; band-ai/openclaw-channel-band is empty.
  • Hermes and NanoClaw: a non-default BAND_BASE_URL used for registration is now persisted for the runtime. NanoClaw's vault --host-pattern is derived from it.
  • Hermes:
    • BAND_HERMES_REF accepts a branch, a tag, or a full 40-character SHA. A short SHA gets a clear error.
    • Fixed the README's "two things" list, which has three items.
  • NanoClaw:
    • On a fresh host the bootstrap stops before the OneCLI check and the hand-off, and prints cd <home> && bash nanoclaw.sh. Before, it registered and then launched claude /add-band with no image or service to build into.
    • An upstream clone that can't merge band-ai/main is told to run from an empty directory.
  • scripts/register-agent.sh (canonical copy): unique default agent name per run, so a second install no longer gets HTTP 422.

Merge order

Merge this first. band-ai/hermes-band-platform#69 and band-ai/nanoclaw-band#36 copy scripts/register-agent.sh from this branch byte for byte (blob 8214bc97). Open PRs #26 and #19 touch neighbouring lines and will need a rebase.

Verification

  • bash -n passes on all changed scripts.
  • shellcheck: clean except SC1091, which main already has.
  • python3 scripts/check.py: OK.
  • pytest tests/ -q: 20 passed.
  • Not run: live registration on Band (no credentials).

Refs thenvoi/fern#347

Agent names are unique per account, so the fixed "Band agent" default
failed with HTTP 422 on the second registration whenever the prompt was
accepted or no terminal was attached. Default to
"Band Agent (<host> <timestamp>)", matching the Hermes bootstrap, which
stays within Band's name rules.
… BAND_BASE_URL, accept SHA refs

- The web-app-exported BAND_USER_API_KEY stayed in the environment of
  install.sh and of `hermes chat -s band:add-band`. Read the key into an
  unexported variable, unset BAND_USER_API_KEY and BAND_API_KEY at once,
  and pass it only to register-agent.sh for that one command.
- A non-default BAND_BASE_URL was used for registration but never
  persisted, so the plugin connected to app.band.ai. Save it to the
  gateway .env through hermes_cli's save_env_value with the agent creds.
- `git clone --branch` rejects commit SHAs. Fetch BAND_HERMES_REF into an
  empty repo and check out FETCH_HEAD, which accepts a branch, a tag, or
  a full commit SHA.
- README: the bootstrap does three things, not two; document
  BAND_BASE_URL and the BAND_USER_API_KEY precedence.
…cret to BAND_BASE_URL, keep the user key out of the hand-off

- On a fresh host the bootstrap stopped at the OneCLI check with a
  pointer to /init-onecli, although `bash nanoclaw.sh` is what installs
  OneCLI at NanoClaw's pinned version; with OneCLI present it registered
  and then handed off to `claude /add-band` with no image or service for
  the skill to rebuild and restart. Gate on base setup before the OneCLI
  check and stop with the exact `cd <home> && bash nanoclaw.sh` command.
  Setup detection now also covers the root systemd unit and the nohup
  wrapper setup writes without systemd, and ~/.local/bin (where setup
  installs onecli) is on PATH for the check.
- A checkout that can't merge band-ai/main (an upstream clone ahead of
  the fork) is told to run from an empty directory instead of
  `git merge band-ai/main`, which conflicts.
- The OneCLI secret's --host-pattern is derived from BAND_BASE_URL's host
  instead of hard-coded app.band.ai, and a non-default BAND_BASE_URL is
  written to .env, which the host adapter reads.
- The user key is read once (web-app placeholder, then BAND_USER_API_KEY,
  then BAND_API_KEY), removed from the environment, and passed only to
  register-agent.sh. Before, a re-run on a wired host handed
  BAND_USER_API_KEY to the Claude session.
…g gateway service, keep the user key out of openclaw

- OpenClaw >= 2026.8.1 refuses a non-interactive plugin install without
  --accept-capabilities, while older releases in the plugin's peer range
  reject the flag. Pass it only when `openclaw plugins install --help`
  offers it.
- With no installed gateway service, newer CLIs exit non-zero from
  `openclaw gateway restart` ("Gateway service disabled."), which killed
  the run under set -e after registration and config had succeeded. When
  `gateway status --json` reports the service not loaded, finish with the
  success line and how to start the gateway; other restart failures stay
  fatal.
- BAND_USER_API_KEY stayed exported to every openclaw process (npm plugin
  install, gateway). Hold the key in an unexported variable and unset
  both names up front; only curl's stdin config sees it.
- Default the agent name to "OpenClaw Agent (<host> <timestamp>)" so a
  second run doesn't collide.
- Point the source link and manifest repo at band-sdk-typescript
  plugins/openclaw (band-ai/openclaw-channel-band is empty), and drop the
  stale thenvoi.com schema-default comment.
…dapter commit

a7bf188c was dropped when band/adapter was rebased onto the re-rooted
main on Aug 31, so GitHub no longer serves it and the NanoClaw prepare
step fails with 'not our ref'. 06b87dc0 is the same change after the
rebase (identical range-diff).
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