Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

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

Abel Yagubyan26bc77ce564b
diff --git a/src/browser/CdpAuthorizedTarget.ts b/src/browser/CdpAuthorizedTarget.ts
index af0f7cf4a..95a2449a3 100644
--- a/src/browser/CdpAuthorizedTarget.ts
+++ b/src/browser/CdpAuthorizedTarget.ts
@@ -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 (
diff --git a/tests/boundary/browser/cdpBrowserProvider.discovery_authorization.test.ts b/tests/boundary/browser/cdpBrowserProvider.discovery_authorization.test.ts
index 653abeec9..98a8ab55c 100644
--- a/tests/boundary/browser/cdpBrowserProvider.discovery_authorization.test.ts
+++ b/tests/boundary/browser/cdpBrowserProvider.discovery_authorization.test.ts
@@ -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")