Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(migrations): migrations_pending default next step; README #218 note within the size cap (#6089)

garrytan6c2e6cfb01f0
diff --git a/README.md b/README.md
index 80e8863e92..c676838fa1 100644
--- a/README.md
+++ b/README.md
@@ -90,25 +90,15 @@ Requires **Bun 1.4.0 or newer**. Existing worker installations should follow the
before restarting services with this version.
> [!WARNING]
-> **GBrain is NOT distributed on npm.** The npm package named `gbrain` is an unrelated
-> package with no connection to this project. Do not run `npm install -g gbrain` or
-> `bun add -g gbrain` — you'll get something else, and it can shadow the real binary on
-> your PATH. Install and upgrade ONLY via the documented paths below
-> (`bun install -g github:garrytan/gbrain`, or `git clone` + `bun install && bun link`).
-> If you already ran the npm install by mistake: `npm uninstall -g gbrain` /
-> `bun remove -g gbrain`, then reinstall from GitHub. `gbrain doctor` detects a
-> shadowing npm install and prints the fix.
-
-<!-- #218 recovery: canonical copy; synced into AGENTS.md and INSTALL_FOR_AGENTS.md. -->
-If `bun install -g` aborts or `gbrain doctor` reports `schema_version: 0` (Bun
-sometimes skips the postinstall hook on global installs, so schema migrations
-don't run), the CLI prints a recovery hint pointing at
-[#218](https://github.com/garrytan/gbrain/issues/218). Run
-`gbrain apply-migrations --yes --no-autopilot-install`. It exits 0 only when the
-schema is at head. Exit 1 with `migrations_pending` means the schema is still
-behind: running `--yes` again repeats the failure, so run `gbrain doctor --json`
-and use the deterministic install:
-`git clone https://github.com/garrytan/gbrain.git ~/gbrain && cd ~/gbrain && bun install && bun link`.
+> **GBrain is NOT distributed on npm.** The npm `gbrain` package is unrelated and
+> can shadow the real binary, so never run `npm install -g gbrain` or
+> `bun add -g gbrain`. Install only via `bun install -g github:garrytan/gbrain`
+> or `git clone` + `bun install && bun link`.
+> Installed it by mistake? `npm uninstall -g gbrain` / `bun remove -g gbrain`, then
+> reinstall; `gbrain doctor` detects it.
+> Schema not migrated ([#218](https://github.com/garrytan/gbrain/issues/218))?
+> Run `gbrain apply-migrations --yes --no-autopilot-install`; exit 1 means it's still
+> behind: run `gbrain doctor --json`, not `--yes` again.
Start with the agent you already use. For Grok Bot and Muse, the dedicated guides above install an isolated launcher, repairable runtime, and memory in a verified persistent directory. For a coding agent, paste:
diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.md
index f67f3f7b57..7f82cc4485 100644
--- a/docs/guides/error-codes.md
+++ b/docs/guides/error-codes.md
@@ -1522,7 +1522,7 @@ Reasons: `orchestrator_failed`, `orchestrator_threw`, `ledger_write_failed`, `pr
| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |
|---|---|---|---|---|---|---|
-| Schema migrations are behind (or could not be confirmed at head), so the command did not report success. | apply-migrations reasons: not_applied: the run had no --yes (or --non-interactive), so it did not apply the schema migrations; the fix reruns with --yes. still_behind: an authorized run tried them and they did not apply; another --yes repeats the failure, so run `gbrain doctor --json` and report. schema_unreadable: the schema version could not be read back after the orchestrators ran, so the run cannot confirm it reached head; report it. Each failure names the schema migrations still pending. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |
+| Schema migrations are behind (or could not be confirmed at head), so the command did not report success. | apply-migrations reasons: not_applied: the run had no --yes (or --non-interactive), so it did not apply the schema migrations; the fix applies them with --yes. still_behind: an authorized run tried them and they did not apply; another --yes repeats the failure, so run `gbrain doctor --json` and report. schema_unreadable: the schema version could not be read back after the orchestrators ran, so the run cannot confirm it reached head; report it. Each failure names the schema migrations still pending. | not_applied: apply them with `gbrain apply-migrations --yes`. still_behind or schema_unreadable: run `gbrain doctor --json` and report it to the user; another --yes repeats the failure. | agent | `repeat the read that failed` | 1 | no |
Reasons: `not_applied`, `still_behind`, `schema_unreadable`.
diff --git a/llms-full.txt b/llms-full.txt
index 987206ba62..cd969e7d8f 100644
--- a/llms-full.txt
+++ b/llms-full.txt
@@ -4657,25 +4657,15 @@ Requires **Bun 1.4.0 or newer**. Existing worker installations should follow the
before restarting services with this version.
> [!WARNING]
-> **GBrain is NOT distributed on npm.** The npm package named `gbrain` is an unrelated
-> package with no connection to this project. Do not run `npm install -g gbrain` or
-> `bun add -g gbrain` — you'll get something else, and it can shadow the real binary on
-> your PATH. Install and upgrade ONLY via the documented paths below
-> (`bun install -g github:garrytan/gbrain`, or `git clone` + `bun install && bun link`).
-> If you already ran the npm install by mistake: `npm uninstall -g gbrain` /
-> `bun remove -g gbrain`, then reinstall from GitHub. `gbrain doctor` detects a
-> shadowing npm install and prints the fix.
-
-<!-- #218 recovery: canonical copy; synced into AGENTS.md and INSTALL_FOR_AGENTS.md. -->
-If `bun install -g` aborts or `gbrain doctor` reports `schema_version: 0` (Bun
-sometimes skips the postinstall hook on global installs, so schema migrations
-don't run), the CLI prints a recovery hint pointing at
-[#218](https://github.com/garrytan/gbrain/issues/218). Run
-`gbrain apply-migrations --yes --no-autopilot-install`. It exits 0 only when the
-schema is at head. Exit 1 with `migrations_pending` means the schema is still
-behind: running `--yes` again repeats the failure, so run `gbrain doctor --json`
-and use the deterministic install:
-`git clone https://github.com/garrytan/gbrain.git ~/gbrain && cd ~/gbrain && bun install && bun link`.
+> **GBrain is NOT distributed on npm.** The npm `gbrain` package is unrelated and
+> can shadow the real binary, so never run `npm install -g gbrain` or
+> `bun add -g gbrain`. Install only via `bun install -g github:garrytan/gbrain`
+> or `git clone` + `bun install && bun link`.
+> Installed it by mistake? `npm uninstall -g gbrain` / `bun remove -g gbrain`, then
+> reinstall; `gbrain doctor` detects it.
+> Schema not migrated ([#218](https://github.com/garrytan/gbrain/issues/218))?
+> Run `gbrain apply-migrations --yes --no-autopilot-install`; exit 1 means it's still
+> behind: run `gbrain doctor --json`, not `--yes` again.
Start with the agent you already use. For Grok Bot and Muse, the dedicated guides above install an isolated launcher, repairable runtime, and memory in a verified persistent directory. For a coding agent, paste:
diff --git a/src/commands/apply-migrations.ts b/src/commands/apply-migrations.ts
index 0899d2d9f5..869f9f53bd 100644
--- a/src/commands/apply-migrations.ts
+++ b/src/commands/apply-migrations.ts
@@ -185,7 +185,7 @@ Exit codes:
0 Success (including "nothing to do").
1 An orchestrator failed, the migration lease stopped matching this run
(migration_lease_lost), or the run left the schema behind
- (migrations_pending: not_applied → rerun with --yes; still_behind or
+ (migrations_pending: not_applied → apply them with --yes; still_behind or
schema_unreadable → run gbrain doctor --json and report, not --yes again).
An unreachable Postgres stays 0 (GBRAIN_DB_ACCESS on stderr) unless --require-db.
2 Invalid arguments.
diff --git a/src/core/error-registry.ts b/src/core/error-registry.ts
index 313fee6414..070667810d 100644
--- a/src/core/error-registry.ts
+++ b/src/core/error-registry.ts
@@ -223,7 +223,8 @@ export const CODES = {
migration_failed: { class: 'server', summary: "A migration orchestrator failed, so the migration chain stopped; finished migrations stay recorded.",
reasons: ['orchestrator_failed', 'orchestrator_threw', 'ledger_write_failed', 'preview_failed', 'schema_failed'] },
migrations_pending: { class: 'caller', summary: "Schema migrations are behind (or could not be confirmed at head), so the command did not report success.",
- why: 'apply-migrations reasons: not_applied: the run had no --yes (or --non-interactive), so it did not apply the schema migrations; the fix reruns with --yes. still_behind: an authorized run tried them and they did not apply; another --yes repeats the failure, so run `gbrain doctor --json` and report. schema_unreadable: the schema version could not be read back after the orchestrators ran, so the run cannot confirm it reached head; report it. Each failure names the schema migrations still pending.',
+ why: 'apply-migrations reasons: not_applied: the run had no --yes (or --non-interactive), so it did not apply the schema migrations; the fix applies them with --yes. still_behind: an authorized run tried them and they did not apply; another --yes repeats the failure, so run `gbrain doctor --json` and report. schema_unreadable: the schema version could not be read back after the orchestrators ran, so the run cannot confirm it reached head; report it. Each failure names the schema migrations still pending.',
+ suggestion: 'not_applied: apply them with `gbrain apply-migrations --yes`. still_behind or schema_unreadable: run `gbrain doctor --json` and report it to the user; another --yes repeats the failure.',
reasons: ['not_applied', 'still_behind', 'schema_unreadable'] },
migrations_running: { class: 'retryable', summary: "Another apply-migrations run holds the migration orchestration lock.", exit: 75 },
missing_source_scope: { class: 'server', summary: "A remote tool call reached dispatch without a resolved source scope; the shared default source is refused." },