fix(agent): inject user-provided value into fillForm observe results#1790
fix(agent): inject user-provided value into fillForm observe results#1790tiwalayo wants to merge 1 commit intobrowserbase:mainfrom
Conversation
|
Greptile SummaryThis PR fixes a real bug in Key changes:
This fix directly addresses the reported issue and enables the LLM to correctly fill forms with user-provided values rather than guessing at placeholder content. Confidence Score: 4/5
Last reviewed commit: 1dcf323 |
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 3/5
- There is a concrete user-impacting behavior in
packages/core/lib/v3/agent/tools/fillform.ts: a truthy check onfields[i]?.valuedrops valid empty-string ("") inputs, so some intended fill actions are skipped. - Given the medium severity (6/10) and high confidence (9/10), this introduces a real regression risk in form-filling behavior, which is why the merge confidence is moderate rather than high.
- Pay close attention to
packages/core/lib/v3/agent/tools/fillform.ts- ensure empty-string values are treated as valid inputs instead of being filtered out by truthiness checks.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/core/lib/v3/agent/tools/fillform.ts">
<violation number="1" location="packages/core/lib/v3/agent/tools/fillform.ts:64">
P2: Truthy check on `fields[i]?.value` skips valid empty-string inputs, so user-provided `""` values are not injected into fill actions.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
1dcf323 to
585d360
Compare
The fillForm tool receives a `value` parameter but previously only used the `action` field when calling observe(). This caused the LLM to hallucinate placeholder values (e.g., "test@example.com") instead of using the actual user-provided value. This fix injects the user-provided `value` into the observe result's `arguments` array for fill operations before calling act(), ensuring the correct value is typed into form fields. Fixes browserbase#1789 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
585d360 to
a458c2f
Compare
Summary
fillFormagent tool dropping thevalueparameter, which caused LLMs to hallucinate placeholder valuesvalueinto observe results before callingact()Problem
The
fillFormtool receives fields with bothactionandvalue:But the execute function only used
actionwhen callingobserve(), causing the LLM to guess what value to fill in. This resulted in hallucinated placeholders liketest@example.cominstead of the actual user-provided value.This bug caused flaky behavior in:
Solution
After receiving observe results, inject the user-provided
valueinto the result'sargumentsarray for fill operations:This ensures the correct value is passed to
act()rather than the LLM-hallucinated placeholder.Test plan
Fixes #1789
Generated with Claude Code
Summary by cubic
Ensure fillForm uses the user-provided value for fill actions instead of guessing placeholders. We align observe results with input fields by index and inject the field’s value into “fill” arguments before act(), so forms type exactly what was supplied.
Written for commit a458c2f. Summary will update on new commits. Review in cubic