Skip to content

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

Under a correction, a popup-launching control with an unread caption on X Pro is not clicked either

Claude670fc943e177
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index d3cf1dd1b..e430befa8 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -5586,7 +5586,7 @@ export class Agent extends LoopDetector {
|| detectedSubmit?.resolvedEditableTarget === true
|| detectedSubmit?.resolvedNonSubmitTarget === true
|| (detectedSubmit?.resolvedOrdinaryActivationTarget === true && detectedSubmit.captionUnread !== true)
- || detectedSubmit?.resolvedPreparatoryTarget === true);
+ || (detectedSubmit?.resolvedPreparatoryTarget === true && detectedSubmit.captionUnread !== true));
if (!isNetworkMutation(name, args) && name !== 'chrome_web_store_publish'
&& !(detectedSubmit?.isSubmit || (!resolvedNonSubmit && this._isFormValidationCandidate(name, args)))) return null;
// Searches, dialog Cancel buttons and ordinary in-form toggles commit
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 987692490..2146e20dc 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -5259,7 +5259,7 @@ export class Agent extends LoopDetector {
|| detectedSubmit?.resolvedEditableTarget === true
|| detectedSubmit?.resolvedNonSubmitTarget === true
|| (detectedSubmit?.resolvedOrdinaryActivationTarget === true && detectedSubmit.captionUnread !== true)
- || detectedSubmit?.resolvedPreparatoryTarget === true);
+ || (detectedSubmit?.resolvedPreparatoryTarget === true && detectedSubmit.captionUnread !== true));
if (!isNetworkMutation(name, args) && name !== 'chrome_web_store_publish'
&& !(detectedSubmit?.isSubmit || (!resolvedNonSubmit && this._isFormValidationCandidate(name, args)))) return null;
// Searches, dialog Cancel buttons and ordinary in-form toggles commit
diff --git a/test/guards-control-classification.mjs b/test/guards-control-classification.mjs
index 95d43e3d8..78bb79f69 100644
--- a/test/guards-control-classification.mjs
+++ b/test/guards-control-classification.mjs
@@ -266,6 +266,15 @@ for (const build of ['chrome', 'firefox']) {
// Under a correction it is not clicked either way.
assert.equal(block?.actionGuard?.reason, 'target_unresolved', reading);
}
+ // A Post button that also opens a popup is not clicked either.
+ const popup = await setup('https://pro.x.com/i/decks/1', html.replace('<button id="t" type="button">', '<button id="t" type="button" aria-haspopup="dialog">'), { steering: true });
+ const popupChat = popup.agent._chatWithCostAllowance;
+ popup.agent._chatWithCostAllowance = async (provider, messages, options, cost, meta) => meta?.generationName === 'semantic_control_effect'
+ ? { content: '' } : popupChat(provider, messages, options, cost, meta);
+ const launcher = await gate(popup, 'click_ax', { ref_id: await ref('t') });
+ assert.equal(launcher.detected?.resolvedPreparatoryTarget, true);
+ assert.equal(launcher.detected.captionUnread, true);
+ assert.equal(launcher.block?.actionGuard?.reason, 'target_unresolved');
const f = await setup('https://pro.x.com/i/decks/1', html, { steering: true });
await page.locator('#editor').focus();
const result = await gate(f, 'press_keys', { key: 'Enter' });
diff --git a/test/guards-steering-receipts.mjs b/test/guards-steering-receipts.mjs
index 88b6afd72..ed9cbba82 100644
--- a/test/guards-steering-receipts.mjs
+++ b/test/guards-steering-receipts.mjs
@@ -718,6 +718,9 @@ for (const build of ['chrome', 'firefox']) {
assert.equal(h.steeringBlock(null)?.actionGuard.reason, 'target_unresolved');
assert.equal(h.steeringBlock({ isSubmit: false, resolvedOrdinaryActivationTarget: true, captionUnread: true })?.actionGuard.reason,
'target_unresolved');
+ // The same for one that opens a popup.
+ assert.equal(h.steeringBlock({ isSubmit: false, resolvedOrdinaryActivationTarget: true, resolvedPreparatoryTarget: true,
+ captionUnread: true })?.actionGuard.reason, 'target_unresolved');
assert.equal(h.steeringBlock({ isSubmit: false, resolvedOrdinaryActivationTarget: true }), null);
attempt(h, { ...formOn(pro), actionUrl: 'https://pro.x.com/i/api/compose' });
if (resume === 'Continue' || resume === 'typed continue') {