Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Writer status proves an owner dead only for claims this host would release, and the docs name the retried-push case with no commit (GST-2572 review)
garrytan29ab6cdfc891
diff --git a/changelog.d/capy-gst-2572-stuck-head.md b/changelog.d/capy-gst-2572-stuck-head.mdindex 5b8ee2869e..d9a45832df 100644--- a/changelog.d/capy-gst-2572-stuck-head.md+++ b/changelog.d/capy-gst-2572-stuck-head.md@@ -9,7 +9,7 @@### A write receipt says when its Git commit landed-**A receipt read after the write (`gbrain write-request <id>`, `get_write_request`, `list_write_requests`) now reports where Git is.** For a page on an ordinary (not `canonical: git`) checkout, `persistence.git_state` used to stay `queued` forever, even after the background Git effect committed the file, and no commit was named anywhere. It now comes from the Git effect: `committed` with the commit in `persistence.git_commit`, or `superseded`, `skipped`, `failed` or `retrying` with the cause in `persistence.git_reason`, and `queued` only while the effect is queued. Nothing stored is rewritten: a Git effect from an earlier build reads `committed` with no commit. Receipts of `canonical: git` sources are unchanged.+**A receipt read after the write (`gbrain write-request <id>`, `get_write_request`, `list_write_requests`) now reports where Git is.** For a page on an ordinary (not `canonical: git`) checkout, `persistence.git_state` used to stay `queued` forever, even after the background Git effect committed the file, and no commit was named anywhere. It now comes from the Git effect: `committed` with the commit in `persistence.git_commit`, or `superseded`, `skipped`, `failed` or `retrying` with the cause in `persistence.git_reason`, and `queued` only while the effect is queued. Nothing stored is rewritten: a Git effect from an earlier build, or one whose commit landed but whose push had to be retried, reads `committed` with no commit. Receipts of `canonical: git` sources are unchanged.Reported by @ethanbeard (#9227).diff --git a/docs/guides/git-canonical.md b/docs/guides/git-canonical.mdindex a6f680b2af..c01fcc8af5 100644--- a/docs/guides/git-canonical.md+++ b/docs/guides/git-canonical.md@@ -16,7 +16,7 @@ operator's view.| | A mixed source (the default) | A strict source (`canonical: git`) ||---|---|---|-| A page write | The file and the database row are published first; a background Git effect commits and pushes the file later, once Git durability is on. The write's reply says `git_state: queued`; a receipt read later (`gbrain write-request <id>`, `get_write_request`) reads the Git effect: `committed` with the commit in `persistence.git_commit`, or `superseded`, `skipped`, `failed` or `retrying` with `persistence.git_reason`. An effect recorded by a build before this one reads `committed` with no commit. | The file is written and committed under the checkout's writer lock, then the row commits. The receipt names the commit (`persistence.git_commit`, `git_state: committed`). The Git effect only pushes. |+| A page write | The file and the database row are published first; a background Git effect commits and pushes the file later, once Git durability is on. The write's reply says `git_state: queued`; a receipt read later (`gbrain write-request <id>`, `get_write_request`) reads the Git effect: `committed` with the commit in `persistence.git_commit`, or `superseded`, `skipped`, `failed` or `retrying` with `persistence.git_reason`. An effect recorded by a build before this one, or one whose commit landed but whose push had to be retried, reads `committed` with no commit. | The file is written and committed under the checkout's writer lock, then the row commits. The receipt names the commit (`persistence.git_commit`, `git_state: committed`). The Git effect only pushes. || A crash between the two | Recovery restores the file's previous bytes. | The committed file is kept, and the write's replay finishes the row against it. || What sync reads | The working tree and the database; disagreements become holds such as `file_drift` or `worktree_dirty`. | Committed blobs at HEAD only. Each committed version is imported over what the database holds, and a committed removal deletes the page. || An uncommitted edit in the checkout | Held as `worktree_dirty`. | Left on disk and not indexed until someone commits it. |diff --git a/src/core/persistence/diagnostics.ts b/src/core/persistence/diagnostics.tsindex 38e1552234..4ffa133adf 100644--- a/src/core/persistence/diagnostics.ts+++ b/src/core/persistence/diagnostics.ts@@ -198,8 +198,9 @@ export async function readWriterDiagnostics(engine: BrainEngine) {const hostId = existingHostIdFor(engine);const consumerRows = hostId ? await listHostConsumers(engine, hostId).catch(() => []) : [];const tracked = (engine as { getPoolDiagnostics?: () => { tracked?: unknown } | null }).getPoolDiagnostics?.()?.tracked ?? null;+ const ownedHere = new Set((worktrees as Array<{ id: string; owner_host_id: string | null }>).filter(w => hostId !== null && w.owner_host_id === hostId).map(w => w.id));const claimStates = blockers.map(row => claimStateOf({ state: row.state, claim_phase: row.claim_phase, execution_token: row.execution_token, claim_lapsed: row.claim_lapsed,- publication_started: row.publication_started, abandoned: row.abandoned, probe_owner: true }));+ publication_started: row.publication_started, abandoned: row.abandoned, probe_owner: row.worktree_id === null || ownedHere.has(row.worktree_id) }));const backends = await readOwnerBackends(engine, claimStates.flatMap(state => state?.owner ? [state.owner] : []));const headBlockers = await readQueuedHeadBlockers(engine, blockers, hostId);// C-NEW-4: the consumer is per process, so this is the answering process's own ingress, never proof the brain's owner is down.