Skip to content

fix(driver): reset command log nesting after grouped commands in cy.origin#33289

Open
nnyouung wants to merge 9 commits intocypress-io:developfrom
nnyouung:issue-33162
Open

fix(driver): reset command log nesting after grouped commands in cy.origin#33289
nnyouung wants to merge 9 commits intocypress-io:developfrom
nnyouung:issue-33162

Conversation

@nnyouung
Copy link

@nnyouung nnyouung commented Jan 27, 2026


Additional details

This PR fixes a bug where grouped commands (e.g. within) inside cy.origin() did not reset the Command Log nesting level, causing subsequent groups to appear nested under the previous one.

Root cause
Cross‑origin logs were mutating or inheriting the primary origin’s log group stack (logGroupIds), so the group level did not properly reset after a grouped command finished.

Fix
Prevent cross‑origin logs from mutating primary logGroupIds (ignore groupStart/groupEnd in primary).
Pass originLogGroupLevel/Id metadata from cy.origin to the spec bridge.
Only fill groupLevel/group when missing, preserving already computed values.

Impact
Grouped commands inside cy.origin() now exit correctly, so subsequent commands appear at the expected nesting level.



Note

Medium Risk
Touches core command-log grouping/state logic used broadly across the runner; mistakes could mis-group or mis-render logs, especially in cross-origin scenarios.

Overview
Fixes cy.origin() command log grouping so grouped commands (e.g. within) correctly reset nesting, preventing cross-origin logs from mutating the primary origin’s logGroupIds stack.

This threads originLogGroupLevel/originLogGroupId from the primary cy.origin log group into the spec bridge, and updates Log defaulting logic to scope group tracking by origin, ignore groupStart/groupEnd mutations for cross-origin logs on the primary, and only backfill group/groupLevel when missing. Adds an e2e regression test for group-level reset behavior and a changelog entry.

Written by Cursor Bugbot for commit 6e979d1. This will update automatically on new commits. Configure here.

Steps to test

- Run:
yarn workspace @packages/driver cypress:run --spec cypress/e2e/e2e/origin/commands/log.cy.ts

- (Optional, visual) Open mode:
yarn workspace @packages/driver cypress:open --e2e
Run log.cy.ts and confirm the second 'within' is at the same level as the first.


How has the user experience changed?

Before
After the first grouped command finishes inside cy.origin(), the Command Log group level does not decrease.
Subsequent commands appear incorrectly nested as if still inside the previous group.

After
Grouped commands inside cy.origin() correctly exit their group.
Subsequent commands display at the correct log level.
(Screenshots/GIF: add before/after if available)

2026-01-27 09 03 18

PR Tasks

@CLAassistant
Copy link

CLAassistant commented Jan 27, 2026

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

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.

Grouped commands nested in cy.origin do not properly decrease their log level when the group is done

3 participants