From 283414770ec6f72b323b7f246618b334ba6b761f Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Sat, 17 Oct 2026 03:46:50 -0500 Subject: [PATCH 1/3] fix(web): never retry detached Playwright input after dispatch evidence --- packages/web/src/actions.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/web/src/actions.ts b/packages/web/src/actions.ts index 9179375f98..4da7b181e0 100644 --- a/packages/web/src/actions.ts +++ b/packages/web/src/actions.ts @@ -287,6 +287,15 @@ export function classifyActionError(rawCause: unknown, action: LocatorAction): E return new EngineError('NODE_STALE', text, { retryable: true, cause }); } if (DETACHED_PATTERN.test(text)) { + // A stale retry earlier in Playwright's log does not undo input sent on + // a later attempt. Replaying the action could submit the same form twice. + if (POST_DISPATCH_PATTERN.test(text)) { + return new EngineError( + 'ACTION_MAY_HAVE_COMMITTED', + `${action.kind} detached after its input was dispatched: ${text}`, + { retryable: false, cause }, + ); + } return new EngineError('NODE_STALE', text, { retryable: true, cause }); } if (/Timeout .*exceeded/i.test(text) || isPwTimeout(rawCause)) { From 212194de285737a9ea8bcf1a6edad0e066059c7a Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Sat, 17 Oct 2026 03:47:07 -0500 Subject: [PATCH 2/3] test(web): pin detached-then-press replay safety regression --- packages/web/tests/unit/actions.test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/web/tests/unit/actions.test.ts b/packages/web/tests/unit/actions.test.ts index a77caa7728..2a20294450 100644 --- a/packages/web/tests/unit/actions.test.ts +++ b/packages/web/tests/unit/actions.test.ts @@ -137,6 +137,31 @@ describe('classifyActionError', () => { expect(classifyActionError(error, { kind: 'press', key: 'Enter' })).toMatchObject({ code: 'ACTION_MAY_HAVE_COMMITTED' }); }); + it('does not retry a press after Playwright detached once but dispatched on a later attempt', () => { + // Playwright may first retry a detached input, then press Enter and time + // out waiting for the navigation the key began. + const dispatched = new Error( + 'locator.press: Timeout 2000ms exceeded.\\nCall log:\\n' + + ' - element was detached from the DOM, retrying\\n' + + ' - elementHandle.press("Enter")\\n', + ); + dispatched.name = 'TimeoutError'; + const result = classifyActionError(dispatched, { kind: 'press', key: 'Enter' }); + expect(result).toMatchObject({ code: 'ACTION_MAY_HAVE_COMMITTED', retryable: false, cause: dispatched }); + + // Without the later dispatch marker the detached locator is still safe + // to re-resolve and retry. + const beforeDispatch = new Error( + 'locator.press: Timeout 2000ms exceeded.\\nCall log:\\n' + + ' - element was detached from the DOM, retrying\\n', + ); + beforeDispatch.name = 'TimeoutError'; + expect(classifyActionError(beforeDispatch, { kind: 'press', key: 'Enter' })).toMatchObject({ + code: 'NODE_STALE', + retryable: true, + }); + }); + it('keeps a bare timeout without a call log a plain actionability miss', () => { const error = new Error('Timeout 5000ms exceeded'); error.name = 'TimeoutError'; From 4932a5761ddbf75ea566eb705d787cbb6a02e0e1 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Sat, 17 Oct 2026 04:03:35 -0500 Subject: [PATCH 3/3] test(web): represent Playwright call log with real newline escapes --- packages/web/tests/unit/actions.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/web/tests/unit/actions.test.ts b/packages/web/tests/unit/actions.test.ts index 2a20294450..4032ac5147 100644 --- a/packages/web/tests/unit/actions.test.ts +++ b/packages/web/tests/unit/actions.test.ts @@ -141,9 +141,9 @@ describe('classifyActionError', () => { // Playwright may first retry a detached input, then press Enter and time // out waiting for the navigation the key began. const dispatched = new Error( - 'locator.press: Timeout 2000ms exceeded.\\nCall log:\\n' + - ' - element was detached from the DOM, retrying\\n' + - ' - elementHandle.press("Enter")\\n', + 'locator.press: Timeout 2000ms exceeded.\nCall log:\n' + + ' - element was detached from the DOM, retrying\n' + + ' - elementHandle.press("Enter")\n', ); dispatched.name = 'TimeoutError'; const result = classifyActionError(dispatched, { kind: 'press', key: 'Enter' }); @@ -152,8 +152,8 @@ describe('classifyActionError', () => { // Without the later dispatch marker the detached locator is still safe // to re-resolve and retry. const beforeDispatch = new Error( - 'locator.press: Timeout 2000ms exceeded.\\nCall log:\\n' + - ' - element was detached from the DOM, retrying\\n', + 'locator.press: Timeout 2000ms exceeded.\nCall log:\n' + + ' - element was detached from the DOM, retrying\n', ); beforeDispatch.name = 'TimeoutError'; expect(classifyActionError(beforeDispatch, { kind: 'press', key: 'Enter' })).toMatchObject({