Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(persistence): keep the writer-status fix first; pool-cap advice follows it

garrytan2734b5a1b4f0
diff --git a/src/core/persistence/consumer.ts b/src/core/persistence/consumer.ts
index 26b31b3938..c3f1c34911 100644
--- a/src/core/persistence/consumer.ts
+++ b/src/core/persistence/consumer.ts
@@ -894,8 +894,9 @@ export class PersistenceConsumer implements PersistenceConsumerLike {
this.lastLog = { key, at };
}
if (!this.opts.onError) process.stderr.write(`[persistence] phase=${phase} reason=${code}${poolCap ? ' cause=pool_exhausted' : ''}${detail ? ` message="${detail}"` : ''}${timing}${row ? requestLogFields(row) : ''}`
- + `; unfinished work remains tracked; fix: ${poolCap ? 'every gbrain process on this database shares the pooler\'s client limit, so run fewer long-running ones (share one gbrain serve --http) or raise the limit (docs/ENGINES.md#pool-sizing), then ' : ''}`
- + 'gbrain sources writer status --json; docs: docs/ENGINES.md#persistence-consumer-log\n');
+ + '; unfinished work remains tracked; fix: gbrain sources writer status --json'
+ + `${poolCap ? '; pool: every gbrain process on this database shares the pooler\'s client limit, so run fewer long-running ones (share one gbrain serve --http) or raise the limit (docs/ENGINES.md#pool-sizing)' : ''}`
+ + '; docs: docs/ENGINES.md#persistence-consumer-log\n');
}
/** #5373: tracks work that outlived its claim until it settles; the returned promise never rejects. */
/**
diff --git a/test/persistence-consumer-log.test.ts b/test/persistence-consumer-log.test.ts
index d181f95267..eed878f5a1 100644
--- a/test/persistence-consumer-log.test.ts
+++ b/test/persistence-consumer-log.test.ts
@@ -49,7 +49,8 @@ describe('persistence consumer stderr line', () => {
expect(line).toContain('reason=53300');
// GBRA-133: the pooler's client cap names itself and the pool-sizing fix ahead of the writer-status pointer.
expect(line).toContain('reason=53300 cause=pool_exhausted ');
- expect(line).toContain('docs/ENGINES.md#pool-sizing), then gbrain sources writer status --json');
+ expect(line).toContain('fix: gbrain sources writer status --json; pool: every gbrain process on this database shares the pooler');
+ expect(line).toContain('(docs/ENGINES.md#pool-sizing); docs: docs/ENGINES.md#persistence-consumer-log');
expect(line).toContain('message="(EMAXCONNSESSION) max clients reached in session mode - pool_size: 15 for ');
expect(line).not.toContain('secret-pw');
expect(line).toContain('fix: gbrain sources writer status --json');