Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
Publication prefetch: durable traces keep the unverified-step card stage
Barack Sokulluccd3637aac20
diff --git a/src/chrome/src/trace/privacy.js b/src/chrome/src/trace/privacy.jsindex b2ba93b14..3b24d811a 100644--- a/src/chrome/src/trace/privacy.js+++ b/src/chrome/src/trace/privacy.js@@ -124,7 +124,7 @@ const PREDISPATCH_TIMING_MS_FIELDS = ['publicationRereadMs', 'submitDetectionMs', 'submitConfirmationMs', 'permissionMs', 'completionChecksMs','recipientGuardMs', 'recipientReadingMs', 'checkpointMs', 'pipelineWaitMs', 'toolbarPreflightMs','pipelinePublicationMs', 'feedbackRecheckMs', 'genericChatMs', 'attemptCheckpointMs',- 'dispatchPreparationMs', 'preDispatchMs', 'executeToolMs', 'totalMs',+ 'dispatchPreparationMs', 'unverifiedStepCardMs', 'preDispatchMs', 'executeToolMs', 'totalMs',];function projectPredispatchTiming(data) {const extra = {};diff --git a/src/firefox/src/trace/privacy.js b/src/firefox/src/trace/privacy.jsindex b2ba93b14..3b24d811a 100644--- a/src/firefox/src/trace/privacy.js+++ b/src/firefox/src/trace/privacy.js@@ -124,7 +124,7 @@ const PREDISPATCH_TIMING_MS_FIELDS = ['publicationRereadMs', 'submitDetectionMs', 'submitConfirmationMs', 'permissionMs', 'completionChecksMs','recipientGuardMs', 'recipientReadingMs', 'checkpointMs', 'pipelineWaitMs', 'toolbarPreflightMs','pipelinePublicationMs', 'feedbackRecheckMs', 'genericChatMs', 'attemptCheckpointMs',- 'dispatchPreparationMs', 'preDispatchMs', 'executeToolMs', 'totalMs',+ 'dispatchPreparationMs', 'unverifiedStepCardMs', 'preDispatchMs', 'executeToolMs', 'totalMs',];function projectPredispatchTiming(data) {const extra = {};diff --git a/test/publication-prefetch.mjs b/test/publication-prefetch.mjsindex 507baa15f..286b740d0 100644--- a/test/publication-prefetch.mjs+++ b/test/publication-prefetch.mjs@@ -377,6 +377,22 @@ for (const browser of ['chrome', 'firefox']) {assert.deepEqual(f.calls.map(call => call.name), ['social_publication_contract', 'social_publication_authorization']);});+ test(`${browser}: every predispatch stage the agent records survives the trace projection`, async () => {+ const fs = await import('node:fs/promises');+ const source = await fs.readFile(new URL(`../src/${browser}/src/agent/agent.js`, import.meta.url), 'utf8');+ const stages = new Set();+ for (const pattern of [/predispatch\.(?:lap|add)\('([A-Za-z]+Ms)'/g, /timedCheck\('([A-Za-z]+Ms)'/g,+ /_predispatchStage\(tabId, '([A-Za-z]+Ms)'/g, /'(publicationAudit(?:Awaited|Reused)Ms)'/g]) {+ for (const match of source.matchAll(pattern)) stages.add(match[1]);+ }+ assert.ok(stages.has('unverifiedStepCardMs'), 'the wait on an unverified-step card is a stage');+ assert.ok(stages.size >= 20, `only ${stages.size} stages found`);+ const extra = Object.fromEntries([...stages].map(stage => [stage, 5]));+ const projected = projectTraceEventData('note', { step: 1, note: 'predispatch_timing',+ extra: { ...extra, tool: 'click_ax', outcome: 'dispatched' } });+ for (const stage of stages) assert.equal(projected.extra[stage], 5, `${stage} is dropped from durable traces`);+ });+test(`${browser}: a background check is traced to the run that started it, and not at all once that run moved on`, async () => {// Bound: a repair attempt is traced to the starting run even when the// tab's run id changed while the first attempt ran.