Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
v0.60.85.0 test(google): settle seeded connector writes before the attachment tests read or hand off the database
garrytanec46a487fded
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex 705b2b9336..3e72d6b0db 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain",- "version": "0.60.84.0",+ "version": "0.60.85.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.jsonindex b4fcba7f61..e827f9616f 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain",- "version": "0.60.84.0",+ "version": "0.60.85.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.mdindex 4a8186d2cf..3ea7347149 100644--- a/BOOTSTRAP_FOR_AGENTS.md+++ b/BOOTSTRAP_FOR_AGENTS.md@@ -1,4 +1,4 @@-<!-- gbrain-runbook-stamp: 0.60.84.0 -->+<!-- gbrain-runbook-stamp: 0.60.85.0 --><!-- This stamp must equal the VERSION file at every release; CI enforces it(scripts/check-bootstrap-tag.sh). `gbrain bootstrap status` compares it tothe installed binary and warns on skew. -->diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 538b92d8f7..4e93828d6a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,18 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [0.60.85.0] - 2026-10-06++**The Gmail attachment-repair command test no longer fails when its second seeded thread page is still publishing as the test hands the database to the command.**++The test seeds two thread pages through a managed connector sweep, stops the in-process persistence consumer, and runs `gbrain google attachments backfill --json` in a child process, which counts the source's thread pages. A managed sweep returns once its wait budget (1.5 seconds in tests) runs out, even if a write it accepted has not published yet: the write stays queued and the cursor stays put, as designed. On a busy CI machine the second page was still `running` when the sweep returned, so the child counted 1 page instead of 2. The seed now waits for every write the source accepted to commit before it reads or hands off the database, and checks that each one committed. gbrain itself does not change.++### For contributors++- `settleConnectorWrites(engine, sourceId)` in `test/helpers/connector-fixture.ts` waits for every persistence request the source admitted and expects each one to be `committed`.+- `test/google-attachments-command.test.ts` and the `seed` helper in `test/google-attachment-backfill.test.ts` call it after their seeding sweep. The backfill file had the same race in two tests.+- A probe that holds the consumer's preparation of the second import for 2.5 seconds reproduces the CI failure on PGLite and Postgres (`imported_thread_pages` 1, expected 2) and fails both backfill tests. With the fix, all 15 tests in the two files pass with the probe in place.+## [0.60.84.0] - 2026-10-06**The 12k-file clone fixture no longer races a background `git gc`, so the large-manifest clone test stops failing with git exit 128.**diff --git a/VERSION b/VERSIONindex fe501775d2..e6297c1357 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-0.60.84.0+0.60.85.0diff --git a/openclaw.plugin.json b/openclaw.plugin.jsonindex 1c605f714d..6da96a2f64 100644--- a/openclaw.plugin.json+++ b/openclaw.plugin.json@@ -1,7 +1,7 @@{"id": "gbrain-context-engine","name": "gbrain",- "version": "0.60.84.0",+ "version": "0.60.85.0","description": "Personal knowledge brain with Postgres + pgvector hybrid search","family": "bundle-plugin","kind": "context-engine",diff --git a/package.json b/package.jsonindex 7911c2694a..9887b679a4 100644--- a/package.json+++ b/package.json@@ -224,7 +224,7 @@"bun": ">=1.4.0"},"license": "MIT",- "version": "0.60.84.0",+ "version": "0.60.85.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.jsonindex e37673a328..146d4dd706 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.84.0",+ "version": "0.60.85.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.jsonindex 198f0e6c29..2f58cea1f3 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.84.0",+ "version": "0.60.85.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.mdindex 525043558f..2cd89c8508 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.84.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.85.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.jsonindex 7a1f4acb58..625b446dda 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.84.0",+ "version": "0.60.85.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.jsonindex ba640ec494..1bbfc4c829 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.84.0",+ "version": "0.60.85.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.mdindex 8f50c1f37b..500b1ac47e 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.84.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.85.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.mdindex 03bc02b956..337956dee8 100644--- a/plugin/README.md+++ b/plugin/README.md@@ -1,4 +1,4 @@-<!-- gbrain-plugin-tree-stamp: 0.60.84.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.85.0 --># gbrain plugin skill tree (generated — do not hand-edit)This tree is the curated skill set for the gbrain Codex and Claude Codediff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.mdindex a3454a78e7..0492207372 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.84.0 -->+<!-- gbrain-template-stamp: 0.60.85.0 -->This repository is the **"Use this template"** distribution artifact for a[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the samediff --git a/test/google-attachment-backfill.test.ts b/test/google-attachment-backfill.test.tsindex d9ed9ec317..f4f3db9627 100644--- a/test/google-attachment-backfill.test.ts+++ b/test/google-attachment-backfill.test.ts@@ -18,7 +18,7 @@ import { sanitizeRemoteBody } from '../src/core/remote-body.ts';import { serializePageToMarkdown } from '../src/core/markdown.ts';import { operationsByName } from '../src/core/operations.ts';import { syncLockId } from '../src/core/db-lock.ts';-import { createConnectorFixture, options, json, sourceCheckpoint } from './helpers/connector-fixture.ts';+import { createConnectorFixture, options, json, settleConnectorWrites, sourceCheckpoint } from './helpers/connector-fixture.ts';import { withEnv } from './helpers/with-env.ts';const { engines, env, source, boundSource, setup, teardown } = createConnectorFixture();@@ -46,6 +46,7 @@ async function seed(engine: BrainEngine, bound = false, count = 1) {await withConnectorSync(engine, f.id, 'google', cfg, options, async managed => {for (let n = 1; n <= count; n++) await managed!.importMarkdown(`${slug(n)}.md`, content(n));});+ await settleConnectorWrites(engine, f.id);return { ...f, cfg };}diff --git a/test/google-attachments-command.test.ts b/test/google-attachments-command.test.tsindex 0f74e88d2e..3cbca11682 100644--- a/test/google-attachments-command.test.ts+++ b/test/google-attachments-command.test.ts@@ -2,7 +2,7 @@ import { afterAll, beforeAll, expect, test } from 'bun:test';import { parseGoogleAttachmentsArgs } from '../src/commands/google-attachments.ts';import { parseGoogleSourceConfig } from '../src/core/google/google-source.ts';import { withConnectorSync } from '../src/core/persistence/connector-sync.ts';-import { createConnectorFixture, options } from './helpers/connector-fixture.ts';+import { createConnectorFixture, options, settleConnectorWrites } from './helpers/connector-fixture.ts';import { withEnv } from './helpers/with-env.ts';import { disposePersistenceConsumer } from '../src/core/persistence/service.ts';import { join } from 'node:path';@@ -28,6 +28,7 @@ test('command JSON preview and apply expose truthful scope and progress withoutawait withConnectorSync(engine, f.id, 'google', parseGoogleSourceConfig(config, f.dir), options, async managed => {for (let n = 1; n <= 2; n++) await managed!.importMarkdown(`emails/2026/09/thread-${n}.md`, `---\ntype: email\ntitle: Synthetic command\naccount: [email protected]\nthread_id: thread${n}\nmessage_ids: [message000000000${n}]\n---\nRetained body.\n`);});+ await settleConnectorWrites(engine, f.id);let database: Record<string, unknown> = { engine: 'pglite', database_path: join(home, 'database') };if (engine.kind === 'postgres') {const [row] = await engine.executeRaw<{ name: string }>('SELECT current_database() AS name');diff --git a/test/helpers/connector-fixture.ts b/test/helpers/connector-fixture.tsindex e7b42d1c8e..a0e4733fa5 100644--- a/test/helpers/connector-fixture.ts+++ b/test/helpers/connector-fixture.ts@@ -1,3 +1,4 @@+import { expect } from 'bun:test';import { randomUUID } from 'node:crypto';import { mkdirSync, mkdtempSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';@@ -5,7 +6,8 @@ import { join } from 'node:path';import type { BrainEngine } from '../../src/core/engine.ts';import type { GBrainConfig } from '../../src/core/config.ts';import { claimWorktree } from '../../src/core/persistence/ownership.ts';-import { disposePersistenceConsumer } from '../../src/core/persistence/service.ts';+import { disposePersistenceConsumer, waitForWrites } from '../../src/core/persistence/service.ts';+import type { WriteRequest } from '../../src/core/persistence/model.ts';import { isolatedPersistencePostgres } from './persistence-postgres.ts';import { syncLockId } from '../../src/core/db-lock.ts';import { testBackends } from './test-backends.ts';@@ -135,6 +137,18 @@ export function withGoogleAccount(fetcher: ((url: string, init?: RequestInit) =>};}+/**+ * A managed sweep returns with an accepted write still pending once its wait+ * budget runs out; the cursor stays put and the write publishes later. A seed+ * that reads its imported pages, or stops the consumer and hands the database+ * to a child, first waits for every write the source admitted to commit.+ */+export async function settleConnectorWrites(engine: BrainEngine, sourceId: string) {+ const rows = await engine.executeRaw<WriteRequest>('SELECT * FROM persistence_requests WHERE source_id=$1 ORDER BY created_at', [sourceId]);+ const settled = await waitForWrites(engine, rows, { engine: engine.kind }, testWaitMs(30_000));+ expect(settled.map(row => [row.slug, row.state])).toEqual(rows.map(row => [row.slug, 'committed']));+}+/** #5600: the pending set a managed connector run ended with (connector state row). */export async function connectorPendingSet(engine: BrainEngine, sourceId: string) {const [source] = await engine.executeRaw<{ incarnation: string }>('SELECT incarnation::text FROM sources WHERE id=$1', [sourceId]);