feat(task-input): preselect server-side team/user default model#3421
Draft
VojtechBartos wants to merge 1 commit into
Draft
feat(task-input): preselect server-side team/user default model#3421VojtechBartos wants to merge 1 commit into
VojtechBartos wants to merge 1 commit into
Conversation
Fetch the resolved AI run defaults (the user's per-project preference over the project default, resolved by the tasks backend) and preselect them in the task input picker ahead of the device-local last-used model. Changing the picker still affects only the current composition. Older servers without the endpoint, fetch failures, and defaults targeting the other runtime adapter all fall back to the existing behavior.
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PostHog now supports team-level and per-user default AI run preferences for task runs, resolved server-side (PostHog/posthog#70671, UI in PostHog/posthog#70683). PostHog Code ignores them: the task input picker preselects the device-local
lastUsedModel, so a project-wide default never reaches runs started from the desktop app, and preferences don't follow the user across devices.Changes
PostHogAPIClient.getTaskRunDefaults()fetchesGET /api/projects/:id/tasks/my_config/and returns theresolved_ai_run_defaultstriple (user preference over project default). Returns null on any failure, missing endpoint (older servers), or when nothing is configured - defaults are a nicety and must never block task creation.usePreviewConfigfetches the defaults alongside the gateway options. Preselection order for the model picker is now: server default (when it targets the current adapter and the gateway still offers the model) > device-local last-used model > gateway default. The default's reasoning effort is applied with it when the model supports it. Changing the picker still affects only the current composition, so a one-off pick never overrides the server-side preference.Not in this PR (follow-ups): passing the server default through the one-click inbox flows (
resolveDefaultModel/ReportModelResolver), and omitting the triple from cloud-run creation so the backend resolves it at run time (the saga currently must sendruntime_adapterforinitial_permission_mode; with this PR the picker already carries the server default into the run explicitly, and the backend applies defaults for any caller that omits them).How did you test this?
vitest packages/api-client/src/posthog-client.test.ts- 70 passed, including 3 new cases forgetTaskRunDefaults(snake_case → client shape mapping, null on 404 from older servers, null when no default is configured).turbo test --filter=@posthog/api-client --filter=@posthog/uiandturbo typecheckfor both packages - green.Automatic notifications