Skip to content

Remove Stagehand context accessors - #2585

Open
miguelg719 wants to merge 1 commit into
miguelgonzalez/stg-2763-migrate-browsercontextfrom
miguelgonzalez/stg-2763-remove-stagehandcontext
Open

Remove Stagehand context accessors#2585
miguelg719 wants to merge 1 commit into
miguelgonzalez/stg-2763-migrate-browsercontextfrom
miguelgonzalez/stg-2763-remove-stagehandcontext

Conversation

@miguelg719

@miguelg719 miguelg719 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

why

With consumers migrated, keeping Stagehand context aliases would preserve an API we do not want to support in v4.

what changed

Removes Stagehand context accessors from TypeScript, Python, and Go and adds API regression guards plus updated parity expectations.

No changeset: this targets the unreleased v4 API.

test plan

  • TypeScript SDK build and unit tests
  • Full Python SDK suite
  • Go SDK suite
  • Cross-language parity tests

Summary by cubic

Removed Stagehand context accessors across TypeScript, Python, and Go. Only stagehand.browser.context remains, with new public API tests and parity rules to prevent reintroducing the legacy accessor.

  • Migration
    • TypeScript: change stagehand.context to stagehand.browser.context.
    • Python: change stagehand.context to stagehand.browser.context.
    • Go: change Stagehand.Context() to Stagehand.Browser().Context().

Linked Linear: STG-2763.

Written for commit c950fc7. Summary will update on new commits.

Review in cubic

@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c950fc7

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

@miguelg719
miguelg719 force-pushed the miguelgonzalez/stg-2763-remove-stagehandcontext branch from c014ab0 to e868799 Compare August 4, 2026 19:27

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cubic analysis

All reported issues were addressed

Linked issue analysis

Linked issue: STG-2763: Change stagehand.context to browser.context

Status Acceptance criteria Notes
Remove Stagehand.Context() method from the Go SDK API The Stagehand.Context() method was deleted from packages/sdk-go/stagehand.go; related tests now reference the browser handle.
Replace uses of Stagehand.Context() with Browser().Context() in Go tests/code Live/test code now calls client.Browser().Context() and error messages updated accordingly.
Add Go unit test asserting Stagehand does not expose Context A test was added that fails if Stagehand has a Context method.
Remove Stagehand.context property in Python and add a test ensuring it's not exposed The context property was removed from the Python Stagehand class and a test asserts Stagehand has no 'context' attribute.
Remove Stagehand.context getter in TypeScript and add tests asserting it is not published The getter was removed and tests now assert 'context' is not present on Stagehand.prototype and via type checks.
Update docs/README to indicate context is on the browser handle README text was changed to state that Stagehand exposes context on the browser handle.
Update cross-language parity expectations to no longer require Stagehand.Context The parity rule no longer includes 'Context' in the Stagehand accessor set.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread rules/ast-grep/sdk-parity.test.ts
@miguelg719
miguelg719 force-pushed the miguelgonzalez/stg-2763-remove-stagehandcontext branch from e868799 to 9c587da Compare August 4, 2026 20:23
@miguelg719
miguelg719 force-pushed the miguelgonzalez/stg-2763-remove-stagehandcontext branch from 9c587da to 9781407 Compare August 4, 2026 20:25
@miguelg719
miguelg719 force-pushed the miguelgonzalez/stg-2763-remove-stagehandcontext branch from 9781407 to c950fc7 Compare August 4, 2026 21:59
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