| author | |
| committer | |
| log | 508872e04b87dc7cb53632988115b54b15f78e06 |
| tree | a04d878a974cb1e9b99118576ce9a55f93606a13 |
| parent | aced302b638608042c8a1d30b6fc91dc5661657a |
Co-authored-by: codex <codex@users.noreply.github.com>2 files changed, 21 insertions(+), 6 deletions(-)
apps/web/src/composerDraftStore.test.ts+20| ... | ... | @@ -242,3 +242,23 @@ describe("composerDraftStore project draft thread mapping", () => { |
| 242 | 242 | }); |
| 243 | 243 | }); |
| 244 | 244 | }); |
| 245 | ||
| 246 | describe("composerDraftStore setModel", () => { | |
| 247 | const threadId = ThreadId.makeUnsafe("thread-model"); | |
| 248 | ||
| 249 | beforeEach(() => { | |
| 250 | useComposerDraftStore.setState({ | |
| 251 | draftsByThreadId: {}, | |
| 252 | draftThreadsByThreadId: {}, | |
| 253 | projectDraftThreadIdByProjectId: {}, | |
| 254 | }); | |
| 255 | }); | |
| 256 | ||
| 257 | it("keeps explicit DEFAULT_MODEL overrides instead of coercing to null", () => { | |
| 258 | const store = useComposerDraftStore.getState(); | |
| 259 | ||
| 260 | store.setModel(threadId, "gpt-5.3-codex"); | |
| 261 | ||
| 262 | expect(useComposerDraftStore.getState().draftsByThreadId[threadId]?.model).toBe("gpt-5.3-codex"); | |
| 263 | }); | |
| 264 | }); |
apps/web/src/composerDraftStore.ts+1-6| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | import { |
| 2 | DEFAULT_MODEL, | |
| 3 | 2 | DEFAULT_REASONING, |
| 4 | 3 | ProjectId, |
| 5 | 4 | REASONING_OPTIONS, |
| ... | ... | @@ -671,11 +670,7 @@ export const useComposerDraftStore = create<ComposerDraftStoreState>()( |
| 671 | 670 | if (threadId.length === 0) { |
| 672 | 671 | return; |
| 673 | 672 | } |
| 674 | const normalizedModelCandidate = normalizeModelSlug(model); | |
| 675 | const normalizedModel = | |
| 676 | normalizedModelCandidate && normalizedModelCandidate !== DEFAULT_MODEL | |
| 677 | ? normalizedModelCandidate | |
| 678 | : null; | |
| 673 | const normalizedModel = normalizeModelSlug(model) ?? null; | |
| 679 | 674 | set((state) => { |
| 680 | 675 | const existing = state.draftsByThreadId[threadId]; |
| 681 | 676 | if (!existing && normalizedModel === null) { |