Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Require a submit-correlated destination, and drop the Bluesky workflow job

Emre Sokullubfc7571339b0
diff --git a/src/chrome/src/agent/adapters.js b/src/chrome/src/agent/adapters.js
index b4a153d26..cecd09132 100644
--- a/src/chrome/src/agent/adapters.js
+++ b/src/chrome/src/agent/adapters.js
@@ -16236,24 +16236,13 @@ const ADAPTERS = [
{
name: 'bluesky',
category: 'general',
- revision: 1,
- regions: ['global'],
- jobs: ['publish-post'],
- workflow: {
- schema: ADAPTER_WORKFLOW_SCHEMA,
- jobs: {
- 'publish-post': {
- description: 'Prepare, publish, and verify a Bluesky post.',
- template: 'publish',
- stateChange: true,
- requiresSubmission: true,
- requiresLedger: false,
- stages: ['access_gate', 'fill', 'review', 'commit', 'verify', 'deliver'],
- successEvidence: ['The reviewed post appears under the intended handle at a stable /profile/<handle>/post/<id> URL.'],
- partialEvidence: ['The verified composer text, attached media, and exact account, validation, or publication blocker are reported.'],
- },
- },
- },
+ // Deliberately notes-only for now. A publish-post workflow job would route
+ // completion through the published_resource contract, which binds its
+ // identity either from a submit that changes the URL or from an
+ // observation-tool read afterwards. A Bluesky publish does neither β€” the
+ // composer closes over XHR and the agent opens the new post by clicking β€”
+ // so adding the job would leave done permanently blocked instead of
+ // letting the ordinary submit-transition evidence path verify the post.
matches: (url) => /^https?:\/\/(www\.)?bsky\.app\//.test(url),
notes: `
- The composer opens from "Compose new post" (also the "New Post" button on wider layouts) and renders as a dialog over the current feed; the URL does not change while it is open.
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index d964449df..777d60a0b 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -1644,7 +1644,11 @@ export class Agent extends LoopDetector {
_sameUrlOrigin(a, b) {
try {
- return new URL(String(a || '')).origin === new URL(String(b || '')).origin;
+ const origin = new URL(String(a || '')).origin;
+ // file:, data: and about:blank all serialise to the string "null", so
+ // comparing those would make two unrelated documents look same-origin.
+ if (!origin || origin === 'null') return false;
+ return origin === new URL(String(b || '')).origin;
} catch (_) {
return false;
}
@@ -1659,34 +1663,42 @@ export class Agent extends LoopDetector {
const submit = this._completionSubmitStates.get(tabId);
const observedUrl = pageUrl || pageState.url || '';
const normalizedObserved = this._normalizeUrl(observedUrl);
- const normalizedOriginating = this._normalizeUrl(submit?.originatingUrl || '');
- // pageState comes from a live read of the document performed for this very
- // check, so the probe is itself an observation of the page after the
- // submit. Single-page apps confirm a publish by navigating to the new
- // resource, and the tools that navigate are not in the observation set, so
- // insisting on an earlier read made the verification step the reason the
- // evidence was rejected.
- const observedAfterSubmit = !!submit
- && (submit.observedAfterSubmit === true || !!normalizedObserved);
- const documentChanged = !!submit && (
- submit.documentChanged === true
- || (!!normalizedOriginating && !!normalizedObserved && normalizedOriginating !== normalizedObserved)
- );
// What this needs to establish is that the page being reported belongs to
// the site that was submitted to, so another site's submit cannot stand in
- // for this one. Demanding the exact document the last read saw punished
- // the very navigation the completion guard asks for.
+ // for this one. Demanding the exact document the last post-submit read saw
+ // punished the very navigation the completion guard asks for: a single-page
+ // app confirms a publish by opening the new resource, and the tools that
+ // navigate there are not in the observation set, so the act of verifying
+ // moved the page off the document that carried the evidence.
+ //
+ // Everything else stays as strict as it was. A submit still has to be
+ // dispatched, still has to be observed afterwards, and still has to have
+ // changed the document or produced a success signal.
+ const observedSuccessSignal = !!submit?.completionSignalObserved || liveSignals.length > 0;
+ // Same origin alone is not evidence that this route came from the submit:
+ // navigating to /home after a no-op submit is same-origin too. The
+ // destination has to be submit-correlated β€” the published resource itself,
+ // or a page carrying an explicit success signal.
+ // Resolve the adapter from the observed URL when no workflow job was
+ // selected, so a recognised published-resource route still counts. A
+ // single-page app publish rarely has a workflow job, and that is exactly
+ // the case that needs this.
+ const observedPublishedResource = !!this._workflowPublishedResourceIdentity(
+ this._planExecutionGuards.get(tabId)?.siteWorkflow
+ || { adapterName: getActiveAdapter(observedUrl)?.name || '' },
+ observedUrl,
+ );
const currentDocumentMatchesSubmit = !!submit && (
(!!submit.currentUrl && this._normalizeUrl(submit.currentUrl) === normalizedObserved)
- || this._sameUrlOrigin(observedUrl, submit.originatingUrl || submit.currentUrl || '')
+ || ((observedPublishedResource || observedSuccessSignal)
+ && this._sameUrlOrigin(observedUrl, submit.originatingUrl || submit.currentUrl || ''))
);
- const observedSuccessSignal = !!submit?.completionSignalObserved || liveSignals.length > 0;
const verifiedSubmit = !!(
submit?.dispatched
- && observedAfterSubmit
+ && submit.observedAfterSubmit
&& !submit.formValidationFailed
&& currentDocumentMatchesSubmit
- && (documentChanged || observedSuccessSignal)
+ && (submit.documentChanged || observedSuccessSignal)
);
return {
submit,
diff --git a/src/firefox/src/agent/adapters.js b/src/firefox/src/agent/adapters.js
index 3514fa3ae..6475417bc 100644
--- a/src/firefox/src/agent/adapters.js
+++ b/src/firefox/src/agent/adapters.js
@@ -16235,24 +16235,13 @@ const ADAPTERS = [
{
name: 'bluesky',
category: 'general',
- revision: 1,
- regions: ['global'],
- jobs: ['publish-post'],
- workflow: {
- schema: ADAPTER_WORKFLOW_SCHEMA,
- jobs: {
- 'publish-post': {
- description: 'Prepare, publish, and verify a Bluesky post.',
- template: 'publish',
- stateChange: true,
- requiresSubmission: true,
- requiresLedger: false,
- stages: ['access_gate', 'fill', 'review', 'commit', 'verify', 'deliver'],
- successEvidence: ['The reviewed post appears under the intended handle at a stable /profile/<handle>/post/<id> URL.'],
- partialEvidence: ['The verified composer text, attached media, and exact account, validation, or publication blocker are reported.'],
- },
- },
- },
+ // Deliberately notes-only for now. A publish-post workflow job would route
+ // completion through the published_resource contract, which binds its
+ // identity either from a submit that changes the URL or from an
+ // observation-tool read afterwards. A Bluesky publish does neither β€” the
+ // composer closes over XHR and the agent opens the new post by clicking β€”
+ // so adding the job would leave done permanently blocked instead of
+ // letting the ordinary submit-transition evidence path verify the post.
matches: (url) => /^https?:\/\/(www\.)?bsky\.app\//.test(url),
notes: `
- The composer opens from "Compose new post" (also the "New Post" button on wider layouts) and renders as a dialog over the current feed; the URL does not change while it is open.
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 0c4496373..55c5ba4bd 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -1358,7 +1358,11 @@ export class Agent extends LoopDetector {
_sameUrlOrigin(a, b) {
try {
- return new URL(String(a || '')).origin === new URL(String(b || '')).origin;
+ const origin = new URL(String(a || '')).origin;
+ // file:, data: and about:blank all serialise to the string "null", so
+ // comparing those would make two unrelated documents look same-origin.
+ if (!origin || origin === 'null') return false;
+ return origin === new URL(String(b || '')).origin;
} catch (_) {
return false;
}
@@ -1373,34 +1377,42 @@ export class Agent extends LoopDetector {
const submit = this._completionSubmitStates.get(tabId);
const observedUrl = pageUrl || pageState.url || '';
const normalizedObserved = this._normalizeUrl(observedUrl);
- const normalizedOriginating = this._normalizeUrl(submit?.originatingUrl || '');
- // pageState comes from a live read of the document performed for this very
- // check, so the probe is itself an observation of the page after the
- // submit. Single-page apps confirm a publish by navigating to the new
- // resource, and the tools that navigate are not in the observation set, so
- // insisting on an earlier read made the verification step the reason the
- // evidence was rejected.
- const observedAfterSubmit = !!submit
- && (submit.observedAfterSubmit === true || !!normalizedObserved);
- const documentChanged = !!submit && (
- submit.documentChanged === true
- || (!!normalizedOriginating && !!normalizedObserved && normalizedOriginating !== normalizedObserved)
- );
// What this needs to establish is that the page being reported belongs to
// the site that was submitted to, so another site's submit cannot stand in
- // for this one. Demanding the exact document the last read saw punished
- // the very navigation the completion guard asks for.
+ // for this one. Demanding the exact document the last post-submit read saw
+ // punished the very navigation the completion guard asks for: a single-page
+ // app confirms a publish by opening the new resource, and the tools that
+ // navigate there are not in the observation set, so the act of verifying
+ // moved the page off the document that carried the evidence.
+ //
+ // Everything else stays as strict as it was. A submit still has to be
+ // dispatched, still has to be observed afterwards, and still has to have
+ // changed the document or produced a success signal.
+ const observedSuccessSignal = !!submit?.completionSignalObserved || liveSignals.length > 0;
+ // Same origin alone is not evidence that this route came from the submit:
+ // navigating to /home after a no-op submit is same-origin too. The
+ // destination has to be submit-correlated β€” the published resource itself,
+ // or a page carrying an explicit success signal.
+ // Resolve the adapter from the observed URL when no workflow job was
+ // selected, so a recognised published-resource route still counts. A
+ // single-page app publish rarely has a workflow job, and that is exactly
+ // the case that needs this.
+ const observedPublishedResource = !!this._workflowPublishedResourceIdentity(
+ this._planExecutionGuards.get(tabId)?.siteWorkflow
+ || { adapterName: getActiveAdapter(observedUrl)?.name || '' },
+ observedUrl,
+ );
const currentDocumentMatchesSubmit = !!submit && (
(!!submit.currentUrl && this._normalizeUrl(submit.currentUrl) === normalizedObserved)
- || this._sameUrlOrigin(observedUrl, submit.originatingUrl || submit.currentUrl || '')
+ || ((observedPublishedResource || observedSuccessSignal)
+ && this._sameUrlOrigin(observedUrl, submit.originatingUrl || submit.currentUrl || ''))
);
- const observedSuccessSignal = !!submit?.completionSignalObserved || liveSignals.length > 0;
const verifiedSubmit = !!(
submit?.dispatched
- && observedAfterSubmit
+ && submit.observedAfterSubmit
&& !submit.formValidationFailed
&& currentDocumentMatchesSubmit
- && (documentChanged || observedSuccessSignal)
+ && (submit.documentChanged || observedSuccessSignal)
);
return {
submit,
diff --git a/test/run.js b/test/run.js
index 3f760c1e6..7c5b2dbc9 100644
--- a/test/run.js
+++ b/test/run.js
@@ -7901,7 +7901,6 @@ test('12306 exposes a validated regional workflow profile with browser parity',
'microsoft-forms',
'gmail',
'linkedin',
- 'bluesky',
'youtube',
'railway-12306',
'douyin',
@@ -7988,7 +7987,6 @@ test('report-driven workflow adapters route exact app-owned jobs with browser pa
['https://forms.cloud.microsoft/pages/responsepage.aspx?id=x', 'microsoft-forms', 'submit-form'],
['https://mail.google.com/mail/u/0/#inbox/abc', 'gmail', 'read-complete-thread'],
['https://www.linkedin.com/feed/', 'linkedin', 'publish-post'],
- ['https://bsky.app/', 'bluesky', 'publish-post'],
['https://studio.youtube.com/video/abc/edit', 'youtube', 'update-metadata'],
['https://www.douyin.com/video/1', 'douyin', 'collect-comments'],
['https://www.naukrigulf.com/job/example', 'naukrigulf', 'submit-application'],
@@ -84858,15 +84856,35 @@ test('single-page app publish evidence survives the verification navigation', ()
`${AgentClass.name}: navigating to the published resource invalidated its own evidence`,
);
- // done reads the live document, so that read is itself the observation.
- agent._completionSubmitStates.set(tabId, publishedSubmit({
- currentUrl: 'https://bsky.app/',
- observedAfterSubmit: false,
- }));
+ // Same origin on its own is not evidence the route came from the submit.
+ // Navigating to an unrelated same-origin page after a no-op submit must
+ // not be accepted as the submitted document.
+ agent._completionSubmitStates.set(tabId, publishedSubmit({ currentUrl: 'https://bsky.app/' }));
assert.equal(
- agent._completionSubmissionEvidence(tabId, pageState, postUrl).verifiedFinalSubmit,
+ agent._completionSubmissionEvidence(tabId, pageState, 'https://bsky.app/home').verifiedFinalSubmit,
+ false,
+ `${AgentClass.name}: an unrelated same-origin route stood in for the submitted document`,
+ );
+
+ // An explicit success signal is the other way a destination qualifies.
+ agent._completionSubmitStates.set(tabId, publishedSubmit({ currentUrl: 'https://bsky.app/' }));
+ assert.equal(
+ agent._completionSubmissionEvidence(
+ tabId,
+ { relevantFormCount: 0, successMessages: ['Post published successfully'] },
+ 'https://bsky.app/home',
+ ).verifiedFinalSubmit,
true,
- `${AgentClass.name}: the completion probe was not counted as an observation`,
+ `${AgentClass.name}: an explicit success signal did not qualify the destination`,
+ );
+
+ // The observation requirement stays: done still cannot stand in for the
+ // read the guard asks for after a submit.
+ agent._completionSubmitStates.set(tabId, publishedSubmit({ observedAfterSubmit: false }));
+ assert.equal(
+ agent._completionSubmissionEvidence(tabId, pageState, postUrl).verifiedFinalSubmit,
+ false,
+ `${AgentClass.name}: a submit with no observation after it was accepted`,
);
// Still no completion when nothing actually changed: a dispatched click on
@@ -84874,7 +84892,6 @@ test('single-page app publish evidence survives the verification navigation', ()
agent._completionSubmitStates.set(tabId, publishedSubmit({
currentUrl: 'https://bsky.app/',
documentChanged: false,
- observedAfterSubmit: false,
}));
assert.equal(
agent._completionSubmissionEvidence(tabId, pageState, 'https://bsky.app/').verifiedFinalSubmit,
@@ -84893,6 +84910,12 @@ test('single-page app publish evidence survives the verification navigation', ()
`${AgentClass.name}: a submit on a different origin satisfied this task`,
);
+ // Opaque origins all serialise to "null", so two unrelated local documents
+ // must not compare as the same origin.
+ assert.equal(agent._sameUrlOrigin('file:///tmp/a/form.html', 'file:///tmp/b/other.html'), false,
+ `${AgentClass.name}: unrelated file: documents compared as same-origin`);
+ assert.equal(agent._sameUrlOrigin('https://bsky.app/a', 'https://bsky.app/b'), true);
+
// Bluesky posts get a stable published-resource identity; a profile or
// feed URL is not one.
assert.equal(