fix(canvas): send model when generating CONTEXT.md with agent#3389
Conversation
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
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "fix(canvas): send model when generating ..." | Re-trigger Greptile |
| // 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, |
There was a problem hiding this comment.
Pinned Model Skips Gateway Resolution
When the gateway does not advertise claude-opus-4-8 for a user, org, or region, this flow still sends that fixed model instead of falling back through the existing model resolver. The generate-context run can then fail validation or startup even though the request now includes a model field.
| // 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, |
There was a problem hiding this comment.
This call now sends model: DEFAULT_GATEWAY_MODEL, but it still does not send the matching adapter. If the cloud API enforces the adapter/model pair the inline comment describes, the default cloud generate path can serialize runtime_adapter: null with a Claude model and be rejected before generation starts.
Problem
Using Generate with agent to create a channel's CONTEXT.md in PostHog Code desktop fails immediately with a validation error and generation never starts:
Why: this flow was reported from the desktop app as broken — clicking the button to generate a CONTEXT.md returns the error above instead of kicking off a run.
The generate flow starts a cloud run but never picks a model (the agent chooses its repo at runtime, so no model picker is shown). The cloud-create path in the task-creation saga defaults the runtime adapter to
claudebut leaves the model unset, and the task-run bootstrap API requires a runtime adapter and model together — a runtime adapter without a model is rejected.Changes
Pin the default gateway model in
useGenerateContextso the adapter/model pair the API requires is always complete, matching the adapter the saga already defaults to. This mirrors how the other programmatic cloud-run entry points (inbox, workstream actions) resolve a model before starting a run.How did you test this?
pnpm --filter @posthog/ui typecheck— passesbiome checkon the changed file — cleanmodelis the cause.Automatic notifications
Created with PostHog from a Slack thread