Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
batch entries: batch-wide reads and the drain hand-off start their own stretch; sync status folds the admission probe into its source read
garrytan5a7b4530135d
diff --git a/src/core/persistence/sync-admission.ts b/src/core/persistence/sync-admission.tsindex 7249882733..5b3baa7c26 100644--- a/src/core/persistence/sync-admission.ts+++ b/src/core/persistence/sync-admission.ts@@ -104,24 +104,51 @@ export async function writeSyncAdmission(engine: Pick<BrainEngine, 'transaction'});}+/** `effective`'s two probes as SQL: `e` names the expressions they read (binds, or columns of an enclosing read). */+function effectProbes(e: { lock: string; passOp: string; passKey: string; setAt: string; sourceId: string; incarnation: string; kinds: string }) {+ return {+ pinned: `EXISTS (SELECT 1 FROM op_checkpoints p JOIN gbrain_cycle_locks l ON l.id=${e.lock} AND l.ttl_expires_at > now()+ AND l.acquisition_token::text = p.completed_keys->0->>'lease_token'+ WHERE p.op=${e.passOp} AND p.fingerprint=${e.passKey} AND p.completed_keys->0->'telemetry'->>'outcome'='open'+ AND (${e.setAt} IS NULL OR (p.completed_keys->0->'telemetry'->>'started_at')::timestamptz < ${e.setAt}))`,+ destructive: `EXISTS (SELECT 1 FROM persistence_requests r WHERE r.source_id=${e.sourceId} AND r.source_incarnation=${e.incarnation}+ AND r.state IN ('queued','running','recovering') AND r.intent->>'kind' = ANY(${e.kinds})+ AND (${e.setAt} IS NULL OR r.created_at < ${e.setAt}))`,+ };+}++/**+ * GBRA-135: `effective`'s probes folded into a read that joins the setting (`syncAdmissionSettingSql`) and the source row+ * `src`, as columns `admission_pinned` and `admission_destructive`: `sync status` reads them with its source, so a+ * restricted value costs it no statement of its own. `$k`..`$k+2` bind `syncAdmissionEffectParams`. Both are null while+ * the stored value reads as `normal` (the guard trims less than `parseSyncAdmission`, so any other value is probed).+ */+export function syncAdmissionEffectSql(k: number, src: string): string {+ const setAt = "(CASE WHEN ao.completed_keys->0->>'value' = ac.value THEN (ao.completed_keys->0->>'set_at')::timestamptz END)";+ const probes = effectProbes({ lock: `$${k}`, kinds: `$${k + 1}::text[]`, passOp: `$${k + 2}`, passKey: `${src}.id||':'||${src}.incarnation::text`, setAt,+ sourceId: `${src}.id`, incarnation: `${src}.incarnation` });+ const restricted = "COALESCE(btrim(ac.value), '') NOT IN ('', 'normal')";+ return `CASE WHEN ${restricted} THEN ${probes.pinned} END AS admission_pinned, CASE WHEN ${restricted} THEN ${probes.destructive} END AS admission_destructive`;+}+export const syncAdmissionEffectParams = (sourceId: string) => [syncLockId(sourceId), [...SYNC_ADMISSION_DESTRUCTIVE_KINDS], MANAGED_SYNC_PASS_OP];++/** A setting row with `effective`'s probes read beside it (`syncAdmissionEffectSql`). */+export interface SyncAdmissionEffectRow extends SyncAdmissionSettingRow { pinned: boolean | null; destructive: boolean | null }+/*** `sync status`'s `admission` of one source incarnation (design §8). `effective` is always true for `normal`; otherwise* it is false while the source's pass row is `open` with `started_at` before `set_at` and its `lease_token` holds the* live drain lease, or while a destructive request of the incarnation admitted before `set_at` is still queued,- * running or recovering. `read` is the setting row a caller already read with `syncAdmissionSettingSql`.+ * running or recovering. `read` is the setting row a caller already read with `syncAdmissionSettingSql`, and its probes+ * when it read them too (`syncAdmissionEffectSql`).*/-export async function syncAdmissionStatus(engine: Exec, sourceId: string, incarnation: string, read?: SyncAdmissionSettingRow): Promise<SyncAdmissionStatus> {+export async function syncAdmissionStatus(engine: Exec, sourceId: string, incarnation: string, read?: SyncAdmissionSettingRow | SyncAdmissionEffectRow): Promise<SyncAdmissionStatus> {const { value, raw_set_at } = read ? settingOf(read) : await readSetting(engine);const set_at = iso(raw_set_at);if (value === 'normal') return { value, set_at, effective: true };- const [row] = await engine.executeRaw<{ pinned: boolean; destructive: boolean }>(`SELECT- EXISTS (SELECT 1 FROM op_checkpoints p JOIN gbrain_cycle_locks l ON l.id=$1 AND l.ttl_expires_at > now()- AND l.acquisition_token::text = p.completed_keys->0->>'lease_token'- WHERE p.op=$2 AND p.fingerprint=$3 AND p.completed_keys->0->'telemetry'->>'outcome'='open'- AND ($4::timestamptz IS NULL OR (p.completed_keys->0->'telemetry'->>'started_at')::timestamptz < $4::timestamptz)) AS pinned,- EXISTS (SELECT 1 FROM persistence_requests r WHERE r.source_id=$5 AND r.source_incarnation=$6::uuid- AND r.state IN ('queued','running','recovering') AND r.intent->>'kind' = ANY($7::text[])- AND ($4::timestamptz IS NULL OR r.created_at < $4::timestamptz)) AS destructive`,- [syncLockId(sourceId), MANAGED_SYNC_PASS_OP, passFingerprint(sourceId, incarnation), raw_set_at, sourceId, incarnation, [...SYNC_ADMISSION_DESTRUCTIVE_KINDS]]);+ const probes = effectProbes({ lock: '$1', passOp: '$2', passKey: '$3', setAt: '$4::timestamptz', sourceId: '$5', incarnation: '$6::uuid', kinds: '$7::text[]' });+ const [row] = read && 'pinned' in read && read.pinned !== null && read.destructive !== null ? [read]+ : await engine.executeRaw<{ pinned: boolean; destructive: boolean }>(`SELECT ${probes.pinned} AS pinned, ${probes.destructive} AS destructive`,+ [syncLockId(sourceId), MANAGED_SYNC_PASS_OP, passFingerprint(sourceId, incarnation), raw_set_at, sourceId, incarnation, [...SYNC_ADMISSION_DESTRUCTIVE_KINDS]]);return { value, set_at, effective: !row?.pinned && !row?.destructive };}diff --git a/src/core/persistence/sync-pass-run.ts b/src/core/persistence/sync-pass-run.tsindex 76079e25a3..8bd018bd51 100644--- a/src/core/persistence/sync-pass-run.ts+++ b/src/core/persistence/sync-pass-run.ts@@ -175,6 +175,8 @@ async function batchEntries(engine: BrainEngine, level: ShadowLevel, deletes: Shconst discovery = { root: level.root, gitRoot: level.gitRoot, target: level.head, sourceId: level.sourceId } as SyncDiscovery;const named = (entry: ShadowPath): SyncEntry => ({ ...entryPaths(level, entry.path), action: 'import', working: working(entry) });if (adopting.length) {+ // A batch-wide read runs on this thread under PGLite (at 8k new files, about as long as the loops' budget): it starts a stretch of its own.+ await step.pause();const identities = await engine.executeRaw<LegacyIdentity>("SELECT id, slug, source_path, deleted_at, frontmatter->>'id' AS fm_id FROM pages WHERE source_id=$1 AND (source_path IS NULL OR slug=ANY($2::text[]))",[level.sourceId, [...new Set(adopting.map(entry => slugOf.get(entry.path)!))]]);const bySlug = new Map(identities.map(page => [page.slug, page]));@@ -186,6 +188,7 @@ async function batchEntries(engine: BrainEngine, level: ShadowLevel, deletes: Sh}}const slugs = [...new Set([...slugOf.values()].filter(Boolean))];+ if (slugs.length) await step.pause();const holders = new Map((slugs.length ? await engine.executeRaw<{ id: number | string; slug: string; source_path: string | null; revision: string; deleted: boolean; unbound: boolean; fm_id: string | null }>(`SELECT id, slug, source_path, knowledge_revision::text AS revision, deleted_at IS NOT NULL AS deleted, ${databaseOnlyPageSql('pages')} AS unbound, frontmatter->>'id' AS fm_id FROM pages WHERE source_id=$1 AND slug=ANY($2::text[])`, [level.sourceId, slugs]) : []).map(page => [page.slug, page]));@@ -283,7 +286,10 @@ async function batchEntries(engine: BrainEngine, level: ShadowLevel, deletes: Sh}entries.push({ ...base, pageId: null, revision: null });}- return { entries: [...deleteEntries.values(), ...entries.sort((a, b) => a.path.localeCompare(b.path))], collisions, skipped, downgrades, identity };+ const batch = [...deleteEntries.values(), ...entries.sort((a, b) => a.path.localeCompare(b.path))];+ // The drain freezes the batch's first entry (and reads its blob window) right after: it starts on a turn of its own too.+ await step.pause();+ return { entries: batch, collisions, skipped, downgrades, identity };}/**diff --git a/src/core/persistence/sync-status.ts b/src/core/persistence/sync-status.tsindex 46b5125b06..f0f622a8aa 100644--- a/src/core/persistence/sync-status.ts+++ b/src/core/persistence/sync-status.ts@@ -45,7 +45,7 @@ import { sha256 } from './digest.ts';import { passResumeArgs } from './sync-pass-readers.ts';import { passConvergence, passStatusNext, passStatusState } from './sync-pass-status.ts';import { MANAGED_SYNC_PASS_OP, readPassRow, SYNC_DELETES_WITHHELD_OP, type PassRow } from './sync-pass-row.ts';-import { SYNC_ADMISSION_SETTING_PARAMS, syncAdmissionSettingSql, syncAdmissionStatus } from './sync-admission.ts';+import { SYNC_ADMISSION_SETTING_PARAMS, syncAdmissionEffectParams, syncAdmissionEffectSql, syncAdmissionSettingSql, syncAdmissionStatus } from './sync-admission.ts';import type { DeletesWithheld } from './sync-markers.ts';import { listIdentityDowngrades, withIdentityRemedies } from '../sync-identity-downgrades.ts';import { GIT_PUSH_CODES, readGitPushHolds, type GitPushHold } from './git-push-holds.ts';@@ -278,15 +278,16 @@ export async function readSyncStatus(engine: BrainEngine, sourceId: string, opts// #6712 PR 4b (design §9): the pass row and the withheld-delete record ride the source read (primary-key probes), so the plain status keeps its statement budget.const admissionSql = syncAdmissionSettingSql(4);const [source] = await engine.executeRaw<{ incarnation: string; pass_value: PassRow['value'] | null; pass_updated_at: Date | string | null; withheld: DeletesWithheld | null;- admission_stored: string | null; admission_row_value: string | null; admission_set_at: string | null; writeback_failed: string | null }>(- `SELECT s.incarnation::text AS incarnation, p.completed_keys->0 AS pass_value, p.updated_at AS pass_updated_at, w.completed_keys->0 AS withheld, ${admissionSql.columns},+ admission_stored: string | null; admission_row_value: string | null; admission_set_at: string | null; admission_pinned: boolean | null; admission_destructive: boolean | null;+ writeback_failed: string | null }>(+ `SELECT s.incarnation::text AS incarnation, p.completed_keys->0 AS pass_value, p.updated_at AS pass_updated_at, w.completed_keys->0 AS withheld, ${admissionSql.columns}, ${syncAdmissionEffectSql(7, 's')},(SELECT r.request_id::text FROM persistence_effects e JOIN persistence_requests r ON r.id=e.request_id WHERE e.kind='git' AND e.state='failed'AND e.request_id IN (SELECT id::uuid FROM jsonb_array_elements_text(CASE WHEN jsonb_typeof(p.completed_keys->0->'obligations'->'converged'->'writeback')='array'THEN p.completed_keys->0->'obligations'->'converged'->'writeback' ELSE '[]'::jsonb END) AS w(id)) ORDER BY e.id LIMIT 1) AS writeback_failed FROM sources sLEFT JOIN op_checkpoints p ON p.op=$2 AND p.fingerprint=s.id||':'||s.incarnation::textLEFT JOIN op_checkpoints w ON w.op=$3 AND w.fingerprint=s.id||':'||s.incarnation::text${admissionSql.joins}- WHERE s.id=$1 AND s.archived IS NOT TRUE`, [sourceId, MANAGED_SYNC_PASS_OP, SYNC_DELETES_WITHHELD_OP, ...SYNC_ADMISSION_SETTING_PARAMS]);+ WHERE s.id=$1 AND s.archived IS NOT TRUE`, [sourceId, MANAGED_SYNC_PASS_OP, SYNC_DELETES_WITHHELD_OP, ...SYNC_ADMISSION_SETTING_PARAMS, ...syncAdmissionEffectParams(sourceId)]);if (!source) throw Object.assign(new Error(`Source ${sourceId} does not exist.`), { code: 'not_found' });const failures = (await readManagedSyncFailures(engine, [sourceId])).filter(failure => failure.code !== 'sync_incomplete');const selected = await cursorHeader(engine, sourceId, source.incarnation, failures[0]?.cursor_key ?? null);@@ -378,7 +379,7 @@ export async function readSyncStatus(engine: BrainEngine, sourceId: string, optsconst fenceHolds = committed?.fence_held ? await (await import('../generations/fence.ts')).fenceHoldEntries(engine, [sourceId]) : [];const [state, stateReason] = statusState({ human: !!(liveError?.needs_human), heldForHuman: holds.some(hold => hold.needs_human), oldest, recovery, liveJob: liveJob !== null, unfinished, lastError: !!liveError, actionable: actionable.length > 0, holds: holds.length > 0, pass: passState });const admission = await syncAdmissionStatus(engine, sourceId, source.incarnation,- { stored: source.admission_stored, row_value: source.admission_row_value, set_at: source.admission_set_at });+ { stored: source.admission_stored, row_value: source.admission_row_value, set_at: source.admission_set_at, pinned: source.admission_pinned, destructive: source.admission_destructive });const passNext = passRow && passState && passState[1] === stateReason ? passStatusNext(sourceId, passState[1], passRow, resume, source.writeback_failed) : null;return { source_id: sourceId, run_id: header?.runId ?? null,cursor: header ? { index: Number(header.index), total: Number(header.total), pinned_target: header.target ?? null, last_advance_at: p ? new Date(p.lastAt).toISOString() : null, done: !!header.done } : null,diff --git a/test/sync-admission-6712.test.ts b/test/sync-admission-6712.test.tsindex 9873aa010f..e127c958e5 100644--- a/test/sync-admission-6712.test.ts+++ b/test/sync-admission-6712.test.ts@@ -74,7 +74,12 @@ async function admitRequest(kind: string, createdAgo: string): Promise<string> {[id, SOURCE, incarnation, `notes/alice-example-${id.slice(0, 8)}`, randomUUID(), kind, createdAgo]);return id;}-const status = () => syncAdmissionStatus(engine, SOURCE, incarnation);+/** The standalone read; `sync status` folds the same probes into its source read (GBRA-135) and must agree with it. */+async function status() {+ const standalone = await syncAdmissionStatus(engine, SOURCE, incarnation);+ expect((await readSyncStatus(engine, SOURCE, { detail: false })).admission).toEqual(standalone);+ return standalone;+}async function setManaged(enabled: boolean) {await engine.transaction(async tx => {await declarePersistenceProtocol(tx);@@ -90,7 +95,8 @@ for (const backend of testBackends()) describe(backend, () => {await engine.initSchema();incarnation = (await engine.executeRaw<{ incarnation: string }>('SELECT incarnation::text AS incarnation FROM sources WHERE id=$1', [SOURCE]))[0]!.incarnation;}, 120_000);- afterAll(async () => { await engine.disconnect(); });+ // A shared Postgres keeps no restricted value for the next file (it cost sync status a statement, GBRA-135).+ afterAll(async () => { await reset(); await engine.disconnect(); });beforeEach(reset);test('config set sync.admission refuses a value outside the three and writes nothing, --force included', async () => {diff --git a/test/sync-pass-batch-entries-6712.test.ts b/test/sync-pass-batch-entries-6712.test.tsindex 0257281d8a..904e618f82 100644--- a/test/sync-pass-batch-entries-6712.test.ts+++ b/test/sync-pass-batch-entries-6712.test.ts@@ -11,11 +11,19 @@* loaded 16-vCPU CI VM, against the 100 ms bound. Its loops now yield as a level's own loops do (sync-yield.ts). The second* probe makes each new file's slug cost SLUG_CPU_MS of CPU, so a build that does not yield holds timers well past the* bound on any machine (451 ms here before the fix).+ *+ * GBRA-135: CI still saw 116 ms on the second probe. The loops' budget counted only loop work, but the batch's+ * legacy-identity and slug-holder reads run on this thread under PGLite (8-25 ms each here at 8k new files), and the drain+ * freezes the first entry right after the batch returns (about 26 ms of CPU: it reads its blob window). A loop's last+ * stretch ran on through the next read, and the batch's last stretch through the first freeze: 55-62 ms here before the+ * fix, 32-48 ms after. Each read and the hand-off now start on a timer turn of their own. The third probe checks each seam+ * for that turn; it fails at all three seams before the fix, and at each one alone when only its pause is removed.*/import { afterEach, describe, expect, spyOn } from 'bun:test';import { execFileSync } from 'node:child_process';import type { BrainEngine } from '../src/core/engine.ts';import * as syncCore from '../src/core/sync.ts';+import * as syncDiscovery from '../src/core/persistence/sync-discovery.ts';import { installFaultHook } from '../src/core/persistence/fault-points.ts';import { performManagedSync } from '../src/core/persistence/sync-run.ts';import { watchLoopLag } from './helpers/cpu-time.ts';@@ -77,4 +85,40 @@ describe('GBRA-133 PR 2b: a first sync builds its batch in linear time', () => {expect(Math.round(maxLag!)).toBeLessThan(MAX_LAG_MS);} finally { spy.mockRestore(); }}, { setup }), 300_000);++ isolatedTest(import.meta.path, 'each batch-wide read and the first freeze start on a timer turn of their own', () => managedBrain(async ({ engine }) => {+ // A counter ticks on every timer turn (1 ms interval). The work before each seam runs 2 ms more, so a turn there always+ // ticks it: the last new file's slug before the legacy-identity read, the last legacy-page check before the slug-holder+ // read, and the batch's sort by path before the drain's first freeze (its first slug).+ let turns = 0, before = -1;+ const ticker = setInterval(() => { turns++; }, 1);+ const spin = (ms: number) => { const end = performance.now() + ms; while (performance.now() < end) { /* the work before the seam */ } };+ const turned: Record<string, boolean> = {};+ const reached = (seam: string) => { if (before >= 0) { turned[seam] = turns > before; before = -1; } };+ const resolve = syncCore.resolveSlugForPath, adopt = syncDiscovery.adoptLegacyPage, compare = String.prototype.localeCompare, raw = engine.executeRaw;+ let slugs = 0, adopted = 0, sorting = false;+ const slugSpy = spyOn(syncCore, 'resolveSlugForPath').mockImplementation(((...args: Parameters<typeof resolve>) => {+ if (window.open && ++slugs === PATHS) { spin(2); before = turns; }+ else if (window.open && slugs === PATHS + 1) reached('first freeze');+ return resolve(...args);+ }) as typeof resolve);+ const adoptSpy = spyOn(syncDiscovery, 'adoptLegacyPage').mockImplementation(((...args: Parameters<typeof adopt>) => {+ if (window.open && ++adopted === PATHS) { spin(2); before = turns; }+ return adopt(...args);+ }) as typeof adopt);+ const compareSpy = spyOn(String.prototype, 'localeCompare').mockImplementation(function (this: string, ...args: Parameters<typeof compare>) {+ if (window.open && adopted === PATHS && !sorting) { sorting = true; spin(2); before = turns; }+ return compare.apply(this, args);+ } as typeof compare);+ engine.executeRaw = function (this: BrainEngine, sql: string, params?: unknown[]) {+ if (window.open && sql.includes('source_path IS NULL OR slug=ANY')) reached('legacy-identity read');+ if (window.open && sql.includes('knowledge_revision::text AS revision, deleted_at IS NOT NULL AS deleted')) reached('slug-holder read');+ return raw.call(this, sql, params);+ } as typeof raw;+ try {+ await batchBuildLag(engine, () => true);+ expect([slugs, adopted, sorting]).toEqual([PATHS + 1, PATHS, true]);+ expect(turned).toEqual({ 'legacy-identity read': true, 'slug-holder read': true, 'first freeze': true });+ } finally { clearInterval(ticker); engine.executeRaw = raw; slugSpy.mockRestore(); adoptSpy.mockRestore(); compareSpy.mockRestore(); }+ }, { setup }), 300_000);});diff --git a/test/sync-status-statement-budget.test.ts b/test/sync-status-statement-budget.test.tsindex 20332fa692..55e659f53b 100644--- a/test/sync-status-statement-budget.test.ts+++ b/test/sync-status-statement-budget.test.ts@@ -9,6 +9,10 @@* about 87), not by the size of the journal.* Fails when: a status read turns per row (or per receipt), or the plain* status grows past its budget.+ * GBRA-135: a stored `sync.admission` other than `normal` (left by another test+ * on a shared local database) cost the plain status a 16th statement, its+ * `effective` probe; the probe now rides the source read. The second test+ * stores `imports_only` and fails with that statement (16 on Postgres before).* Seams: the PGLite statement counter; Postgres through the wire trace in* test/e2e/sync-status-statement-budget-postgres.test.ts.*/@@ -20,6 +24,7 @@ import type { BrainEngine } from '../src/core/engine.ts';import { PGLiteEngine } from '../src/core/pglite-engine.ts';import { PostgresEngine } from '../src/core/postgres-engine.ts';import { vacuumPersistenceQueues } from '../src/core/persistence/journal.ts';+import { SYNC_ADMISSION_KEY, SYNC_ADMISSION_SET_OP, syncAdmissionStatus, writeSyncAdmission } from '../src/core/persistence/sync-admission.ts';import { readSyncStatus } from '../src/core/persistence/sync-status.ts';import { countPgliteStatements, readSqlTrace, type StatementRecord } from './helpers/statement-counter.ts';import { requirePostgresTestDatabase, testBackends } from './helpers/test-backends.ts';@@ -30,6 +35,8 @@ const PLAIN_BUDGET = { pglite: 11, postgres: 15 } as const;const home = mkdtempSync(join(tmpdir(), 'gbrain-status-budget-'));afterAll(() => rmSync(home, { recursive: true, force: true }));+const statements = (records: StatementRecord[]) => records.filter(record => record.kind === 'execute' || record.kind === 'simple').length;+/** `rows` terminal receipts of managed imports: most committed, one in fifty failed, the newest within the last ten minutes. */async function seed(engine: BrainEngine, sourceId: string, rows: number) {await engine.executeRaw('INSERT INTO sources(id,name) VALUES($1,$1)', [sourceId]);@@ -75,7 +82,6 @@ for (const backend of testBackends()) {});test('a 61,000-receipt source costs the same statements as a 1,000-receipt one, within budget', async () => {- const statements = (records: StatementRecord[]) => records.filter(record => record.kind === 'execute' || record.kind === 'simple').length;const measured: Record<string, { plain: number; detail: number }> = {};for (const rows of [1_000, 61_000]) {const sourceId = `status-budget-${backend}-${rows}`;@@ -88,5 +94,24 @@ for (const backend of testBackends()) {expect(measured[61_000]).toEqual(measured[1_000]!);expect(measured[61_000]!.plain).toBeLessThanOrEqual(PLAIN_BUDGET[backend]);}, 300_000);++ test('a restricted sync.admission costs the plain status no statement of its own', async () => {+ const sourceId = `status-budget-${backend}-admission`;+ sources.push(sourceId);+ await seed(engine, sourceId, 1_000);+ const normal = statements(await counted(() => readSyncStatus(engine, sourceId, { detail: false })));+ await writeSyncAdmission(engine, 'imports_only');+ try {+ let admission: Awaited<ReturnType<typeof readSyncStatus>>['admission'] | undefined;+ const restricted = statements(await counted(async () => { admission = (await readSyncStatus(engine, sourceId, { detail: false })).admission; }));+ const [{ incarnation }] = await engine.executeRaw<{ incarnation: string }>('SELECT incarnation::text AS incarnation FROM sources WHERE id=$1', [sourceId]);+ expect(admission).toEqual(await syncAdmissionStatus(engine, sourceId, incarnation!));+ expect(admission).toMatchObject({ value: 'imports_only', effective: true });+ expect(restricted).toBe(normal);+ } finally {+ await engine.unsetConfig(SYNC_ADMISSION_KEY);+ await engine.executeRaw('DELETE FROM op_checkpoints WHERE op=$1', [SYNC_ADMISSION_SET_OP]);+ }+ }, 300_000);});}