-
Notifications
You must be signed in to change notification settings - Fork 505
feat: auto-set Pro models after sign-in while preserving previous configs #3306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devin-ai-integration
wants to merge
2
commits into
main
Choose a base branch
from
devin/1769074332-auto-pro-models-signin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+223
−15
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,176 @@ | ||
| import { describe, expect, test } from "vitest"; | ||
|
|
||
| import { createTestSettingsStore } from "../store/tinybase/persister/testing/mocks"; | ||
|
|
||
| describe("Pro model auto-config store logic", () => { | ||
| test("on becoming Pro: saves non-Pro config and sets Pro models", () => { | ||
| const store = createTestSettingsStore(); | ||
|
|
||
| store.setValue("current_stt_provider", "openai"); | ||
| store.setValue("current_stt_model", "whisper-1"); | ||
| store.setValue("current_llm_provider", "anthropic"); | ||
| store.setValue("current_llm_model", "claude-3"); | ||
|
|
||
| const currentSttProvider = store.getValue("current_stt_provider"); | ||
| const currentSttModel = store.getValue("current_stt_model"); | ||
| const currentLlmProvider = store.getValue("current_llm_provider"); | ||
| const currentLlmModel = store.getValue("current_llm_model"); | ||
|
|
||
| if (currentSttProvider && currentSttProvider !== "hyprnote") { | ||
| store.setValue("pre_pro_stt_provider", currentSttProvider); | ||
| store.setValue("pre_pro_stt_model", currentSttModel ?? ""); | ||
| } | ||
| if (currentLlmProvider && currentLlmProvider !== "hyprnote") { | ||
| store.setValue("pre_pro_llm_provider", currentLlmProvider); | ||
| store.setValue("pre_pro_llm_model", currentLlmModel ?? ""); | ||
| } | ||
|
|
||
| store.setValue("current_stt_provider", "hyprnote"); | ||
| store.setValue("current_stt_model", "cloud"); | ||
| store.setValue("current_llm_provider", "hyprnote"); | ||
| store.setValue("current_llm_model", "Auto"); | ||
|
|
||
| expect(store.getValue("current_stt_provider")).toBe("hyprnote"); | ||
| expect(store.getValue("current_stt_model")).toBe("cloud"); | ||
| expect(store.getValue("current_llm_provider")).toBe("hyprnote"); | ||
| expect(store.getValue("current_llm_model")).toBe("Auto"); | ||
| expect(store.getValue("pre_pro_stt_provider")).toBe("openai"); | ||
| expect(store.getValue("pre_pro_stt_model")).toBe("whisper-1"); | ||
| expect(store.getValue("pre_pro_llm_provider")).toBe("anthropic"); | ||
| expect(store.getValue("pre_pro_llm_model")).toBe("claude-3"); | ||
| }); | ||
|
|
||
| test("on sign-out: restores pre-Pro config and clears saved values", () => { | ||
| const store = createTestSettingsStore(); | ||
|
|
||
| store.setValue("current_stt_provider", "hyprnote"); | ||
| store.setValue("current_stt_model", "cloud"); | ||
| store.setValue("current_llm_provider", "hyprnote"); | ||
| store.setValue("current_llm_model", "Auto"); | ||
| store.setValue("pre_pro_stt_provider", "openai"); | ||
| store.setValue("pre_pro_stt_model", "whisper-1"); | ||
| store.setValue("pre_pro_llm_provider", "anthropic"); | ||
| store.setValue("pre_pro_llm_model", "claude-3"); | ||
|
|
||
| const preProSttProvider = store.getValue("pre_pro_stt_provider"); | ||
| const preProSttModel = store.getValue("pre_pro_stt_model"); | ||
| const preProLlmProvider = store.getValue("pre_pro_llm_provider"); | ||
| const preProLlmModel = store.getValue("pre_pro_llm_model"); | ||
|
|
||
| if (preProSttProvider) { | ||
| store.setValue("current_stt_provider", preProSttProvider); | ||
| store.setValue("current_stt_model", preProSttModel ?? ""); | ||
| } else { | ||
| store.setValue("current_stt_provider", ""); | ||
| store.setValue("current_stt_model", ""); | ||
| } | ||
|
|
||
| if (preProLlmProvider) { | ||
| store.setValue("current_llm_provider", preProLlmProvider); | ||
| store.setValue("current_llm_model", preProLlmModel ?? ""); | ||
| } else { | ||
| store.setValue("current_llm_provider", ""); | ||
| store.setValue("current_llm_model", ""); | ||
| } | ||
|
|
||
| store.setValue("pre_pro_stt_provider", ""); | ||
| store.setValue("pre_pro_stt_model", ""); | ||
| store.setValue("pre_pro_llm_provider", ""); | ||
| store.setValue("pre_pro_llm_model", ""); | ||
|
|
||
| expect(store.getValue("current_stt_provider")).toBe("openai"); | ||
| expect(store.getValue("current_stt_model")).toBe("whisper-1"); | ||
| expect(store.getValue("current_llm_provider")).toBe("anthropic"); | ||
| expect(store.getValue("current_llm_model")).toBe("claude-3"); | ||
| expect(store.getValue("pre_pro_stt_provider")).toBe(""); | ||
| expect(store.getValue("pre_pro_stt_model")).toBe(""); | ||
| expect(store.getValue("pre_pro_llm_provider")).toBe(""); | ||
| expect(store.getValue("pre_pro_llm_model")).toBe(""); | ||
| }); | ||
|
|
||
| test("on sign-out without pre-Pro config: clears current config", () => { | ||
| const store = createTestSettingsStore(); | ||
|
|
||
| store.setValue("current_stt_provider", "hyprnote"); | ||
| store.setValue("current_stt_model", "cloud"); | ||
| store.setValue("current_llm_provider", "hyprnote"); | ||
| store.setValue("current_llm_model", "Auto"); | ||
|
|
||
| const preProSttProvider = store.getValue("pre_pro_stt_provider"); | ||
| const preProLlmProvider = store.getValue("pre_pro_llm_provider"); | ||
|
|
||
| if (preProSttProvider) { | ||
| store.setValue("current_stt_provider", preProSttProvider); | ||
| } else { | ||
| store.setValue("current_stt_provider", ""); | ||
| store.setValue("current_stt_model", ""); | ||
| } | ||
|
|
||
| if (preProLlmProvider) { | ||
| store.setValue("current_llm_provider", preProLlmProvider); | ||
| } else { | ||
| store.setValue("current_llm_provider", ""); | ||
| store.setValue("current_llm_model", ""); | ||
| } | ||
|
|
||
| expect(store.getValue("current_stt_provider")).toBe(""); | ||
| expect(store.getValue("current_stt_model")).toBe(""); | ||
| expect(store.getValue("current_llm_provider")).toBe(""); | ||
| expect(store.getValue("current_llm_model")).toBe(""); | ||
| }); | ||
|
|
||
| test("full flow: non-Pro -> Pro -> sign-out restores original config", () => { | ||
| const store = createTestSettingsStore(); | ||
|
|
||
| store.setValue("current_stt_provider", "deepgram"); | ||
| store.setValue("current_stt_model", "nova-2"); | ||
| store.setValue("current_llm_provider", "openai"); | ||
| store.setValue("current_llm_model", "gpt-4"); | ||
|
|
||
| const sttBefore = store.getValue("current_stt_provider"); | ||
| const sttModelBefore = store.getValue("current_stt_model"); | ||
| const llmBefore = store.getValue("current_llm_provider"); | ||
| const llmModelBefore = store.getValue("current_llm_model"); | ||
|
|
||
| if (sttBefore && sttBefore !== "hyprnote") { | ||
| store.setValue("pre_pro_stt_provider", sttBefore); | ||
| store.setValue("pre_pro_stt_model", sttModelBefore ?? ""); | ||
| } | ||
| if (llmBefore && llmBefore !== "hyprnote") { | ||
| store.setValue("pre_pro_llm_provider", llmBefore); | ||
| store.setValue("pre_pro_llm_model", llmModelBefore ?? ""); | ||
| } | ||
| store.setValue("current_stt_provider", "hyprnote"); | ||
| store.setValue("current_stt_model", "cloud"); | ||
| store.setValue("current_llm_provider", "hyprnote"); | ||
| store.setValue("current_llm_model", "Auto"); | ||
|
|
||
| expect(store.getValue("current_stt_provider")).toBe("hyprnote"); | ||
| expect(store.getValue("current_llm_provider")).toBe("hyprnote"); | ||
|
|
||
| const preProStt = store.getValue("pre_pro_stt_provider"); | ||
| const preProSttModel = store.getValue("pre_pro_stt_model"); | ||
| const preProLlm = store.getValue("pre_pro_llm_provider"); | ||
| const preProLlmModel = store.getValue("pre_pro_llm_model"); | ||
|
|
||
| if (preProStt) { | ||
| store.setValue("current_stt_provider", preProStt); | ||
| store.setValue("current_stt_model", preProSttModel ?? ""); | ||
| } | ||
| if (preProLlm) { | ||
| store.setValue("current_llm_provider", preProLlm); | ||
| store.setValue("current_llm_model", preProLlmModel ?? ""); | ||
| } | ||
| store.setValue("pre_pro_stt_provider", ""); | ||
| store.setValue("pre_pro_stt_model", ""); | ||
| store.setValue("pre_pro_llm_provider", ""); | ||
| store.setValue("pre_pro_llm_model", ""); | ||
|
|
||
| expect(store.getValue("current_stt_provider")).toBe("deepgram"); | ||
| expect(store.getValue("current_stt_model")).toBe("nova-2"); | ||
| expect(store.getValue("current_llm_provider")).toBe("openai"); | ||
| expect(store.getValue("current_llm_model")).toBe("gpt-4"); | ||
| expect(store.getValue("pre_pro_stt_provider")).toBe(""); | ||
| expect(store.getValue("pre_pro_llm_provider")).toBe(""); | ||
| }); | ||
| }); |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Critical Step: The sign-out flow reads and restores
pre_pro_*configs but never saves the current Pro configuration before clearing.What breaks: If a user manually customized their Pro settings (e.g., changed from default hyprnote models to specific models), those customizations are lost on sign-out. The code only restores configs that were saved when first becoming Pro, not the current state at sign-out time.
Impact: User loses any Pro configuration changes they made between sign-in and sign-out.
Fix: Save current config before restoration:
Note: This requires adding
pre_logout_*settings to settings.ts as mentioned in the PR description but missing from implementation.Spotted by Graphite Agent

Is this helpful? React 👍 or 👎 to let us know.