Skip to content

first regression test #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

filip-michalsky
Copy link
Collaborator

why

what changed

test plan

Copy link

linear bot commented Jun 12, 2025

@@ -46,6 +47,29 @@ async def act(self, options: Union[ActOptions, ObserveResult]) -> ActResult:
options, self.stagehand.dom_settle_timeout_ms
)

# Extract timeout_ms from options (check both snake_case and camelCase)
timeout_ms = options.get("timeout_ms") or options.get("timeoutMs")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I needed to touch this since the regression tests revealed we were not handling act timeout locally

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@miguelg719 i am not sure how you want to handle the aliases mapping for local execution ? Since we need to convert to CamelCase for the API, but in Python for local execution it should be snake_case? Should we not use the Alias mapper for local execution

from LLM:

Alternative Solutions
We could have avoided this by:

  • Not using aliases in ActHandler: Change StagehandPage.act() to serialize without aliases for local execution
  • Converting back to snake_case: In ActHandler, convert camelCase back to snake_case
  • Using the Pydantic object directly: Pass the ActOptions object instead of a serialized dict

But the current approach is the safest since it maintains compatibility with both the API format and handles the current codebase structure without major refactoring.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am open to a different solution, but the regression tests should pass locally


result = await stagehand.page.extract(extract_options)

# TODO - how to unify the extract result handling between LOCAL and BROWSERBASE?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@miguelg719 pls lmk what you think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolved with new PR on extract API pydantic return, will merge into here when merged there


result = await stagehand.page.extract(extract_options)

# TODO - how to unify the extract result handling between LOCAL and BROWSERBASE?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@miguelg719 pls lmk what you think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolved with new PR on extract API pydantic return, will merge into here when merged there

)

result = await stagehand.page.extract(extract_options)
#TODO - how to unify the extract result handling between LOCAL and BROWSERBASE?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@miguelg719 pls lmk what you think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolved with new PR on extract API pydantic return, will merge into here when merged there


result = await stagehand.page.extract(extract_options)

#TODO - how to unify the extract result handling between LOCAL and BROWSERBASE?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@miguelg719 pls lmk what you think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolved with new PR on extract API pydantic return, will merge into here when merged there

@filip-michalsky filip-michalsky marked this pull request as ready for review June 13, 2025 01:08
# If timeout is specified, wrap the entire act operation with asyncio.wait_for
if timeout_ms:
try:
return await asyncio.wait_for(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To confirm based on a concern raised in standup yesterday, I am not too concerned about race conditions here as this implementation mirrors TS.

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

Successfully merging this pull request may close these issues.

1 participant