Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(persistence-robot): a connector or sync write may end a concurrent group after a receipted put

garrytanb6fef31e0815
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 339d393648..3b64579446 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.65.0",
+ "version": "0.60.67.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 d54030a883..e32f0485b6 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.65.0",
+ "version": "0.60.67.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 cb2d9420b2..f70bf1a326 100644
--- a/BOOTSTRAP_FOR_AGENTS.md
+++ b/BOOTSTRAP_FOR_AGENTS.md
@@ -1,4 +1,4 @@
-<!-- gbrain-runbook-stamp: 0.60.65.0 -->
+<!-- gbrain-runbook-stamp: 0.60.67.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 c32d6cf5e3..154c4f0b1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,35 @@ 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.67.0] - 2026-10-05
+
+**The crash robot no longer reports a lost write when a connector republish lands after an agent's write to the same page; no write was lost.**
+
+The Postgres crash robot failed one CI run with `lost_write` on `sync_and_connector_race_direct_write` (seed 5105, no crash injected). In that race an agent's `put_page` committed first, then the GitHub connector republished the newer upstream issue over it. The page ended at the connector's revision, and the agent's revision is in the page history. That is the serial order put-then-connector, which the robot already accepts when the two run one after the other. Its concurrent-group check only knew the revisions writers returned, and a connector publish (like a sync) returns none, so it called the legal final state lost.
+
+Measured on Postgres 16 with 6 replays at a time on 4 CPUs:
+
+| | Runs | Robot reported `lost_write` | All of them: put committed, connector committed after it, page carries the connector's write, put's revision in history |
+| --- | --- | --- | --- |
+| Before the lock-order change (214211929), direct | 150 | 2 | yes |
+| Before, through PgBouncer | 150 | 3 | yes |
+| After it (8c9a8e9a4), direct | 150 | 5 | yes |
+| After it, through PgBouncer | 200 | 2 | yes |
+| Connector forced to run after the put, before and after | 6 | 6 | yes |
+| Same forced order, with this release | 10 | 0 | n/a |
+
+The race and the false report predate v0.60.65.0 at a similar rate; the lock-order change did not introduce them.
+
+## To take advantage of v0.60.67.0
+
+Nothing to do: this release changes the persistence validation robot only. `bun --no-env-file scripts/persistence/validate.ts --engine=postgres --replay=<manifest>` replays a failing run.
+
+### Itemized changes
+
+#### Crash robot
+- After a concurrent group, a page may end at the write of a committed sync or connector publish (which return no revision) only when the page carries that member's marker; every receipted revision a later member replaced must still be in the page history. A revision no member explains is still `lost_write`.
+- `test/persistence-crash-robot.test.ts` runs the put, then the connector republish, through the real handlers and settles them as one group: the previous oracle reported `lost_write` and this one passes; an extra write nobody in the group returned still reports `lost_write`.
+
## [0.60.65.0] - 2026-10-05
**Writes no longer stall when a source is added, claimed or archived at the same time.**
diff --git a/VERSION b/VERSION
index ca43b6c8e3..fc83dae1e0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.60.65.0
+0.60.67.0
diff --git a/openclaw.plugin.json b/openclaw.plugin.json
index d87ca562a2..6ce87c1590 100644
--- a/openclaw.plugin.json
+++ b/openclaw.plugin.json
@@ -1,7 +1,7 @@
{
"id": "gbrain-context-engine",
"name": "gbrain",
- "version": "0.60.65.0",
+ "version": "0.60.67.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 4df6c21e51..8abbb00e97 100644
--- a/package.json
+++ b/package.json
@@ -218,7 +218,7 @@
"bun": ">=1.4.0"
},
"license": "MIT",
- "version": "0.60.65.0",
+ "version": "0.60.67.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 8face156bb..e2acbcfb4e 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.65.0",
+ "version": "0.60.67.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 492bb2b1a1..0bf99b2f9f 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.65.0",
+ "version": "0.60.67.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 919debc200..b6ff68aea0 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.65.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.67.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 94d8d47291..c4f8be06e6 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.65.0",
+ "version": "0.60.67.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 caffe8863a..2909480e82 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.65.0",
+ "version": "0.60.67.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 0a3a8c6a21..c1d64aa646 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.65.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.67.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 b28ab0aecb..5c6e8b6e52 100644
--- a/plugin/README.md
+++ b/plugin/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.65.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.67.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/persistence/README.md b/scripts/persistence/README.md
index 8ce1fed231..32d0400839 100644
--- a/scripts/persistence/README.md
+++ b/scripts/persistence/README.md
@@ -110,7 +110,11 @@ exactly once.
The reference model (`model.ts`) checks: a committed receipt is visible at
once and later revisions move only through committed ops; a late receipt
-names a revision the page really had; a refused write never becomes visible;
+names a revision the page really had; after a concurrent group a page ends
+at a revision a committed member returned, or at the write of a committed sync
+or connector publish (which return no revision) whose marker it carries, and
+every receipted revision a later member replaced is in the page's history; a
+refused write never becomes visible;
a withdrawn fact never returns through recall, `get_page` or the facts table;
a write never lands in another source; another principal reusing a request
id never receives the original receipt; takes and facts rows equal their
diff --git a/scripts/persistence/model.ts b/scripts/persistence/model.ts
index ed7cc2f848..7189d7e752 100644
--- a/scripts/persistence/model.ts
+++ b/scripts/persistence/model.ts
@@ -176,8 +176,10 @@ export class ReferenceModel {
/**
* After a concurrent group: each touched page's revision must be one a
- * committed group member returned, every committed edit's marker is
- * visible, and every superseded member revision is in the page's history.
+ * committed group member returned, or the write of a committed sync or
+ * connector publish (which returns no revision) whose marker the page
+ * carries; every committed edit's marker is visible, and every superseded
+ * member revision is in the page's history.
*/
async settleGroup(batch: OpDescriptor[], observed: OpObservation[]): Promise<void> {
const committed = batch.map((d, i) => ({ d, o: observed[i] })).filter(x => x.o.status === 'committed');
@@ -190,13 +192,18 @@ export class ReferenceModel {
const [source, slug] = k.split('\u0000');
const read = await this.readPage('local', source, slug);
const revisions = members.map(x => x.o.values.revision).filter(Boolean) as string[];
- if (revisions.length && !revisions.includes(String(read?.revision))) {
- this.violate({ class: 'lost_write', op: members.map(x => x.d.id).join('+'), detail: `concurrent group left ${source}/${slug} at ${String(read?.revision)}, none of the committed revisions ${revisions.join(',')}` });
- }
// Whole-page writers (put, sync, connector) may legally replace each other; edits and fact writes compose.
const replacing = members.some(x => ['put_page', 'sync', 'connector_publish'].includes(x.d.kind));
const memberMarkers = members.map(x => ['edit_page', 'put_page', 'sync', 'connector_publish'].includes(x.d.kind) ? markersIn(JSON.stringify(x.d.args)).at(-1) : null);
- if (replacing && memberMarkers.some(Boolean) && !memberMarkers.some(mk => mk && markersIn(String(read?.content)).includes(mk))) {
+ const visible = markersIn(String(read?.content));
+ // A sync or connector publish returns no revision: the page may end at its write when it ran after a
+ // receipted member, and then carries its marker.
+ const unreceiptedFinal = members.some((x, i) => ['sync', 'connector_publish'].includes(x.d.kind) && !x.o.values.revision
+ && !!memberMarkers[i] && visible.includes(memberMarkers[i]!));
+ if (revisions.length && !revisions.includes(String(read?.revision)) && !unreceiptedFinal) {
+ this.violate({ class: 'lost_write', op: members.map(x => x.d.id).join('+'), detail: `concurrent group left ${source}/${slug} at ${String(read?.revision)}, none of the committed revisions ${revisions.join(',')}` });
+ }
+ if (replacing && memberMarkers.some(Boolean) && !memberMarkers.some(mk => mk && visible.includes(mk))) {
this.violate({ class: 'lost_write', op: members.map(x => x.d.id).join('+'), detail: `no committed whole-page write of the group is visible in ${source}/${slug}` });
}
for (const [i, x] of members.entries()) {
diff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.md
index c9a59083bf..c1dbecc320 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.65.0 -->
+<!-- gbrain-template-stamp: 0.60.67.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/persistence-crash-robot.test.ts b/test/persistence-crash-robot.test.ts
index 58ecc823fd..5450aa20c4 100644
--- a/test/persistence-crash-robot.test.ts
+++ b/test/persistence-crash-robot.test.ts
@@ -18,10 +18,11 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { descriptor, executeOp, parseDescriptor } from '../scripts/persistence/ops.ts';
+import { ReferenceModel } from '../scripts/persistence/model.ts';
import { crossBoundarySequences, randomSchedule } from '../scripts/persistence/generator.ts';
import { ROBOT_TOPOLOGY, restrict } from '../scripts/persistence/robot-driver.ts';
import { shrinkRun } from '../scripts/persistence/shrink.ts';
-import { runSchedule } from '../scripts/persistence/crash-robot.ts';
+import { runSchedule, runSteps } from '../scripts/persistence/crash-robot.ts';
import { installLockOrderTrace, lockOrderReport } from '../scripts/persistence/lock-order.ts';
import { prepareTopology } from '../scripts/persistence/history-fixture.ts';
import { claimPersistenceEffect, releaseAbandonedClaims } from '../src/core/persistence/effect-journal.ts';
@@ -100,6 +101,36 @@ describe('reference model on master behavior', () => {
}, 180_000);
});
+describe('concurrent connector publish and direct write', () => {
+ // CI run 37322995874: the direct put committed first, then the connector republish imported the newer
+ // item over it. The group check knew only the put's revision; the connector reports none.
+ test('the connector republishing after a receipted put is a legal final state; an unexplained revision is still lost', async () => {
+ await robotBrain(async ({ world }) => {
+ const schedule = crossBoundarySequences(ROBOT_TOPOLOGY).find(s => s.label === 'sync_and_connector_race_direct_write')!;
+ const [again, racing] = schedule.groups.find(g => g.length === 2 && schedule.ops.some(d => d.id === g[0] && d.kind === 'connector_publish'))!
+ .map(id => schedule.ops.find(d => d.id === id)!);
+ const model = new ReferenceModel(world);
+ world.descriptors = new Map(schedule.ops.map(d => [d.id, d]));
+ await runSteps(world, model, { ...schedule, ops: schedule.ops.filter(d => d !== again && d !== racing), groups: schedule.groups.filter(g => !g.includes(again.id)) });
+ expect(model.violations).toEqual([]);
+ const put = await executeOp(world, racing);
+ const connector = await executeOp(world, again);
+ expect([put.status, connector.status]).toEqual(['committed', 'committed']);
+ model.beginStep(true);
+ await model.observe(again, connector); await model.observe(racing, put);
+ await model.settleGroup([again, racing], [connector, put]);
+ expect(model.violations).toEqual([]);
+
+ // A write no group member returned moves the page to the put's content at a revision nobody receipted.
+ const unseen = await executeOp(world, { ...racing, id: `${racing.id}-unseen`, requestId: crypto.randomUUID() });
+ expect(unseen.status).toBe('committed');
+ model.beginStep(true);
+ await model.settleGroup([again, racing], [connector, put]);
+ expect(model.violations.map(v => v.class)).toEqual(['lost_write']);
+ });
+ }, 120_000);
+});
+
describe('lock order', () => {
test('real publications keep worktree > sources-by-id order; an inversion is reported', async () => {
await robotBrain(async ({ world }) => {