Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

v0.60.80.0 fix(ubicloud): an interrupted up/run exits 130 even when bash 5.2 loses the signal trap

garrytan2d246031ebe6
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 6d109540ff..6edd1bf1b8 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.78.0",
+ "version": "0.60.80.0",
"description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.",
"author": {
"name": "Garry Tan",
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 52d927e49e..d00ad275e5 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.78.0",
+ "version": "0.60.80.0",
"description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.",
"author": {
"name": "Garry Tan",
diff --git a/BOOTSTRAP_FOR_AGENTS.md b/BOOTSTRAP_FOR_AGENTS.md
index d9209b3e14..df4d5cb609 100644
--- a/BOOTSTRAP_FOR_AGENTS.md
+++ b/BOOTSTRAP_FOR_AGENTS.md
@@ -1,4 +1,4 @@
-<!-- gbrain-runbook-stamp: 0.60.78.0 -->
+<!-- gbrain-runbook-stamp: 0.60.80.0 -->
<!-- This stamp must equal the VERSION file at every release; CI enforces it
(scripts/check-bootstrap-tag.sh). `gbrain bootstrap status` compares it to
the installed binary and warns on skew. -->
diff --git a/CHANGELOG.md b/CHANGELOG.md
index adf2e52ef8..a7cec056b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,24 @@ credits are retained; no result has been reassigned to another provider. Origina
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [0.60.80.0] - 2026-10-06
+
+**An interrupted `ubi-runner.sh up` or `run` now always exits 130, including when bash 5.2 loses the signal's trap.**
+
+Bash 5.2, the bash on Ubuntu 24.04, can drop a signal trap. When SIGTERM, SIGINT, SIGHUP or SIGQUIT lands just before the shell parses a `$(...)`, the trap never runs and the shell exits 2. The runner's exit handler still destroyed the VM, so nothing leaked, but the interrupted `up` or `run` reported 2 instead of 130, and the provisioning-signal test failed intermittently in CI. The runner now recognizes that exit and reports 130. A command that really fails with status 2 still exits 2.
+
+| After upgrading | Before | After |
+| --- | --- | --- |
+| A signal reaches `up` or `run` while bash 5.2 is parsing a `$(...)` | VM destroyed, exit 2 | VM destroyed, exit 130 |
+
+## To take advantage of v0.60.80.0
+
+There is nothing to do. `ubi-runner.sh` is a contributor tool: `gbrain upgrade` installs the binary, and there are no schema migrations.
+
+### For contributors
+
+- `test/scripts/ubi-runner.test.ts` forces the lost trap for `up` and `run` on every run: `BASH_ENV` turns on xtrace with a `PS4` that sends the runner SIGTERM, then makes bash parse a `$(...)` with that trap pending.
+
## [0.60.78.0] - 2026-10-06
**Green master wave: a brain with embedding turned off no longer sends your text to an embedding provider, lint survives a file vanishing mid-scan, embed and reindex-code stop failing when a background rebuild wins a race, and a release only publishes after its tests pass.**
diff --git a/VERSION b/VERSION
index 12adcd74b6..af8767a0a7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.60.78.0
+0.60.80.0
diff --git a/openclaw.plugin.json b/openclaw.plugin.json
index d9d84ca5cb..ccf9fc29f3 100644
--- a/openclaw.plugin.json
+++ b/openclaw.plugin.json
@@ -1,7 +1,7 @@
{
"id": "gbrain-context-engine",
"name": "gbrain",
- "version": "0.60.78.0",
+ "version": "0.60.80.0",
"description": "Personal knowledge brain with Postgres + pgvector hybrid search",
"family": "bundle-plugin",
"kind": "context-engine",
diff --git a/package.json b/package.json
index eb3ba59518..00dc7b6329 100644
--- a/package.json
+++ b/package.json
@@ -224,7 +224,7 @@
"bun": ">=1.4.0"
},
"license": "MIT",
- "version": "0.60.78.0",
+ "version": "0.60.80.0",
"overrides": {
"@ai-sdk/provider-utils": "4.0.56",
"@hono/node-server": "^2.0.5",
diff --git a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
index 3bc6cfa0a9..4dbbedb715 100644
--- a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
+++ b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-coding",
- "version": "0.60.78.0",
+ "version": "0.60.80.0",
"description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
index 6f5e84ae29..2cf8c50efd 100644
--- a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
+++ b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-coding",
- "version": "0.60.78.0",
+ "version": "0.60.80.0",
"description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-coding/README.md b/plugin-variants/gbrain-coding/README.md
index c5a934ac6f..d01d5a088d 100644
--- a/plugin-variants/gbrain-coding/README.md
+++ b/plugin-variants/gbrain-coding/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.78.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.80.0 -->
# gbrain-coding (generated persona variant — do not hand-edit)
Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant.
diff --git a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
index d35d24c74f..7da739100e 100644
--- a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
+++ b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-daily",
- "version": "0.60.78.0",
+ "version": "0.60.80.0",
"description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
index 87508d43db..02d38f7826 100644
--- a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
+++ b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-daily",
- "version": "0.60.78.0",
+ "version": "0.60.80.0",
"description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-daily/README.md b/plugin-variants/gbrain-daily/README.md
index 96607512c1..8e395b6a7a 100644
--- a/plugin-variants/gbrain-daily/README.md
+++ b/plugin-variants/gbrain-daily/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.78.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.80.0 -->
# gbrain-daily (generated persona variant — do not hand-edit)
Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant.
diff --git a/plugin/README.md b/plugin/README.md
index 15c2299bb8..c82a25b104 100644
--- a/plugin/README.md
+++ b/plugin/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.78.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.80.0 -->
# gbrain plugin skill tree (generated — do not hand-edit)
This tree is the curated skill set for the gbrain Codex and Claude Code
diff --git a/scripts/ubicloud/ubi-runner.sh b/scripts/ubicloud/ubi-runner.sh
index 93e15afe83..ea4447fd95 100755
--- a/scripts/ubicloud/ubi-runner.sh
+++ b/scripts/ubicloud/ubi-runner.sh
@@ -30,7 +30,7 @@
# Stale-VM sweeps are off by default. With UBI_GC_HOURS set to a positive
# number, every `up` first destroys this owner's VMs older than that; `gc HOURS`
# runs the same sweep on demand. Neither ever touches another owner's VMs.
-set -euo pipefail
+set -Eeuo pipefail
# Keep heredoc bodies on temp files, not the pipe window (test/heredoc-pipe-deadlock.test.ts).
BASH_COMPAT=50
@@ -48,6 +48,24 @@ PREFIX="ubirun"
die() { echo "ubi-runner: $*" >&2; exit 1; }
log() { echo "ubi-runner: $*" >&2; }
+# Bash 5.2 can lose a signal trap: when the signal lands just before the shell
+# parses a $(...), the trap runs inside that parse, fails to parse itself
+# ("trap: line 2: unexpected EOF while looking for matching `)'") and the shell
+# exits 2 without running it (fixed in bash 5.3). The EXIT trap still runs.
+# The only other exit 2 here is a failed command, which sets FAILED through
+# the ERR trap, so finish reports an exit 2 without FAILED as the signal's 130.
+FAILED=""
+trap 'FAILED=1' ERR
+
+# finish STATUS NAME: EXIT handler of `up` and `run`. Destroys NAME unless it
+# is empty, then exits with STATUS.
+finish() {
+ local rc=$1
+ [ "$rc" != 2 ] || [ -n "$FAILED" ] || rc=130
+ [ -z "$2" ] || cmd_down "$2" || log "WARNING: failed to destroy $2; run: $0 down $2"
+ exit "$rc"
+}
+
for bin in curl python3 ssh ssh-keygen tar; do
command -v "$bin" >/dev/null || die "$bin is required"
done
@@ -408,11 +426,11 @@ cmd_run() {
RUN_VM=$name
# Armed before the create request: an interrupted `up` still destroys its VM.
# A second signal must not cut teardown short, so the EXIT handler ignores them.
- trap 'trap "" INT TERM HUP QUIT; cmd_down "$RUN_VM" || log "WARNING: failed to destroy $RUN_VM; run: $0 down $RUN_VM"' EXIT
+ trap 'rc=$?; trap "" INT TERM HUP QUIT; finish "$rc" "$RUN_VM"' EXIT
trap 'exit 130' INT TERM HUP QUIT
cmd_up "${up_args[@]}" >/dev/null
if [ "$keep" = 1 ]; then
- trap - EXIT
+ RUN_VM=""
log "--keep: leaving $name running; destroy with: $0 down $name"
fi
@@ -480,7 +498,7 @@ case $cmd in
esac
case $cmd in
run) cmd_run "$@" ;;
- up) trap 'trap "" INT TERM HUP QUIT; [ -z "$UP_NAME" ] || [ -n "$UP_READY" ] || cmd_down "$UP_NAME" || log "WARNING: failed to destroy $UP_NAME; run: $0 down $UP_NAME"' EXIT
+ up) trap 'rc=$?; trap "" INT TERM HUP QUIT; [ -z "$UP_READY" ] || UP_NAME=""; finish "$rc" "$UP_NAME"' EXIT
trap 'exit 130' INT TERM HUP QUIT
cmd_up "$@" ;;
ssh) name=$1; shift; load "$name"
diff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.md
index 08c4dcd83c..b2b977801f 100644
--- a/templates/bootstrap/template-repo/README.md
+++ b/templates/bootstrap/template-repo/README.md
@@ -1,6 +1,6 @@
# gbrain agent workspace — template
-<!-- gbrain-template-stamp: 0.60.78.0 -->
+<!-- gbrain-template-stamp: 0.60.80.0 -->
This repository is the **"Use this template"** distribution artifact for a
[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same
diff --git a/test/scripts/ubi-runner.test.ts b/test/scripts/ubi-runner.test.ts
index c52ae65783..47487864df 100644
--- a/test/scripts/ubi-runner.test.ts
+++ b/test/scripts/ubi-runner.test.ts
@@ -4,7 +4,7 @@
// out in-flight creates when `up` gets SIGTERM or SIGKILL mid-provision.
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
-import { mkdtempSync, rmSync } from "node:fs";
+import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { startMockUbicloud, waitForEvent, type MockUbicloud, type MockUbicloudOptions } from "../helpers/mock-ubicloud-api.ts";
@@ -105,6 +105,27 @@ describe("teardown waits for in-flight creates", () => {
expect(api.vms.size).toBe(0);
});
+ // Bash 5.2 runs a pending signal trap inside the parse of the next $(...),
+ // where the trap fails to parse and the shell exits 2 without running it.
+ // BASH_ENV turns on xtrace with a PS4 whose first $(...) sends the runner
+ // SIGTERM, so the second is always parsed with that trap pending.
+ for (const args of [["up"], ["run", "--", "true"]]) {
+ it(`${args[0]}: a SIGTERM that lands while bash parses a $(...) still destroys the VM and exits 130`, async () => {
+ const api = serve();
+ const bashEnv = join(dir, "bash-env");
+ writeFileSync(bashEnv, `PS4='$([ "$BASH_SUBSHELL" = 1 ] && [ -e "$PROBE_DIR/go" ] && mkdir "$PROBE_DIR/fired" 2>/dev/null && kill -TERM $$)$(:)+ '\nset -x\n`);
+ const proc = spawnRunner(args, { UBI_OWNER: "t1", BASH_ENV: bashEnv, PROBE_DIR: dir });
+ const output = Promise.all([new Response(proc.stdout).text(), new Response(proc.stderr).text()]);
+ const name = (await waitForEvent(api, /^created /)).split(" ")[1]!;
+ writeFileSync(join(dir, "go"), "");
+ expect(await proc.exited).toBe(130);
+ await output;
+ expect(existsSync(join(dir, "fired"))).toBe(true);
+ expect(api.events.slice(-2)).toEqual([`destroy ${name}`, `removed ${name}`]);
+ expect(api.vms.size).toBe(0);
+ });
+ }
+
it("after SIGKILL mid-create, down waits for the create to land and destroys the VM", async () => {
const api = serve({ createDelayMs: () => 1500 });
const proc = spawnRunner(["up"], { UBI_OWNER: "t1" });