Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

feat(sync): six lanes by default (clamped to the pool)

garrytandf1de31abd18
diff --git a/src/commands/sync/args.ts b/src/commands/sync/args.ts
index 15b5f00105..1ceca8e9d3 100644
--- a/src/commands/sync/args.ts
+++ b/src/commands/sync/args.ts
@@ -95,7 +95,7 @@ Options:
GBRAIN_SYNC_BULK=0; tune with sync.bulk_size and
sync.bulk_max_txn_ms.
--lanes N Managed Postgres sync: publish up to N bulk groups at
- once (1-8, default 4, capped by the connection pool).
+ once (1-8, default 6, capped by the connection pool).
Pages still commit in file order. Persist with
'gbrain config set sync.lanes N' or GBRAIN_SYNC_LANES.
--no-lanes Same as --lanes 1: one bulk group at a time.
diff --git a/src/core/persistence/sync-group.ts b/src/core/persistence/sync-group.ts
index f95af526ac..dd0564e9ed 100644
--- a/src/core/persistence/sync-group.ts
+++ b/src/core/persistence/sync-group.ts
@@ -45,15 +45,15 @@ async function resolveGrouping(engine: BrainEngine, noBulk: boolean | undefined)
return { enabled: true, reason: null, size, maxTxnMs };
}
/**
- * #5984 lanes: `--lanes N` / `--no-lanes` > `GBRAIN_SYNC_LANES` > `sync.lanes` > 4, then clamped to what the
+ * #5984 lanes: `--lanes N` / `--no-lanes` > `GBRAIN_SYNC_LANES` > `sync.lanes` > 6, then clamped to what the
* connection pool can hold at once (its long-hold capacity minus 3 for the sync loop, one foreground write and
* the consumer's control work). Lanes need bulk groups.
*/
async function resolveLanes(engine: BrainEngine, bulk: BulkSettings, flag: number | undefined): Promise<{ lanes: number; lanesReason: string | null }> {
if (!bulk.enabled) return { lanes: 1, lanesReason: `bulk groups are off (${bulk.reason})` };
if (flag !== undefined && (!Number.isInteger(flag) || flag < 1 || flag > 8)) throw new OperationError('invalid_params', `--lanes must be a whole number from 1 to 8; got ${flag}.`,
- 'Pass --lanes 4 (the default), or --no-lanes to publish one group at a time.');
- const asked = flag ?? await whole(engine, 'GBRAIN_SYNC_LANES', 'sync.lanes', 4, 1, 8);
+ 'Pass --lanes 6 (the default), or --no-lanes to publish one group at a time.');
+ const asked = flag ?? await whole(engine, 'GBRAIN_SYNC_LANES', 'sync.lanes', 6, 1, 8);
if (asked === 1) return { lanes: 1, lanesReason: flag === 1 ? 'disabled by --no-lanes' : 'disabled by sync.lanes=1 (or GBRAIN_SYNC_LANES=1)' };
const pool = (engine as BrainEngine & { sql?: BudgetPool }).sql;
const capacity = pool ? poolLongHoldCapacity(pool) - 3 : 1;
diff --git a/test/managed-sync-lanes.test.ts b/test/managed-sync-lanes.test.ts
index 521a730ad5..567156225c 100644
--- a/test/managed-sync-lanes.test.ts
+++ b/test/managed-sync-lanes.test.ts
@@ -55,9 +55,9 @@ afterAll(async () => {
rmSync(home, { recursive: true, force: true });
});
-test('lane settings follow flag > env > config > 4, clamp to the pool and need bulk groups', async () => {
+test('lane settings follow flag > env > config > 6, clamp to the pool and need bulk groups', async () => {
if (!engine) return;
- expect(await resolveBulkSettings(engine, false)).toMatchObject({ enabled: true, lanes: 4, lanesReason: null });
+ expect(await resolveBulkSettings(engine, false)).toMatchObject({ enabled: true, lanes: 6, lanesReason: null });
expect(await resolveBulkSettings(engine, false, 1)).toMatchObject({ lanes: 1, lanesReason: 'disabled by --no-lanes' });
expect(await resolveBulkSettings(engine, false, 8)).toMatchObject({ lanes: 8, lanesReason: null });
expect(await resolveBulkSettings(engine, true, 4)).toMatchObject({ enabled: false, lanes: 1 });