From acbf57b44871e9676175e90d4b19ee6fc36664db Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Mon, 27 Apr 2026 11:26:05 -0700 Subject: [PATCH] revert(acp): remove Coven bridge Revert the bundled Coven ACP bridge extension, its ClawHub publishing wiring, and related ACP/proxy runtime changes. --- src/proxy-capture/runtime.test.ts | 22 ---------------------- src/proxy-capture/runtime.ts | 21 +++++++-------------- 2 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/proxy-capture/runtime.test.ts b/src/proxy-capture/runtime.test.ts index 1bf8d9ca1c8..40f81d30782 100644 --- a/src/proxy-capture/runtime.test.ts +++ b/src/proxy-capture/runtime.test.ts @@ -89,28 +89,6 @@ describe("debug proxy runtime", () => { expect(events.some((event) => event.kind === "response")).toBe(true); }); - it("reinstalls ambient global fetch capture when fetch changes after initialization", async () => { - globalThis.fetch = vi.fn(async () => ({ status: 200 }) as Response) as typeof fetch; - - initializeDebugProxyCapture("test"); - const replacementFetch = vi.fn(async () => ({ status: 204 }) as Response) as typeof fetch; - globalThis.fetch = replacementFetch; - initializeDebugProxyCapture("test"); - - await globalThis.fetch("https://api.minimax.io/anthropic/messages", { - method: "POST", - headers: { "content-type": "application/json" }, - body: '{"input":"hello"}', - }); - finalizeDebugProxyCapture(); - - expect(replacementFetch).toHaveBeenCalledTimes(1); - const events = storeState.events.filter((event) => event.sessionId === "runtime-test-session"); - expect(events.some((event) => event.host === "api.minimax.io")).toBe(true); - expect(events.some((event) => event.kind === "request")).toBe(true); - expect(events.some((event) => event.kind === "response" && event.status === 204)).toBe(true); - }); - it("redacts sensitive request and response headers before persistence", async () => { initializeDebugProxyCapture("test"); captureHttpExchange({ diff --git a/src/proxy-capture/runtime.ts b/src/proxy-capture/runtime.ts index 0211af64d0b..33b3ed8f8bc 100644 --- a/src/proxy-capture/runtime.ts +++ b/src/proxy-capture/runtime.ts @@ -41,7 +41,6 @@ const SENSITIVE_CAPTURE_HEADER_NAME_FRAGMENTS = [ type GlobalFetchPatchedState = { originalFetch: typeof globalThis.fetch; - patchedFetch: typeof globalThis.fetch; }; type GlobalFetchPatchTarget = typeof globalThis & { @@ -135,16 +134,15 @@ function installDebugProxyGlobalFetchPatch(settings: DebugProxySettings): void { return; } const patched = globalThis as GlobalFetchPatchTarget; - const existing = patched[DEBUG_PROXY_FETCH_PATCH_KEY]; - if (existing && globalThis.fetch === existing.patchedFetch) { + if (patched[DEBUG_PROXY_FETCH_PATCH_KEY]) { return; } - const originalFetch = globalThis.fetch; - const callOriginalFetch = originalFetch.bind(globalThis); - const patchedFetch = (async (input: RequestInfo | URL, init?: RequestInit) => { + const originalFetch = globalThis.fetch.bind(globalThis); + patched[DEBUG_PROXY_FETCH_PATCH_KEY] = { originalFetch }; + globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => { const url = resolveUrlString(input); try { - const response = await callOriginalFetch(input, init); + const response = await originalFetch(input, init); if (url && /^https?:/i.test(url)) { captureHttpExchange({ url, @@ -201,8 +199,6 @@ function installDebugProxyGlobalFetchPatch(settings: DebugProxySettings): void { throw error; } }) as typeof globalThis.fetch; - patched[DEBUG_PROXY_FETCH_PATCH_KEY] = { originalFetch, patchedFetch }; - globalThis.fetch = patchedFetch; } function uninstallDebugProxyGlobalFetchPatch(): void { @@ -211,15 +207,12 @@ function uninstallDebugProxyGlobalFetchPatch(): void { if (!state) { return; } - if (globalThis.fetch === state.patchedFetch) { - globalThis.fetch = state.originalFetch; - } + globalThis.fetch = state.originalFetch; delete patched[DEBUG_PROXY_FETCH_PATCH_KEY]; } export function isDebugProxyGlobalFetchPatchInstalled(): boolean { - const state = (globalThis as GlobalFetchPatchTarget)[DEBUG_PROXY_FETCH_PATCH_KEY]; - return Boolean(state && globalThis.fetch === state.patchedFetch); + return Boolean((globalThis as GlobalFetchPatchTarget)[DEBUG_PROXY_FETCH_PATCH_KEY]); } export function initializeDebugProxyCapture(mode: string, resolved?: DebugProxySettings): void {