Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(persistence): the classic-brain unbound-source hint names the full bind route (claim plus activate)

garrytan8d0d7096afa5
diff --git a/src/core/persistence/unbound-source.ts b/src/core/persistence/unbound-source.ts
index d8e39e6bfb..d47927c5c3 100644
--- a/src/core/persistence/unbound-source.ts
+++ b/src/core/persistence/unbound-source.ts
@@ -45,11 +45,11 @@ export function unboundSourceError(sourceId: string, path: string | null, scope:
// #6122: on a brain whose managed persistence is not activated, a claim alone fences classic sync of the source,
// so the working path is the file plus classic sync; claiming is named with that consequence.
const edit = `edit the page's file in the checkout${path ? ` (${path})` : ''} and run gbrain sync --source ${sourceId}, which imports it`;
- const trap = `Managed persistence is not activated on this brain, so claiming the source (gbrain sources writer claim) would block classic sync of ${sourceId} `
- + 'until managed persistence is activated or the claim is released with gbrain sources writer deactivate.';
+ const trap = `To have gbrain own the checkout instead, ${bind}, then activate managed persistence (preview first: gbrain sources writer activate --confirm-quiesced --dry-run --json). `
+ + `Managed persistence is not activated on this brain, so a claim without activation blocks classic sync of ${sourceId} until it is activated or the claim is released with gbrain sources writer deactivate.`;
const suggestion = classic ? scope === 'database_only_eligible'
? `Source '${sourceId}' has a checkout path but no canonical owner. Choose one: ${edit}; or allow database-only writes to unbound sources `
- + `with gbrain config set ${UNBOUND_WRITE_KEY} database_only (such pages stay database-only). ${trap}`
+ + `with gbrain config set ${UNBOUND_WRITE_KEY} database_only. Pages written that way stay database-only and are not materialized into canonical files after binding. ${trap}`
: `Source '${sourceId}' has a checkout path but no canonical owner. To change this page, ${edit}. `
+ `${UNBOUND_WRITE_KEY}=database_only does not apply: this page came from a canonical file, and a database-only edit would be lost on the next sync. ${trap}`
: scope === 'database_only_eligible'
diff --git a/test/persistence-preactivation-claim.test.ts b/test/persistence-preactivation-claim.test.ts
index 57fb70b0a6..cf234bd458 100644
--- a/test/persistence-preactivation-claim.test.ts
+++ b/test/persistence-preactivation-claim.test.ts
@@ -93,7 +93,9 @@ test('the unbound-source hint on a classic brain names the file and classic sync
const classic = unboundSourceError('notes-example', '/srv/notes', 'file_backed', true).suggestion!;
expect(classic).toContain('gbrain sync --source notes-example');
expect(classic).toContain('gbrain sources writer deactivate');
- expect(classic).not.toContain('gbrain sources writer claim notes-example --path');
+ // A claim is offered only together with activation, never alone, and after the classic edit-and-sync path.
+ expect(classic).toContain('gbrain sources writer activate --confirm-quiesced --dry-run --json');
+ expect(classic.indexOf('gbrain sync --source notes-example')).toBeLessThan(classic.indexOf('gbrain sources writer claim notes-example'));
const managed = unboundSourceError('notes-example', '/srv/notes', 'file_backed').suggestion!;
expect(managed).toContain('gbrain sources writer claim notes-example --path /srv/notes');
});