Skip to content

feat: install GBrain without Bun on Apple Silicon Macs and x86-64 Linux - #200987

Merged
obviyus merged 7 commits into
mainfrom
gbrain-binary
Nov 18, 2026
Merged

obviyus merged 7 commits into
mainfrom
gbrain-binary

Conversation

@obviyus

@obviyus obviyus commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The GBrain plugin (#200625) needs Bun to install GBrain. On a clean Mac or Linux machine that meant a terminal step after the one-click install: run Bun's installer, and on Linux install unzip first.

User Impact

User impact: on Apple Silicon macOS and x86-64 Linux without Bun, installing the GBrain plugin is now the only step. The plugin installs GBrain's own release binary and connects; on a clean macOS VM it was connected 14 seconds after the install request. Existing Bun users keep the same Bun install. Intel macOS and ARM Linux, where GBrain publishes no binary, still show the Bun command.

Why This Change Was Made

When gbrain is missing and Bun is not installed, the plugin:

  1. Reads GBrain's stable version from its documented stable/VERSION file.
  2. Downloads that release's asset (gbrain-darwin-arm64 or gbrain-linux-x64) to ~/.gbrain/bin/gbrain.
  3. Accepts it only when GitHub's build-provenance attestation for its SHA-256 names that asset and GBrain's release workflow on master. This is the same check GBrain's own binary self-update uses (src/core/binary-self-update.ts). Nothing is made executable or moved into place before the check passes.

GBrain then owns the binary as it does any install: gbrain mcp expose supervises the service, and gbrain upgrade self-updates the binary in place. When Bun is present the plugin keeps using Bun, so existing installs and the GitHub API limit (see below) cannot block a host that can already install.

The release download uses GitHub's fixed download URL; only the attestation lookup uses GitHub's API (one unauthenticated request per install). The plugin logs where it installed GBrain and that ~/.gbrain/bin must be on PATH to run gbrain in a terminal. It does not edit shell files.

Evidence

Clean hosts, packed candidate, live model:

macOS 15 VM, Apple Silicon (binary path) Ubuntu VM, ARM (Bun fallback)
Bun on host before install none none
User steps install only install + apt install unzip + Bun command
Connected after install 14 s 64 s after Bun
~/.gbrain/bin/gbrain --version 0.60.734.0 (Bun install)
Recall after Gateway restart ✅ ✅
One brain.pglite holder, 2 concurrent sessions ✅ ✅
Stop / kill / key rotation → recall ✅ ✅ ✅ ✅ ✅ ✅
gbrain upgrade (from 0.60.733.0) → recall ✅ ✅
Uninstall keeps service and brain ✅ ✅
  • Earlier runs of the same flow each failed one step: macOS run 2 and ARM Linux run 1. The failing steps were the service-restart recall, where the Gateway's MCP client tried GBrain moments before its restarted service answered, and one of two concurrent recall turns. Both were green on the next run. This is the known MCP retry gap from feat: connect OpenClaw to GBrain with one plugin install #200625.

  • One macOS run hit GitHub's unauthenticated API limit (HTTP 403, 60 requests an hour per network). That led to dropping the releases API call and to a clear "limit used up, resets within an hour" status. The plugin retries within 10 minutes.

  • x86-64 Linux (privileged Ubuntu container under Rosetta): the binary runs, gbrain init and gbrain serve work with health ok, with no Bun, git or unzip on the host.

  • Unit tests cover the binary install, a failed download, Bun-first ordering, and the attestation check rejecting a fork, another workflow, another branch, the wrong asset or the wrong digest.

  • Local ClawSweeper review (local range origin/main...90ad0c3793): complete, "patch is correct", 0 findings. Earlier rounds found that an existing Bun install could be skipped, that a GitHub API limit could block a Bun host, and that the Bun-free e2e assertion could pass with Bun present; all fixed.

Known gaps:

  • No full x86-64 Linux e2e. GBrain installs no service inside containers, and no x86 Linux VM was available.
  • GBrain upstream: after an upgrade, gbrain upgrade checks the new version through PATH, not the binary it replaced. Without ~/.gbrain/bin on PATH it swaps the binary, fails, and skips the service restart.
  • GBrain upstream: gbrain upgrade reads the stable channel with git ls-remote, so a binary install on Linux needs git to upgrade (Bun installs had the same need).
  • GBrain upstream: no binary for Intel macOS or ARM Linux.

…and x86-64 Linux need no Bun

- When `gbrain` is missing, download GBrain's stable release binary (`stable/VERSION` → release asset) to `~/.gbrain/bin/gbrain`; accept it only when GitHub's build-provenance attestation binds its SHA-256 and asset name to GBrain's release workflow on master, as GBrain's own binary self-update does.
- Bun stays the installer on hosts GBrain publishes no binary for (Intel macOS, ARM Linux).
- Host e2e driver expects no user step on binary hosts and downgrades/upgrades the binary in place.
- ARM Linux has no GBrain release binary, so the driver still installs unzip before Bun there.
- The macOS e2e hit GitHub's unauthenticated API limit (60/hour per network). The download URL is fixed by GitHub, so only the attestation lookup uses the API; a 403/429 now says the limit is used up and resets within an hour.
- Every later step needs the connection; a failed connect logged 15 misleading follow-on failures.
- Status table row for an attestation lookup refused by GitHub's unauthenticated limit.
- With Bun present, look up its global bin (`bun pm bin -g`) before downloading, so an existing install outside PATH is used and a GitHub limit cannot block it.
- The host e2e Bun-free step now fails when the host has Bun.
- The release binary is now only for Bun-free hosts, so existing Bun users keep the unchanged install path and a GitHub API limit cannot block a host that can install with Bun.
@clawsweeper

clawsweeper Bot commented Nov 18, 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.

@obviyus

obviyus commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Raw e2e step logs

One JSON line per step (step, exit, seconds, last output line), from scripts/e2e/lib/gbrain/host-e2e.sh on clean VMs with a live model.

macOS 15, Apple Silicon: release binary, no Bun: 36 steps
{"step":"node","exit":0,"seconds":3,"last":""}
{"step":"install-openclaw","exit":0,"seconds":52,"last":"npm warn install-scripts Run `npm install -g --allow-scripts=@google/genai,esbuild,protobufjs,openclaw` to allow these scripts once, or `npm config set allow-scripts=@google/genai,esbuild,protobufjs,openclaw --location=user` to allow them for all global installs."}
{"step":"onboard","exit":0,"seconds":5,"last":"Tip: run `openclaw configure --section web` to store your Brave API key for web_search. Docs: https://docs.openclaw.ai/tools/web"}
{"step":"model-secret","exit":0,"seconds":2,"last":"Updated secrets.providers.oaikey. No gateway restart needed."}
{"step":"model-provider","exit":0,"seconds":2,"last":"Updated models.providers.openai. Change will apply without restarting the gateway."}
{"step":"model-default","exit":0,"seconds":4,"last":"Updated agents.defaults.model. Change will apply without restarting the gateway."}
{"step":"gateway-start","exit":0,"seconds":8,"last":""}
{"step":"plugin-install","exit":0,"seconds":6,"last":"attempt=1"}
{"step":"no-bun","exit":0,"seconds":0,"last":"bun and unzip absent: 1"}
{"step":"connect","exit":0,"seconds":14,"last":""}
{"step":"release-binary","exit":0,"seconds":1,"last":"gbrain 0.60.734.0"}
{"step":"inspect-runtime","exit":0,"seconds":3,"last":"{\"status\":\"loaded\",\"imported\":true,\"activated\":true}"}
{"step":"seed","exit":0,"seconds":1,"last":"}"}
{"step":"gateway-stop","exit":0,"seconds":1,"last":""}
{"step":"mcp-probe","exit":0,"seconds":3,"last":"- gbrain: 8 tools, resources, Codex approval auto"}
{"step":"gateway-restart","exit":0,"seconds":8,"last":""}
{"step":"recall","exit":0,"seconds":19,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"gbrain__recall\"]}"}
{"step":"concurrent-holders","exit":0,"seconds":0,"last":"max_holders=1 parA=0 parB=0"}
{"step":"gbrain-doctor","exit":0,"seconds":1,"last":"Overall health score: 85/100. All checks OK (some warnings)."}
{"step":"fault-stop-service","exit":0,"seconds":0,"last":""}
{"step":"fault-stop-reported","exit":0,"seconds":0,"last":"2026-11-18T04:14:11.365+00:00 [plugins] GBrain's service is not answering on http://127.0.0.1:3131. Check it with: gbrain mcp expose --status"}
{"step":"fault-start-service","exit":0,"seconds":0,"last":""}
{"step":"fault-stop-recovered","exit":0,"seconds":18,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"fault-kill-serve","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-supervisor-restart","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-recovered","exit":0,"seconds":15,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"fault-rotate-token","exit":0,"seconds":0,"last":"{\"id\":\"2a26a04c-c907-4113-a2c9-895c1e6d8d26\",\"revoked\":true}"}
{"step":"fault-rotate-reminted","exit":0,"seconds":0,"last":""}
{"step":"fault-rotate-recovered","exit":0,"seconds":23,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"upgrade-downgrade","exit":0,"seconds":83,"last":"gbrain 0.60.733.0"}
{"step":"upgrade-run","exit":0,"seconds":18,"last":"gbrain 0.60.734.0"}
{"step":"upgrade-recall","exit":0,"seconds":28,"last":"{\"codeword\":true,\"tools\":[\"read\",\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"uninstall","exit":0,"seconds":4,"last":"Uninstalled plugin \"gbrain\". Removed: plugin settings, install record, directory."}
{"step":"uninstall-no-record","exit":0,"seconds":0,"last":"{\"present\":false}"}
{"step":"uninstall-service-kept","exit":0,"seconds":0,"last":""}
{"step":"uninstall-brain-kept","exit":0,"seconds":0,"last":""}
Ubuntu, ARM: Bun fallback: 37 steps
{"step":"node","exit":0,"seconds":2,"last":""}
{"step":"install-openclaw","exit":0,"seconds":47,"last":"npm warn install-scripts Run `npm install -g --allow-scripts=@google/genai,esbuild,protobufjs,openclaw` to allow these scripts once, or `npm config set allow-scripts=@google/genai,esbuild,protobufjs,openclaw --location=user` to allow them for all global installs."}
{"step":"onboard","exit":0,"seconds":3,"last":"Tip: run `openclaw configure --section web` to store your Brave API key for web_search. Docs: https://docs.openclaw.ai/tools/web"}
{"step":"model-secret","exit":0,"seconds":2,"last":"Updated secrets.providers.oaikey. No gateway restart needed."}
{"step":"model-provider","exit":0,"seconds":2,"last":"Updated models.providers.openai. Change will apply without restarting the gateway."}
{"step":"model-default","exit":0,"seconds":3,"last":"Updated agents.defaults.model. Change will apply without restarting the gateway."}
{"step":"gateway-start","exit":0,"seconds":6,"last":""}
{"step":"plugin-install","exit":0,"seconds":5,"last":"attempt=1"}
{"step":"bun-missing-message","exit":0,"seconds":0,"last":"2026-11-18T03:36:34.727+00:00 [plugins] GBrain publishes release binaries only for Apple Silicon macOS and x86-64 Linux; on this computer it needs Bun 1.4.4 or newer. Install it with: curl -fsSL https://bun.sh/install | bash (on Linux, Bun's installer also needs unzip). OpenClaw finishes the GBrain setup within a minute."}
{"step":"unzip-install","exit":0,"seconds":5,"last":"No VM guests are running outdated hypervisor (qemu) binaries on this host."}
{"step":"bun-install","exit":0,"seconds":3,"last":"Run 'bun --help' to get started"}
{"step":"connect","exit":0,"seconds":64,"last":""}
{"step":"inspect-runtime","exit":0,"seconds":3,"last":"{\"status\":\"loaded\",\"imported\":true,\"activated\":true}"}
{"step":"seed","exit":0,"seconds":1,"last":"}"}
{"step":"gateway-stop","exit":0,"seconds":1,"last":""}
{"step":"mcp-probe","exit":0,"seconds":2,"last":"- gbrain: 8 tools, resources, Codex approval auto"}
{"step":"gateway-restart","exit":0,"seconds":6,"last":""}
{"step":"recall","exit":0,"seconds":19,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"concurrent-holders","exit":0,"seconds":0,"last":"max_holders=1 parA=0 parB=0"}
{"step":"gbrain-doctor","exit":0,"seconds":1,"last":"Overall health score: 90/100. All checks OK (some warnings)."}
{"step":"fault-stop-service","exit":0,"seconds":0,"last":""}
{"step":"fault-stop-reported","exit":0,"seconds":0,"last":"2026-11-18T03:39:09.728+00:00 [plugins] GBrain's service is not answering on http://127.0.0.1:3131. Check it with: gbrain mcp expose --status"}
{"step":"fault-start-service","exit":0,"seconds":0,"last":""}
{"step":"fault-stop-recovered","exit":0,"seconds":14,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"fault-kill-serve","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-supervisor-restart","exit":0,"seconds":0,"last":""}
{"step":"fault-kill-recovered","exit":0,"seconds":28,"last":"{\"codeword\":true,\"tools\":[\"read\",\"exec\",\"memory_search\",\"gbrain__recall\"]}"}
{"step":"fault-rotate-token","exit":0,"seconds":0,"last":"{\"id\":\"1d93a571-4fff-4a9c-b516-82354c7a2724\",\"revoked\":true}"}
{"step":"fault-rotate-reminted","exit":0,"seconds":0,"last":""}
{"step":"fault-rotate-recovered","exit":0,"seconds":24,"last":"{\"codeword\":true,\"tools\":[\"memory_search\",\"exec\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"upgrade-downgrade","exit":0,"seconds":8,"last":"gbrain 0.60.732.0"}
{"step":"upgrade-run","exit":0,"seconds":11,"last":"gbrain 0.60.734.0"}
{"step":"upgrade-recall","exit":0,"seconds":29,"last":"{\"codeword\":true,\"tools\":[\"exec\",\"memory_search\",\"sessions_search\",\"gbrain__recall\"]}"}
{"step":"uninstall","exit":0,"seconds":4,"last":"Uninstalled plugin \"gbrain\". Removed: plugin settings, install record, directory."}
{"step":"uninstall-no-record","exit":0,"seconds":0,"last":"{\"present\":false}"}
{"step":"uninstall-service-kept","exit":0,"seconds":0,"last":""}
{"step":"uninstall-brain-kept","exit":0,"seconds":0,"last":""}

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts plugin: gbrain size: M labels Nov 18, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 18, 2026
@obviyus
obviyus merged commit 0ff7e27 into main Nov 18, 2026
131 of 132 checks passed
@obviyus
obviyus deleted the gbrain-binary branch November 18, 2026 04:35
@obviyus

obviyus commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 0ff7e27.

  • Problem: on a clean Mac or Linux machine, the GBrain plugin needed a terminal step after the one-click install: Bun's installer, and unzip on Linux.
  • Fix: on Apple Silicon macOS and x86-64 Linux without Bun, the plugin installs GBrain's own stable release binary to ~/.gbrain/bin/gbrain, accepted only when GitHub's build-provenance attestation binds its digest to GBrain's release workflow. Hosts with Bun keep the Bun install; Intel macOS and ARM Linux still show the Bun command.
  • Proof: clean macOS VM with no Bun connected 14 s after the install request and passed recall, concurrency, faults, gbrain upgrade and uninstall; the ARM Linux Bun fallback passed the same run. Green CI and a clean local ClawSweeper review of the merged head; no override needed.
  • Open upstream (GBrain): gbrain upgrade checks the new version through PATH (add ~/.gbrain/bin to PATH), needs git on Linux to read the stable channel, and GBrain ships no Intel macOS or ARM Linux binary.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…ux (openclaw#200987)

## What Problem This Solves

The GBrain plugin (openclaw#200625) needs Bun to install GBrain. On a clean Mac or Linux machine that meant a terminal step after the one-click install: run Bun's installer, and on Linux install `unzip` first.

## User Impact

User impact: on Apple Silicon macOS and x86-64 Linux without Bun, installing the GBrain plugin is now the only step. The plugin installs GBrain's own release binary and connects; on a clean macOS VM it was connected 14 seconds after the install request. Existing Bun users keep the same Bun install. Intel macOS and ARM Linux, where GBrain publishes no binary, still show the Bun command.

## Why This Change Was Made

When `gbrain` is missing and Bun is not installed, the plugin:

1. Reads GBrain's stable version from its documented `stable/VERSION` file.
2. Downloads that release's asset (`gbrain-darwin-arm64` or `gbrain-linux-x64`) to `~/.gbrain/bin/gbrain`.
3. Accepts it only when GitHub's build-provenance attestation for its SHA-256 names that asset and GBrain's release workflow on `master`. This is the same check GBrain's own binary self-update uses (`src/core/binary-self-update.ts`). Nothing is made executable or moved into place before the check passes.

GBrain then owns the binary as it does any install: `gbrain mcp expose` supervises the service, and `gbrain upgrade` self-updates the binary in place. When Bun is present the plugin keeps using Bun, so existing installs and the GitHub API limit (see below) cannot block a host that can already install.

The release download uses GitHub's fixed download URL; only the attestation lookup uses GitHub's API (one unauthenticated request per install). The plugin logs where it installed GBrain and that `~/.gbrain/bin` must be on `PATH` to run `gbrain` in a terminal. It does not edit shell files.

## Evidence

**Clean hosts, packed candidate, live model:**

| | macOS 15 VM, Apple Silicon (binary path) | Ubuntu VM, ARM (Bun fallback) |
|---|---|---|
| Bun on host before install | none | none |
| User steps | install only | install + `apt install unzip` + Bun command |
| Connected after install | 14 s | 64 s after Bun |
| `~/.gbrain/bin/gbrain --version` | 0.60.734.0 | (Bun install) |
| Recall after Gateway restart | ✅ | ✅ |
| One `brain.pglite` holder, 2 concurrent sessions | ✅ | ✅ |
| Stop / kill / key rotation → recall | ✅ ✅ ✅ | ✅ ✅ ✅ |
| `gbrain upgrade` (from 0.60.733.0) → recall | ✅ | ✅ |
| Uninstall keeps service and brain | ✅ | ✅ |

- Earlier runs of the same flow each failed one step: macOS run 2 and ARM Linux run 1. The failing steps were the service-restart recall, where the Gateway's MCP client tried GBrain moments before its restarted service answered, and one of two concurrent recall turns. Both were green on the next run. This is the known MCP retry gap from openclaw#200625.
- One macOS run hit GitHub's unauthenticated API limit (HTTP 403, 60 requests an hour per network). That led to dropping the releases API call and to a clear "limit used up, resets within an hour" status. The plugin retries within 10 minutes.
- x86-64 Linux (privileged Ubuntu container under Rosetta): the binary runs, `gbrain init` and `gbrain serve` work with health `ok`, with no Bun, git or unzip on the host.
- Unit tests cover the binary install, a failed download, Bun-first ordering, and the attestation check rejecting a fork, another workflow, another branch, the wrong asset or the wrong digest.

- Local ClawSweeper review (local range `origin/main...90ad0c3`): complete, "patch is correct", 0 findings. Earlier rounds found that an existing Bun install could be skipped, that a GitHub API limit could block a Bun host, and that the Bun-free e2e assertion could pass with Bun present; all fixed.

**Known gaps:**
- No full x86-64 Linux e2e. GBrain installs no service inside containers, and no x86 Linux VM was available.
- GBrain upstream: after an upgrade, `gbrain upgrade` checks the new version through `PATH`, not the binary it replaced. Without `~/.gbrain/bin` on `PATH` it swaps the binary, fails, and skips the service restart.
- GBrain upstream: `gbrain upgrade` reads the stable channel with `git ls-remote`, so a binary install on Linux needs `git` to upgrade (Bun installs had the same need).
- GBrain upstream: no binary for Intel macOS or ARM Linux.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:feature Preliminary submission classification; full source review pending. docs Improvements or additions to documentation plugin: gbrain scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant