Skip to content

An open-source, faster Devin alternative

TypeScript

Webhooks: redact URL credentials in log export, forward identity headers, bump CLI to 0.6.8, correct docs

Igor Zalutskib294c046120d
diff --git a/cli/package-lock.json b/cli/package-lock.json
index 550d7685..3fc61788 100644
--- a/cli/package-lock.json
+++ b/cli/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@opencomputer/cli",
- "version": "0.6.7",
+ "version": "0.6.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@opencomputer/cli",
- "version": "0.6.7",
+ "version": "0.6.8",
"dependencies": {
"@opencode-ai/sdk": "1.18.4",
"ai": "^7.0.45",
diff --git a/cli/package.json b/cli/package.json
index a643eb10..0d272eac 100644
--- a/cli/package.json
+++ b/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@opencomputer/cli",
- "version": "0.6.7",
+ "version": "0.6.8",
"description": "Build, test, deploy, and share OpenComputer agents as code.",
"type": "module",
"bin": {
diff --git a/cloudflare-workers/api-edge/src/managed_agents.test.ts b/cloudflare-workers/api-edge/src/managed_agents.test.ts
index 78f3378a..1794572c 100644
--- a/cloudflare-workers/api-edge/src/managed_agents.test.ts
+++ b/cloudflare-workers/api-edge/src/managed_agents.test.ts
@@ -379,7 +379,8 @@ describe("managed agents proxy", () => {
const headers = new Headers(init?.headers);
expect(headers.get("authorization")).toBeNull();
expect(headers.get("request-id")).toBe("sentry-delivery-1");
- expect(headers.get("sentry-hook-resource")).toBeNull();
+ expect(headers.get("sentry-hook-resource")).toBe("event_alert");
+ expect(headers.get("sentry-hook-signature")).toBeNull();
expect(await new Response(init?.body).json()).toEqual(sentryBody);
return Response.json({
request: {
@@ -408,6 +409,7 @@ describe("managed agents proxy", () => {
"content-type": "application/json",
"request-id": "sentry-delivery-1",
"sentry-hook-resource": "event_alert",
+ "sentry-hook-signature": "abc",
},
body: JSON.stringify(sentryBody),
},
diff --git a/cloudflare-workers/api-edge/src/managed_agents.ts b/cloudflare-workers/api-edge/src/managed_agents.ts
index 678b5da0..716f70a3 100644
--- a/cloudflare-workers/api-edge/src/managed_agents.ts
+++ b/cloudflare-workers/api-edge/src/managed_agents.ts
@@ -1346,11 +1346,16 @@ export async function handleManagedAgentChannelConnection(
});
}
+// Headers that carry or select a delivery identity; the backend decides
+// precedence (Sentry deliveries are identified by the alerted object named
+// by `sentry-hook-resource`, not by the per-attempt `request-id`).
const WEBHOOK_DELIVERY_ID_HEADERS = [
"idempotency-key",
- "request-id",
+ "sentry-hook-resource",
"x-github-delivery",
+ "stripe-signature",
"svix-id",
+ "request-id",
] as const;
export async function handleAgentWebhookInvocation(
@@ -1415,8 +1420,6 @@ export async function handleAgentWebhookInvocation(
"x-request-id": crypto.randomUUID(),
});
if (authorization) headers.set("authorization", authorization);
- // Delivery identity, in the backend's order of precedence: the caller's
- // key, else the delivery id a provider sends.
for (const header of WEBHOOK_DELIVERY_ID_HEADERS) {
const value = request.headers.get(header);
if (value) headers.set(header, value);
diff --git a/cloudflare-workers/log-tail/src/index.test.ts b/cloudflare-workers/log-tail/src/index.test.ts
index e36803db..a3069858 100644
--- a/cloudflare-workers/log-tail/src/index.test.ts
+++ b/cloudflare-workers/log-tail/src/index.test.ts
@@ -45,6 +45,59 @@ test("records a silent HTTP 5xx even when the invocation outcome is ok", async (
assert.equal(JSON.stringify(records[0]).includes("password"), false);
});
+test("redacts the webhook credential segment from request URLs", async () => {
+ const originalFetch = globalThis.fetch;
+ let records: Array<Record<string, unknown>> = [];
+ globalThis.fetch = (async (_input: RequestInfo | URL, init?: RequestInit) => {
+ records = JSON.parse(String(init?.body));
+ return new Response(null, { status: 200 });
+ }) as typeof fetch;
+ const token = "ocwh_dummy-credential-segment_0123456789";
+
+ try {
+ await worker.tail([{
+ scriptName: "api-edge",
+ outcome: "ok",
+ eventTimestamp: Date.parse("2026-09-08T20:00:00Z"),
+ event: {
+ request: {
+ method: "POST",
+ url: `https://app.opencomputer.dev/api/agent-webhooks/wh_0123456789abcdef0123456789abcdef/${token}`,
+ },
+ response: { status: 502 },
+ },
+ logs: [],
+ exceptions: [],
+ }, {
+ scriptName: "managed-agents",
+ outcome: "ok",
+ eventTimestamp: Date.parse("2026-09-08T20:00:01Z"),
+ event: {
+ request: {
+ method: "POST",
+ url: `https://managedagents.example/v1/agent-webhooks/wh_0123456789abcdef0123456789abcdef/${token}`,
+ },
+ response: { status: 502 },
+ },
+ logs: [],
+ exceptions: [],
+ }], env, {} as ExecutionContext);
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+
+ assert.equal(records.length, 2);
+ assert.equal(
+ records[0]?.request_url,
+ "https://app.opencomputer.dev/api/agent-webhooks/wh_0123456789abcdef0123456789abcdef/redacted",
+ );
+ assert.equal(
+ records[1]?.request_url,
+ "https://managedagents.example/v1/agent-webhooks/wh_0123456789abcdef0123456789abcdef/redacted",
+ );
+ assert.equal(JSON.stringify(records).includes(token), false);
+});
+
test("fails the collector invocation when the durable sink rejects a batch", async () => {
const originalFetch = globalThis.fetch;
const originalConsoleError = console.error;
diff --git a/cloudflare-workers/log-tail/src/index.ts b/cloudflare-workers/log-tail/src/index.ts
index bb5b9344..17c50fa7 100644
--- a/cloudflare-workers/log-tail/src/index.ts
+++ b/cloudflare-workers/log-tail/src/index.ts
@@ -54,8 +54,13 @@ function safeStringify(v: unknown): string {
catch { return String(v); }
}
-// Request query strings can carry browser client tokens (`?token=...`). Keep
-// the route useful for diagnostics without copying credentials into Axiom.
+// Agent webhook URLs carry their credential as the last path segment
+// (public `/api/agent-webhooks/<id>/<token>`, backend `/v1/agent-webhooks/<id>/<token>`).
+const WEBHOOK_TOKEN_PATH = /^(\/(?:api|v1)\/agent-webhooks\/[^/]+)\/[^/]+$/;
+
+// Request query strings can carry browser client tokens (`?token=...`), and
+// webhook paths carry the webhook credential. Keep the route useful for
+// diagnostics without copying credentials into Axiom.
function requestUrlForLogs(value?: string): string | undefined {
if (!value) return undefined;
try {
@@ -64,6 +69,7 @@ function requestUrlForLogs(value?: string): string | undefined {
url.password = "";
url.search = "";
url.hash = "";
+ url.pathname = url.pathname.replace(WEBHOOK_TOKEN_PATH, "$1/redacted");
return url.toString();
} catch {
return undefined;
diff --git a/create-start/package.json b/create-start/package.json
index 9134d84a..bf66bf73 100644
--- a/create-start/package.json
+++ b/create-start/package.json
@@ -1,6 +1,6 @@
{
"name": "@opencomputer/create-start",
- "version": "0.6.7",
+ "version": "0.6.8",
"description": "Create a hello-world OpenComputer agent application.",
"type": "module",
"bin": {
@@ -18,7 +18,7 @@
"node": ">=22.0.0"
},
"dependencies": {
- "@opencomputer/cli": "0.6.7"
+ "@opencomputer/cli": "0.6.8"
},
"publishConfig": {
"access": "public"
diff --git a/docs/agents/webhooks.mdx b/docs/agents/webhooks.mdx
index 7b6f6127..9c10fe34 100644
--- a/docs/agents/webhooks.mdx
+++ b/docs/agents/webhooks.mdx
@@ -66,15 +66,25 @@ The response is HTTP 202 with the request, session ID, and dashboard session
URL. It is sent as soon as the delivery is stored; the session starts
afterwards, so the response arrives within Sentry's and GitHub's timeouts.
The request's `outcome` is `pending` in the response and becomes `accepted`
-once the session is running, or `failed` after the platform has retried the
-start for about forty minutes. The dashboard's Webhooks tab lists requests
-with their outcomes.
+once the session is running, or `failed` after five start attempts over
+about thirteen minutes. Read outcomes from the request ledger with your API
+key; the session id there is authoritative, since a retried start can use a
+different session than the one first announced:
+
+```bash
+curl 'https://app.opencomputer.dev/api/managed-agents/projects/<project-id>/webhooks/<webhook-id>/requests?environment=production' \
+ -H 'Authorization: Bearer <api-key>'
+```
Each delivery needs an identity so that a retry does not start a second
-session. OpenComputer uses the first present of `Idempotency-Key`,
-`Request-ID` (Sentry), `X-GitHub-Delivery`, and `Svix-Id`. Retrying the same
-body with the same identity returns the original request and session; if
-that request had failed to start, the retry starts it again.
+session. OpenComputer uses the first available of: your `Idempotency-Key`;
+for Sentry, the alerted event or issue named in the body together with the
+`Sentry-Hook-Resource` header, which stays the same across Sentry's retries
+while its `Request-ID` does not; `X-GitHub-Delivery`; for Stripe, the event
+id in the body; `Svix-Id`; and finally `Request-ID`. Retrying with the same
+identity and body returns the original request and session; if that request
+had failed to start, the retry starts it again. A body larger than 256 KiB
+once wrapped as agent input is rejected with 400 before acknowledgement.
## Read webhook input