fix(browser): keep refresh guidance for a missing CDP target (#6340)

Co-authored-by: Abelo9996 <Abelo9996@users.noreply.github.com>
This commit is contained in:
Abel YagubyanandAbelo9996 authored and GitHub committed 2026-10-23 02:20:37 +08:00
1 parent 7aee876d81
commit 26bc77ce56
2 files changed
+6 -1

No files matched your search

+2
View File
@@ -21,6 +21,8 @@ export const authorizeCdpTarget = (
if (target === undefined)
throw new BrowserObservationError(operation, "target_not_found", {
detail: `Target ${input.target_id} was not found at the selected endpoint.`,
remediationAction:
"Refresh target discovery for that endpoint and retry with a returned target ID.",
});
const origin = sanitizeBrowserUrl(target.url).origin;
if (
@@ -415,16 +415,18 @@ describe("CdpBrowserProvider: target selection detail", () => {
"missing",
"target_not_found",
"Target missing was not found at the selected endpoint.",
"Refresh target discovery for that endpoint and retry with a returned target ID.",
],
[
"disallowed-page",
"target_not_allowed",
"Target disallowed-page must be an HTTP(S) page in the selected origin scope.",
"Target disallowed-page must be an HTTP(S) page in the selected origin scope.",
],
] as const;
const inspected = new Map<string, unknown>();
for (const [operation, run] of operations)
for (const [targetId, reason, detail] of selections) {
for (const [targetId, reason, detail, remediation] of selections) {
const result = await run({
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
@@ -437,6 +439,7 @@ describe("CdpBrowserProvider: target selection detail", () => {
expect(projected).toMatchObject({
code: "target_unavailable",
message: detail,
remediation: { action: remediation },
});
// Only the attributed operation differs from the inspect projection.
if (operation === "inspect_web_page")