Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) đź§ 

Measure a second look against the people and schedule the task carried

Claude4d088f95bb90
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb27850f7..6c3592aff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,7 +19,7 @@ This changelog was generated from the repository Git history and release tags. V
- Providers → Decision accepts a local decision server on another machine on your network, such as `http://192.168.1.51:8091`. **Load available models** and **Test** used to stop with "Decision endpoints require HTTPS outside localhost." for any address but this computer's. Private addresses (10.x, 172.16–31.x, 192.168.x, Tailscale's 100.64–127.x, link-local, IPv6 unique-local) and `.local`, `.home.arpa` and `.internal` names now work over plain HTTP; public addresses still need HTTPS. In Chrome, decision requests to such a server go through the same offscreen proxy as chat models on your network. Vision and speech endpoints already accepted these addresses.
- Act can send a photo or video in an Instagram direct message. Instagram's message box keeps its file input hidden, outside any form, deep in a long conversation, where WebBrain's check that an action still targets what the model saw cannot reach it. Every attachment was refused, even with the exact selector WebBrain itself listed for that input, often right after you had confirmed the recipient on WebBrain's card; the model then sent a link to the picture, or said Instagram blocks attachments. With Strict checks off, an upload to the very input WebBrain listed on that page, named by the selector it gave, now goes through with a note to the model, and the recipient checks still apply. A selector WebBrain did not list is still refused, and so is an input the page re-created after the list under the same selector, until WebBrain lists the page's controls again. When clicking "Add Photo or Video" opens a file chooser, WebBrain now names the input with that same selector, and the Instagram site notes say to attach the file to that input instead of clicking the button, and that a link to a picture is not the picture.
- Act can attach images and videos to a post on X again. While the post composer is open at x.com/compose/post, the timeline behind it keeps a second, identical file input, and WebBrain's list of the page's controls gave neither input a selector. After the model's first selector matched both, WebBrain refused every later upload until it saw a selector it could not get, so the run ended at its cost limit with nothing attached. The list now gives every file input a selector that matches only that input, scoped to the open dialog where that is what tells them apart, and marks the dialog's input `inDialog`. The X site notes name the dialog's input, and when no selector can single out an input, WebBrain tells the model to report the upload as blocked instead of retrying.
-- Act no longer asks you the same question again when the answer is on the page. Asked to post the same thing on LinkedIn while the X post was open, the planner asked which text and files to use, and after “look at the screen — the same” it asked again: the planner works from your words, the page's address and title and a short summary of the chat, never the page itself or your attachments. That summary held only the last ten messages, tool calls and page observations included, each cut to 300 characters, so the earlier answer that named the post's text and your screenshot file had dropped out of it. It now holds the last ten turns of the conversation without the agent's step-by-step notes, gives the latest answer up to 1,200 characters, and names the files you attached earlier. When you have just answered a planner question and the planner wants to ask again, it first takes a second look, told that it cannot see the page while the agent can, and plans the task instead. That second look cannot add anything you did not ask for: posting, sending or a schedule your request did not already carry stays a question for you. When a scheduled task should run, who a message goes to, an account or an amount stay questions too until you give them, and it never takes them from the page; an answer such as "every five minutes" to a question about a scheduled task is planned. A planner running Qwen 3, QwQ or DeepSeek R1, which is told not to think so that it answers faster, now thinks during that second look and before any question it would ask you, unless reasoning is turned off for that provider. Chrome and Firefox.
+- Act no longer asks you the same question again when the answer is on the page. Asked to post the same thing on LinkedIn while the X post was open, the planner asked which text and files to use, and after “look at the screen — the same” it asked again: the planner works from your words, the page's address and title and a short summary of the chat, never the page itself or your attachments. That summary held only the last ten messages, tool calls and page observations included, each cut to 300 characters, so the earlier answer that named the post's text and your screenshot file had dropped out of it. It now holds the last ten turns of the conversation without the agent's step-by-step notes, gives the latest answer up to 1,200 characters, and names the files you attached earlier. When you have just answered a planner question and the planner wants to ask again, it first takes a second look, told that it cannot see the page while the agent can, and plans the task instead. That second look cannot add anything you did not ask for: posting, sending or a schedule your request did not already carry stays a question for you. When a scheduled task should run, who a message goes to, an account or an amount stay questions too until you give them, and it never takes them from the page: an answer such as "every five minutes" to a question about a scheduled task, or the name of the person to write to, is planned, and a task you asked to repeat is never run just once instead. A planner running Qwen 3, QwQ or DeepSeek R1, which is told not to think so that it answers faster, now thinks during that second look and before any question it would ask you, unless reasoning is turned off for that provider. Chrome and Firefox.
## [42.3.1] - 2026-10-20
diff --git a/docs/architecture.md b/docs/architecture.md
index e7ae2ce3b..84a319696 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -934,7 +934,7 @@ Planner calls are traced with `phase: "planner"` when trace recording is enabled
The recent-history digest (`_buildPlannerHistoryDigest()`) takes the last ten authored turns, after app-owned notes, pinned state, tool results and the narration sent with tool calls are filtered out, and spends a 2,000-character budget newest first: an assistant turn keeps up to 1,200 characters and a user turn up to 600, and older turns that no longer fit are left out whole. A user turn names its attachments (`[attached: …]`, at most four names, sanitized like the executor's attachment notice), because the planner never receives attachment bytes.
-A `clarify` from the planner or the intent check gets one second look before the user sees it (`_plannerClarifyRetry()`). A model that was sent `/no_think` (Qwen 3, QwQ, DeepSeek R1) answers again with thinking on and up to 8,192 output tokens (`_plannerCanRethink()`: not when reasoning is off in the provider's settings or extra request body, and not for Qwen3 Instruct-2507 and Coder models, which have no thinking mode). On the turn that answers the planner's previous question (`_turnAnswersPlannerQuestion()`, which reads an answer as the task binding does; not in scheduled runs or the intent recheck), `PLANNER_REASK_GUIDANCE` is added to the system prompt: the planner cannot see the page and the executor can, so it may ask again only about schedule timing or a calendar recurrence, a recipient, an account, an amount, a credential, whether to publish, send or submit at all, or conflicting answers, none of which it may take from page content. Such a second look may not add a submission or a schedule that neither its first answer nor the answered question carried, or a recipient, for a message or a draft, that its first answer did not name (`_plannerSecondLookWidens()`, trace note `planner_second_look_rejected`). A planner question keeps the schedule of the task it asks about (`normalizePlan()` keeps `scheduling` on a `clarify` plan, and nothing runs from it), and the stored question records its tool as `schedulingTool`, so an answer that only gives a scheduled task its timing ("every five minutes") can still be planned. Only a schedule of the kind the task carried passes: a task that carried a `schedule_resume` pause does not let a second look create a recurring `schedule_task`. The trace phase is `planner_rethink` or `planner_reask` (`intent_rethink`, `intent_reask` for the intent check). The second answer is parsed and consistency-checked like the first and then takes the first answer's place in the rest of the gate, which in the planner gate includes the alignment check, recipient pinning and review. A failed, unparseable, inconsistent or rejected second answer, including one stopped by the cost allowance, keeps the first question, and a pending correction gets no second look.
+A `clarify` from the planner or the intent check gets one second look before the user sees it (`_plannerClarifyRetry()`). A model that was sent `/no_think` (Qwen 3, QwQ, DeepSeek R1) answers again with thinking on and up to 8,192 output tokens (`_plannerCanRethink()`: not when reasoning is off in the provider's settings or extra request body, and not for Qwen3 Instruct-2507 and Coder models, which have no thinking mode). On the turn that answers the planner's previous question (`_turnAnswersPlannerQuestion()`, which reads an answer as the task binding does; not in scheduled runs or the intent recheck), `PLANNER_REASK_GUIDANCE` is added to the system prompt: the planner cannot see the page and the executor can, so it may ask again only about schedule timing or a calendar recurrence, a recipient, an account, an amount, a credential, whether to publish, send or submit at all, or conflicting answers, none of which it may take from page content. Such a second look is measured against what the task already carried, in its first answer on that turn and in the question the user answered (`_plannerSecondLookRejection()`, trace note `planner_second_look_rejected` with the reason). A planner question keeps the submission, the people to address and the schedule of the task it asks about (`normalizePlan()` keeps `scheduling` and, for a message it does not send, `draft_recipients` on a `clarify` plan; nothing runs from it), and the stored question records the target as `messageTarget` and the schedule's tool as `schedulingTool`. The second look may not add a submission neither of them carried (`adds_submission`); a recipient, for a message or a draft, that neither of them named, unless the user's own words in the task (the task binding, built from user turns only) name every person (`adds_recipient`; the open conversation is never taken from the page); or a schedule of a kind neither of them carried (`adds_schedule`), so an answer that only gives a scheduled task its timing ("every five minutes") is planned, while a `schedule_resume` pause never becomes a recurring `schedule_task`. An execute plan may not drop the `schedule_task` the task carried (`drops_schedule`): the intent check has no alignment check that would notice the run doing the task once instead. The trace phase is `planner_rethink` or `planner_reask` (`intent_rethink`, `intent_reask` for the intent check). The second answer is parsed and consistency-checked like the first and then takes the first answer's place in the rest of the gate, which in the planner gate includes the alignment check, recipient pinning and review. A failed, unparseable, inconsistent or rejected second answer, including one stopped by the cost allowance, keeps the first question, and a pending correction gets no second look.
LLM-request trace events include privacy-safe prompt provenance: the controlled
prompt variant, system-prompt and aggregate message character counts, message
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index cfbd3fee9..7da8e69bc 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -27167,18 +27167,47 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
}
// For the planner's second look (_plannerClarifyRetry): whether the user
- // turn at `index` answers the planner's previous question, and the schedule
- // tool of the task that question was about (_plannerSecondLookWidens). A
- // correction or a scheduled run answers no question.
+ // turn at `index` answers the planner's previous question, and what the
+ // task carried (_plannerSecondLookRejection): the schedule tool and message
+ // target of the question it answers, and the user's own words in the task.
+ // A correction or a scheduled run answers no question.
_plannerQuestionAnswerContext(messages, index, runOptions = {}) {
const answersPlannerQuestion = runOptions?.steeringRevision == null
&& runOptions?.scheduledRun !== true && runOptions?.scheduledResume !== true
&& this._turnAnswersPlannerQuestion(messages, index);
- const question = answersPlannerQuestion ? messages[this._plannerClarificationIndexBefore(messages, index)] : null;
+ if (!answersPlannerQuestion) {
+ return { answersPlannerQuestion: false, answeredQuestionSchedulingTool: null, answeredQuestionMessageTarget: null, taskUserText: '' };
+ }
+ const question = messages[this._plannerClarificationIndexBefore(messages, index)]?.webbrainPlannerClarification || {};
return {
- answersPlannerQuestion,
- answeredQuestionSchedulingTool: question?.webbrainPlannerClarification?.schedulingTool || null,
- };
+ answersPlannerQuestion: true,
+ answeredQuestionSchedulingTool: question.schedulingTool || null,
+ answeredQuestionMessageTarget: normalizeMessageTarget(question.messageTarget),
+ // The task binding is built from user turns only: the request and each
+ // answer, never the page or an assistant turn.
+ taskUserText: this._activeTaskBinding(messages.slice(0, index + 1)).text || '',
+ };
+ }
+
+ // Whether the user's own words name every recipient: each identity appears
+ // as a whole token (an address may end a sentence). Only the text passed in
+ // counts, never a page title, OCR, an assistant turn or an address suffix.
+ _userTextNamesRecipients(text, recipients) {
+ if (!Array.isArray(recipients) || recipients.length === 0) return false;
+ const authored = normalizeAuthoredRecipientText(text).slice(0, 100000);
+ const tokenChar = /[\p{L}\p{N}@._%+-]/u;
+ return recipients.every(recipient => {
+ const identity = normalizeRecipientIdentity(recipient?.identity);
+ if (!identity) return false;
+ for (let at = authored.indexOf(identity); at >= 0; at = authored.indexOf(identity, at + 1)) {
+ const before = authored[at - 1] || '';
+ const end = at + identity.length;
+ const after = authored[end] || '';
+ const sentencePeriod = after === '.' && !tokenChar.test(authored[end + 1] || '');
+ if ((!before || !tokenChar.test(before)) && (!after || !tokenChar.test(after) || sentencePeriod)) return true;
+ }
+ return false;
+ });
}
// Whether a second look may think: only a model planning tells not to
@@ -27197,25 +27226,42 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
.reasoningEffort !== 'off';
}
- // A second look told not to re-ask may not take on more than the user's
- // task already carried: a submission or a schedule that neither the first
- // answer nor the question the user just answered held, or a recipient the
- // first answer did not name. Those stay questions for the user. A schedule
- // of the kind the task carried may be planned (a pause for schedule_resume
- // never becomes a recurring schedule_task): the user's answer is often its
- // timing ("every five minutes"), and in the planner gate the plan is still
- // checked for alignment with the task and that answer. A recipient counts for a draft
- // too: normalizePlan moves the addressees of a message that is not sent
- // into draft_recipients, and a draft written into the open conversation is
- // still a recipient taken from the page.
- _plannerSecondLookWidens(firstPlan, plan, followUpContext = {}) {
+ // What a second look told not to re-ask may plan, measured against what
+ // the user's task already carried: the first answer on this turn (a
+ // question keeps the submission, the people to address and the schedule of
+ // the task it asks about) and the question the user just answered. Returns
+ // why the plan is rejected, or null. A rejected plan leaves the question
+ // with the user.
+ // - adds_submission: a submission neither of them carried.
+ // - adds_recipient: a recipient, for a message or a draft (normalizePlan
+ // keeps a draft's addressees in draft_recipients), that neither of them
+ // named, unless the user's own words in the task name every person. The
+ // open conversation is never taken from the page on a second look.
+ // - adds_schedule: a schedule of a kind neither of them carried. The user's
+ // answer is often the timing of a schedule the task carried ("every five
+ // minutes"), but a schedule_resume pause never becomes a recurring
+ // schedule_task.
+ // - drops_schedule: an execute plan without the schedule_task the task
+ // carried. The intent check has no alignment check that would notice the
+ // run doing the task once instead.
+ _plannerSecondLookRejection(firstPlan, plan, followUpContext = {}) {
const submissionCarried = firstPlan?.requires_submission === true
|| followUpContext?.plannerClarification?.requiresSubmission === true;
- if (plan?.requires_submission === true && !submissionCarried) return true;
- const named = JSON.stringify(firstPlan?.messaging || firstPlan?.draft_recipients || null);
- if ([plan?.messaging, plan?.draft_recipients].some(target => target && JSON.stringify(target) !== named)) return true;
+ if (plan?.requires_submission === true && !submissionCarried) return 'adds_submission';
+ const carriedTargets = [firstPlan?.messaging, firstPlan?.draft_recipients, followUpContext?.answeredQuestionMessageTarget]
+ .filter(Boolean)
+ .map(target => JSON.stringify(target));
+ for (const target of [plan?.messaging, plan?.draft_recipients]) {
+ if (!target || carriedTargets.includes(JSON.stringify(target))) continue;
+ if (target.target_kind === 'named'
+ && this._userTextNamesRecipients(followUpContext?.taskUserText, target.recipients)) continue;
+ return 'adds_recipient';
+ }
const carriedSchedules = [firstPlan?.scheduling?.tool, followUpContext?.answeredQuestionSchedulingTool];
- return !!plan?.scheduling && !carriedSchedules.includes(plan.scheduling.tool);
+ if (plan?.scheduling && !carriedSchedules.includes(plan.scheduling.tool)) return 'adds_schedule';
+ if (plan?.request_kind === 'execute' && carriedSchedules.includes('schedule_task')
+ && plan.scheduling?.tool !== 'schedule_task') return 'drops_schedule';
+ return null;
}
// A planner question gets one more look before it reaches the user. The
@@ -27231,7 +27277,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// question, PLANNER_REASK_GUIDANCE reminds the planner that the executor
// can see what it cannot, and leaves a question only for values that have
// to come from the user. Its plan may not add a submission, a recipient
- // or a schedule (_plannerSecondLookWidens).
+ // or a schedule the task did not carry, or drop a recurring schedule it
+ // did (_plannerSecondLookRejection).
// The answer is parsed and checked like the first one, and an execute plan
// then goes through alignment, recipient pinning and review like any other.
// Returns null to keep the first answer: nothing to retry, or the retry
@@ -27270,10 +27317,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
await this._tracePlannerAttemptResponse(runId, 0, provider, result, phase, 1, startedAt, chatOptions);
const plan = parsePlanFromContent(result?.content, parseOptions);
if (!plan || this._plannerIntentConsistencyIssue(plan, followUpContext)) return null;
- if (reask && this._plannerSecondLookWidens(firstPlan, plan, followUpContext)) {
+ const rejection = reask ? this._plannerSecondLookRejection(firstPlan, plan, followUpContext) : null;
+ if (rejection) {
if (runId) {
try {
- Promise.resolve(trace.recordNote(runId, 0, 'planner_second_look_rejected', { phase, reason: 'widens_task' }))
+ Promise.resolve(trace.recordNote(runId, 0, 'planner_second_look_rejected', { phase, reason: rejection }))
.catch(() => {});
} catch {}
}
@@ -27372,9 +27420,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (gate.requestKind === 'clarify' && gate.plannerClarification === true) {
message.webbrainPlannerClarification = {
requiresSubmission: gate.requiresSubmission === true,
- // The schedule of the task this question is about, so the second look
- // at the user's answer may plan it (_plannerSecondLookWidens).
+ // The schedule and the people to address of the task this question is
+ // about, so the second look at the user's answer may plan them
+ // (_plannerSecondLookRejection).
schedulingTool: ['schedule_task', 'schedule_resume'].includes(gate.schedulingTool) ? gate.schedulingTool : null,
+ messageTarget: normalizeMessageTarget(gate.messageTarget),
pageUrl: String(tabInfo?.tabUrl || ''),
taskText: this._progressTaskTextKey(activeTaskText).slice(0, 1600),
taskKey: /^tk_[0-9a-f]{8}$/i.test(String(activeTaskKey || ''))
@@ -28220,6 +28270,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
requiresStateChange: false,
requiresSubmission: plan.request_kind === 'clarify' && plan.requires_submission === true,
schedulingTool: plan.request_kind === 'clarify' ? plan.scheduling?.tool || null : null,
+ messageTarget: plan.request_kind === 'clarify' ? plan.messaging || plan.draft_recipients || null : null,
};
}
if (runOptions?.cloudRun === true && runOptions?.trustedContinuation !== true
@@ -28227,20 +28278,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// Semantic intent is necessary but cannot invent a named destination.
// The fresh authenticated task must itself contain each exact identity;
// a page title, OCR, prior turn or address suffix cannot provide it.
- const authored = normalizeAuthoredRecipientText(this._plannerUserAuthoredText(enriched)).slice(0, 100000);
- const tokenChar = /[\p{L}\p{N}@._%+-]/u;
- const present = plan.messaging.recipients.every(recipient => {
- const identity = normalizeRecipientIdentity(recipient.identity);
- if (!identity) return false;
- for (let at = authored.indexOf(identity); at >= 0; at = authored.indexOf(identity, at + 1)) {
- const before = authored[at - 1] || '';
- const end = at + identity.length;
- const after = authored[end] || '';
- const sentencePeriod = after === '.' && !tokenChar.test(authored[end + 1] || '');
- if ((!before || !tokenChar.test(before)) && (!after || !tokenChar.test(after) || sentencePeriod)) return true;
- }
- return false;
- });
+ const present = this._userTextNamesRecipients(this._plannerUserAuthoredText(enriched), plan.messaging.recipients);
if (!present) return {
proceed: false, reason: 'active_recipient_unverified', requestKind: 'clarify', plannerClarification: true,
requiresStateChange: false, requiresSubmission: false, schedulingTool: plan.scheduling?.tool || null, messaging: null,
@@ -28550,6 +28588,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
requiresStateChange: false,
requiresSubmission: candidate.request_kind === 'clarify' && candidate.requires_submission === true,
schedulingTool: candidate.request_kind === 'clarify' ? candidate.scheduling?.tool || null : null,
+ messageTarget: candidate.request_kind === 'clarify' ? candidate.messaging || candidate.draft_recipients || null : null,
};
}
return null;
diff --git a/src/chrome/src/agent/planner.js b/src/chrome/src/agent/planner.js
index c7b7bff89..ebcf514f9 100644
--- a/src/chrome/src/agent/planner.js
+++ b/src/chrome/src/agent/planner.js
@@ -1244,8 +1244,9 @@ export function normalizePlan(obj, opts = {}) {
// can be checked against the requested target without becoming sendable.
// An open-thread draft arrives as target_kind="active_conversation" and is
// pinned to its verified recipients before execution, so both kinds are kept
- // here; dropping the conversation kind would leave the draft unbound.
- const draftRecipients = executablePlan && requiresSubmission !== true
+ // here; dropping the conversation kind would leave the draft unbound. A
+ // question about such a draft keeps them too, as it keeps its schedule.
+ const draftRecipients = submissionBearingPlan && requiresSubmission !== true
? normalizeMessageTarget(obj.messaging)
: null;
const requiresDownload = executablePlan
@@ -1321,7 +1322,7 @@ export function normalizePlan(obj, opts = {}) {
// A question keeps the schedule of the task it asks about, as it keeps
// the submission. Nothing runs from it: the agent records that the task
// carries a schedule, and the planner's second look at the user's answer
- // may then plan one (Agent._plannerSecondLookWidens).
+ // may then plan one (Agent._plannerSecondLookRejection).
scheduling: executablePlan || requestKind === 'clarify' ? normalizedScheduling : null,
risks,
localized,
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 2bac7d2f9..743b79a81 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -24205,18 +24205,47 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
}
// For the planner's second look (_plannerClarifyRetry): whether the user
- // turn at `index` answers the planner's previous question, and the schedule
- // tool of the task that question was about (_plannerSecondLookWidens). A
- // correction or a scheduled run answers no question.
+ // turn at `index` answers the planner's previous question, and what the
+ // task carried (_plannerSecondLookRejection): the schedule tool and message
+ // target of the question it answers, and the user's own words in the task.
+ // A correction or a scheduled run answers no question.
_plannerQuestionAnswerContext(messages, index, runOptions = {}) {
const answersPlannerQuestion = runOptions?.steeringRevision == null
&& runOptions?.scheduledRun !== true && runOptions?.scheduledResume !== true
&& this._turnAnswersPlannerQuestion(messages, index);
- const question = answersPlannerQuestion ? messages[this._plannerClarificationIndexBefore(messages, index)] : null;
+ if (!answersPlannerQuestion) {
+ return { answersPlannerQuestion: false, answeredQuestionSchedulingTool: null, answeredQuestionMessageTarget: null, taskUserText: '' };
+ }
+ const question = messages[this._plannerClarificationIndexBefore(messages, index)]?.webbrainPlannerClarification || {};
return {
- answersPlannerQuestion,
- answeredQuestionSchedulingTool: question?.webbrainPlannerClarification?.schedulingTool || null,
- };
+ answersPlannerQuestion: true,
+ answeredQuestionSchedulingTool: question.schedulingTool || null,
+ answeredQuestionMessageTarget: normalizeMessageTarget(question.messageTarget),
+ // The task binding is built from user turns only: the request and each
+ // answer, never the page or an assistant turn.
+ taskUserText: this._activeTaskBinding(messages.slice(0, index + 1)).text || '',
+ };
+ }
+
+ // Whether the user's own words name every recipient: each identity appears
+ // as a whole token (an address may end a sentence). Only the text passed in
+ // counts, never a page title, OCR, an assistant turn or an address suffix.
+ _userTextNamesRecipients(text, recipients) {
+ if (!Array.isArray(recipients) || recipients.length === 0) return false;
+ const authored = normalizeAuthoredRecipientText(text).slice(0, 100000);
+ const tokenChar = /[\p{L}\p{N}@._%+-]/u;
+ return recipients.every(recipient => {
+ const identity = normalizeRecipientIdentity(recipient?.identity);
+ if (!identity) return false;
+ for (let at = authored.indexOf(identity); at >= 0; at = authored.indexOf(identity, at + 1)) {
+ const before = authored[at - 1] || '';
+ const end = at + identity.length;
+ const after = authored[end] || '';
+ const sentencePeriod = after === '.' && !tokenChar.test(authored[end + 1] || '');
+ if ((!before || !tokenChar.test(before)) && (!after || !tokenChar.test(after) || sentencePeriod)) return true;
+ }
+ return false;
+ });
}
// Whether a second look may think: only a model planning tells not to
@@ -24235,25 +24264,42 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
.reasoningEffort !== 'off';
}
- // A second look told not to re-ask may not take on more than the user's
- // task already carried: a submission or a schedule that neither the first
- // answer nor the question the user just answered held, or a recipient the
- // first answer did not name. Those stay questions for the user. A schedule
- // of the kind the task carried may be planned (a pause for schedule_resume
- // never becomes a recurring schedule_task): the user's answer is often its
- // timing ("every five minutes"), and in the planner gate the plan is still
- // checked for alignment with the task and that answer. A recipient counts for a draft
- // too: normalizePlan moves the addressees of a message that is not sent
- // into draft_recipients, and a draft written into the open conversation is
- // still a recipient taken from the page.
- _plannerSecondLookWidens(firstPlan, plan, followUpContext = {}) {
+ // What a second look told not to re-ask may plan, measured against what
+ // the user's task already carried: the first answer on this turn (a
+ // question keeps the submission, the people to address and the schedule of
+ // the task it asks about) and the question the user just answered. Returns
+ // why the plan is rejected, or null. A rejected plan leaves the question
+ // with the user.
+ // - adds_submission: a submission neither of them carried.
+ // - adds_recipient: a recipient, for a message or a draft (normalizePlan
+ // keeps a draft's addressees in draft_recipients), that neither of them
+ // named, unless the user's own words in the task name every person. The
+ // open conversation is never taken from the page on a second look.
+ // - adds_schedule: a schedule of a kind neither of them carried. The user's
+ // answer is often the timing of a schedule the task carried ("every five
+ // minutes"), but a schedule_resume pause never becomes a recurring
+ // schedule_task.
+ // - drops_schedule: an execute plan without the schedule_task the task
+ // carried. The intent check has no alignment check that would notice the
+ // run doing the task once instead.
+ _plannerSecondLookRejection(firstPlan, plan, followUpContext = {}) {
const submissionCarried = firstPlan?.requires_submission === true
|| followUpContext?.plannerClarification?.requiresSubmission === true;
- if (plan?.requires_submission === true && !submissionCarried) return true;
- const named = JSON.stringify(firstPlan?.messaging || firstPlan?.draft_recipients || null);
- if ([plan?.messaging, plan?.draft_recipients].some(target => target && JSON.stringify(target) !== named)) return true;
+ if (plan?.requires_submission === true && !submissionCarried) return 'adds_submission';
+ const carriedTargets = [firstPlan?.messaging, firstPlan?.draft_recipients, followUpContext?.answeredQuestionMessageTarget]
+ .filter(Boolean)
+ .map(target => JSON.stringify(target));
+ for (const target of [plan?.messaging, plan?.draft_recipients]) {
+ if (!target || carriedTargets.includes(JSON.stringify(target))) continue;
+ if (target.target_kind === 'named'
+ && this._userTextNamesRecipients(followUpContext?.taskUserText, target.recipients)) continue;
+ return 'adds_recipient';
+ }
const carriedSchedules = [firstPlan?.scheduling?.tool, followUpContext?.answeredQuestionSchedulingTool];
- return !!plan?.scheduling && !carriedSchedules.includes(plan.scheduling.tool);
+ if (plan?.scheduling && !carriedSchedules.includes(plan.scheduling.tool)) return 'adds_schedule';
+ if (plan?.request_kind === 'execute' && carriedSchedules.includes('schedule_task')
+ && plan.scheduling?.tool !== 'schedule_task') return 'drops_schedule';
+ return null;
}
// A planner question gets one more look before it reaches the user. The
@@ -24269,7 +24315,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// question, PLANNER_REASK_GUIDANCE reminds the planner that the executor
// can see what it cannot, and leaves a question only for values that have
// to come from the user. Its plan may not add a submission, a recipient
- // or a schedule (_plannerSecondLookWidens).
+ // or a schedule the task did not carry, or drop a recurring schedule it
+ // did (_plannerSecondLookRejection).
// The answer is parsed and checked like the first one, and an execute plan
// then goes through alignment, recipient pinning and review like any other.
// Returns null to keep the first answer: nothing to retry, or the retry
@@ -24308,10 +24355,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
await this._tracePlannerAttemptResponse(runId, 0, provider, result, phase, 1, startedAt, chatOptions);
const plan = parsePlanFromContent(result?.content, parseOptions);
if (!plan || this._plannerIntentConsistencyIssue(plan, followUpContext)) return null;
- if (reask && this._plannerSecondLookWidens(firstPlan, plan, followUpContext)) {
+ const rejection = reask ? this._plannerSecondLookRejection(firstPlan, plan, followUpContext) : null;
+ if (rejection) {
if (runId) {
try {
- Promise.resolve(trace.recordNote(runId, 0, 'planner_second_look_rejected', { phase, reason: 'widens_task' }))
+ Promise.resolve(trace.recordNote(runId, 0, 'planner_second_look_rejected', { phase, reason: rejection }))
.catch(() => {});
} catch {}
}
@@ -24410,9 +24458,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (gate.requestKind === 'clarify' && gate.plannerClarification === true) {
message.webbrainPlannerClarification = {
requiresSubmission: gate.requiresSubmission === true,
- // The schedule of the task this question is about, so the second look
- // at the user's answer may plan it (_plannerSecondLookWidens).
+ // The schedule and the people to address of the task this question is
+ // about, so the second look at the user's answer may plan them
+ // (_plannerSecondLookRejection).
schedulingTool: ['schedule_task', 'schedule_resume'].includes(gate.schedulingTool) ? gate.schedulingTool : null,
+ messageTarget: normalizeMessageTarget(gate.messageTarget),
pageUrl: String(tabInfo?.tabUrl || ''),
taskText: this._progressTaskTextKey(activeTaskText).slice(0, 1600),
taskKey: /^tk_[0-9a-f]{8}$/i.test(String(activeTaskKey || ''))
@@ -25247,6 +25297,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
requiresStateChange: false,
requiresSubmission: plan.request_kind === 'clarify' && plan.requires_submission === true,
schedulingTool: plan.request_kind === 'clarify' ? plan.scheduling?.tool || null : null,
+ messageTarget: plan.request_kind === 'clarify' ? plan.messaging || plan.draft_recipients || null : null,
};
}
if (runOptions?.cloudRun === true && runOptions?.trustedContinuation !== true
@@ -25254,20 +25305,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// Semantic intent is necessary but cannot invent a named destination.
// The fresh authenticated task must itself contain each exact identity;
// a page title, OCR, prior turn or address suffix cannot provide it.
- const authored = normalizeAuthoredRecipientText(this._plannerUserAuthoredText(enriched)).slice(0, 100000);
- const tokenChar = /[\p{L}\p{N}@._%+-]/u;
- const present = plan.messaging.recipients.every(recipient => {
- const identity = normalizeRecipientIdentity(recipient.identity);
- if (!identity) return false;
- for (let at = authored.indexOf(identity); at >= 0; at = authored.indexOf(identity, at + 1)) {
- const before = authored[at - 1] || '';
- const end = at + identity.length;
- const after = authored[end] || '';
- const sentencePeriod = after === '.' && !tokenChar.test(authored[end + 1] || '');
- if ((!before || !tokenChar.test(before)) && (!after || !tokenChar.test(after) || sentencePeriod)) return true;
- }
- return false;
- });
+ const present = this._userTextNamesRecipients(this._plannerUserAuthoredText(enriched), plan.messaging.recipients);
if (!present) return {
proceed: false, reason: 'active_recipient_unverified', requestKind: 'clarify', plannerClarification: true,
requiresStateChange: false, requiresSubmission: false, schedulingTool: plan.scheduling?.tool || null, messaging: null,
@@ -25573,6 +25611,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
requiresStateChange: false,
requiresSubmission: candidate.request_kind === 'clarify' && candidate.requires_submission === true,
schedulingTool: candidate.request_kind === 'clarify' ? candidate.scheduling?.tool || null : null,
+ messageTarget: candidate.request_kind === 'clarify' ? candidate.messaging || candidate.draft_recipients || null : null,
};
}
return null;
diff --git a/src/firefox/src/agent/planner.js b/src/firefox/src/agent/planner.js
index c7b7bff89..ebcf514f9 100644
--- a/src/firefox/src/agent/planner.js
+++ b/src/firefox/src/agent/planner.js
@@ -1244,8 +1244,9 @@ export function normalizePlan(obj, opts = {}) {
// can be checked against the requested target without becoming sendable.
// An open-thread draft arrives as target_kind="active_conversation" and is
// pinned to its verified recipients before execution, so both kinds are kept
- // here; dropping the conversation kind would leave the draft unbound.
- const draftRecipients = executablePlan && requiresSubmission !== true
+ // here; dropping the conversation kind would leave the draft unbound. A
+ // question about such a draft keeps them too, as it keeps its schedule.
+ const draftRecipients = submissionBearingPlan && requiresSubmission !== true
? normalizeMessageTarget(obj.messaging)
: null;
const requiresDownload = executablePlan
@@ -1321,7 +1322,7 @@ export function normalizePlan(obj, opts = {}) {
// A question keeps the schedule of the task it asks about, as it keeps
// the submission. Nothing runs from it: the agent records that the task
// carries a schedule, and the planner's second look at the user's answer
- // may then plan one (Agent._plannerSecondLookWidens).
+ // may then plan one (Agent._plannerSecondLookRejection).
scheduling: executablePlan || requestKind === 'clarify' ? normalizedScheduling : null,
risks,
localized,
diff --git a/test/planner-clarify-loop.mjs b/test/planner-clarify-loop.mjs
index 7e0e2c7aa..5cbd74a5e 100644
--- a/test/planner-clarify-loop.mjs
+++ b/test/planner-clarify-loop.mjs
@@ -92,6 +92,10 @@ const OPEN_SCHEDULE = { tool: 'schedule_task', hint: 'The user wants the page ch
const EVERY_FIVE = { tool: 'schedule_task', hint: 'Every 5 minutes, as the user answered.' };
const HOW_OFTEN = 'How often should I check this page for a new release?';
const PAUSE = { tool: 'schedule_resume', hint: 'Wait until the deploy finishes, then continue.' };
+const ALI = { target_kind: 'named', recipients: [{ identity: 'Ali Veli', role: 'to' }] };
+const OPEN_CHAT = { target_kind: 'active_conversation', recipients: [] };
+// The user's words in a task binding: the request and each answer.
+const userWords = (request, ...answers) => `User task clarified by the latest answer: ${JSON.stringify({ request, answers })}`;
for (const build of ['chrome', 'firefox']) {
const { Agent } = await import(`../src/${build}/src/agent/agent.js`);
@@ -238,7 +242,7 @@ for (const build of ['chrome', 'firefox']) {
assert.equal(agent._turnAnswersPlannerQuestion(messages, -1), false);
});
- test(`${build}: the answer context names the schedule of the question's task, and only for a direct answer`, () => {
+ test(`${build}: the answer context names what the question's task carried, and only for a direct answer`, () => {
const agent = newAgent();
const answer = user('every five minutes');
const asked = gate => {
@@ -247,27 +251,36 @@ for (const build of ['chrome', 'firefox']) {
TAB, messages[1].content, agent._progressTaskKeyForText(messages[1].content)));
return [...messages, answer];
};
- const scheduled = asked({ schedulingTool: 'schedule_task' });
- assert.equal(scheduled[2].webbrainPlannerClarification.schedulingTool, 'schedule_task', 'the question records the schedule');
- assert.equal(asked({})[2].webbrainPlannerClarification.schedulingTool, null);
- assert.equal(asked({ schedulingTool: 'schedule_everything' })[2].webbrainPlannerClarification.schedulingTool, null, 'only a known tool');
- assert.deepEqual(agent._plannerQuestionAnswerContext(scheduled, 3), { answersPlannerQuestion: true, answeredQuestionSchedulingTool: 'schedule_task' });
- assert.deepEqual(agent._plannerQuestionAnswerContext(asked({}), 3), { answersPlannerQuestion: true, answeredQuestionSchedulingTool: null });
+ const scheduled = asked({ schedulingTool: 'schedule_task', messageTarget: ALI });
+ const stored = scheduled[2].webbrainPlannerClarification;
+ assert.deepEqual([stored.schedulingTool, stored.messageTarget], ['schedule_task', ALI], 'the question records the schedule and the people');
+ assert.deepEqual([asked({})[2].webbrainPlannerClarification.schedulingTool, asked({})[2].webbrainPlannerClarification.messageTarget], [null, null]);
+ const invalid = asked({ schedulingTool: 'schedule_everything', messageTarget: { target_kind: 'everyone', recipients: [] } })[2].webbrainPlannerClarification;
+ assert.deepEqual([invalid.schedulingTool, invalid.messageTarget], [null, null], 'only a known tool and a valid target');
+ const context = agent._plannerQuestionAnswerContext(scheduled, 3);
+ assert.deepEqual([context.answersPlannerQuestion, context.answeredQuestionSchedulingTool, context.answeredQuestionMessageTarget],
+ [true, 'schedule_task', ALI]);
+ assert.match(context.taskUserText, /Check this page for a new release on a schedule[\s\S]*every five minutes/, 'the user\'s words: request and answer');
+ assert.doesNotMatch(context.taskUserText, /How often/, 'never the question');
+ assert.deepEqual(agent._plannerQuestionAnswerContext(asked({}), 3).answeredQuestionSchedulingTool, null);
+ const none = { answersPlannerQuestion: false, answeredQuestionSchedulingTool: null, answeredQuestionMessageTarget: null, taskUserText: '' };
for (const runOptions of [{ steeringRevision: 1 }, { scheduledRun: true }, { scheduledResume: true }]) {
- assert.deepEqual(agent._plannerQuestionAnswerContext(scheduled, 3, runOptions),
- { answersPlannerQuestion: false, answeredQuestionSchedulingTool: null }, JSON.stringify(runOptions));
+ assert.deepEqual(agent._plannerQuestionAnswerContext(scheduled, 3, runOptions), none, JSON.stringify(runOptions));
}
const newRequest = [...scheduled.slice(0, 3), { ...answer, webbrainTurnKind: 'request' }];
- assert.deepEqual(agent._plannerQuestionAnswerContext(newRequest, 3), { answersPlannerQuestion: false, answeredQuestionSchedulingTool: null },
- 'a new request answers no question');
+ assert.deepEqual(agent._plannerQuestionAnswerContext(newRequest, 3), none, 'a new request answers no question');
});
- test(`${build}: a question keeps the schedule of the task it asks about, and nothing runs from it`, async () => {
+ test(`${build}: a question keeps the schedule and the people of the task it asks about, and nothing runs from it`, async () => {
const { parsePlanFromContent } = await import(`../src/${build}/src/agent/planner.js`);
const parse = plan => parsePlanFromContent(JSON.stringify(plan), { requireIntent: true, locale: 'en' });
const question = parse(clarifyPlan({ requires_submission: false, summary: HOW_OFTEN, scheduling: OPEN_SCHEDULE }));
assert.deepEqual(question.scheduling, OPEN_SCHEDULE);
assert.deepEqual([question.request_kind, question.requires_state_change], ['clarify', false]);
+ const aboutDraft = parse(clarifyPlan({ requires_submission: false, messaging: ALI }));
+ assert.deepEqual([aboutDraft.messaging, aboutDraft.draft_recipients], [null, ALI], 'a draft\'s people, never send authority');
+ const aboutMessage = parse(clarifyPlan({ messaging: ALI }));
+ assert.deepEqual([aboutMessage.messaging, aboutMessage.draft_recipients], [ALI, null]);
assert.deepEqual(parse(plannerPlan({ requires_submission: false, scheduling: EVERY_FIVE })).scheduling, EVERY_FIVE);
for (const request_kind of ['respond', 'plan_only']) {
const plan = parse(plannerPlan({
@@ -364,7 +377,7 @@ for (const build of ['chrome', 'firefox']) {
});
test(`${build}: a second look told not to re-ask may not add a submission, a recipient or a schedule the task did not carry`, async () => {
- const named = { target_kind: 'named', recipients: [{ identity: 'Ali Veli', role: 'to' }] };
+ const named = ALI;
const cases = [
['a submission nobody asked for', clarifyPlan({ requires_submission: false }), plannerPlan(), {}, false],
['a submission the answered question carried', clarifyPlan({ requires_submission: false }), plannerPlan(),
@@ -378,6 +391,19 @@ for (const build of ['chrome', 'firefox']) {
plannerPlan({ requires_submission: false, messaging: named }), {}, false],
['a draft for the recipient the first answer named', clarifyPlan({ messaging: named }),
plannerPlan({ requires_submission: false, messaging: named }), {}, true],
+ ['a draft for the recipient of the draft the first answer asked about', clarifyPlan({ requires_submission: false, messaging: named }),
+ plannerPlan({ requires_submission: false, messaging: named }), {}, true],
+ ['a recipient the answered question named', clarifyPlan(), plannerPlan({ messaging: named }),
+ { answeredQuestionMessageTarget: named }, true],
+ ['a recipient the user named in the answer', clarifyPlan(), plannerPlan({ messaging: named }),
+ { taskUserText: userWords('Send the report to my accountant', 'It is Ali Veli') }, true],
+ ['a recipient only the page could have named', clarifyPlan(), plannerPlan({ messaging: named }),
+ { taskUserText: userWords('Send the report to my accountant', 'the one on the screen') }, false],
+ ['the open conversation, whatever the user wrote', clarifyPlan({ requires_submission: false }),
+ plannerPlan({ requires_submission: false, messaging: OPEN_CHAT }),
+ { taskUserText: userWords('Draft a reply', 'use the current chat') }, false],
+ ['the open conversation the answered question addressed', clarifyPlan({ requires_submission: false }),
+ plannerPlan({ requires_submission: false, messaging: OPEN_CHAT }), { answeredQuestionMessageTarget: OPEN_CHAT }, true],
['a schedule the task did not carry', clarifyPlan(), plannerPlan({ scheduling: { tool: 'schedule_task', hint: 'Every 43200 minutes.' } }), {}, false],
['a schedule the first answer carried', clarifyPlan({ scheduling: OPEN_SCHEDULE }), plannerPlan({ scheduling: EVERY_FIVE }), {}, true],
['a schedule the answered question carried', clarifyPlan(), plannerPlan({ scheduling: EVERY_FIVE }),
@@ -386,6 +412,10 @@ for (const build of ['chrome', 'firefox']) {
plannerPlan({ scheduling: EVERY_FIVE }), {}, false],
['a recurring schedule where the answered question carried only a pause', clarifyPlan(),
plannerPlan({ scheduling: EVERY_FIVE }), { answeredQuestionSchedulingTool: 'schedule_resume' }, false],
+ ['a run without the recurring schedule the first answer carried', clarifyPlan({ scheduling: OPEN_SCHEDULE }), plannerPlan(), {}, false],
+ ['a run without the recurring schedule the answered question carried', clarifyPlan(), plannerPlan(),
+ { answeredQuestionSchedulingTool: 'schedule_task' }, false],
+ ['a run without the pause the first answer carried', clarifyPlan({ scheduling: PAUSE }), plannerPlan(), {}, true],
];
for (const [label, first, second, extraContext, accepted] of cases) {
for (const gate of ['planner', 'intent']) {
@@ -408,6 +438,34 @@ for (const build of ['chrome', 'firefox']) {
assert.equal(result.requiredSchedulingTool, 'schedule_task');
});
+ test(`${build}: a rejected second look names why`, async () => {
+ const { parsePlanFromContent } = await import(`../src/${build}/src/agent/planner.js`);
+ const parse = plan => parsePlanFromContent(JSON.stringify(plan), { requireIntent: true, locale: 'en' });
+ const agent = newAgent();
+ const reason = (first, second, context = {}) => agent._plannerSecondLookRejection(parse(first), parse(second), context);
+ assert.equal(reason(clarifyPlan({ requires_submission: false }), plannerPlan()), 'adds_submission');
+ assert.equal(reason(clarifyPlan(), plannerPlan({ messaging: ALI })), 'adds_recipient');
+ assert.equal(reason(clarifyPlan({ requires_submission: false }), plannerPlan({ requires_submission: false, messaging: ALI })), 'adds_recipient',
+ 'a draft\'s recipient too');
+ assert.equal(reason(clarifyPlan(), plannerPlan({ scheduling: EVERY_FIVE })), 'adds_schedule');
+ assert.equal(reason(clarifyPlan({ scheduling: OPEN_SCHEDULE }), plannerPlan()), 'drops_schedule');
+ assert.equal(reason(clarifyPlan({ scheduling: OPEN_SCHEDULE }), clarifyPlan({ summary: SECOND_QUESTION })), null,
+ 'another question runs nothing, so it drops nothing');
+ assert.equal(reason(clarifyPlan({ scheduling: OPEN_SCHEDULE }), plannerPlan({ scheduling: EVERY_FIVE })), null);
+ });
+
+ test(`${build}: only whole names in the user's own words name a recipient`, () => {
+ const agent = newAgent();
+ const people = (...identities) => identities.map(identity => ({ identity, role: 'to' }));
+ assert.equal(agent._userTextNamesRecipients(userWords('Send it to Ali Veli.'), people('ali veli')), true, 'a name may end a sentence');
+ assert.equal(agent._userTextNamesRecipients('mail [email protected] and Bob', people('[email protected]', 'bob')), true);
+ assert.equal(agent._userTextNamesRecipients('mail [email protected]', people('[email protected]', 'bob')), false, 'every person');
+ assert.equal(agent._userTextNamesRecipients('Send it to Alice', people('Ali')), false, 'a whole name, not part of one');
+ assert.equal(agent._userTextNamesRecipients('mail [email protected]', people('[email protected]')), false, 'not an address prefix');
+ assert.equal(agent._userTextNamesRecipients('Send it to Ali', []), false, 'no one is not a recipient');
+ assert.equal(agent._userTextNamesRecipients('', people('Ali')), false);
+ });
+
test(`${build}: only a model with a thinking mode it may use rethinks`, () => {
const agent = newAgent();
const withConfig = (config, model = VLLM_QWEN.model) => ({ ...VLLM_QWEN, model, config: { ...VLLM_QWEN.config, model, ...config } });
@@ -526,6 +584,30 @@ for (const build of ['chrome', 'firefox']) {
}
});
+ test(`${build}: an answer that names the recipient is planned, and a name only the page holds is not`, async () => {
+ const WHO = 'Who is your accountant? Tell me their name or address.';
+ for (const [label, answerText, accepted] of [['named in the answer', 'It is Ali Veli', true], ['only on the page', 'the one on the screen', false]]) {
+ const tabId = accepted ? 39 : 40;
+ const question = clarifyPlan({ summary: WHO });
+ const { agent, calls } = scriptedAgent({ provider: PLAIN_MODEL, answers: [question, question, plannerPlan({ messaging: ALI })] });
+ const messages = [{ role: 'system', content: 'sys' }];
+ agent.conversations.set(tabId, messages);
+ agent._persistSubmittedTurn = async () => {};
+ agent._persist = () => {};
+ const asked = await agent._maybeRunPlannerGate(tabId, messages, user('Send the monthly report to my accountant'), () => {}, 'act', null, null, TAB, {});
+ assert.deepEqual([asked.proceed, asked.message], [false, WHO], `${label}: ${JSON.stringify(asked)}`);
+ const gate = await agent._maybeRunPlannerGate(tabId, messages, user(answerText), () => {}, 'act', null, null, TAB, {});
+ assert.equal(calls.length, 3, label);
+ assert.match(calls[2].messages[0].content, REASK, `${label}: the answer got a second look`);
+ if (accepted) {
+ assert.equal(gate.proceed, true, `${label}: ${JSON.stringify(gate)}`);
+ assert.equal(gate.requiresSubmission, true, label);
+ } else {
+ assert.deepEqual([gate.proceed, gate.requestKind, gate.message], [false, 'clarify', WHO], `${label}: ${JSON.stringify(gate)}`);
+ }
+ }
+ });
+
test(`${build}: a recipient question about a scheduled task records the schedule`, async () => {
const scheduledMessage = plannerPlan({ messaging: { target_kind: 'active_conversation', recipients: [] }, scheduling: EVERY_FIVE });
for (const gate of ['planner', 'intent']) {