Skip to content

Conversation

tkattkat
Copy link
Collaborator

@tkattkat tkattkat commented Sep 10, 2025

why

solves #1060
patch regression of playwright arguments being removed from agent execute response

what changed

agent.execute now returns playwright arguments in its response

test plan

tested locally

Copy link

changeset-bot bot commented Sep 10, 2025

🦋 Changeset detected

Latest commit: 8473aa4

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tkattkat tkattkat marked this pull request as ready for review September 10, 2025 19:08
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR restores the missing playwrightArguments field to the agent execute response, addressing issue #1060. The implementation adds observe calls to capture Playwright action details (selector, method, arguments, description) before executing actions, then passes these details through the tool result chain to be included in the final AgentAction.

Key changes:

  • Modified act.ts to call observe() before act() to capture Playwright arguments
  • Updated stagehandAgentHandler.ts to extract and include playwrightArguments from tool results
  • Added new TypeScript interfaces for PlaywrightArguments and ActToolResult
  • Handles both regular and iframe action scenarios
  • Added proper changeset documentation

Issues identified:

  • Inconsistent parameter usage between execution model paths in act tool
  • Iframe observe options don't use buildActObservePrompt() for consistency

Confidence score: 3/5

  • This PR addresses a valid regression but has some logical inconsistencies that should be resolved
  • The implementation successfully restores the missing playwrightArguments functionality, but there are two logical issues: inconsistent parameter usage between execution paths and inconsistent observe prompt building in iframe handling. These issues could cause runtime problems or unexpected behavior.
  • Pay close attention to lib/agent/tools/act.ts for the parameter consistency issues

3 files reviewed, 2 comments

Edit Code Review Bot Settings | Greptile

@tkattkat tkattkat marked this pull request as draft September 10, 2025 19:34
@tkattkat tkattkat marked this pull request as ready for review September 10, 2025 19:49
@tkattkat tkattkat marked this pull request as draft September 10, 2025 19:49
@tkattkat tkattkat marked this pull request as ready for review September 10, 2025 19:50
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR restores the playwrightArguments field to the AgentResult that was previously removed, addressing issue #1060. The changes implement a new approach that uses observe() first to get the playwright arguments, then executes the action with act().

Key changes:

  • Modified act.ts tool to call observe() before act() to capture playwright arguments
  • Updated stagehandAgentHandler.ts to extract and include playwright arguments in the agent response
  • Added proper TypeScript types for PlaywrightArguments and ActToolResult
  • Handles both regular and iframe contexts appropriately

Confidence score: 4/5

  • This PR is safe to merge with minor style improvements recommended
  • Score reflects well-structured implementation that addresses the regression properly with comprehensive type safety and error handling, though there's a minor consistency issue with iframe prompt building
  • No files require special attention, though the iframe observe logic could be made more consistent

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR restores the missing playwrightArguments field in agent execution responses, addressing a regression where playwright execution details were no longer being returned to users. The fix refactors the act tool to use the observe/act pattern consistently, extracting playwright action details from observe results and including them in all response paths (normal execution, iframe handling, and error cases).

Confidence score: 4/5

  • This PR is safe to merge with low risk
  • Score reflects a well-structured fix that restores expected functionality. The code properly handles all execution paths including iframe scenarios and error cases. The refactor to consistently use observe/act pattern improves code organization.
  • No files require special attention

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants