Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(feedback): make failed requests reportable (#271)

Leo3071b2ac20fb
diff --git a/apps/marketing/src/pages/privacy-policy.astro b/apps/marketing/src/pages/privacy-policy.astro
index 754a1bc0e..0e18491ce 100644
--- a/apps/marketing/src/pages/privacy-policy.astro
+++ b/apps/marketing/src/pages/privacy-policy.astro
@@ -40,8 +40,9 @@ const sections = [
its own processing and retention.
</li>
<li>
- <strong>Product feedback.</strong> Feedback you submit goes to the Akeru feedback service and may be
- kept for up to 90 days.
+ <strong>Product feedback.</strong> Feedback you submit goes to the Akeru feedback service, may be
+ kept there for up to 90 days, and may be posted publicly to the Akeru Bot GitHub Issues tab
+ until a maintainer removes it.
</li>
<li>
<strong>Voice.</strong> During a voice call, microphone audio and session data go to the
diff --git a/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts b/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts
index d3cb22a66..2d02ad0e5 100644
--- a/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts
+++ b/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts
@@ -1230,6 +1230,38 @@ describe("ProviderRuntimeIngestion", () => {
expect(thread.messages.filter((message) => message.turnId === turnId)).toHaveLength(1);
});
+ it("adds an actionable reply when a failed turn has no assistant text", async () => {
+ const harness = await createHarness();
+ const turnId = asTurnId("turn-failed-without-text");
+
+ harness.emit({
+ type: "turn.started",
+ eventId: asEventId("evt-turn-failed-without-text-started"),
+ provider: ProviderDriverKind.make("codex"),
+ threadId: asThreadId("thread-1"),
+ createdAt: "2026-01-01T00:00:01.000Z",
+ turnId,
+ });
+ harness.emit({
+ type: "turn.completed",
+ eventId: asEventId("evt-turn-failed-without-text-completed"),
+ provider: ProviderDriverKind.make("codex"),
+ threadId: asThreadId("thread-1"),
+ createdAt: "2026-01-01T00:00:02.000Z",
+ turnId,
+ payload: { state: "failed", errorMessage: "Provider crashed" },
+ });
+
+ const thread = await waitForThread(harness.readModel, (entry) =>
+ entry.messages.some(
+ (message) =>
+ message.turnId === turnId &&
+ message.text === "I cannot complete the request. Check the error details.",
+ ),
+ );
+ expect(thread.messages.filter((message) => message.turnId === turnId)).toHaveLength(1);
+ });
+
it("applies provider session.state.changed transitions directly", async () => {
const harness = await createHarness();
const waitingAt = "2026-01-01T00:00:00.000Z";
diff --git a/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts b/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
index 22088a341..e1e84f064 100644
--- a/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
+++ b/apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
@@ -2192,7 +2192,7 @@ const make = Effect.gen(function* () {
if (!hasVisibleAssistantReply && !finalizedReplyVisibility.some(Boolean)) {
const fallbackText =
event.payload.state === "failed"
- ? "I could not complete that request. Check the error details and try again."
+ ? "I cannot complete the request. Check the error details."
: "I finished without a text response. Please try again.";
yield* finalizeAssistantMessage({
event,
diff --git a/apps/web/src/components/chat/ThreadErrorBanner.test.tsx b/apps/web/src/components/chat/ThreadErrorBanner.test.tsx
index a3dbb2751..2137d4417 100644
--- a/apps/web/src/components/chat/ThreadErrorBanner.test.tsx
+++ b/apps/web/src/components/chat/ThreadErrorBanner.test.tsx
@@ -7,6 +7,7 @@ import {
isThreadErrorBannerDismissedForSession,
shouldShowThreadErrorBanner,
ThreadErrorBanner,
+ threadErrorFeedbackDraft,
} from "./ThreadErrorBanner";
describe("ThreadErrorBanner", () => {
@@ -85,4 +86,13 @@ describe("ThreadErrorBanner", () => {
expect(markup).toContain("h-lh w-4");
expect(markup).toContain("h-lh self-start");
});
+
+ it("offers a one-click feedback draft containing the error details", () => {
+ const markup = renderToStaticMarkup(<ThreadErrorBanner error="Provider crashed" />);
+
+ expect(markup).toContain("Send feedback");
+ expect(threadErrorFeedbackDraft("Provider crashed")).toBe(
+ "A request failed in a bot chat.\n\nError details:\nProvider crashed",
+ );
+ });
});
diff --git a/apps/web/src/components/chat/ThreadErrorBanner.tsx b/apps/web/src/components/chat/ThreadErrorBanner.tsx
index 62b211c3f..3b4038ea8 100644
--- a/apps/web/src/components/chat/ThreadErrorBanner.tsx
+++ b/apps/web/src/components/chat/ThreadErrorBanner.tsx
@@ -3,6 +3,11 @@ import { Alert, AlertAction, AlertDescription } from "../ui/alert";
import { Button } from "../ui/button";
import { CircleAlertIcon, XIcon } from "lucide-react";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
+import { openProductFeedbackWithPrefill } from "../../productFeedbackStore";
+
+export function threadErrorFeedbackDraft(error: string): string {
+ return `A request failed in a bot chat.\n\nError details:\n${error}`;
+}
export function getThreadErrorBannerKey(threadKey: string, error: string | null): string | null {
return error === null ? null : `${threadKey}\u0000${error}`;
@@ -53,13 +58,21 @@ export const ThreadErrorBanner = memo(function ThreadErrorBanner({
</TooltipPopup>
</Tooltip>
</AlertDescription>
- {onDismiss && (
- <AlertAction>
+ <AlertAction>
+ <Button
+ size="xs"
+ type="button"
+ variant="outline"
+ onClick={() => openProductFeedbackWithPrefill(threadErrorFeedbackDraft(error))}
+ >
+ Send feedback
+ </Button>
+ {onDismiss ? (
<Button variant="ghost" size="icon-xs" aria-label="Dismiss error" onClick={onDismiss}>
<XIcon className="text-destructive" />
</Button>
- </AlertAction>
- )}
+ ) : null}
+ </AlertAction>
</Alert>
</div>
);
diff --git a/apps/web/src/components/productFeedback/ProductFeedbackDialog.tsx b/apps/web/src/components/productFeedback/ProductFeedbackDialog.tsx
index 5b5ede1bc..20322fd66 100644
--- a/apps/web/src/components/productFeedback/ProductFeedbackDialog.tsx
+++ b/apps/web/src/components/productFeedback/ProductFeedbackDialog.tsx
@@ -20,6 +20,7 @@ import {
} from "../ui/dialog";
import { Label } from "../ui/label";
import { Textarea } from "../ui/textarea";
+import { toastManager } from "../ui/toast";
interface TurnstileApi {
readonly render: (
@@ -83,13 +84,11 @@ export function ProductFeedbackDialog() {
const startPicking = useProductFeedbackStore((state) => state.startPicking);
const stopPicking = useProductFeedbackStore((state) => state.stopPicking);
const updateDraft = useProductFeedbackStore((state) => state.updateDraft);
- const clearDraft = useProductFeedbackStore((state) => state.clearDraft);
+ const completeFeedback = useProductFeedbackStore((state) => state.completeFeedback);
const [submitting, setSubmitting] = useState(false);
const [website, setWebsite] = useState("");
const [status, setStatus] = useState<
- | { readonly kind: "idle" }
- | { readonly kind: "success"; readonly feedbackId: string }
- | { readonly kind: "failure"; readonly message: string }
+ { readonly kind: "idle" } | { readonly kind: "failure"; readonly message: string }
>({ kind: "idle" });
const [challengeSiteKey, setChallengeSiteKey] = useState<string | null>(null);
const [challengeAttempt, setChallengeAttempt] = useState(0);
@@ -135,11 +134,11 @@ export function ProductFeedbackDialog() {
const result = await submitProductFeedback(settings.productFeedbackEndpoint, payload);
setSubmitting(false);
if (result.ok) {
- setStatus({ kind: "success", feedbackId: result.receipt.feedbackId });
- clearDraft();
+ completeFeedback();
setWebsite("");
setChallengeSiteKey(null);
setTurnstileToken(undefined);
+ toastManager.add({ type: "success", title: "Feedback sent" });
return;
}
setStatus({ kind: "failure", message: result.rejection.message });
@@ -214,11 +213,10 @@ export function ProductFeedbackDialog() {
<p role="alert" className="text-sm text-destructive-foreground">
{status.message}
</p>
- ) : status.kind === "success" ? (
- <p role="status" className="text-sm text-foreground">
- Feedback sent. ID: <code>{status.feedbackId}</code>
- </p>
) : null}
+ <p className="text-xs text-muted-foreground">
+ Feedback is posted publicly to GitHub Issues. Do not include secrets or private data.
+ </p>
{!settings.productFeedbackEnabled ? (
<p role="status" className="text-sm text-muted-foreground">
Product feedback is disabled in Settings.
diff --git a/apps/web/src/components/roster/useBotThreadRuntime.test.ts b/apps/web/src/components/roster/useBotThreadRuntime.test.ts
index 50eeaa92b..8aaa3a20b 100644
--- a/apps/web/src/components/roster/useBotThreadRuntime.test.ts
+++ b/apps/web/src/components/roster/useBotThreadRuntime.test.ts
@@ -10,6 +10,9 @@ const mocks = vi.hoisted(() => ({
useAtomCommand: vi.fn(),
command: vi.fn(),
approvalCommand: Symbol("respondToApproval"),
+ primaryEnvironmentId: null as EnvironmentId | null,
+ threadShells: [] as Array<Record<string, unknown>>,
+ threadShell: null as Record<string, unknown> | null,
}));
vi.mock("react", async (importOriginal) => {
@@ -33,15 +36,17 @@ vi.mock("../../hooks/useSettings", () => ({ usePrimarySettings: () => ({}) }));
vi.mock("../../modelSelection", () => ({ resolveAppModelSelectionState: () => null }));
vi.mock("../../state/entities", () => ({
useProjects: () => [],
- useThreadShells: () => [],
+ useThreadShells: () => mocks.threadShells,
useAllEnvironmentShellsBootstrapped: () => true,
- useThreadShell: () => null,
+ useThreadShell: () => mocks.threadShell,
useThreadMessages: () => [],
useThreadActivities: () => [],
readEnvironmentSupportsFileAttachments: () => true,
}));
vi.mock("../../state/bots", () => ({ environmentBotsAtom: () => null }));
-vi.mock("../../state/environments", () => ({ usePrimaryEnvironmentId: () => null }));
+vi.mock("../../state/environments", () => ({
+ usePrimaryEnvironmentId: () => mocks.primaryEnvironmentId,
+}));
vi.mock("../../state/server", () => ({ primaryServerProvidersAtom: null }));
vi.mock("../../state/threads", () => ({
threadEnvironment: { respondToApproval: mocks.approvalCommand },
@@ -60,6 +65,9 @@ vi.mock("./rosterStore", () => ({
beforeEach(() => {
hooks.reset();
vi.clearAllMocks();
+ mocks.primaryEnvironmentId = null;
+ mocks.threadShells = [];
+ mocks.threadShell = null;
mocks.derivePendingApprovals.mockReturnValue([]);
mocks.useAtomCommand.mockReturnValue(mocks.command);
mocks.command.mockResolvedValue({ _tag: "Success", value: undefined });
@@ -102,3 +110,28 @@ describe("bot runtime approval ownership", () => {
});
});
});
+
+describe("bot runtime errors", () => {
+ it("surfaces the persisted provider error for a failed turn", () => {
+ const environmentId = EnvironmentId.make("env-a");
+ mocks.primaryEnvironmentId = environmentId;
+ mocks.threadShells = [
+ {
+ environmentId,
+ id: ThreadId.make("thread-1"),
+ botId: "bot-1",
+ updatedAt: "2026-09-13T00:00:00.000Z",
+ archivedAt: null,
+ },
+ ];
+ mocks.threadShell = {
+ ...mocks.threadShells[0],
+ session: { lastError: "Provider rejected the request." },
+ };
+
+ hooks.beginRender();
+ const runtime = useBotThreadRuntime("bot-1", null);
+
+ expect(runtime.error).toBe("Provider rejected the request.");
+ });
+});
diff --git a/apps/web/src/components/roster/useBotThreadRuntime.ts b/apps/web/src/components/roster/useBotThreadRuntime.ts
index bc7673a54..9fba64f40 100644
--- a/apps/web/src/components/roster/useBotThreadRuntime.ts
+++ b/apps/web/src/components/roster/useBotThreadRuntime.ts
@@ -506,7 +506,7 @@ export function useBotThreadRuntime(botId: string, effectiveModelSelection: Mode
bootstrapped,
botReady,
defaultProject: activeProject,
- error,
+ error: error ?? rememberedThread?.session?.lastError ?? null,
linkedThreadRef,
latestTurn: rememberedThread?.latestTurn ?? null,
messages,
diff --git a/apps/web/src/components/roster/useGroupThreadRuntime.test.ts b/apps/web/src/components/roster/useGroupThreadRuntime.test.ts
new file mode 100644
index 000000000..7e67d4d02
--- /dev/null
+++ b/apps/web/src/components/roster/useGroupThreadRuntime.test.ts
@@ -0,0 +1,82 @@
+import { EnvironmentId, ThreadId } from "@t3tools/contracts";
+import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
+
+import { reactHookHarness as hooks } from "../../test/reactHookHarness";
+import { useGroupThreadRuntime } from "./useGroupThreadRuntime";
+
+const mocks = vi.hoisted(() => ({
+ primaryEnvironmentId: "env-a" as EnvironmentId,
+ threadShells: [] as Array<Record<string, unknown>>,
+ threadShell: null as Record<string, unknown> | null,
+}));
+
+vi.mock("react", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("react")>();
+ const { reactHookHarness } = await import("../../test/reactHookHarness");
+ return {
+ ...actual,
+ useCallback: reactHookHarness.useCallback,
+ useEffect: () => undefined,
+ useMemo: reactHookHarness.useMemo,
+ useRef: reactHookHarness.useRef,
+ useState: reactHookHarness.useState,
+ };
+});
+vi.mock("react/compiler-runtime", async () => {
+ const { reactHookHarness } = await import("../../test/reactHookHarness");
+ return { c: reactHookHarness.useMemoCache };
+});
+vi.mock("@effect/atom-react", () => ({ useAtomValue: () => [] }));
+vi.mock("../../hooks/useSettings", () => ({ usePrimarySettings: () => ({}) }));
+vi.mock("../../modelSelection", () => ({ resolveAppModelSelectionState: () => null }));
+vi.mock("../../state/entities", () => ({
+ useProjects: () => [],
+ useThreadShells: () => mocks.threadShells,
+ useAllEnvironmentShellsBootstrapped: () => true,
+ useThreadShell: () => mocks.threadShell,
+ useThreadMessages: () => [],
+ useThreadActivities: () => [],
+ readEnvironmentSupportsFileAttachments: () => true,
+}));
+vi.mock("../../state/bots", () => ({ environmentGroupsAtom: () => null }));
+vi.mock("../../state/environments", () => ({
+ usePrimaryEnvironmentId: () => mocks.primaryEnvironmentId,
+}));
+vi.mock("../../state/server", () => ({ primaryServerProvidersAtom: null }));
+vi.mock("../../state/threads", () => ({ threadEnvironment: {} }));
+vi.mock("../../state/use-atom-command", () => ({ useAtomCommand: () => vi.fn() }));
+vi.mock("../../session-logic", () => ({ derivePendingUserInputs: () => [] }));
+vi.mock("../Sidebar.logic", () => ({ sortScopedProjectsForSidebar: () => [] }));
+vi.mock("./rosterStore", () => ({
+ useRosterStore: (selector: (state: { bots: []; groups: [] }) => unknown) =>
+ selector({ bots: [], groups: [] }),
+}));
+
+beforeEach(() => {
+ hooks.reset();
+ mocks.threadShells = [];
+ mocks.threadShell = null;
+});
+
+describe("group runtime errors", () => {
+ it("surfaces the persisted provider error for a failed turn", () => {
+ mocks.threadShells = [
+ {
+ environmentId: mocks.primaryEnvironmentId,
+ id: ThreadId.make("thread-1"),
+ groupId: "group-1",
+ updatedAt: "2026-09-13T00:00:00.000Z",
+ archivedAt: null,
+ },
+ ];
+ mocks.threadShell = {
+ ...mocks.threadShells[0],
+ session: { lastError: "Provider rejected the request." },
+ };
+
+ hooks.beginRender();
+ const runtime = useGroupThreadRuntime("group-1");
+
+ expect(runtime.error).toBe("Provider rejected the request.");
+ });
+});
diff --git a/apps/web/src/components/roster/useGroupThreadRuntime.ts b/apps/web/src/components/roster/useGroupThreadRuntime.ts
index c67020d69..b6586be6a 100644
--- a/apps/web/src/components/roster/useGroupThreadRuntime.ts
+++ b/apps/web/src/components/roster/useGroupThreadRuntime.ts
@@ -409,7 +409,7 @@ export function useGroupThreadRuntime(groupId: string) {
return {
bootstrapped,
defaultProject: activeProject,
- error,
+ error: error ?? rememberedThread?.session?.lastError ?? null,
groupReady,
linkedThreadRef,
latestTurn: rememberedThread?.latestTurn ?? null,
diff --git a/apps/web/src/productFeedbackStore.test.ts b/apps/web/src/productFeedbackStore.test.ts
index 88a653117..06ba36ba5 100644
--- a/apps/web/src/productFeedbackStore.test.ts
+++ b/apps/web/src/productFeedbackStore.test.ts
@@ -4,6 +4,7 @@ import {
EMPTY_PRODUCT_FEEDBACK_DRAFT,
openProductFeedback,
openProductFeedbackFromToolArgs,
+ openProductFeedbackWithPrefill,
productFeedbackDraftFromToolArgs,
useProductFeedbackStore,
} from "./productFeedbackStore";
@@ -40,6 +41,18 @@ describe("product feedback store", () => {
expect(useProductFeedbackStore.getState().draft).toEqual(EMPTY_PRODUCT_FEEDBACK_DRAFT);
});
+ it("closes and clears the dialog after a successful submission", () => {
+ openProductFeedback({ feedback: "The action failed." });
+
+ useProductFeedbackStore.getState().completeFeedback();
+
+ expect(useProductFeedbackStore.getState()).toMatchObject({
+ open: false,
+ picking: false,
+ draft: EMPTY_PRODUCT_FEEDBACK_DRAFT,
+ });
+ });
+
it("decodes only bounded bot-authored draft fields", () => {
expect(
productFeedbackDraftFromToolArgs({
@@ -71,4 +84,16 @@ describe("product feedback store", () => {
});
expect(fetch).not.toHaveBeenCalled();
});
+
+ it("adds error context without replacing an existing manual draft", () => {
+ openProductFeedback({ feedback: "My existing report." });
+ useProductFeedbackStore.getState().closeFeedback();
+
+ openProductFeedbackWithPrefill("A request failed.");
+
+ expect(useProductFeedbackStore.getState()).toMatchObject({
+ open: true,
+ draft: { feedback: "My existing report.\n\nA request failed." },
+ });
+ });
});
diff --git a/apps/web/src/productFeedbackStore.ts b/apps/web/src/productFeedbackStore.ts
index 823413b16..f1e27f157 100644
--- a/apps/web/src/productFeedbackStore.ts
+++ b/apps/web/src/productFeedbackStore.ts
@@ -31,6 +31,7 @@ interface ProductFeedbackDialogState {
readonly stopPicking: (element?: ProductFeedbackElement) => void;
readonly updateDraft: (draft: Partial<ProductFeedbackDraft>) => void;
readonly clearDraft: () => void;
+ readonly completeFeedback: () => void;
}
export const useProductFeedbackStore = create<ProductFeedbackDialogState>((set) => ({
@@ -53,12 +54,20 @@ export const useProductFeedbackStore = create<ProductFeedbackDialogState>((set)
})),
updateDraft: (draft) => set((state) => ({ draft: { ...state.draft, ...draft } })),
clearDraft: () => set({ draft: EMPTY_PRODUCT_FEEDBACK_DRAFT }),
+ completeFeedback: () => set({ open: false, picking: false, draft: EMPTY_PRODUCT_FEEDBACK_DRAFT }),
}));
export function openProductFeedback(draft?: Partial<ProductFeedbackDraft>): void {
useProductFeedbackStore.getState().openFeedback(draft);
}
+export function openProductFeedbackWithPrefill(feedback: string): void {
+ const current = useProductFeedbackStore.getState().draft;
+ useProductFeedbackStore.getState().openFeedback({
+ feedback: appendBounded(current.feedback, feedback, PRODUCT_FEEDBACK_TEXT_MAX_CHARS),
+ });
+}
+
export function productFeedbackDraftFromToolArgs(
args: unknown,
): Partial<ProductFeedbackDraft> | null {
@@ -78,9 +87,6 @@ function appendBounded(current: string, proposed: string, maxLength: number): st
export function openProductFeedbackFromToolArgs(args: unknown): boolean {
const proposed = productFeedbackDraftFromToolArgs(args);
if (!proposed?.feedback) return false;
- const current = useProductFeedbackStore.getState().draft;
- useProductFeedbackStore.getState().openFeedback({
- feedback: appendBounded(current.feedback, proposed.feedback, PRODUCT_FEEDBACK_TEXT_MAX_CHARS),
- });
+ openProductFeedbackWithPrefill(proposed.feedback);
return true;
}
diff --git a/docs/internals/product-feedback.md b/docs/internals/product-feedback.md
index d8a813c6d..45f8380ee 100644
--- a/docs/internals/product-feedback.md
+++ b/docs/internals/product-feedback.md
@@ -2,7 +2,7 @@
> For maintainers. Using Akeru Bot? See [Product feedback](../user/product-feedback.md).
-Product feedback uses a standalone Cloudflare Worker in `infra/feedback`. Static web clients cannot own the inbox, and each distributed Akeru Bot server belongs to one installation. The default central endpoint is `https://akeru-feedback.leoisadev.workers.dev/v1/feedback`. The `akeru-bot.com` zone is on Vercel DNS, so the Worker has no custom hostname; the contracts default points at the workers.dev URL and clients post to it directly with CORS. The Worker stores no Linear issue and exposes no public inbox route.
+Product feedback uses a standalone Cloudflare Worker in `infra/feedback`. Static web clients cannot own the inbox, and each distributed Akeru Bot server belongs to one installation. The default central endpoint is `https://akeru-feedback.leoisadev.workers.dev/v1/feedback`. The `akeru-bot.com` zone is on Vercel DNS, so the Worker has no custom hostname; the contracts default points at the workers.dev URL and clients post to it directly with CORS. The Worker exposes no separate inbox route. When configured, it forwards accepted reports to the normal GitHub Issues tab for `opencoredev/akeru-bot` by default.
## Client boundary
@@ -34,10 +34,16 @@ The client keeps its installation token for 30 days. A successful send does not
D1 stores only the HMAC identifiers and the bounded safe payload. It does not store the raw installation token, raw IP, Turnstile token, or honeypot. A daily cron removes rows after 90 days. Submission returns a generated feedback ID and receipt time.
+The D1 row is also a delivery outbox. New submissions are explicitly marked eligible for public delivery; migrated rows default to ineligible so feedback accepted before the public-GitHub disclosure cannot be published retroactively. After returning the durable receipt, the Worker schedules GitHub delivery with `waitUntil`; the daily cron deletes expired non-quarantined rows before draining unexpired pending and confirmed-failed rows. HTTP failures retry with bounded exponential backoff. Each attempt has a unique claim ID, and both GitHub requests have deadlines shorter than the delivery lease, preventing a stale attempt from overwriting a newer result.
+
+A network or runtime failure after GitHub issue creation begins is marked `unknown` because retrying an ambiguous create could duplicate the issue. Unknown rows are quarantined from automatic delivery, but the same 90-day retention limit still deletes them. The transition and every scheduled run with outstanding unexpired unknown rows emit structured `feedback.github_delivery_unknown` or `feedback.github_delivery_unknown_outstanding` errors to Worker logs.
+
+To reconcile an unknown row before its expiry, query `feedback_id`, `received_at`, `expires_at`, `github_last_error_code`, and `payload_json` from `akeru_feedback_inbox WHERE github_issue_status = 'unknown'` with authenticated Wrangler D1 tooling. Search all repository issues for the feedback ID. If an issue exists, set the row to `delivered` with its issue number and URL; if none exists, set it to `failed` with `github_next_attempt_at` set to the current ISO timestamp so the next drain retries. Never retry before checking GitHub.
+
The Cloudflare deployment trusts only `CF-Connecting-IP`. A self-host adapter must pass the socket address from a trusted proxy. It must not trust an arbitrary `X-Forwarded-For` header.
## Operations and self-hosting
-Deploy the Worker from `infra/feedback` with `vp run --filter akeru-feedback deploy`. `AKERU_FEEDBACK_HMAC_SECRET` is required; the Worker returns `503` until it holds at least 32 bytes. `AKERU_FEEDBACK_TURNSTILE_SITE_KEY` and `AKERU_FEEDBACK_TURNSTILE_SECRET_KEY` are optional and enable the challenge step. Alchemy state is local and gitignored because the Cloudflare state store bootstrap fails on the pinned alchemy version. The Worker and D1 names are pinned, so a checkout without state recovers the existing resources with `alchemy deploy --stage production --adopt`; a plain deploy without state fails instead of creating duplicates.
+Deploy the Worker from `infra/feedback` with `vp run --filter akeru-feedback deploy`. `AKERU_FEEDBACK_HMAC_SECRET` is required; the Worker returns `503` until it holds at least 32 bytes. `AKERU_FEEDBACK_TURNSTILE_SITE_KEY` and `AKERU_FEEDBACK_TURNSTILE_SECRET_KEY` are optional and enable the challenge step. `AKERU_FEEDBACK_GITHUB_REPOSITORY` names the `owner/repository` issue destination and defaults to `opencoredev/akeru-bot`. GitHub delivery uses `AKERU_FEEDBACK_GITHUB_APP_ID`, `AKERU_FEEDBACK_GITHUB_APP_INSTALLATION_ID`, and the secret `AKERU_FEEDBACK_GITHUB_APP_PRIVATE_KEY`. The App installation must be limited to the destination repository and needs only Issues write permission. The Worker signs a short-lived App JWT, then asks GitHub for a repository- and permission-scoped installation token before creating an issue. Without all three App values, feedback remains in D1 as pending. Alchemy state is local and gitignored because the Cloudflare state store bootstrap fails on the pinned alchemy version. The Worker and D1 names are pinned, so a checkout without state recovers the existing resources with `alchemy deploy --stage production --adopt`; a plain deploy without state fails instead of creating duplicates.
Maintainers inspect the inbox with authenticated local D1 tooling. Do not add a public listing route. A self-hosted Akeru Bot environment can replace the endpoint in **Settings → About**. Keep production endpoints on HTTPS.
diff --git a/docs/user/privacy.md b/docs/user/privacy.md
index a33a26ef0..c2d98d6a8 100644
--- a/docs/user/privacy.md
+++ b/docs/user/privacy.md
@@ -9,7 +9,8 @@ server uses that worktree's `.akeru` directory instead.
- Provider requests send the prompt, selected files, tool results, and conversation context to the
provider that you select. That provider controls its processing and retention.
- Product feedback sends the text and an optional safe interface descriptor to
- the Akeru feedback service. The service can retain accepted feedback for up to 90 days.
+ the Akeru feedback service. The service can retain accepted feedback for up to 90 days and post
+ it publicly to the Akeru Bot GitHub Issues tab, where it remains until a maintainer removes it.
- Voice calls send microphone audio and call state to the ChatGPT Realtime service while a call is
active.
- Reading a stored reply aloud will send the spoken form of that reply to the selected speech
diff --git a/docs/user/product-feedback.md b/docs/user/product-feedback.md
index 11de3a9f9..a915a887a 100644
--- a/docs/user/product-feedback.md
+++ b/docs/user/product-feedback.md
@@ -13,7 +13,8 @@ does not contain a screenshot, raw page content, input value, credential, tool r
path, full URL, open chat, or conversation history.
A failed send keeps the draft. A confirmed send clears it. No account is required. The service can
-keep accepted feedback for up to 90 days.
+keep accepted feedback for up to 90 days and post it publicly to the Akeru Bot GitHub Issues tab.
+Do not include secrets or private data. A GitHub issue remains until a maintainer removes it.
Turn off **Product feedback** under **Settings > Privacy** to disable sending. A self-hosted
environment can set an HTTPS endpoint under **Settings > General > About**. Loopback HTTP is allowed
diff --git a/infra/feedback/.env.example b/infra/feedback/.env.example
index 1f1306648..98d942c02 100644
--- a/infra/feedback/.env.example
+++ b/infra/feedback/.env.example
@@ -1,3 +1,7 @@
AKERU_FEEDBACK_HMAC_SECRET=replace-with-at-least-32-random-bytes
AKERU_FEEDBACK_TURNSTILE_SITE_KEY=
AKERU_FEEDBACK_TURNSTILE_SECRET_KEY=
+AKERU_FEEDBACK_GITHUB_REPOSITORY=opencoredev/akeru-bot
+AKERU_FEEDBACK_GITHUB_APP_ID=
+AKERU_FEEDBACK_GITHUB_APP_INSTALLATION_ID=
+AKERU_FEEDBACK_GITHUB_APP_PRIVATE_KEY=
diff --git a/infra/feedback/README.md b/infra/feedback/README.md
index 82e54fb01..38acaf443 100644
--- a/infra/feedback/README.md
+++ b/infra/feedback/README.md
@@ -7,9 +7,13 @@ Set these deployment values:
- `AKERU_FEEDBACK_HMAC_SECRET`: required HMAC secret.
- `AKERU_FEEDBACK_TURNSTILE_SITE_KEY`: optional Turnstile site key.
- `AKERU_FEEDBACK_TURNSTILE_SECRET_KEY`: optional Turnstile secret key. Both keys together enable the challenge step; without them the endpoint rejects further submissions from a coarse network after five accepted submissions in one hour.
+- `AKERU_FEEDBACK_GITHUB_REPOSITORY`: `owner/repository` that receives accepted reports as issues. Defaults to `opencoredev/akeru-bot`.
+- `AKERU_FEEDBACK_GITHUB_APP_ID`: ID of the GitHub App that delivers feedback.
+- `AKERU_FEEDBACK_GITHUB_APP_INSTALLATION_ID`: repository-scoped installation ID for the App.
+- `AKERU_FEEDBACK_GITHUB_APP_PRIVATE_KEY`: private key for minting short-lived installation tokens. Store it only as a Worker secret.
Run the focused test with `vp test run infra/feedback/src/endpoint.test.ts`. Run the typecheck with `vp run --filter akeru-feedback typecheck`. Deploy only on direct request with `vp run --filter akeru-feedback deploy`.
-The Worker is named `akeru-feedback`, has no custom hostname, and accepts `POST /v1/feedback` at `https://akeru-feedback.leoisadev.workers.dev`. Alchemy state is local and gitignored. The Worker and D1 names are pinned; from a checkout without state, run `alchemy deploy --stage production --adopt` to take over the existing resources. Use authenticated D1 tooling to inspect rows in `akeru_feedback_inbox`. Do not add a public inbox route or create Linear issues from this Worker. A daily cron removes rows after 90 days.
+The Worker is named `akeru-feedback`, has no custom hostname, and accepts `POST /v1/feedback` at `https://akeru-feedback.leoisadev.workers.dev`. Alchemy state is local and gitignored. The Worker and D1 names are pinned; from a checkout without state, run `alchemy deploy --stage production --adopt` to take over the existing resources. Use authenticated D1 tooling to inspect rows in `akeru_feedback_inbox`. Do not add a public inbox route or create Linear issues from this Worker. When GitHub delivery is configured, accepted reports become normal GitHub issues authored by the installed GitHub App. The Worker signs a ten-minute App JWT only long enough to mint a repository-scoped, one-hour installation token for each delivery attempt. Confirmed HTTP failures retry from the D1 outbox; migrated reports are ineligible for public delivery, expired reports are removed before draining, and unique claim IDs plus bounded GitHub requests prevent stale attempts from owning another attempt's result. Ambiguous `unknown` deliveries remain quarantined from automatic retries, emit daily structured errors while retained, and must be reconciled using `docs/internals/product-feedback.md` before the normal 90-day cleanup removes them.
Cloudflare supplies the trusted client address through `CF-Connecting-IP`. A self-host adapter must use a trusted proxy socket address and must not accept arbitrary `X-Forwarded-For` values.
diff --git a/infra/feedback/alchemy.run.ts b/infra/feedback/alchemy.run.ts
index 01c3d0b96..0f27fbc3b 100644
--- a/infra/feedback/alchemy.run.ts
+++ b/infra/feedback/alchemy.run.ts
@@ -13,7 +13,7 @@ export const FeedbackWorker = Cloudflare.Worker("FeedbackWorker", {
name: "akeru-feedback",
main: new URL("./src/worker.ts", import.meta.url).pathname,
compatibility: {
- date: "2026-08-30",
+ date: "2026-09-14",
flags: ["nodejs_compat"],
},
crons: ["0 3 * * *"],
@@ -26,6 +26,16 @@ export const FeedbackWorker = Cloudflare.Worker("FeedbackWorker", {
TURNSTILE_SECRET_KEY: Config.redacted("AKERU_FEEDBACK_TURNSTILE_SECRET_KEY").pipe(
Config.withDefault(Redacted.make("")),
),
+ GITHUB_REPOSITORY: Config.string("AKERU_FEEDBACK_GITHUB_REPOSITORY").pipe(
+ Config.withDefault("opencoredev/akeru-bot"),
+ ),
+ GITHUB_APP_ID: Config.string("AKERU_FEEDBACK_GITHUB_APP_ID").pipe(Config.withDefault("")),
+ GITHUB_APP_INSTALLATION_ID: Config.string("AKERU_FEEDBACK_GITHUB_APP_INSTALLATION_ID").pipe(
+ Config.withDefault(""),
+ ),
+ GITHUB_APP_PRIVATE_KEY: Config.redacted("AKERU_FEEDBACK_GITHUB_APP_PRIVATE_KEY").pipe(
+ Config.withDefault(Redacted.make("")),
+ ),
},
observability: {
enabled: true,
diff --git a/infra/feedback/migrations/0003_github_delivery_safety.sql b/infra/feedback/migrations/0003_github_delivery_safety.sql
new file mode 100644
index 000000000..e9c43f6ff
--- /dev/null
+++ b/infra/feedback/migrations/0003_github_delivery_safety.sql
@@ -0,0 +1,18 @@
+ALTER TABLE akeru_feedback_inbox
+ ADD COLUMN github_delivery_eligible INTEGER NOT NULL DEFAULT 0
+ CHECK (github_delivery_eligible IN (0, 1));
+
+ALTER TABLE akeru_feedback_inbox
+ ADD COLUMN github_delivery_claim_id TEXT;
+
+DROP INDEX idx_akeru_feedback_github_delivery;
+
+CREATE INDEX idx_akeru_feedback_github_delivery
+ ON akeru_feedback_inbox(
+ github_delivery_eligible,
+ github_issue_status,
+ github_next_attempt_at,
+ github_lease_expires_at,
+ expires_at,
+ received_at
+ );
diff --git a/infra/feedback/src/endpoint.test.ts b/infra/feedback/src/endpoint.test.ts
index f87f92c5b..4e7230559 100644
--- a/infra/feedback/src/endpoint.test.ts
+++ b/infra/feedback/src/endpoint.test.ts
@@ -104,11 +104,13 @@ async function reason(response: Response): Promise<string> {
describe("product feedback endpoint", () => {
it("stores a strict, privacy-bounded payload and returns a feedback id", async () => {
const memory = makeRepository();
+ const accepted: StoredProductFeedback[] = [];
const endpoint = makeProductFeedbackEndpoint({
repository: memory.repository,
hmacSecret: "test-secret-that-is-long-enough",
randomId: () => "feedback-1",
now: () => new Date("2026-08-30T12:00:00.000Z"),
+ onAccepted: (feedback) => accepted.push(feedback),
});
const response = await endpoint(
request({
@@ -136,6 +138,23 @@ describe("product feedback endpoint", () => {
expect(memory.rows[0]?.submission).not.toHaveProperty("website");
expect(memory.rows[0]?.installHash).toMatch(/^[a-f0-9]{64}$/);
expect(memory.rows[0]?.coarseIpHash).toMatch(/^[a-f0-9]{64}$/);
+ expect(accepted).toEqual(memory.rows);
+ });
+
+ it("keeps the durable receipt successful when background delivery cannot be scheduled", async () => {
+ const memory = makeRepository();
+ const endpoint = makeProductFeedbackEndpoint({
+ repository: memory.repository,
+ hmacSecret: "test-secret-that-is-long-enough",
+ onAccepted: () => {
+ throw new Error("scheduler unavailable");
+ },
+ });
+
+ const response = await endpoint(request(baseSubmission()));
+
+ expect(response.status).toBe(201);
+ expect(memory.rows).toHaveLength(1);
});
it("rejects malformed JSON, excess fields, oversized bodies, and honeypots", async () => {
diff --git a/infra/feedback/src/endpoint.ts b/infra/feedback/src/endpoint.ts
index 5572a2ae5..a7f4b2265 100644
--- a/infra/feedback/src/endpoint.ts
+++ b/infra/feedback/src/endpoint.ts
@@ -52,6 +52,7 @@ export interface ProductFeedbackEndpointOptions {
readonly resolveIp?: (request: Request) => string;
readonly now?: () => Date;
readonly randomId?: () => string;
+ readonly onAccepted?: (feedback: StoredProductFeedback) => void;
readonly turnstile?: {
readonly siteKey: string;
readonly verify: (token: string, remoteIp: string) => Promise<boolean>;
@@ -363,6 +364,20 @@ export function makeProductFeedbackEndpoint(options: ProductFeedbackEndpointOpti
message: "This feedback was already received.",
});
}
+ try {
+ options.onAccepted?.({
+ feedbackId,
+ receivedAt,
+ expiresAt,
+ installHash,
+ coarseIpHash,
+ contentHash,
+ submission: safeSubmission,
+ });
+ } catch {
+ // Storage is the acceptance boundary. A background delivery scheduler
+ // cannot turn a durable receipt into a failed browser submission.
+ }
return receipt({ feedbackId, receivedAt });
} catch {
return rejection(500, {
diff --git a/infra/feedback/src/githubIssueDelivery.test.ts b/infra/feedback/src/githubIssueDelivery.test.ts
new file mode 100644
index 000000000..7e1932a6f
--- /dev/null
+++ b/infra/feedback/src/githubIssueDelivery.test.ts
@@ -0,0 +1,217 @@
+// @effect-diagnostics globalDate:off
+import { describe, expect, it, vi } from "vite-plus/test";
+import * as NodeBuffer from "node:buffer";
+import * as NodeCrypto from "node:crypto";
+
+import {
+ createGitHubAppJwt,
+ deliverFeedbackToGitHub,
+ formatGitHubIssue,
+ type FeedbackDeliveryOutbox,
+ type FeedbackDeliveryRecord,
+} from "./githubIssueDelivery.ts";
+
+const record: FeedbackDeliveryRecord = {
+ feedbackId: "fb_example",
+ claimId: "claim-example",
+ receivedAt: "2026-09-14T12:00:00.000Z",
+ deliveryAttempts: 1,
+ submission: {
+ schemaVersion: 1,
+ feedback: "The send button stays disabled.\nPlease fix it.",
+ element: {
+ selector: "button[data-feedback-target='send']",
+ component: "ComposerSendButton",
+ role: "button",
+ label: "Send",
+ },
+ },
+};
+
+function outbox(overrides: Partial<FeedbackDeliveryOutbox> = {}): FeedbackDeliveryOutbox {
+ return {
+ claim: vi.fn(async () => record),
+ listEligible: vi.fn(async () => []),
+ markDelivered: vi.fn(async () => undefined),
+ markFailed: vi.fn(async () => undefined),
+ markUnknown: vi.fn(async () => undefined),
+ countUnknown: vi.fn(async () => 0),
+ ...overrides,
+ };
+}
+
+const destination = {
+ repository: "opencoredev/akeru-bot",
+ appId: "12345",
+ installationId: "67890",
+ privateKey: "private-key",
+};
+const signJwt = () => "app-jwt";
+const installationTokenResponse = () => Response.json({ token: "installation-token" });
+
+describe("GitHub feedback delivery", () => {
+ it("formats a bounded maintainer-readable issue", () => {
+ const issue = formatGitHubIssue(record);
+
+ expect(issue.title).toBe("[Akeru feedback] The send button stays disabled. Please fix it.");
+ expect(issue.body).toContain(" The send button stays disabled.");
+ expect(issue.body).toContain(" Selector: button[data-feedback-target='send']");
+ expect(issue.body).toContain("- Feedback ID: `fb_example`");
+ });
+
+ it("signs a short-lived RS256 GitHub App JWT", () => {
+ const { privateKey, publicKey } = NodeCrypto.generateKeyPairSync("rsa", {
+ modulusLength: 2_048,
+ });
+ const jwt = createGitHubAppJwt(
+ "12345",
+ privateKey.export({ format: "pem", type: "pkcs1" }).toString(),
+ new Date("2026-09-14T12:00:00.000Z"),
+ );
+ const [header, payload, signature] = jwt.split(".");
+
+ expect(JSON.parse(NodeBuffer.Buffer.from(header ?? "", "base64url").toString())).toEqual({
+ alg: "RS256",
+ typ: "JWT",
+ });
+ expect(JSON.parse(NodeBuffer.Buffer.from(payload ?? "", "base64url").toString())).toEqual({
+ iat: 1_789_387_140,
+ exp: 1_789_387_740,
+ iss: "12345",
+ });
+ expect(
+ NodeCrypto.verify(
+ "RSA-SHA256",
+ NodeBuffer.Buffer.from(`${header}.${payload}`),
+ publicKey,
+ NodeBuffer.Buffer.from(signature ?? "", "base64url"),
+ ),
+ ).toBe(true);
+ });
+
+ it("creates and records a normal GitHub issue", async () => {
+ const store = outbox();
+ const request = vi
+ .fn<typeof fetch>()
+ .mockResolvedValueOnce(installationTokenResponse())
+ .mockResolvedValueOnce(
+ Response.json(
+ { number: 42, html_url: "https://github.com/opencoredev/akeru-bot/issues/42" },
+ { status: 201 },
+ ),
+ );
+
+ await deliverFeedbackToGitHub({
+ destination,
+ feedbackId: record.feedbackId,
+ outbox: store,
+ request,
+ signJwt,
+ claimId: () => record.claimId,
+ });
+
+ expect(request).toHaveBeenCalledTimes(2);
+ expect(store.claim).toHaveBeenCalledWith(
+ "fb_example",
+ "claim-example",
+ expect.stringMatching(/^\d{4}-\d{2}-\d{2}T/),
+ expect.stringMatching(/^\d{4}-\d{2}-\d{2}T/),
+ );
+ expect(request.mock.calls[0]?.[0]).toBe(
+ "https://api.github.com/app/installations/67890/access_tokens",
+ );
+ expect(request.mock.calls[1]?.[0]).toBe(
+ "https://api.github.com/repos/opencoredev/akeru-bot/issues",
+ );
+ expect(request.mock.calls[0]?.[1]?.signal).toBeInstanceOf(AbortSignal);
+ expect(request.mock.calls[1]?.[1]?.signal).toBeInstanceOf(AbortSignal);
+ expect(store.markDelivered).toHaveBeenCalledWith(
+ "fb_example",
+ "claim-example",
+ 42,
+ "https://github.com/opencoredev/akeru-bot/issues/42",
+ );
+ });
+
+ it("retries a confirmed GitHub rejection", async () => {
+ const store = outbox();
+ const request = vi
+ .fn<typeof fetch>()
+ .mockResolvedValueOnce(installationTokenResponse())
+ .mockResolvedValueOnce(new Response(null, { status: 503 }));
+
+ await deliverFeedbackToGitHub({
+ destination,
+ feedbackId: record.feedbackId,
+ outbox: store,
+ request,
+ signJwt,
+ claimId: () => record.claimId,
+ now: () => new Date("2026-09-14T12:00:00.000Z"),
+ });
+
+ expect(request).toHaveBeenCalledTimes(2);
+ expect(store.markFailed).toHaveBeenCalledWith(
+ "fb_example",
+ "claim-example",
+ "2026-09-14T12:05:00.000Z",
+ "issue_http_503",
+ );
+ expect(store.markDelivered).not.toHaveBeenCalled();
+ });
+
+ it("flags an ambiguous issue-creation failure without retrying into a duplicate", async () => {
+ const store = outbox();
+ const log = vi.spyOn(console, "error").mockImplementation(() => undefined);
+ const request = vi
+ .fn<typeof fetch>()
+ .mockResolvedValueOnce(installationTokenResponse())
+ .mockRejectedValueOnce(new Error("connection closed"));
+
+ await deliverFeedbackToGitHub({
+ destination,
+ feedbackId: record.feedbackId,
+ outbox: store,
+ request,
+ signJwt,
+ claimId: () => record.claimId,
+ });
+
+ expect(store.markUnknown).toHaveBeenCalledWith(
+ "fb_example",
+ "claim-example",
+ "issue_network_error",
+ );
+ expect(log).toHaveBeenCalledWith(
+ JSON.stringify({
+ event: "feedback.github_delivery_unknown",
+ feedbackId: "fb_example",
+ errorCode: "issue_network_error",
+ }),
+ );
+ expect(store.markFailed).not.toHaveBeenCalled();
+ });
+
+ it("retries when GitHub App authentication is unavailable", async () => {
+ const store = outbox();
+ const request = vi.fn<typeof fetch>().mockResolvedValue(new Response(null, { status: 503 }));
+
+ await deliverFeedbackToGitHub({
+ destination,
+ feedbackId: record.feedbackId,
+ outbox: store,
+ request,
+ signJwt,
+ claimId: () => record.claimId,
+ now: () => new Date("2026-09-14T12:00:00.000Z"),
+ });
+
+ expect(store.markFailed).toHaveBeenCalledWith(
+ "fb_example",
+ "claim-example",
+ "2026-09-14T12:05:00.000Z",
+ "installation_token_http_503",
+ );
+ expect(store.markUnknown).not.toHaveBeenCalled();
+ });
+});
diff --git a/infra/feedback/src/githubIssueDelivery.ts b/infra/feedback/src/githubIssueDelivery.ts
new file mode 100644
index 000000000..f46fdc0b4
--- /dev/null
+++ b/infra/feedback/src/githubIssueDelivery.ts
@@ -0,0 +1,328 @@
+// @effect-diagnostics cryptoRandomUUID:off globalConsole:off globalDate:off
+import type { StoredProductFeedbackSubmission } from "@t3tools/contracts";
+import * as NodeBuffer from "node:buffer";
+import * as NodeCrypto from "node:crypto";
+
+export interface FeedbackDeliveryRecord {
+ readonly feedbackId: string;
+ readonly claimId: string;
+ readonly receivedAt: string;
+ readonly deliveryAttempts: number;
+ readonly submission: StoredProductFeedbackSubmission;
+}
+
+export interface FeedbackDeliveryOutbox {
+ readonly claim: (
+ feedbackId: string,
+ claimId: string,
+ now: string,
+ leaseExpiresAt: string,
+ ) => Promise<FeedbackDeliveryRecord | null>;
+ readonly listEligible: (now: string, limit: number) => Promise<readonly string[]>;
+ readonly markDelivered: (
+ feedbackId: string,
+ claimId: string,
+ issueNumber: number,
+ issueUrl: string,
+ ) => Promise<void>;
+ readonly markFailed: (
+ feedbackId: string,
+ claimId: string,
+ nextAttemptAt: string,
+ errorCode: string,
+ ) => Promise<void>;
+ readonly markUnknown: (feedbackId: string, claimId: string, errorCode: string) => Promise<void>;
+ readonly countUnknown: () => Promise<number>;
+}
+
+export interface GitHubIssueDestination {
+ readonly repository: string;
+ readonly appId: string;
+ readonly installationId: string;
+ readonly privateKey: string;
+}
+
+interface GitHubIssueReceipt {
+ readonly kind: "delivered";
+ readonly number: number;
+ readonly htmlUrl: string;
+}
+
+interface GitHubIssueFailure {
+ readonly kind: "failed";
+ readonly errorCode: string;
+}
+
+interface GitHubIssueUnknown {
+ readonly kind: "unknown";
+ readonly errorCode: string;
+}
+
+const DELIVERY_LEASE_MILLISECONDS = 60_000;
+const GITHUB_REQUEST_TIMEOUT_MILLISECONDS = 20_000;
+const MAX_DELIVERY_BATCH = 10;
+const MAX_RETRY_DELAY_MILLISECONDS = 86_400_000;
+const GITHUB_API_VERSION = "2026-03-10";
+
+function indentedCode(value: string): string {
+ return value
+ .split("\n")
+ .map((line) => ` ${line}`)
+ .join("\n");
+}
+
+export function formatGitHubIssue(record: FeedbackDeliveryRecord): {
+ readonly title: string;
+ readonly body: string;
+} {
+ const summary = record.submission.feedback.replace(/\s+/g, " ").trim().slice(0, 96);
+ const element = record.submission.element;
+ const body = [
+ "## Feedback",
+ "",
+ indentedCode(record.submission.feedback),
+ "",
+ ...(element
+ ? [
+ "## Selected element",
+ "",
+ indentedCode(
+ [
+ `Selector: ${element.selector}`,
+ ...(element.component ? [`Component: ${element.component}`] : []),
+ ...(element.source ? [`Source: ${element.source}`] : []),
+ ...(element.role ? [`Role: ${element.role}`] : []),
+ ...(element.label ? [`Label: ${element.label}`] : []),
+ ].join("\n"),
+ ),
+ "",
+ ]
+ : []),
+ "## Submission",
+ "",
+ `- Feedback ID: \`${record.feedbackId}\``,
+ `- Received: \`${record.receivedAt}\``,
+ ].join("\n");
+ return {
+ title: `[Akeru feedback] ${summary || record.feedbackId}`,
+ body,
+ };
+}
+
+function githubHeaders(token: string): HeadersInit {
+ return {
+ Accept: "application/vnd.github+json",
+ Authorization: `Bearer ${token}`,
+ "Content-Type": "application/json",
+ "User-Agent": "akeru-feedback",
+ "X-GitHub-Api-Version": GITHUB_API_VERSION,
+ };
+}
+
+function base64UrlJson(value: unknown): string {
+ return NodeBuffer.Buffer.from(JSON.stringify(value)).toString("base64url");
+}
+
+export function createGitHubAppJwt(
+ appId: string,
+ privateKey: string,
+ now: Date = new Date(),
+): string {
+ const issuedAt = Math.floor(now.getTime() / 1_000) - 60;
+ const header = base64UrlJson({ alg: "RS256", typ: "JWT" });
+ const payload = base64UrlJson({ iat: issuedAt, exp: issuedAt + 600, iss: appId });
+ const unsigned = `${header}.${payload}`;
+ const signature = NodeCrypto.sign(
+ "RSA-SHA256",
+ NodeBuffer.Buffer.from(unsigned),
+ privateKey,
+ ).toString("base64url");
+ return `${unsigned}.${signature}`;
+}
+
+async function createInstallationToken(
+ destination: GitHubIssueDestination,
+ request: typeof fetch,
+ now: Date,
+ signJwt: typeof createGitHubAppJwt,
+): Promise<{ readonly kind: "authenticated"; readonly token: string } | GitHubIssueFailure> {
+ if (!validRepository(destination.repository)) {
+ return { kind: "failed", errorCode: "invalid_repository" };
+ }
+ const repositoryName = destination.repository.split("/")[1];
+ if (!repositoryName) return { kind: "failed", errorCode: "invalid_repository" };
+ let jwt: string;
+ try {
+ jwt = signJwt(destination.appId, destination.privateKey, now);
+ } catch {
+ return { kind: "failed", errorCode: "app_jwt_signing_error" };
+ }
+ let response: Response;
+ try {
+ response = await request(
+ `https://api.github.com/app/installations/${destination.installationId}/access_tokens`,
+ {
+ method: "POST",
+ headers: githubHeaders(jwt),
+ signal: AbortSignal.timeout(GITHUB_REQUEST_TIMEOUT_MILLISECONDS),
+ body: JSON.stringify({
+ repositories: [repositoryName],
+ permissions: { issues: "write" },
+ }),
+ },
+ );
+ } catch {
+ return { kind: "failed", errorCode: "installation_token_network_error" };
+ }
+ if (!response.ok) {
+ return { kind: "failed", errorCode: `installation_token_http_${response.status}` };
+ }
+ let body: unknown;
+ try {
+ body = await response.json();
+ } catch {
+ return { kind: "failed", errorCode: "invalid_installation_token_receipt" };
+ }
+ if (
+ typeof body !== "object" ||
+ body === null ||
+ !("token" in body) ||
+ typeof body.token !== "string" ||
+ body.token.length === 0
+ ) {
+ return { kind: "failed", errorCode: "invalid_installation_token_receipt" };
+ }
+ return { kind: "authenticated", token: body.token };
+}
+
+function validRepository(repository: string): boolean {
+ return /^[a-z0-9_.-]+\/[a-z0-9_.-]+$/i.test(repository);
+}
+
+async function createGitHubIssue(
+ destination: GitHubIssueDestination,
+ token: string,
+ record: FeedbackDeliveryRecord,
+ request: typeof fetch,
+): Promise<GitHubIssueReceipt | GitHubIssueFailure | GitHubIssueUnknown> {
+ if (!validRepository(destination.repository)) {
+ return { kind: "failed", errorCode: "invalid_repository" };
+ }
+ const repositoryUrl = `https://api.github.com/repos/${destination.repository}`;
+ let issueResponse: Response;
+ try {
+ issueResponse = await request(`${repositoryUrl}/issues`, {
+ method: "POST",
+ headers: githubHeaders(token),
+ signal: AbortSignal.timeout(GITHUB_REQUEST_TIMEOUT_MILLISECONDS),
+ body: JSON.stringify(formatGitHubIssue(record)),
+ });
+ } catch {
+ return { kind: "unknown", errorCode: "issue_network_error" };
+ }
+ if (!issueResponse.ok) {
+ return { kind: "failed", errorCode: `issue_http_${issueResponse.status}` };
+ }
+ let issueBody: unknown;
+ try {
+ issueBody = await issueResponse.json();
+ } catch {
+ return { kind: "unknown", errorCode: "invalid_issue_receipt" };
+ }
+ if (
+ typeof issueBody !== "object" ||
+ issueBody === null ||
+ !("number" in issueBody) ||
+ typeof issueBody.number !== "number" ||
+ !("html_url" in issueBody) ||
+ typeof issueBody.html_url !== "string"
+ ) {
+ return { kind: "unknown", errorCode: "invalid_issue_receipt" };
+ }
+ return { kind: "delivered", number: issueBody.number, htmlUrl: issueBody.html_url };
+}
+
+function retryAt(now: Date, attempts: number): string {
+ const delay = Math.min(300_000 * 2 ** Math.max(0, attempts - 1), MAX_RETRY_DELAY_MILLISECONDS);
+ return new Date(now.getTime() + delay).toISOString();
+}
+
+export async function deliverFeedbackToGitHub(options: {
+ readonly destination: GitHubIssueDestination;
+ readonly feedbackId: string;
+ readonly outbox: FeedbackDeliveryOutbox;
+ readonly now?: () => Date;
+ readonly request?: typeof fetch;
+ readonly signJwt?: typeof createGitHubAppJwt;
+ readonly claimId?: () => string;
+}): Promise<void> {
+ const current = (options.now ?? (() => new Date()))();
+ const claimId = (options.claimId ?? (() => crypto.randomUUID()))();
+ const record = await options.outbox.claim(
+ options.feedbackId,
+ claimId,
+ current.toISOString(),
+ new Date(current.getTime() + DELIVERY_LEASE_MILLISECONDS).toISOString(),
+ );
+ if (!record) return;
+ const authenticated = await createInstallationToken(
+ options.destination,
+ options.request ?? fetch,
+ current,
+ options.signJwt ?? createGitHubAppJwt,
+ );
+ if (authenticated.kind === "failed") {
+ await options.outbox.markFailed(
+ record.feedbackId,
+ record.claimId,
+ retryAt(current, record.deliveryAttempts),
+ authenticated.errorCode,
+ );
+ return;
+ }
+ const result = await createGitHubIssue(
+ options.destination,
+ authenticated.token,
+ record,
+ options.request ?? fetch,
+ );
+ if (result.kind === "failed") {
+ await options.outbox.markFailed(
+ record.feedbackId,
+ record.claimId,
+ retryAt(current, record.deliveryAttempts),
+ result.errorCode,
+ );
+ return;
+ }
+ if (result.kind === "unknown") {
+ await options.outbox.markUnknown(record.feedbackId, record.claimId, result.errorCode);
+ console.error(
+ JSON.stringify({
+ event: "feedback.github_delivery_unknown",
+ feedbackId: record.feedbackId,
+ errorCode: result.errorCode,
+ }),
+ );
+ return;
+ }
+ await options.outbox.markDelivered(
+ record.feedbackId,
+ record.claimId,
+ result.number,
+ result.htmlUrl,
+ );
+}
+
+export async function drainFeedbackToGitHub(options: {
+ readonly destination: GitHubIssueDestination;
+ readonly outbox: FeedbackDeliveryOutbox;
+ readonly now?: () => Date;
+ readonly request?: typeof fetch;
+}): Promise<void> {
+ const now = options.now ?? (() => new Date());
+ const ids = await options.outbox.listEligible(now().toISOString(), MAX_DELIVERY_BATCH);
+ for (const feedbackId of ids) {
+ await deliverFeedbackToGitHub({ ...options, feedbackId, now });
+ }
+}
diff --git a/infra/feedback/src/worker.test.ts b/infra/feedback/src/worker.test.ts
index ef5e2b469..b891d823a 100644
--- a/infra/feedback/src/worker.test.ts
+++ b/infra/feedback/src/worker.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from "vite-plus/test";
import type { FeedbackWorkerEnv } from "../alchemy.run.ts";
-import worker from "./worker.ts";
+import worker, { makeGitHubIssueOutbox } from "./worker.ts";
const ENDPOINT = "https://akeru-feedback.leoisadev.workers.dev/v1/feedback";
@@ -11,10 +11,22 @@ function env(overrides: Partial<FeedbackWorkerEnv> = {}): FeedbackWorkerEnv {
HMAC_SECRET: "test-secret-that-is-at-least-32-bytes",
TURNSTILE_SITE_KEY: "",
TURNSTILE_SECRET_KEY: "",
+ GITHUB_REPOSITORY: "",
+ GITHUB_APP_ID: "",
+ GITHUB_APP_INSTALLATION_ID: "",
+ GITHUB_APP_PRIVATE_KEY: "",
...overrides,
} as FeedbackWorkerEnv;
}
+function context(waitUntil = vi.fn()): ExecutionContext {
+ return {
+ waitUntil,
+ passThroughOnException: vi.fn(),
+ props: {},
+ };
+}
+
// A D1 stub for one empty inbox: every lookup finds nothing and the insert lands.
function emptyInboxDatabase(): D1Database {
const statement = {
@@ -43,6 +55,7 @@ describe("feedback worker", () => {
const response = await worker.fetch(
new Request(ENDPOINT, { method: "POST" }),
env({ HMAC_SECRET: "short" }),
+ context(),
);
expect(response.status).toBe(503);
@@ -51,17 +64,39 @@ describe("feedback worker", () => {
});
it("accepts a direct browser submission without Turnstile keys", async () => {
- const response = await worker.fetch(submission(), env({ DB: emptyInboxDatabase() }));
+ const response = await worker.fetch(submission(), env({ DB: emptyInboxDatabase() }), context());
expect(response.status).toBe(201);
expect(response.headers.get("access-control-allow-origin")).toBe("*");
expect(await response.json()).toMatchObject({ feedbackId: expect.stringMatching(/^fb_/) });
});
+ it("schedules GitHub issue delivery after accepting feedback", async () => {
+ const waitUntil = vi.fn();
+ const execution = context(waitUntil);
+
+ const response = await worker.fetch(
+ submission(),
+ env({
+ DB: emptyInboxDatabase(),
+ GITHUB_REPOSITORY: "opencoredev/akeru-bot",
+ GITHUB_APP_ID: "12345",
+ GITHUB_APP_INSTALLATION_ID: "67890",
+ GITHUB_APP_PRIVATE_KEY: "invalid-test-key",
+ }),
+ execution,
+ );
+
+ expect(response.status).toBe(201);
+ expect(waitUntil).toHaveBeenCalledOnce();
+ await expect(waitUntil.mock.calls[0]?.[0]).resolves.toBeUndefined();
+ });
+
it("answers CORS preflight before reading configuration", async () => {
const response = await worker.fetch(
new Request(ENDPOINT, { method: "OPTIONS" }),
env({ HMAC_SECRET: "short" }),
+ context(),
);
expect(response.status).toBe(204);
@@ -71,7 +106,7 @@ describe("feedback worker", () => {
it("deletes expired rows during the daily scheduled run", async () => {
const run = vi.fn(async () => undefined);
const bind = vi.fn(() => ({ run }));
- const prepare = vi.fn(() => ({ bind }));
+ const prepare = vi.fn((_sql: string) => ({ bind }));
await worker.scheduled(
{} as ScheduledController,
@@ -83,4 +118,41 @@ describe("feedback worker", () => {
expect(bind).toHaveBeenCalledWith(expect.stringMatching(/^\d{4}-\d{2}-\d{2}T/));
expect(run).toHaveBeenCalledOnce();
});
+
+ it("claims only unexpired feedback submitted with public delivery enabled", async () => {
+ const run = vi.fn(async () => ({ meta: { changes: 0 } }));
+ const bind = vi.fn(() => ({ run }));
+ const prepare = vi.fn((_sql: string) => ({ bind }));
+ const outbox = makeGitHubIssueOutbox({ prepare } as unknown as D1Database);
+
+ await outbox.claim(
+ "fb_example",
+ "claim-example",
+ "2026-09-14T12:00:00.000Z",
+ "2026-09-14T12:01:00.000Z",
+ );
+
+ expect(prepare.mock.calls[0]?.[0]).toContain("github_delivery_eligible = 1");
+ expect(prepare.mock.calls[0]?.[0]).toContain("expires_at > ?");
+ expect(bind).toHaveBeenCalledWith(
+ "claim-example",
+ "2026-09-14T12:01:00.000Z",
+ "fb_example",
+ "2026-09-14T12:00:00.000Z",
+ "2026-09-14T12:00:00.000Z",
+ "2026-09-14T12:00:00.000Z",
+ );
+ });
+
+ it("updates a delivery only for the invocation that owns the claim", async () => {
+ const run = vi.fn(async () => ({ meta: { changes: 1 } }));
+ const bind = vi.fn(() => ({ run }));
+ const prepare = vi.fn((_sql: string) => ({ bind }));
+ const outbox = makeGitHubIssueOutbox({ prepare } as unknown as D1Database);
+
+ await outbox.markDelivered("fb_example", "claim-example", 42, "https://example.com/42");
+
+ expect(prepare.mock.calls[0]?.[0]).toContain("github_delivery_claim_id = ?");
+ expect(bind).toHaveBeenCalledWith(42, "https://example.com/42", "fb_example", "claim-example");
+ });
});
diff --git a/infra/feedback/src/worker.ts b/infra/feedback/src/worker.ts
index 464a956b4..3fd4f2f75 100644
--- a/infra/feedback/src/worker.ts
+++ b/infra/feedback/src/worker.ts
@@ -1,4 +1,4 @@
-// @effect-diagnostics globalFetch:off globalDate:off
+// @effect-diagnostics globalConsole:off globalFetch:off globalDate:off
import { StoredProductFeedbackSubmission } from "@t3tools/contracts";
import * as Exit from "effect/Exit";
import * as Schema from "effect/Schema";
@@ -9,6 +9,12 @@ import {
productFeedbackOptionsResponse,
type ProductFeedbackRepository,
} from "./endpoint.ts";
+import {
+ deliverFeedbackToGitHub,
+ drainFeedbackToGitHub,
+ type FeedbackDeliveryOutbox,
+ type GitHubIssueDestination,
+} from "./githubIssueDelivery.ts";
interface FeedbackRow {
readonly feedback_id: string;
@@ -18,6 +24,8 @@ interface FeedbackRow {
readonly coarse_ip_hash: string;
readonly content_hash: string;
readonly payload_json: string;
+ readonly github_delivery_attempts?: number;
+ readonly github_delivery_claim_id?: string;
}
const TurnstileResponse = Schema.Struct({ success: Schema.Boolean });
@@ -64,8 +72,8 @@ export function makeRepository(database: FeedbackWorkerEnv["DB"]): ProductFeedba
const result = await database
.prepare(
`INSERT INTO akeru_feedback_inbox
- (feedback_id, received_at, expires_at, install_hash, coarse_ip_hash, content_hash, payload_json)
- SELECT ?, ?, ?, ?, ?, ?, ?
+ (feedback_id, received_at, expires_at, install_hash, coarse_ip_hash, content_hash, payload_json, github_delivery_eligible)
+ SELECT ?, ?, ?, ?, ?, ?, ?, 1
WHERE (SELECT COUNT(*) FROM akeru_feedback_inbox
WHERE coarse_ip_hash = ? AND received_at >= ?) < ?
AND NOT EXISTS (SELECT 1 FROM akeru_feedback_inbox
@@ -139,6 +147,125 @@ export function makeRepository(database: FeedbackWorkerEnv["DB"]): ProductFeedba
};
}
+function deliveryRecord(row: FeedbackRow) {
+ const decoded = decodeStoredProductFeedbackSubmission(JSON.parse(row.payload_json));
+ if (Exit.isFailure(decoded)) throw new Error("Stored feedback payload is invalid.");
+ return {
+ feedbackId: row.feedback_id,
+ claimId: row.github_delivery_claim_id ?? "",
+ receivedAt: row.received_at,
+ deliveryAttempts: row.github_delivery_attempts ?? 0,
+ submission: decoded.value,
+ };
+}
+
+export function makeGitHubIssueOutbox(database: FeedbackWorkerEnv["DB"]): FeedbackDeliveryOutbox {
+ return {
+ claim: async (feedbackId, claimId, now, leaseExpiresAt) => {
+ const result = await database
+ .prepare(
+ `UPDATE akeru_feedback_inbox
+ SET github_issue_status = 'delivering',
+ github_delivery_attempts = github_delivery_attempts + 1,
+ github_delivery_claim_id = ?,
+ github_lease_expires_at = ?,
+ github_next_attempt_at = NULL,
+ github_last_error_code = NULL
+ WHERE feedback_id = ?
+ AND github_delivery_eligible = 1
+ AND expires_at > ?
+ AND (github_issue_status = 'pending'
+ OR (github_issue_status = 'failed'
+ AND (github_next_attempt_at IS NULL OR github_next_attempt_at <= ?))
+ OR (github_issue_status = 'delivering' AND github_lease_expires_at <= ?))`,
+ )
+ .bind(claimId, leaseExpiresAt, feedbackId, now, now, now)
+ .run();
+ if (result.meta.changes !== 1) return null;
+ const row = await database
+ .prepare("SELECT * FROM akeru_feedback_inbox WHERE feedback_id = ? LIMIT 1")
+ .bind(feedbackId)
+ .first<FeedbackRow>();
+ return row ? deliveryRecord(row) : null;
+ },
+ listEligible: async (now, limit) => {
+ const result = await database
+ .prepare(
+ `SELECT feedback_id FROM akeru_feedback_inbox
+ WHERE github_delivery_eligible = 1
+ AND expires_at > ?
+ AND (github_issue_status = 'pending'
+ OR (github_issue_status = 'failed'
+ AND (github_next_attempt_at IS NULL OR github_next_attempt_at <= ?))
+ OR (github_issue_status = 'delivering' AND github_lease_expires_at <= ?))
+ ORDER BY received_at ASC
+ LIMIT ?`,
+ )
+ .bind(now, now, now, limit)
+ .all<{ feedback_id: string }>();
+ return result.results.map((row) => row.feedback_id);
+ },
+ markDelivered: async (feedbackId, claimId, issueNumber, issueUrl) => {
+ await database
+ .prepare(
+ `UPDATE akeru_feedback_inbox
+ SET github_issue_status = 'delivered',
+ github_issue_number = ?,
+ github_issue_url = ?,
+ github_next_attempt_at = NULL,
+ github_lease_expires_at = NULL,
+ github_delivery_claim_id = NULL,
+ github_last_error_code = NULL
+ WHERE feedback_id = ?
+ AND github_issue_status = 'delivering'
+ AND github_delivery_claim_id = ?`,
+ )
+ .bind(issueNumber, issueUrl, feedbackId, claimId)
+ .run();
+ },
+ markFailed: async (feedbackId, claimId, nextAttemptAt, errorCode) => {
+ await database
+ .prepare(
+ `UPDATE akeru_feedback_inbox
+ SET github_issue_status = 'failed',
+ github_next_attempt_at = ?,
+ github_lease_expires_at = NULL,
+ github_delivery_claim_id = NULL,
+ github_last_error_code = ?
+ WHERE feedback_id = ?
+ AND github_issue_status = 'delivering'
+ AND github_delivery_claim_id = ?`,
+ )
+ .bind(nextAttemptAt, errorCode, feedbackId, claimId)
+ .run();
+ },
+ markUnknown: async (feedbackId, claimId, errorCode) => {
+ await database
+ .prepare(
+ `UPDATE akeru_feedback_inbox
+ SET github_issue_status = 'unknown',
+ github_next_attempt_at = NULL,
+ github_lease_expires_at = NULL,
+ github_delivery_claim_id = NULL,
+ github_last_error_code = ?
+ WHERE feedback_id = ?
+ AND github_issue_status = 'delivering'
+ AND github_delivery_claim_id = ?`,
+ )
+ .bind(errorCode, feedbackId, claimId)
+ .run();
+ },
+ countUnknown: async () => {
+ const row = await database
+ .prepare(
+ "SELECT COUNT(*) AS count FROM akeru_feedback_inbox WHERE github_issue_status = 'unknown'",
+ )
+ .first<{ count: number }>();
+ return row?.count ?? 0;
+ },
+ };
+}
+
function makeTurnstile(env: FeedbackWorkerEnv) {
if (!env.TURNSTILE_SITE_KEY || !env.TURNSTILE_SECRET_KEY) return undefined;
return {
@@ -163,8 +290,29 @@ function validHmacSecret(secret: string): boolean {
return new TextEncoder().encode(secret).byteLength >= 32;
}
+function githubDestination(env: FeedbackWorkerEnv): GitHubIssueDestination | null {
+ if (
+ !env.GITHUB_REPOSITORY ||
+ !env.GITHUB_APP_ID ||
+ !env.GITHUB_APP_INSTALLATION_ID ||
+ !env.GITHUB_APP_PRIVATE_KEY
+ ) {
+ return null;
+ }
+ return {
+ repository: env.GITHUB_REPOSITORY,
+ appId: env.GITHUB_APP_ID,
+ installationId: env.GITHUB_APP_INSTALLATION_ID,
+ privateKey: env.GITHUB_APP_PRIVATE_KEY,
+ };
+}
+
export default {
- async fetch(request: Request, env: FeedbackWorkerEnv): Promise<Response> {
+ async fetch(
+ request: Request,
+ env: FeedbackWorkerEnv,
+ context: ExecutionContext,
+ ): Promise<Response> {
const url = new URL(request.url);
if (url.pathname !== "/v1/feedback") {
return new Response("Not Found", { status: 404 });
@@ -182,10 +330,24 @@ export default {
// Without Turnstile keys the endpoint still runs, but the suspicious-traffic
// threshold becomes a hard network limit instead of a challenge.
const turnstile = makeTurnstile(env);
+ const destination = githubDestination(env);
+ const outbox = destination ? makeGitHubIssueOutbox(env.DB) : null;
return makeProductFeedbackEndpoint({
repository: makeRepository(env.DB),
hmacSecret: env.HMAC_SECRET,
...(turnstile ? { turnstile } : {}),
+ ...(destination && outbox
+ ? {
+ onAccepted: (feedback) =>
+ context.waitUntil(
+ deliverFeedbackToGitHub({
+ destination,
+ feedbackId: feedback.feedbackId,
+ outbox,
+ }),
+ ),
+ }
+ : {}),
})(request);
},
async scheduled(
@@ -193,6 +355,18 @@ export default {
env: FeedbackWorkerEnv,
_context: ExecutionContext,
): Promise<void> {
- await makeRepository(env.DB).deleteExpired(new Date().toISOString());
+ const now = new Date().toISOString();
+ await makeRepository(env.DB).deleteExpired(now);
+ const destination = githubDestination(env);
+ if (destination) {
+ const outbox = makeGitHubIssueOutbox(env.DB);
+ await drainFeedbackToGitHub({ destination, outbox });
+ const unknownCount = await outbox.countUnknown();
+ if (unknownCount > 0) {
+ console.error(
+ JSON.stringify({ event: "feedback.github_delivery_unknown_outstanding", unknownCount }),
+ );
+ }
+ }
},
};
diff --git a/infra/feedback/tsconfig.json b/infra/feedback/tsconfig.json
index 0e252145b..0148d7d78 100644
--- a/infra/feedback/tsconfig.json
+++ b/infra/feedback/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"lib": ["ES2024", "WebWorker"],
- "types": ["@cloudflare/workers-types"]
+ "types": ["@cloudflare/workers-types", "node"]
},
"include": ["alchemy.run.ts", "src/**/*.ts"]
}