Skip to content

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

fix(social-publish): polite command prefix exits body scope

Barack Sokullu577b3adb994c
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 8e5d1b84e..0b2fb1516 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -18096,8 +18096,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (inColonBodyScope) {
const clauseDelim = clause.delim || '';
const leadText = String(clause.maskedText || clause.text || '').trimStart();
- const leadsWithPublish = startsWithPublishVerb.test(leadText)
- && !SOCIAL_PROPER_NAME_PROSE_LEAD.test(leadText);
+ // A polite prefix ("Please post this on Bluesky.") is still a new
+ // command: look past it before deciding the sentence stays prose.
+ const commandLeadText = leadText.replace(/^(?:please|kindly)\b[\s,]+/iu, '');
+ const leadsWithPublish = startsWithPublishVerb.test(commandLeadText)
+ && !SOCIAL_PROPER_NAME_PROSE_LEAD.test(commandLeadText);
if (!SOCIAL_COORDINATING_DELIMITER.test(clauseDelim)
&& !SOCIAL_SEQUENTIAL_DELIMITER.test(clauseDelim)
&& clauseDelim.trim() !== ','
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index ef204c2db..04d2719f4 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -15895,8 +15895,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (inColonBodyScope) {
const clauseDelim = clause.delim || '';
const leadText = String(clause.maskedText || clause.text || '').trimStart();
- const leadsWithPublish = startsWithPublishVerb.test(leadText)
- && !SOCIAL_PROPER_NAME_PROSE_LEAD.test(leadText);
+ // A polite prefix ("Please post this on Bluesky.") is still a new
+ // command: look past it before deciding the sentence stays prose.
+ const commandLeadText = leadText.replace(/^(?:please|kindly)\b[\s,]+/iu, '');
+ const leadsWithPublish = startsWithPublishVerb.test(commandLeadText)
+ && !SOCIAL_PROPER_NAME_PROSE_LEAD.test(commandLeadText);
if (!SOCIAL_COORDINATING_DELIMITER.test(clauseDelim)
&& !SOCIAL_SEQUENTIAL_DELIMITER.test(clauseDelim)
&& clauseDelim.trim() !== ','
diff --git a/test/run.js b/test/run.js
index 663092780..8482b39cf 100644
--- a/test/run.js
+++ b/test/run.js
@@ -91031,6 +91031,8 @@ test('social publication workflow follows the live X or Bluesky destination and
'proper-name prose left colon scope and adopted Bluesky'],
['Post on X: Hello. Post-processing happens on Bluesky.', ['twitter'],
'hyphenated prose left colon scope and adopted Bluesky'],
+ ['Post on X: Hello. Please post this on Bluesky.', ['twitter', 'bluesky'],
+ 'a polite follow-up command stayed inside the first body scope'],
['Do not publish anything; open https://x.com/compose/post to inspect it, then submit findings in the form', [],
'a prohibited composer URL was adopted as a publish destination'],
['Post on X: hello. Post on Bluesky: world', ['twitter', 'bluesky'],