Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(E10): flip gmail_sweep_loops_enqueue, loops_close and cycle_extract green; cover the dispatch -> sync handler chain (#5867)
garrytanbbffa0a8140c
diff --git a/test/google-loops-recovery.serial.test.ts b/test/google-loops-recovery.serial.test.tsindex 943b167936..d65855c222 100644--- a/test/google-loops-recovery.serial.test.ts+++ b/test/google-loops-recovery.serial.test.ts@@ -20,6 +20,7 @@ import { parseGoogleSourceConfig, runGoogleSync } from '../src/core/google/googlimport { readGoogleState } from '../src/core/google/google-source.ts';import { GRACE_REFETCH_PER_SWEEP } from '../src/core/google/loop-catchup.ts';import { makeLoopsExtractHandler } from '../src/core/minions/handlers/loops-extract.ts';+import { makeSyncHandler } from '../src/core/minions/handlers/sync.ts';import { connectorHeldItemsCheck } from '../src/commands/doctor/checks/connector-holds.ts';import { disposePersistenceConsumer } from '../src/core/persistence/service.ts';import { __clearSuppressionCacheForTests } from '../src/core/google/loop-detect.ts';@@ -138,6 +139,25 @@ describe('#5867 managed Gmail sweeps enqueue loops_extract', () => {}}), 180_000);+ test('the autopilot dispatch → sync handler chain on a managed source queues loops_extract', async () => withEnv(env, async () => {+ chatReady();+ for (const engine of engines) {+ await engine.setConfig('loops.extraction_enabled', 'true');+ const f = await gmailSource(engine, true);+ const { gmail, fetcher } = fakeGmail(f.cfg.account, [{ tid: '17aa00000000e051', ms: Date.now() - 2 * DAY }]);+ const realFetch = globalThis.fetch;+ globalThis.fetch = withGoogleAccount(fetcher, f.cfg.account) as typeof fetch;+ try {+ // The job data autopilot-dispatch's connector freshness sync submits (no noExtract: the handler defaults it to true).+ await makeSyncHandler(engine)({ id: 1, name: 'sync', data: { sourceId: f.id, pull: false, auto_embed_backfill: true, embed_reason: 'autopilot_freshness' },+ signal: new AbortController().signal, updateProgress: async () => {}, log: async () => {} } as never);+ } finally { globalThis.fetch = realFetch; }+ expect(gmail.threadReads.length).toBeGreaterThan(0);+ expect((await loopsJobs(engine, f.id)).filter((j) => j.idempotency_key.startsWith('loops:'))).toHaveLength(1);+ await disposePersistenceConsumer(engine);+ }+ }), 180_000);+test('the kill switch logs a skip and queues nothing on the sweep or the catch-up', async () => withEnv(env, async () => {chatReady();for (const engine of engines) {diff --git a/test/helpers/managed-connector-job-contract.ts b/test/helpers/managed-connector-job-contract.tsindex d52e6193ec..67f84d420f 100644--- a/test/helpers/managed-connector-job-contract.ts+++ b/test/helpers/managed-connector-job-contract.ts@@ -89,9 +89,6 @@ export const POSTGRES_ONLY_CASES: ReadonlySet<ContractCase> = new Set(['synthesi* passes. `signature` must match the case's failure message.*/export const EXPECTED_FAILURES: Partial<Record<ContractCase, { issue: string; signature: RegExp; engines?: ReadonlyArray<'pglite' | 'postgres'> }>> = {- gmail_sweep_loops_enqueue: { issue: '#5867', signature: /loops_extract jobs enqueued by the managed sweep: 0/ },- loops_close: { issue: '#5869', signature: /loops_close reported fact_expired=true but the fact is still active/ },- cycle_extract: { issue: '#5875', signature: /cycle extract phase: skipped \(no_brain_dir\)/ },atom_drain_default_off: { issue: '#5856', signature: /extract-atoms-drain ended dead after 3 attempt\(s\): Atom maintenance requires the configured canonical owner/ },atom_drain_opted_in: { issue: '#5856', signature: /extract-atoms-drain ended dead after 3 attempt\(s\): Atom maintenance requires the configured canonical owner/ },atom_dispatch: { issue: '#5856', signature: /auto-drain submitted extract-atoms-drain for the connector source with connector atoms off/, engines: ['postgres'] },