From 777114e97a38f71ec897db18617a8136c9f57b24 Mon Sep 17 00:00:00 2001 From: Ben White Date: Mon, 13 Jul 2026 14:16:35 +0200 Subject: [PATCH] fix(canvas): send model when generating CONTEXT.md with agent The "Generate with agent" flow for a channel's CONTEXT.md starts a cloud run without a model. The cloud-create path defaults the runtime adapter to "claude" but leaves the model unset, and the task-run bootstrap API rejects a runtime adapter without a paired model ("This field is required when selecting a cloud runtime."), so generation never starts. Pin the default gateway model in the generate flow, matching the adapter the saga defaults to, so the adapter/model pair the API requires is always complete. Generated-By: PostHog Code Task-Id: c292e951-0bde-4d16-8fb2-c18104829a09 --- packages/ui/src/features/canvas/hooks/useGenerateContext.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/ui/src/features/canvas/hooks/useGenerateContext.ts b/packages/ui/src/features/canvas/hooks/useGenerateContext.ts index b868629eb3..b75c052c62 100644 --- a/packages/ui/src/features/canvas/hooks/useGenerateContext.ts +++ b/packages/ui/src/features/canvas/hooks/useGenerateContext.ts @@ -1,3 +1,4 @@ +import { DEFAULT_GATEWAY_MODEL } from "@posthog/agent/gateway-models"; import { TASK_SERVICE, type TaskService, @@ -42,6 +43,11 @@ export function useGenerateContext(channelId: string, channelName: string) { // test a local build of these features before merging. workspaceMode, allowNoRepo: true, + // A cloud run pairs a runtime adapter with a model, and the API + // rejects one without the other. Since this flow lets the agent pick + // its repo at runtime, it never surfaces a model picker, so pin the + // default gateway model here to match the adapter the saga defaults to. + model: DEFAULT_GATEWAY_MODEL, }, (output) => invalidateTasks(output.task), );