Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(graduation,serve): classify persistence_consumers as a discarded relation; the movement watch keeps its own timer (#6317)

garrytan8bf1d9cdd93d
diff --git a/src/commands/serve.ts b/src/commands/serve.ts
index 12eab884c6..ef9038b20a 100644
--- a/src/commands/serve.ts
+++ b/src/commands/serve.ts
@@ -578,7 +578,8 @@ function installFactsDrain(engine: BrainEngine, opts: ServeOptions, deps: StdioL
*/
function installResidentTickers(engine: BrainEngine, opts: ServeOptions, deps: StdioLifecycleDeps, shuttingDown: () => boolean): { stop(): Promise<void> } {
const factsDrain = installFactsDrain(engine, opts, deps, shuttingDown);
- const movementWatch: MovementWatch = startMovementWatch(engine, { log: deps.log, setInterval: deps.setInterval as typeof setInterval, clearInterval: deps.clearInterval as typeof clearInterval });
+ // The watch keeps its own unref'd timer: the injected lifecycle timers are the parent watchdog's and the idle sweep's, which tests count.
+ const movementWatch: MovementWatch = startMovementWatch(engine, { log: deps.log });
return { stop: async () => { movementWatch.stop(); await factsDrain?.stop(); } };
}
diff --git a/src/core/persistence/graduation-inventory.ts b/src/core/persistence/graduation-inventory.ts
index caf9d87d29..30434f329f 100644
--- a/src/core/persistence/graduation-inventory.ts
+++ b/src/core/persistence/graduation-inventory.ts
@@ -170,6 +170,7 @@ export const GRADUATION_INVENTORY: Inventory = {
entry('gbrain_cycle_locks', 'discard', 'operational', 'TTL run locks; every row is an orphan under the kernel lock.'),
entry('budget_reservations', 'discard', 'operational', 'Daily-ledger holds (src/core/budget/daily-ledger.ts) that expire within minutes; budget_ledger carries the day\'s totals, so a hold dropped mid-graduation stays counted as reserved until its UTC day ends (only tightening that day\'s cap).'),
entry('subagent_rate_leases', 'discard', 'operational', 'Job-owned concurrency leases that expire.'),
+ entry('persistence_consumers', 'discard', 'operational', 'Per-process consumer heartbeat rows (#6317): each is renewed every 10 s by a live process on the source host and lapses in 90 s; the target\'s consumers write their own rows.'),
entry('oauth_codes', 'discard', 'security', 'One-time authorization codes; an in-flight OAuth handshake restarts.'),
entry('page_links', 'schema_owned', 'operational', 'View over links; each engine\'s schema defines it.', { kind: 'view' }),
diff --git a/test/graduation-inventory.test.ts b/test/graduation-inventory.test.ts
index 576a114dc3..17a4ef75b6 100644
--- a/test/graduation-inventory.test.ts
+++ b/test/graduation-inventory.test.ts
@@ -60,7 +60,7 @@ describe('graduation inventory', () => {
expect(new Set(names).size).toBe(names.length);
const counts: Record<string, number> = {};
for (const e of GRADUATION_INVENTORY.entries) counts[e.class] = (counts[e.class] ?? 0) + 1;
- expect(counts).toEqual({ carry: 110, rebind: 2, rebuild: 2, discard: 6, schema_owned: 3 });
+ expect(counts).toEqual({ carry: 110, rebind: 2, rebuild: 2, discard: 7, schema_owned: 3 });
for (const e of GRADUATION_INVENTORY.entries) {
expect({ relation: e.relation, reason: e.reason.length > 5, present: e.engines.pglite || e.engines.postgres })
.toEqual({ relation: e.relation, reason: true, present: true });