Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

storage manifest: register the new ops and writers in the inventories; hosted test runs in the parallel lane

garrytanfb4fb7282d53
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46bfd0e297..d13815328c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,7 +27,7 @@ The shelf is written only through the storage verbs. `put_page`, `remember` and
- `src/core/error-registry.ts`, `docs/guides/write-refusals.md`, `docs/guides/error-codes.md`: `storage_source_managed`, `storage_manifest_missing`, `storage_record_invalid`, `storage_record_secret`, `storage_card_exists` and `storage_revision_conflict`, each with its recovery path. Remote register and update refuse with the shared `trusted_local_only`.
- `src/commands/storage.ts`: `gbrain storage init`; the help separates the tiers report (`status`) from the shelf verbs.
- Goldens: `test/fixtures/goldens/cli/tools-json.json` gains the three read tools; `test/fixtures/goldens/exports/types.json` gains the new error codes in the `canonical` union and lists `ThinkSynthesisStatus` in a new order (the new schema module declares the `not_json` literal first; the type is unchanged).
-- Tests: `test/storage-manifest.test.ts` (PGLite, repo-less) and `test/storage-manifest-hosted.serial.test.ts` (managed PGLite with a Git checkout).
+- Tests: `test/storage-manifest.test.ts` (PGLite, repo-less) and `test/storage-manifest-hosted.test.ts` (managed PGLite with a Git checkout).
## [0.60.618.0] - 2026-11-08
**A refresh no longer loses its tick when gbrain's own writes land while it drains.** `gbrain sources refresh` waits for writes admitted before its fence, and finishing them commits on the checkout and pushes, so HEAD moved past the commit the refresh started from and the run refused `refresh_source_changed`, twice when its same-run retry met the next writes. When every commit since that start is in gbrain's commit ledger and the upstream branch the refresh started with holds them, the refresh now takes HEAD as its start under the fence and fast-forwards to that upstream; any other HEAD move, one commit another agent made among them or an upstream changed under the fence included, still refuses as before.
diff --git a/docs/architecture/canonical-writers.tsv b/docs/architecture/canonical-writers.tsv
index d546f89093..0912023aa7 100644
--- a/docs/architecture/canonical-writers.tsv
+++ b/docs/architecture/canonical-writers.tsv
@@ -298,3 +298,4 @@ src/core/connectors/api-source.ts 2 coordinator Shared Fireflies/Slack publish s
src/core/meetings/meetings-source.ts 1 coordinator Meetings connector (GBRA-220): the one sources.last_sync_at/newest_content_at stamp (never page content) runs only for unmanaged sources; managed runs stamp through the connector checkpoint save in connector-sync.ts.
src/core/slack/slack-source.ts 1 coordinator Slack channel connector (GBRA-220): the one sources.last_sync_at/newest_content_at stamp (never page content) runs only for unmanaged sources; managed runs stamp through the connector checkpoint save in connector-sync.ts.
src/core/access/attest-sources.ts 1 projection GST-1113: applyAttestSources sets only sources.config.qm_scope (and federated false) on a source a credential first lists in attest_sources, under the sources row lock in the binding transaction. It writes no page column, revision, content hash, generation, checkpoint or topology column, so gbrain_require_managed_writer passes it on a managed brain, as with policy.ts writeAccessStore; the mark only hides.
+src/core/storage-manifest/source.ts 1 contract markRole sets role and federated in the config of the storage source that addSource or hostRepo created in the same storage init or first repo-less register; it writes source configuration only, never page content.
diff --git a/docs/architecture/managed-mutating-writers.tsv b/docs/architecture/managed-mutating-writers.tsv
index 511d4eb04a..e5c8c507cb 100644
--- a/docs/architecture/managed-mutating-writers.tsv
+++ b/docs/architecture/managed-mutating-writers.tsv
@@ -8,6 +8,8 @@ op forget coordinator submitForgetMutation records a coordinated withdrawal.
op memory_write coordinator Each fact is a remember write (submitRememberMutation) under a per-member child request id.
op put_page coordinator submitPageMutation; unbound Postgres sources refuse unless persistence.unbound_write=database_only.
op put_pages coordinator Every page is admitted as its own coordinated put_page write request, together in one journal transaction (#6007)
+op storage_register coordinator submitPageMutation through the storage door (trusted local only); on a hosted shelf the card commits to its repository before it is indexed.
+op storage_update coordinator submitPageMutation through the storage door bound to expected_revision (trusted local only); on a hosted shelf the change commits before it is indexed.
op delete_page coordinator submitPageMutation soft delete or trusted-local purge.
op restore_page coordinator submitPageMutation restores a recorded version.
op purge_deleted_pages coordinator purgeDeletedPagesCoordinated purges each expired tombstone through delete_page purge.
diff --git a/src/commands/storage.ts b/src/commands/storage.ts
index ab4587a028..523861f57d 100644
--- a/src/commands/storage.ts
+++ b/src/commands/storage.ts
@@ -11,6 +11,7 @@ import { scannerSlugRootMode } from '../core/write-through.ts';
import type { SlugRootMode } from '../core/sync-anchor.ts';
import { nativeFileTarget } from '../core/persistence/native-file-target.ts';
import { OperationError } from '../core/ops/contract.ts';
+import { setCliExitVerdict } from '../core/cli-force-exit.ts';
/**
* Distinct nominal types for the two tier-keyed numeric maps. Both shapes
@@ -454,6 +455,6 @@ async function runStorageInit(engine: BrainEngine, args: string[]): Promise<void
if (!(error instanceof OperationError)) throw error;
console.log(json ? JSON.stringify({ error: error.code, message: error.message, suggestion: error.suggestion }) : `Refused (${error.code}): ${error.message}
Fix: ${error.suggestion ?? ''}`);
- process.exitCode = error.code === 'invalid_params' ? 2 : 1;
+ setCliExitVerdict(error.code === 'invalid_params' ? 2 : 1);
}
}
diff --git a/test/operations-coverage-ledger.test.ts b/test/operations-coverage-ledger.test.ts
index d12ad26738..72475d36bf 100644
--- a/test/operations-coverage-ledger.test.ts
+++ b/test/operations-coverage-ledger.test.ts
@@ -38,6 +38,11 @@ const LEDGER: Record<string, string> = {
get_page: 'test/get-page-federated-scope.test.ts',
put_page: 'test/put-page-provenance.test.ts',
put_pages: 'test/put-pages-batch.test.ts',
+ storage_find: 'test/storage-manifest.test.ts',
+ storage_get: 'test/storage-manifest.test.ts',
+ storage_list: 'test/storage-manifest.test.ts',
+ storage_register: 'test/storage-manifest.test.ts',
+ storage_update: 'test/storage-manifest.test.ts',
delete_page: 'test/pages-source-scoping-4329.test.ts',
list_pages: 'test/list-pages-truncation.test.ts',
find_pages: 'test/page-lookup-7191.test.ts',
diff --git a/test/operations-source-isolation-matrix.test.ts b/test/operations-source-isolation-matrix.test.ts
index 4f19d02ea1..d3fef02142 100644
--- a/test/operations-source-isolation-matrix.test.ts
+++ b/test/operations-source-isolation-matrix.test.ts
@@ -122,6 +122,9 @@ const MATRIX: Row[] = [
{ name: 'questions_list', mode: 'skip', reason: 'owner-private (C4): a caller that cannot read private pages is refused question_owner_only; test/helpers/pinned-questions-scenarios.ts owns source confinement and the leakage matrix' },
{ name: 'questions_status', mode: 'skip', reason: 'owner-private (C4): refused question_owner_only for restricted grants; ids outside the read scope answer question_not_found (test/helpers/pinned-questions-scenarios.ts)' },
{ name: 'open_loops', mode: 'skip', reason: 'loop rows need the Gmail detector pipeline; test/ops-loops.test.ts owns its remote posture (no-scope denial, grant confinement, redacted evidence)' },
+ { name: 'storage_find', mode: 'skip', reason: 'reads only the storage source, which is not federated: a remote caller reads cards only when its grant names storage; test/storage-manifest.test.ts pins the bound, unbound and granted cases' },
+ { name: 'storage_get', mode: 'skip', reason: 'reads only the storage source, which is not federated: a remote caller reads cards only when its grant names storage; test/storage-manifest.test.ts pins the bound, unbound and granted cases' },
+ { name: 'storage_list', mode: 'skip', reason: 'reads only the storage source, which is not federated: a remote caller reads cards only when its grant names storage; test/storage-manifest.test.ts pins the bound, unbound and granted cases' },
{ name: 'list_skills', mode: 'skip', reason: 'bundled skills catalog from the install tree; skills suites own it (throws outside an installed skills dir)' },
// Deliberately brain-wide (config / registry / identity — not source data).
diff --git a/test/operations-trust-boundary.test.ts b/test/operations-trust-boundary.test.ts
index bb649ab230..a18536a97d 100644
--- a/test/operations-trust-boundary.test.ts
+++ b/test/operations-trust-boundary.test.ts
@@ -247,6 +247,9 @@ describe('mcpOperations filter — localOnly ops are excluded from the HTTP-expo
'purge_deleted_pages',
'retain_skill_revision',
'sources_inspect',
+ // GST-1943: the storage manifest's writers run from the trusted local CLI only.
+ 'storage_register',
+ 'storage_update',
'sync_brain',
// W9F item 8: the CLI delegates rebuild to a resident owner over IPC.
'takes_rebuild',
diff --git a/test/remote-privacy-sweep.test.ts b/test/remote-privacy-sweep.test.ts
index 6157dbcb95..288b424ff1 100644
--- a/test/remote-privacy-sweep.test.ts
+++ b/test/remote-privacy-sweep.test.ts
@@ -158,6 +158,9 @@ const PARAM_FACTORY: Record<string, Record<string, unknown>> = {
fetch: { id: WORLD_FENCE_SLUG },
list_pages: {},
find_pages: { pattern: '*' },
+ storage_find: { query: 'WORLDMARK' },
+ storage_get: { id: 'dataset-a' },
+ storage_list: {},
search: { query: 'WORLDSWEEP' },
// 'SWEEP_' is inside every PRIVATE sentinel too: the literal scan must still return only world text.
search_exact: { phrase: 'SWEEP_' },
@@ -263,6 +266,10 @@ const EXPECTED_OUTCOME: Record<string, Outcome> = {
fetch: 'data',
list_pages: 'data',
find_pages: 'data',
+ // GST-1943: this fixture has no storage shelf: find and list answer empty, get answers not_found.
+ storage_find: 'ok',
+ storage_get: 'error',
+ storage_list: 'ok',
search: 'data',
search_exact: 'data',
query: 'data',
diff --git a/test/retrieval-op-redaction.test.ts b/test/retrieval-op-redaction.test.ts
index a8fbc5f657..21ece5a745 100644
--- a/test/retrieval-op-redaction.test.ts
+++ b/test/retrieval-op-redaction.test.ts
@@ -136,6 +136,9 @@ const SWEEP: Record<string, Row> = {
synthesize: { skip: 'LLM-backed; keyless test env returns no composition. Wrapper coverage is the registration test below.' },
list_pages: { args: { limit: 100 } },
find_pages: { args: { pattern: '*', limit: 100 } },
+ storage_find: { skip: 'Cards refuse secret-shaped values when written (storage_record_secret) and the shelf is not federated, so this fixture has no card a remote caller can read; test/storage-manifest.test.ts covers both.' },
+ storage_get: { skip: 'Cards refuse secret-shaped values when written (storage_record_secret) and the shelf is not federated, so this fixture has no card a remote caller can read; test/storage-manifest.test.ts covers both.' },
+ storage_list: { skip: 'Cards refuse secret-shaped values when written (storage_record_secret) and the shelf is not federated, so this fixture has no card a remote caller can read; test/storage-manifest.test.ts covers both.' },
search: { args: { query: 'PLANTMARK note body', limit: 20 } },
query: { args: { query: 'PLANTMARK note body', limit: 20 } },
search_exact: { args: { phrase: 'PLANTMARK' } },
diff --git a/test/storage-manifest-hosted.serial.test.ts b/test/storage-manifest-hosted.test.ts
similarity index 100%
rename from test/storage-manifest-hosted.serial.test.ts
rename to test/storage-manifest-hosted.test.ts