Repository navigation
fix(automations): align model selector with chat under Simple Mode - #3305
Merged
Merged
Conversation
When Simple Mode is enabled, the chat's selectedModel is resolved from the active tier and the stored model ref is ignored. Calling setModel from the Test button therefore had no effect and the chat ran on whatever tier it happened to be on. Branch on simpleMode.enabled and call setSimpleModeTier with the automation's current tier, mirroring the chat input's own picker behavior. When Simple Mode is off, behavior is unchanged.
Move the tier picker out of input.tsx into its own file so the automation editor can reuse the exact same dropdown rather than duplicating the markup. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
buildDefaultAutomationInput accepted no model context, so new automations always saved empty model fields and never honored Simple Mode. Thread the chat's already-resolved selectedModel and credentialId (via useChatPrefs) through AutomationsList.handleCreate so the row persists a concrete modelId/keyId — exactly what the runtime expects and the same shape chat sends to /stream. When chatModel hasn't resolved yet, fall back to empty fields (no regression). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Move SimpleModeSection above the credits hero and provider grid so admins see the org-wide model policy as the primary action on the AI Providers page. Hide it entirely when no provider keys are configured — the form has nothing to bind to in that state. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsSuggested: Patch ( React with an emoji to override the release type:
Current version:
|
navigateToTask rebuilt the search params from scratch and dropped prev.main and prev.chat, so clicking Test from the automation editor collapsed the side panel and reset chat visibility. Preserve both keys mirroring usePanelActions.setTaskId, and force-open chat from handleRunClick so a collapsed chat panel still surfaces the test run. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The constant is only consumed by SimpleModeTierDropdown in the same file. Knip flagged the export as dead.
viktormarinho
added a commit
that referenced
this pull request
May 7, 2026
Stop baking the resolved model into the automation row. When the user
saves with Simple Mode enabled, persist a `tier` intent ("fast" /
"smart" / "thinking") inside `automation.models`; `buildStreamRequest`
then looks up the live tier slot from `organization_settings.simple_mode`
and uses that instead of the stored credentialId / thinking.id snapshot.
Effects:
- Dormant automations now pick up org Simple Mode changes the next time
they fire — no UI visit needed to reconcile.
- The detail page derives the dropdown label from `models.tier` first
(truthful even after a slot reconfig), falling back to slot-match for
legacy automations.
- The form clears `tier` whenever the user explicitly picks via the
ModelSelector fallback, so an explicit override beats the tier intent.
- Legacy automations (no tier persisted) keep using the stored snapshot
until next save, at which point Simple Mode is enabled they get pinned
to the matched / default tier.
Tests cover the four resolution paths (override, simple-mode disabled,
tier slot unset, no tier on legacy row).
This builds on the UI work merged in #3305 — that PR aligned the model
selector with the chat input but kept baking the resolved model into the
row, so dormant automations stayed stale until someone opened them.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
3 of 4 tasks
viktormarinho
added a commit
that referenced
this pull request
May 7, 2026
* feat(automations): resolve simple-mode tier at run time
Stop baking the resolved model into the automation row. When the user
saves with Simple Mode enabled, persist a `tier` intent ("fast" /
"smart" / "thinking") inside `automation.models`; `buildStreamRequest`
then looks up the live tier slot from `organization_settings.simple_mode`
and uses that instead of the stored credentialId / thinking.id snapshot.
Effects:
- Dormant automations now pick up org Simple Mode changes the next time
they fire — no UI visit needed to reconcile.
- The detail page derives the dropdown label from `models.tier` first
(truthful even after a slot reconfig), falling back to slot-match for
legacy automations.
- The form clears `tier` whenever the user explicitly picks via the
ModelSelector fallback, so an explicit override beats the tier intent.
- Legacy automations (no tier persisted) keep using the stored snapshot
until next save, at which point Simple Mode is enabled they get pinned
to the matched / default tier.
Tests cover the four resolution paths (override, simple-mode disabled,
tier slot unset, no tier on legacy row).
This builds on the UI work merged in #3305 — that PR aligned the model
selector with the chat input but kept baking the resolved model into the
row, so dormant automations stayed stale until someone opened them.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
* fix(automations): refresh full thinking metadata + safer auto-pin
Address review on PR #3307:
#1 — The previous override only patched `credentialId` and `thinking.id`,
leaving stale `capabilities` / `limits` / `provider` / `title` from the
saved snapshot. Downstream code (`ensureModelCompatibility`, the
max-output-tokens cap, telemetry, prompt headers) consumes those fields,
so a tier whose live slot pointed to a different model would get gated
against the wrong capability set. Replace the patch with a typed
`TierOverride` produced by `resolveTierOverride`, which fetches the full
`ModelInfo` via `ctx.aiProviders.listModels` and translates it into the
`thinking` shape — same translation as the chat path's
`toMetadataModelInfo`. Falls back to a slot-only override (with stored
title) if the provider call throws, so a flaky provider doesn't block
the run.
#2 — Saving any edit on a Simple-Mode-enabled legacy automation (e.g.
just renaming it) used to silently write `tier: "smart"` because
`tierToPersist` fell back to the dropdown's display fallback. After
that, the run path would override the user's original snapshot model
with the org's live "smart" slot. Only auto-pin when `slotMatchedTier`
is truthy — i.e. the saved credential/model actually correspond to a
configured slot. Legacy automations with no slot match stay unpinned
on incidental saves; the user has to explicitly pick a tier via the
dropdown to opt in.
Tests: split build-stream-request tests into "tier override" (verifies
full thinking replacement) and add a new resolve-tier-override.test.ts
that exercises ModelInfo translation, the disabled / unset / no-tier
short-circuits, and the listModels-throws fallback.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
* docs(automations): clarify tier snapshot fallback role
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* fix(settings): persist Simple Mode toggle on first enable
The autosave gated on `formState.isDirty`, but RHF's dirty flag was
cleared before the 250ms debounce fired:
- `handleToggle` calls `form.reset(...)` to seed default tier slots,
which rebases the dirty baseline (even with keepDirty: true, fields
that weren't already dirty stay clean).
- `useForm({ values: simpleMode })` re-syncs whenever the React Query
cache emits a new object reference, which `useSimpleMode`'s select
does on every render.
By the time the timer fired, `isDirty` was false and `save` bailed,
so the mutation never ran and the row was never inserted. First-time
toggle-on on a fresh org silently no-op'd.
Drop the isDirty gate. Each `schedule()` call is the explicit save
intent — only user actions call it, and nothing inside `save`
re-schedules, so there's no feedback loop.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.
What is this contribution about?
The automation model selector diverged from chat's: the picker showed concrete model names instead of Fast/Smart/Thinking tiers under Simple Mode, new automations always saved empty model fields, and the Test button left the chat running on the wrong tier. This PR brings the automation editor to parity with the chat input — same
SimpleModeTierDropdown, same Simple-Mode-aware seeding for new rows, same model state when firing a test run.Also surfaces the Simple Mode section first on the AI Providers settings page (and hides it when no keys are configured) since it's the org-wide model policy.
How to Test
/$org/settings/ai-providersand configure all three tiers.models.thinking.idupdates to the resolved concrete model.thinking, click "New automation": the created row'smodels.thinking.idmatches thethinkingslot.thinking, open an automation pinned tofastand click Test: the chat tier switches tofastand the test run uses thefast-tier model.Migration Notes
None. Runtime payload shape (
{ credentialId, thinking: { id } }) is unchanged; this is a UI/seeding alignment.Review Checklist
Summary by cubic
Aligns the Automations model selector with Chat in Simple Mode and fixes tier/test behavior. Also keeps the automation panel and chat visible when a test creates a new thread.
Bug Fixes
models.thinking.id.setSimpleModeTier); behavior unchanged when off.credentialId/modelIdfrom the chat when available.Refactors
SimpleModeTierDropdownto a shared component and reused in chat and automations; removed unusedSIMPLE_MODE_TIER_OPTIONSexport.Written for commit 6332e3d. Summary will update on new commits.