Compare commits

...
Author SHA1 Message Date
morlutoandGitHub 49ada44d9b Merge branch 'main' into cursor/browser-cancellation-after-cleanup-1ffc 2026-10-14 03:06:36 +08:00
AadityaandGitHub 64041e3072 fix(session): reject an unknown configured provider before unbound routing (#2976)
When every registered deep provider rejected a target, select() returned
an intentionally unbound success for any concrete environment selector,
including one that names no registered provider. A misconfigured
REA_ANALYSIS_PROVIDER therefore opened the target unbound, and the later
deep-operation diagnostic blamed target support instead of the unknown
configuration. The same identifier requested explicitly already failed
with unknown_provider.

Take the unbound shortcut only for a registered environment preference.
An unknown configured identifier now reaches concrete selection and fails
with unknown_provider, matching the explicit request. Registered
preferences and auto still leave artifact-only targets unbound.

Fixes #2592
2026-10-14 03:05:57 +08:00
39f96d7188 fix(qlog): list a hidden stream's records without spreading call arguments (#2860)
* fix(qlog): list a hidden stream's records without spreading call arguments

When an explicit declaration matched a stream's derived total, the
decoder pushed every contribution ordinal with a spread call. A stream
with more than ~125k STREAM frames exceeded the engine's argument limit,
so a valid capture within the input budget failed with RangeError
instead of listing the records as incomplete. Push the ordinals in a
loop.

* fix(comparison): recheck historical calls-only changes (#2223)

* fix(comparison): preserve incomplete function call evidence

Keep missing, unknown, partial and unresolved call relationships unknown in function comparisons and reconstruction claims. Aggregate IDA caller and callee coverage without overwriting uncertainty.

Validate with 144 focused tests, typecheck/lint, docs checks and test discovery. Real providers were not verified; the full headless IDA session suite requires unavailable Windows native controls.

* fix(comparison): recheck historical calls-only changes

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

* fix(ci): isolate Linux Hopper process fixture inventory

* fix(android): make DEX descriptor pattern portable

---------

Co-authored-by: Lucien <164857476+dakjdakd@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-10-14 03:05:34 +08:00
morlutoandGitHub 1ed755ac60 Merge branch 'main' into cursor/browser-cancellation-after-cleanup-1ffc 2026-10-14 02:44:24 +08:00
morluto bfcc9526a3 fix(browser): preserve source-map cancellation results 2026-10-14 01:56:05 +08:00
REA Maintenance a742936108 Merge commit 'ebaaa79ca02bde4a73013a2a9a781d0b07a57ee4' into HEAD
# Conflicts:
#	src/browser/CdpBrowserProvider.ts
#	tests/boundary/cli/clientProfileLifecycle.test.ts
2026-10-14 01:31:47 +08:00
Cursor Agent 82bcf0814d test(cli): type the retained skill directory pairs
noUncheckedIndexedAccess treats the unlabeled pair list as an open array, so the directory passed to join was string or undefined.
2026-10-13 16:02:11 +00:00
Cursor Agent 474b34c570 test(ghidra): drop the duplicated path join import
The inventory MCP test imported join twice, which fails lint on current main.
2026-10-13 16:00:50 +00:00
Cursor Agent de1d3f2a24 test(browser): keep cleanup cancellation coverage in its own suite
The added interrupt cases made the existing lifecycle suite exceed the function-length lint limit.
2026-10-13 16:00:49 +00:00
Cursor Agent 0e92dd8e60 fix(setup): keep Devin configuration JSON-formatted
The empty DSH_HOME fix also changed Devin's declared format to "devin", which is not a configuration format and stops the typecheck. Devin still writes mcp_config.json.
2026-10-13 15:59:23 +00:00
Cursor Agent d32287ebf6 fix(browser): report cancellation after cleanup and source-map abort
An interrupt during CDP cleanup could still publish the captured page, and a source-map download abort was wrapped as a provider failure. Both now return AnalysisCancelledError for the requested operation.
2026-10-13 15:56:56 +00:00
9 changed files with 258 additions and 6 deletions
@@ -186,6 +186,28 @@ describe("analysis provider registry: binding failures and cancellation", () =>
expect(explicit.error.reason).toBe("target_unsupported");
});
it("rejects an unknown environment preference even when every candidate rejects the target", async () => {
const alpha = candidate("alpha");
const misconfigured = new AnalysisProviderRegistry(
[alpha.provider],
"missing",
);
for (const selected of [
await misconfigured.select(ARTIFACT_TARGET),
await misconfigured.select(ARTIFACT_TARGET, "missing"),
]) {
if (selected.ok) throw new Error("expected unknown provider rejection");
expect(projectAnalysisError(selected.error)).toMatchObject({
details: {
selection_reason: "unknown_provider",
requested_provider_id: "missing",
candidate_ids: ["alpha"],
},
});
}
});
it("does not bind a profile with unresolved version or adapter failure", async () => {
const unresolved = candidate("unresolved", { profile: "missing" });
const failed = candidate("failed", { profile: "error" });
@@ -176,7 +176,7 @@ export class AnalysisProviderRegistry {
return err(new AnalysisCancelledError("open_binary"));
if (
request === undefined &&
selector !== "auto" &&
this.#byId.has(selector) &&
baseline.length > 0 &&
baseline.every(
({ targetSupport }) => targetSupport.status === "unsupported",
+10 -1
View File
@@ -43,7 +43,10 @@ import {
type WebScreenshotDiff,
} from "../domain/webScreenshot.js";
import { AnalysisError } from "../domain/analysisErrorBase.js";
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
import {
AnalysisCancelledError,
AnalysisInputError,
} from "../domain/analysisErrorCore.js";
import { BrowserObservationError } from "../domain/browserObservationError.js";
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
import type { BrowserObservationOperation } from "../domain/browserObservationErrors.js";
@@ -164,6 +167,8 @@ export class CdpBrowserProvider implements BrowserObservationPort {
),
);
} catch (cause: unknown) {
if (options.signal?.aborted === true)
return err(new AnalysisCancelledError("analyze_web_bundle", { cause }));
return err(providerError(cause, "analyze_web_bundle"));
}
}
@@ -335,6 +340,10 @@ const withTargetSession = async <
);
// An unadopted browser socket is closed here; closing is idempotent.
await endpoint.connection?.close();
// Cleanup can observe an interrupt after work returns. Do not publish its
// result once cancellation arrived while the target session was closing.
if (options.signal?.aborted === true)
throw new AnalysisCancelledError(operation);
}
};
+15
View File
@@ -186,6 +186,21 @@ it("excludes structural auth material and explicit normalized values without gue
expect(traces[0]?.incomplete_fact_records).toContain(2);
});
it("omits a hidden derived total for a stream with more contributions than call arguments allow", () => {
const events = Array.from({ length: 130 }, (_, index) =>
event(
Array.from({ length: 1_000 }, (_, offset) =>
frame(index * 1_000 + offset, 1),
),
),
);
const { traces } = facts(capture(events), ["130000"]);
expect(traces[0]?.streams).toEqual([]);
expect(traces[0]?.incomplete_fact_records).toEqual(
Array.from({ length: 130 }, (_, ordinal) => ordinal),
);
});
it("hides marked ancestor keys and safe derived sums while still validating hidden subtrees", () => {
const text = capture([event([frame(0, 3), frame(3, 4)])]);
expect(facts(text, ["7"]).traces[0]?.streams).toEqual([]);
+3 -3
View File
@@ -95,10 +95,10 @@ export const decodeQlogCapture = (
...stream.reported_final_sizes,
...stream.covered_ranges.flatMap((r) => [r.start, r.end]),
];
// A stream can have more contributions than call arguments allow.
if (numericValues.some(excluded))
fact.incomplete_fact_records.push(
...stream.contributions.map((c) => c.record_ordinal),
);
for (const contribution of stream.contributions)
fact.incomplete_fact_records.push(contribution.record_ordinal);
else fact.streams.push(stream);
}
fact.incomplete_fact_records = [...new Set(fact.incomplete_fact_records)];
@@ -7,12 +7,205 @@ import {
} from "../../../src/domain/browserObservation.js";
import { analyzeWebBundleInputSchema } from "../../../src/domain/webBundleAnalysis.js";
import { observeWebSessionInputSchema } from "../../../src/domain/browserSession.js";
import { discoverWebMcpToolsInputSchema } from "../../../src/domain/webMcpDiscovery.js";
import { captureWebScreenshotInputSchema } from "../../../src/domain/webScreenshot.js";
import {
startFakeCdpBrowser,
type FakeCdpBrowser,
} from "../../fixtures/fakeCdpBrowser.js";
import { trackBrowser } from "./cdpBrowserProvider.support.js";
const waitFor = async (ready: () => boolean, description: string) => {
const deadline = Date.now() + 5_000;
while (!ready()) {
if (Date.now() > deadline) throw new Error(description);
await new Promise((resolve) => setTimeout(resolve, 10));
}
};
describe("CdpBrowserProvider: cancellation during cleanup", () => {
it.each([
{
name: "WebMCP discovery",
operation: "discover_webmcp_tools",
invoke: (
provider: CdpBrowserProvider,
browser: FakeCdpBrowser,
signal: AbortSignal,
) =>
provider.discoverWebMcpTools(
discoverWebMcpToolsInputSchema.parse({
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
observation_ms: 0,
}),
{ signal },
),
},
{
name: "screenshot capture",
operation: "capture_web_screenshot",
invoke: (
provider: CdpBrowserProvider,
browser: FakeCdpBrowser,
signal: AbortSignal,
) =>
provider.captureScreenshot(
captureWebScreenshotInputSchema.parse({
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
}),
{ signal },
),
},
])(
"reports cancellation during $name cleanup",
async ({ operation, invoke }) => {
const browser = await startFakeCdpBrowser({
hangOnMethod: "Page.disable",
webMcpTools: true,
});
trackBrowser(browser);
const controller = new AbortController();
const pending = invoke(
new CdpBrowserProvider(),
browser,
controller.signal,
);
await waitFor(
() => browser.commands.some(({ method }) => method === "Page.disable"),
"page cleanup did not start",
);
controller.abort();
await expect(pending).resolves.toMatchObject({
ok: false,
error: { _tag: "AnalysisCancelledError", operation },
});
},
);
it("reports cancellation when an interrupt arrives during page cleanup", async () => {
const browser = await startFakeCdpBrowser({
hangOnMethod: "Network.disable",
});
trackBrowser(browser);
const controller = new AbortController();
const pending = new CdpBrowserProvider().inspectPage(
inspectWebPageInputSchema.parse({
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
observation_ms: 0,
}),
{ signal: controller.signal },
);
await waitFor(
() => browser.commands.some(({ method }) => method === "Network.disable"),
"page cleanup did not start",
);
controller.abort();
await expect(pending).resolves.toMatchObject({
ok: false,
error: {
_tag: "AnalysisCancelledError",
operation: "inspect_web_page",
},
});
});
it("reports cancellation when an interrupt arrives during session cleanup", async () => {
const browser = await startFakeCdpBrowser({
hangOnMethod: "Network.disable",
});
trackBrowser(browser);
const controller = new AbortController();
const pending = new CdpBrowserProvider().observeSession(
observeWebSessionInputSchema.parse({
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
observation_ms: 1,
}),
{ signal: controller.signal },
);
await waitFor(
() => browser.commands.some(({ method }) => method === "Network.disable"),
"session cleanup did not start",
);
controller.abort();
await expect(pending).resolves.toMatchObject({
ok: false,
error: {
_tag: "AnalysisCancelledError",
operation: "observe_web_session",
},
});
});
it("reports cancellation when an interrupt arrives during source-map download", async () => {
const browser = await startFakeCdpBrowser({ hangSourceMap: true });
trackBrowser(browser);
const controller = new AbortController();
const pending = new CdpBrowserProvider().analyzeBundle(
analyzeWebBundleInputSchema.parse({
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
observation_ms: 0,
fetch_source_maps: true,
}),
{ signal: controller.signal },
);
await waitFor(
() =>
browser.httpRequests.some(({ url }) => url.startsWith("/app.js.map")),
"source-map download did not start",
);
controller.abort();
await expect(pending).resolves.toMatchObject({
ok: false,
error: {
_tag: "AnalysisCancelledError",
operation: "analyze_web_bundle",
},
});
});
it("classifies custom source-map abort reasons as cancellation", async () => {
const browser = await startFakeCdpBrowser({ hangSourceMap: true });
trackBrowser(browser);
const controller = new AbortController();
const pending = new CdpBrowserProvider().analyzeBundle(
analyzeWebBundleInputSchema.parse({
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
observation_ms: 0,
fetch_source_maps: true,
}),
{ signal: controller.signal },
);
await waitFor(
() =>
browser.httpRequests.some(({ url }) => url.startsWith("/app.js.map")),
"source-map download did not start",
);
controller.abort(new Error("stopped"));
await expect(pending).resolves.toMatchObject({
ok: false,
error: {
_tag: "AnalysisCancelledError",
operation: "analyze_web_bundle",
},
});
});
});
describe("CdpBrowserProvider: cancellation and session events", () => {
it("honors cancellation during the final progress callback before publishing inspection", async () => {
const browser = await startFakeCdpBrowser();
@@ -73,7 +73,13 @@ it("releases cleanup when cancellation arrives after capture completes", async (
});
controller.abort();
const result = await pending;
expect(result.ok).toBe(true);
expect(result).toMatchObject({
ok: false,
error: {
_tag: "AnalysisCancelledError",
operation: "observe_web_session",
},
});
expect(browser.commands.map(({ method }) => method)).toContain(
"Target.detachFromTarget",
);
+5
View File
@@ -229,6 +229,11 @@ const serveSourceMap = (
response: ServerResponse,
options: FakeOptions,
): boolean => {
if (
options.hangSourceMap === true &&
request.url?.startsWith("/app.js.map") === true
)
return true;
if (options.sourceMapBody === undefined) return false;
if (request.url?.startsWith("/app.js.map") === true) {
if (options.sourceMapRedirect !== undefined)
+2
View File
@@ -95,6 +95,8 @@ export interface FakeOptions {
readonly webSocketWithoutFrames?: boolean;
readonly invalidBinaryWebSocketEvent?: boolean;
readonly sourceMapBody?: string;
/** Accept a source-map request and leave the response open. */
readonly hangSourceMap?: boolean;
readonly sourceMapRedirect?: string;
readonly sessionTimeline?:
| "same_origin"