Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge origin/master (#6435, #6443) into capy/w13-pr2-persistence-sync

time-attackd603e91edc25
diff --cc src/core/persistence/consumer.ts
index 05f0cd5abc,626edc04df..ffc6ca52df
--- a/src/core/persistence/consumer.ts
+++ b/src/core/persistence/consumer.ts
@@@ -625,21 -661,9 +666,22 @@@ export class PersistenceConsumer implem
return isTerminal(row);
}
/** #6278: abandoned preparations past the ceiling have reached this process's cap; it claims nothing more until it restarts. */
- restartRequired(): boolean { return this.zombies.size >= (this.opts.zombieCap ?? DEFAULT_ZOMBIE_CAP); }
+ restartRequired(): boolean { return this.zombies.size >= (this.opts.zombieCap ?? DEFAULT_ZOMBIE_CAP) || this.stuckPublications.size > 0; }
+ /** #6288 (P2.3): the consumer's side of `boundPublication`: the claim stamp at the ceiling, restart_required past it. */
+ private publicationBound(row: WriteRequest, ceilingMs: number, clock?: ClaimPhaseClock): PublicationBound {
+ return { ceilingMs,
+ onOverdue: () => {
+ if (clock) clock.waitingOn = 'publication_deadline';
+ this.log('publication', 'publication_deadline', `request ${row.request_id}: publishing past the ${ceilingMs} ms ceiling; its transaction's server-side timeouts end it on Postgres`);
+ },
+ onStuck: settled => {
+ this.stuckPublications.set(row.id, { request_id: row.request_id, stuck_at: new Date().toISOString() });
+ void settled.then(() => { this.stuckPublications.delete(row.id); });
+ this.log('publication', 'restart_required', `request ${row.request_id}: the publication has not settled past the ceiling and its grace; restart this process (its root stays held until then)`);
+ } };
+ }
status() {
+ const drain = this.draining;
const { deadlines, syncMs, maintenanceMs, ceilingMs, maxAttempts } = this.policy;
return { accepting: !this.stopping, active_preparations: this.active.size, active_worktrees: this.activeRoots.size,
sampled_at: new Date().toISOString(), observation_scope: 'current_process_reset_on_restart',
@@@ -651,7 -675,8 +693,9 @@@
abandoned_preparations: this.abandoned.size,
outlived_ceiling: [...this.zombies.values()].map(value => ({ ...value })),
restart_required: this.restartRequired(),
+ stuck_publications: [...this.stuckPublications.values()].map(value => ({ ...value })),
+ // The effects drain in progress: since when, no-op embedding effects settled in bulk, effects run.
+ ...(drain ? { draining: { since: new Date(drain.since).toISOString(), settled_noop_embeddings: drain.settled, ran: drain.ran } } : {}),
// #6317: which connection this consumer's statements take, and whether the ordinary pool is a transaction-mode pooler.
connection: consumerConnectionRoute(this.engine),
...(this.lastError ? { last_error: { ...this.lastError } } : {}) };