Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: pre-landing review fixes (named OWNER_APPLY_TIMEOUT_MS; load the release door only when trust_apply runs)
garrytanc2ea2af63657
diff --git a/src/commands/trust.ts b/src/commands/trust.tsindex cfe932f92c..e6129ea896 100644--- a/src/commands/trust.ts+++ b/src/commands/trust.ts@@ -229,7 +229,6 @@ export async function maybeDelegateTrust(hostConfig: GBrainConfig | null, args:const { loadMounts } = await import('../core/brain-registry.ts');const { maybeDelegateLocalAdministration, persistenceConfigForBrain } = await import('../core/persistence/local-client.ts');const { inspectLockHolder } = await import('../core/pglite-lock.ts');- const { DOOR_WAIT_MS } = await import('../core/trust/release-publish.ts');const brainId = resolveBrainId(getCliOptions().brain, process.cwd());const config = persistenceConfigForBrain(hostConfig, brainId, brainId === 'host' ? [] : loadMounts());if (config?.engine !== 'pglite' || !config.database_path || config.database_url || !inspectLockHolder(config.database_path).held) return false;@@ -242,7 +241,10 @@ export async function maybeDelegateTrust(hostConfig: GBrainConfig | null, args:review: async filter => await call('trust_read', { view: 'review', filter: { source: filter.sourceId, kind: filter.kind, since: filter.since?.toISOString() } }) as unknown as TrustReview,explain: async (query, source) => (await call('trust_read', { view: 'explain', query, source })).items as TrustExplanation[],preview: async input => await call('trust_preview', { input }) as unknown as OwnerActionPreview,- apply: async (input, binding, confirmed) => await call('trust_apply', { input, binding, ...(confirmed ? { confirmed: 'tty' } : {}) }, DOOR_WAIT_MS + 30_000) as unknown as OwnerActionResult,+ apply: async (input, binding, confirmed) => {+ const { OWNER_APPLY_TIMEOUT_MS } = await import('../core/trust/release-publish.ts');+ return await call('trust_apply', { input, binding, ...(confirmed ? { confirmed: 'tty' } : {}) }, OWNER_APPLY_TIMEOUT_MS) as unknown as OwnerActionResult;+ },};await runTrustOwnerCommand(backend, sub!, rest);return true;diff --git a/src/core/trust/release-publish.ts b/src/core/trust/release-publish.tsindex d2fcf42e99..00582b7efd 100644--- a/src/core/trust/release-publish.ts+++ b/src/core/trust/release-publish.ts@@ -38,6 +38,8 @@ import { getWriteGateHold, releaseWriteGateHold, type WriteGateHold } from '../wexport const TRUST_RELEASE_OPERATION = 'trust_release';export const DOOR_WAIT_MS = 60_000;+/** The CLI's wait for trust_apply over the owner socket: the door's own wait plus room for the owner's work before admission. */+export const OWNER_APPLY_TIMEOUT_MS = DOOR_WAIT_MS + 30_000;interface ReleaseIntent { hold_id: number; last_seen_at: string; by: string; mode: 'append' | 'index-existing'; row_num?: number }