Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Guest notes docs: promoting again after the kept page was purged writes it anew, and racing promotions both succeed

garrytan2cd30251d25c
diff --git a/changelog.d/garrytan-guest-notes-follow-ups.md b/changelog.d/garrytan-guest-notes-follow-ups.md
index 0fa629067c..18b67f03e6 100644
--- a/changelog.d/garrytan-guest-notes-follow-ups.md
+++ b/changelog.d/garrytan-guest-notes-follow-ups.md
@@ -4,7 +4,7 @@ A brain whose gbrain process connects to Postgres as a scoped row-level-security
### Fixed
- Schema migration v314 re-creates the guest guard in the trust trigger and the guest-record guard so they refuse a role that row-level security keeps from reading `guest_sources`; guest admission, `remember`, links and remote deletes refuse the same way instead of treating the source as ordinary.
-- `gbrain guests promote` no longer answers `already_promoted` when the kept page was purged: promoting again writes the page and keeps one link. v314 adds a unique index on the promotion link (a brain that already holds duplicate links keeps them, gets no index and a warning).
+- `gbrain guests promote` no longer answers `already_promoted` when the kept page was purged, so promoting again writes the page and keeps one link. v314 adds a unique index on the promotion link (a brain that already holds duplicate links keeps them, gets no index and a warning), and two promotions of the same note to the same page that race each other both succeed with one link.
- A guest note whose mark writes no row now fails the save instead of committing a guest page with no mark.
- `gbrain guests init` counts the source's pages under the source row's lock, so no page can land between the check and the change.
- The repair `gbrain doctor` suggests for a source whose config says guest but has no guest record, `gbrain guests init --source <id> --yes`, now works when the source holds pages.
diff --git a/docs/guides/guest-notes.md b/docs/guides/guest-notes.md
index 0e049c716d..ab55d4b202 100644
--- a/docs/guides/guest-notes.md
+++ b/docs/guides/guest-notes.md
@@ -249,7 +249,8 @@ The guest note and its mark are not changed. Its reads now show
`guest.promoted: true`, and the broker's delete of it is refused
`guest_page_promoted`, so a retention sweep can't remove what you kept. You can
still delete it from your own CLI. Promoting the same note to the same page again
-writes nothing (`already_promoted`). If a promotion stopped after the new page was
+writes nothing (`already_promoted`), unless the kept page was purged: then
+promoting again writes the page anew and keeps one link. If a promotion stopped after the new page was
written but before the link was recorded (an interrupted run, or a write that was
still pending), promoting again records the link without writing the page twice.
The note is read through the same read scope as `get_page`, so a connection that