Skip to content

fix: substitute variables in keys tool#1926

Draft
ShaoyeLi wants to merge 1 commit intobrowserbase:mainfrom
ShaoyeLi:codex/keys-variable-substitution-1776
Draft

fix: substitute variables in keys tool#1926
ShaoyeLi wants to merge 1 commit intobrowserbase:mainfrom
ShaoyeLi:codex/keys-variable-substitution-1776

Conversation

@ShaoyeLi
Copy link
Copy Markdown

@ShaoyeLi ShaoyeLi commented Mar 30, 2026

Summary

  • pass agent variables into the keys tool just like other variable-aware tools
  • substitute %variable% placeholders before typing when method="type"
  • cover the regression with a unit test that asserts the resolved value is typed

Testing

  • pnpm --dir packages/core run build:esm
  • pnpm --dir packages/core exec vitest run dist/esm/tests/unit/agent-execution-model.test.js
  • pnpm --dir packages/core exec eslint lib/v3/agent/tools/index.ts lib/v3/agent/tools/keys.ts tests/unit/agent-execution-model.test.ts

Summary by cubic

Fixes variable substitution in the keys tool by passing agent variables and resolving %variable% placeholders before typing, preventing literal placeholders from being typed.

  • Bug Fixes
    • Wired variables into keys via createAgentTools and substituted values when method="type".
    • Added a unit test to assert %token% resolves and the actual value is typed.

Written for commit 1c29e02. Summary will update on new commits. Review in cubic

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 30, 2026

⚠️ No Changeset found

Latest commit: 1c29e02

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions
Copy link
Copy Markdown
Contributor

This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run.
Approving the latest commit mirrors it into an internal PR owned by the approver.
If new commits are pushed later, the internal PR stays open but is marked stale until someone approves the latest external commit and refreshes it.

@github-actions github-actions bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. labels Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant