Skip to content

fix variable parsing in act#656

Merged
kamath merged 1 commit intomainfrom
sean/stg-287-fix-variables-in-act
Apr 11, 2025
Merged

fix variable parsing in act#656
kamath merged 1 commit intomainfrom
sean/stg-287-fix-variables-in-act

Conversation

@seanmcguire12
Copy link
Copy Markdown
Member

why

  • when a user wraps their variable name in percentage symbols, those percentage symbols are not currently parsed out, and are therefore included as part of the variable value
  • eg, user does something like:
  • await stagehand.page.act({
      action: "search for %search_string%",
      variables: {
        search_string: "stagehand",
      },
    });
    
  • the resulting search will look like:
Screenshot 2025-04-09 at 4 42 26 PM

what changed

  • we now parse out the percentage signs

test plan

  • evals

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 9, 2025

🦋 Changeset detected

Latest commit: 9db9ed1

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

This PR includes changesets to release 1 package
Name Type
@browserbasehq/stagehand Patch

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

Copy link
Copy Markdown
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.

PR Summary

The PR refines the variable parsing in the act method to correctly strip percentage symbols from variables.

  • Updated replacement logic in /lib/handlers/actHandler.ts to handle %variable% patterns precisely.
  • Ensures that only exact matches are replaced, preventing unintended inclusion of percentage symbols.
  • Aligns implementation with user expectations as documented in the PR body.
  • Test plans via evals will verify multiple occurrences and overall behavior.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@kamath kamath merged commit c630373 into main Apr 11, 2025
16 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 11, 2025
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