Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs(changelog): publication_started stamp rides the request-row lock
garrytan98a85d8daaa8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dd30ad65a5..a16a2187d2 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.142.0] - 2026-10-10++**A file write's publication takes its request-row lock and its `publication_started` stamp in one statement instead of two. No behavior changes; one UPDATE fewer per published file.**++GBRA-69's import profile (50k pages, Postgres 16) counted about six UPDATEs of each `persistence_requests` row per write. One of them was the `publication_started=true` stamp the publication transaction issued right after a bare `SELECT … FOR UPDATE` of the same row. The stamp now rides on the row lock: a file publication locks its request with `UPDATE … SET publication_started=true … RETURNING *`, which takes the same lock, in the same transaction, with the same visibility (the stamp still lives and dies with that transaction, as `control.ts` relies on), and the claim-token and state checks run on the returned row exactly as before. Database-only writes keep the bare `FOR UPDATE`; they never stamped.++### Itemized changes++- `src/core/persistence/coordinator.ts` (`publishMutation`): the request-row lock of a file publication is the stamping UPDATE; the separate stamp statement before `before_publication` is gone.+- `scripts/persistence/lock-order.ts`: the crash robot's lock-order tracer recognises the stamping UPDATE as the publication's exclusive request-row lock (it previously keyed publications on the bare `FOR UPDATE`), and reports `publication_row_lock_statements_max`.+- Tests: `test/persistence-crash-robot.test.ts` asserts one request-row lock statement per publication (two on the previous code). Statement budget (`test/e2e/persistence-statement-budget.test.ts`) measures publication at 42 statements on Postgres, under its 50 budget.+## [0.60.140.0] - 2026-10-10**CI only: unit shard 7 no longer loses its tail to a Bun runtime defect, and a red shard that does names the defect instead of blaming the tests. Nothing in gbrain itself changes.**diff --git a/test/persistence-crash-robot.test.ts b/test/persistence-crash-robot.test.tsindex fdcbb5a363..70a82ffb97 100644--- a/test/persistence-crash-robot.test.ts+++ b/test/persistence-crash-robot.test.ts@@ -238,7 +238,7 @@ describe('lock order', () => {expect(clean.violations.slice(before)).toEqual([]);expect(clean.publications_reading_brain_for_share).toBeGreaterThan(0);// The request row is locked by one statement per publication: the `publication_started` stamp takes the lock- // (two statements, a bare FOR UPDATE and then the stamp, is the shape before v0.60.141.0).+ // (two statements, a bare FOR UPDATE and then the stamp, is the shape before v0.60.142.0).expect(clean.publication_row_lock_statements_max).toBe(1);await world.engine.transaction(async tx => {await tx.executeRaw('SELECT id FROM sources WHERE id=$1 FOR SHARE', ['robot-0']);