Skip to content

fix(debug-controller): drop recorded actions when recording session ends - #42458

Open
Ashraf Ali (ashrafiucse) wants to merge 1 commit into
microsoft:mainfrom
ashrafiucse:fix-42218
Open

fix(debug-controller): drop recorded actions when recording session ends#42458
Ashraf Ali (ashrafiucse) wants to merge 1 commit into
microsoft:mainfrom
ashrafiucse:fix-42218

Conversation

@ashrafiucse

@ashrafiucse Ashraf Ali (ashrafiucse) commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • clear the accumulated recorder actions when the recorder mode switches to none, so the next recording session on the same page starts from a clean list
  • the list was never cleared before, so a late signal (dialog, navigation, popup) re-rendered a stale previous-session action as the last one, and clients diffing by count - e.g. the VS Code extension's "Record at cursor" - inserted that stale action into the editor

Addresses the cross-session variant of #42218. The mid-recording variant is fixed on the extension side: microsoft/playwright-vscode#807

Related: #42461 keeps the browser open after stopping a debug session, extending the record-after-debug workflow (#37822).

The debug controller accumulates recorder actions in a closure and
re-sends the full list in every `sourceChanged` event. The list was
never cleared when recording was disabled, so a subsequent recording
session on the same page leaked the previous session's actions: a late
signal (dialog, navigation, popup) re-rendered a stale action as the
last one, and clients that diff by count - like the VS Code extension's
"Record at cursor" - inserted that stale action into the editor.

Clear the accumulated actions when the recorder mode switches to
'none', so each session starts from a clean list.

Fixes: microsoft#42218
// Recording session has ended: drop the accumulated actions, so that the
// next session does not leak them into the emitted source (the client
// would re-insert the stale last action into the editor).
if (mode === 'none')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this include 'standby' as well?

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [firefox-library] › library/debug-controller.spec.ts:275 › should not leak actions from the previous recording session @firefox-ubuntu-22.04-node20
❌ [playwright-test] › ui-mode-trace.spec.ts:827 › should update state on subsequent run @windows-latest-node22

9 flaky ⚠️ [chromium-library] › library/video.spec.ts:113 › screencast › should capture static page `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:294 › screencast › should capture navigation `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:301 › should report intercepted service worker requests in HAR `@chromium-ubuntu-22.04-node22`
⚠️ [chromium-library] › library/chromium/oopif.spec.ts:179 › should take screenshot `@chromium-ubuntu-22.04-node22`
⚠️ [chromium-library] › library/video.spec.ts:294 › screencast › should capture navigation `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:388 › should reveal errors in the sourcetab `@windows-latest-node22`

51279 passed, 1241 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [chromium] › mcp/http.spec.ts:144 › http transport browser sigint @mcp-windows-latest-chromium

8304 passed, 1367 skipped


Merge workflow run.

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