Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: pre-landing review fixes
garrytan4ee14306ba60
diff --git a/src/core/google/people-calendar-sweep.ts b/src/core/google/people-calendar-sweep.tsindex dd2254c2b3..85cf3a4ca9 100644--- a/src/core/google/people-calendar-sweep.ts+++ b/src/core/google/people-calendar-sweep.ts@@ -51,8 +51,10 @@ export async function sweepContacts(// recorded) is unusable, so the sweep lists fully once and then records the// new token with the mask it was minted under.const maskChanged = state.contacts_person_fields !== CONTACT_PERSON_FIELDS;- // #8906: a full re-list that a deadline or the page budget stopped resumes at its checkpointed page.- const resumeToken = state.contacts_relist?.person_fields === CONTACT_PERSON_FIELDS ? state.contacts_relist.page_token : null;+ // #8906: a full re-list that a deadline or the page budget stopped resumes at its checkpointed page. --full lists+ // from page 1 to the end in one run, as it did before the checkpoint.+ const resumeToken = !deps.opts.full && state.contacts_relist?.person_fields === CONTACT_PERSON_FIELDS ? state.contacts_relist.page_token : null;+ const pageBudget = deps.opts.full ? Infinity : CONTACT_RELIST_PAGES_PER_RUN;const syncToken = deps.opts.full || maskChanged || resumeToken ? null : state.contacts_sync_token;if (maskChanged && state.contacts_sync_token && !deps.opts.full && !resumeToken) deps.log('[google] contacts field mask changed; full re-list');let groupNames: Record<string, string> | null = null;@@ -95,7 +97,7 @@ export async function sweepContacts(// list from page 1, once.let pageToken = resumeToken;if (resumeToken) deps.log('[google] contacts full re-list resuming at its checkpointed page');- for (let pages = 0; pages < CONTACT_RELIST_PAGES_PER_RUN && !listed; pages++) {+ for (let pages = 0; pages < pageBudget && !listed; pages++) {let page;try {page = await people.listConnectionsPage(pageToken, signal);diff --git a/test/contacts-relist-checkpoint-8906.slow.test.ts b/test/contacts-relist-checkpoint-8906.slow.test.tsindex 29d1bf67b3..9715f3dcdd 100644--- a/test/contacts-relist-checkpoint-8906.slow.test.ts+++ b/test/contacts-relist-checkpoint-8906.slow.test.ts@@ -197,4 +197,21 @@ describe('contacts full re-list checkpoints (#8906)', () => {rmSync(dir, { recursive: true, force: true });}}, 240_000);+test('--full ignores a saved re-list checkpoint and the page budget: it lists from page 1 to the end before recording last_full_at', async () => {+ const { dir, cfg } = await googleSource();+ try {+ seedState(dir, { contacts_sync_token: null, contacts_person_fields: CONTACT_PERSON_FIELDS, contacts_relist: { page_token: 'p3', person_fields: CONTACT_PERSON_FIELDS } });+ const api = peopleApi(11);+ await withEnv({ GBRAIN_HOME: mkdtempSync(join(tmpdir(), 'gbrain-home-8906-')), GBRAIN_TEST_8906_TOKEN: 'synthetic-fixture-token' }, () =>+ runGoogleSync(engine, 'gsrc', cfg, { sourceId: 'gsrc', full: true, noEmbed: true, noExtract: true, noSchemaPack: true }, api.fetchImpl));+ expect(api.served).toEqual(Array.from({ length: 11 }, (_, i) => 'p' + (i + 1)));+ const state = readGoogleState(dir);+ expect(state.contacts_sync_token).toBe('ppl-new');+ expect(relistOf(dir)).toBeNull();+ expect(state.last_full_at).toBeTruthy();+ expect(await personPages()).toBe(2_200);+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ }, 240_000);});