Skip to content

Commit 478d3c1

Browse files
author
SentienceDEV
committed
fix: tighten isSearchNavigationComplete heuristic to avoid false positives
Restrict search task pattern to search/find/look-up only (remove open/ visit/browse/go-to which matched non-search tasks like 'Open cart'). Add guards for 'and continue' and multi-step task patterns.
1 parent 36064c7 commit 478d3c1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/agents/planner-executor/planner-executor-agent.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,20 +5057,24 @@ COUNT:`;
50575057

50585058
const taskLower = task.toLowerCase();
50595059

5060-
const isSearchTask =
5061-
/\b(search|find|look\s*up|go\s*to|navigate\s*to|open|visit|browse)\b/i.test(taskLower);
5060+
const isSearchTask = /\b(?:search(?:\s+for)?|find|look\s*up)\b/i.test(taskLower);
50625061
if (!isSearchTask) {
50635062
return false;
50645063
}
50655064

50665065
const hasFollowUpAction =
5067-
/\b(?:and|then)\s+(?:add|remove|delete|create|update|fill|submit|buy|purchase|add\s+to\s+cart|checkout)\b/i.test(
5066+
/\b(?:and|then)\s+(?:add|remove|delete|create|update|fill|submit|buy|purchase|add\s+to\s+cart|checkout|continue)\b/i.test(
50685067
taskLower
50695068
);
50705069
if (hasFollowUpAction) {
50715070
return false;
50725071
}
50735072

5073+
const hasMultiStep = /\b(?:and\s+continue|multi[\s-]?step|then\s+\w+)\b/i.test(taskLower);
5074+
if (hasMultiStep) {
5075+
return false;
5076+
}
5077+
50745078
if (!urlBefore || !urlAfter || urlBefore === urlAfter) {
50755079
return false;
50765080
}

0 commit comments

Comments
 (0)