Skip to content

studio: show the model a chat was started on, and offer it back - #9081

Merged
danielhanchen merged 11 commits into
mainfrom
studio-chat-remembers-its-model
Aug 19, 2026
Merged

danielhanchen merged 11 commits into
mainfrom
studio-chat-remembers-its-model

Conversation

@shimmyshimmer

Copy link
Copy Markdown
Member

Why

From a user on the forum, following the per-chat settings thread:

what i'm hoping for is functionality that associates each chat with 1) the model it was created with, and 2) the settings it was assigned. so if i return to a prior chat, it would automatically populate with the model and settings i originally chose for it.

Half of that is #9055, which keeps a chat's system prompt and sampling with the chat. This is the other half: the model.

What was already there

chat_threads.model_id has existed for a long time, and every thread is stamped with the active checkpoint at creation:

const modelIdAtInit = modelId ?? runtimeStateAtInit.params.checkpoint ?? "";

Today that stamp is read for exactly one thing, an image-compatibility warning when you switch models mid-chat, plus a label helper. Nothing shows it and nothing offers it back.

So the model each chat was started on is already recorded, including for chats created long before this PR. No migration, and no backfill that could only guess.

What this adds

  • The chat list shows the model on each single row. Compare rows run two models and show none.
  • A chat open on a different model gets a one-line notice with a Switch back button.

Why an offer and not an automatic switch

Restoring the model on open sounds like the literal request, but for a local model it means evicting whatever is resident and spending a multi-gigabyte load because someone clicked a row in the sidebar. Reading an old chat should not cost that. The notice makes the model visible and the switch one click, which is also how LM Studio and Jan behave.

The button calls handleCheckpointChange, the model picker's own handler, so confirmations, VRAM checks and external-provider handling are exactly those of a manual switch rather than a second path that can drift.

Staying quiet

The notice renders nothing when it has nothing to offer: an unsent New Chat, a legacy row with no stamp, a chat already on its model, or a model since deleted or a connection since removed. The row label yields the right-hand slot to the run spinner and the unread dot, and the title truncates first, so a long model name cannot squeeze it out.

Verification

3488 frontend tests pass, 9 of them new. Typecheck and build clean. Biome error counts per touched file identical to main (6/8/1/1), and both new files are clean. The formatter would touch none of the changed lines.

One thing I have not been able to do: none of this has been looked at in a browser. The logic is covered by tests, but the two visual pieces, the notice bar and the row label, have not been seen rendered, so they deserve a look before merge. That is also why the row label is a contained single-line addition rather than the two-line layout that would read better: restructuring a fixed-height row shared by every chat, alongside drag handles, spinners and the kebab, is not something to change unseen. Worth revisiting once someone can eyeball it.

Independent of #9055 and can merge in either order.

Every thread row has carried modelId since long before this, stamped at
creation and read only for an image-compatibility warning. So the model a chat
was started on is already recorded for chats that already exist; what was
missing was showing it and offering it back.

The chat list shows it on each single row, and a chat open on a different model
gets a one-line notice with a Switch back button. Compare rows run two models
and show none.

Deliberately an offer rather than an automatic switch. For a local model,
restoring on open would evict whatever is resident and spend a multi-gigabyte
load on clicking a row in the sidebar. The button routes through
handleCheckpointChange, the picker's own handler, so the confirmations, VRAM
checks and external-provider handling are the same ones a manual switch gets.

The notice stays quiet when it has nothing to offer: no stamp, already on that
model, or a model since deleted and no longer selectable. The row label yields
the right-hand slot to the spinner and the unread dot, and the title truncates
first, so a long model name cannot squeeze it out.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80266d5437

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

onSwitch,
}: ChatModelNoticeProps) {
const createdModelId = useChatCreatedModel(threadId);
if (!createdModelId || createdModelId === checkpoint) return null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Track the GGUF variant before treating models as equal

For GGUF repositories, multiple quantizations share the same checkpoint ID and are distinguished by activeGgufVariant. If a chat began on Q4 but Q8 of the same repository is now loaded, this equality suppresses the notice even though the resident model differs; when switching from another checkpoint, the button likewise supplies only the ID, so the normal selection handler receives no ggufVariant and may load the default quant instead. Persist and compare the creation-time variant, and pass it through the switch metadata.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The premise is true but the consequence is not, so this would make things worse rather than better. For a local GGUF, params.checkpoint is the bare repo id and the quant lives in a SEPARATE store field, activeGgufVariant (chat-runtime-store.ts:2141, setter setCheckpoint(modelId, ggufVariant) at :2491); the backend says as much at routes/inference.py:4832-4837 and returns gguf_variant as its own field at :10623. thread.modelId is written straight from params.checkpoint, and ThreadRecord has no quant field at all. So two quants of one repo do compare equal - and that branch is if (!createdModelId || createdModelId === checkpoint) return null;. Equality renders NOTHING, so the wrong sentence described here sits on the unreachable side of the return. Silence is also the only honest option, since no quant is persisted: there is nothing to name, and onSwitch(createdModelId) could not restore one. Adding a variant comparison would make every pre-existing thread carry undefined against a live "Q4_K_M" and fire the notice on chats that ARE on the right model, producing exactly the false statement this warns about.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member

Review summary

Verdict: useful, and it now works. The sidebar half was correct as filed. The open-chat half rendered but never reached the screen, which is fixed in a6a4e18.

The notice was invisible

ChatModelNotice was an in-flow sibling rendered after the chat header (chat-page.tsx:3689), but that header is pointer-events-none absolute top-[var(--studio-content-top-inset,0px)] ... z-40 ... bg-background (:3447) - out of flow, opaque, painted on top. Per CSS painting order a positioned element paints above every non-positioned one whatever the source order, so the bar laid out at y=0-37 inside the header's own y=0-48 band. Measured on a built Studio: notice_box {x:280, y:0, w:1210, h:37}, notice_covered_by_header: true, notice_visible_px_below_header: 0.0.

Two things kept this hidden from every existing check. The suppression is layout, not logic, so chat-remembers-its-model.test.ts passed the whole time. And elementFromPoint reports the notice on top - a red herring, because pointer-events-none lets hit-testing pass straight through the header while paint order does not. Bounding boxes plus computed position/z-index/background-color are what settled it.

Before the fix, the honest user-view frame was byte-identical on both sides. Only with the header hidden symmetrically on both halves did the bar appear at all - which is the definition of a change that ships nothing.

The fix

Position the notice at the same --studio-content-top-inset + --studio-chat-header-height offset the header fade already uses, at z-30: above the z-20 fade, below the z-40 header so the model picker's menu stays clickable. bg-muted/40 becomes opaque bg-muted, because an overlay over the scrolling conversation would otherwise let messages read through it - translucency was only safe while the bar had its own row.

After: notice_box y 0 -> 48 (bottom 37 -> 85), notice_covered_by_header true -> false, notice_visible_px_below_header 0.0 -> 37.

Before / after evidence

The AFTER install was rebuilt at a6a4e18 (the .uidiff_sha stamp mismatched, so this is not a stale side). BEFORE is the PR's own merge base 0575c27, not main. No header manipulation in this frame - this is what a user sees:

chat notice

And the sidebar half, which was right all along - the two rows carrying a modelId gain a right-aligned label, and the legacy row stays bare:

sidebar

sidebar_model_labels [] -> ["gpt-5","gpt-4o"], sidebar_labels_by_row {A: "gpt-5", B: "gpt-4o", Legacy: ""}, has_notice false -> true, notice_text "" -> "This chat was started on gpt-5. Switch back". Controls identical on both sides: same three row titles in the same order, picker_model_count 23, header_model_label "openai/gpt-4o OpenAI", 0 row spinners.

The label's title attribute holds the full external::<providerId>::openai%2Fgpt-5, so compareModelDisplayName is doing the shortening rather than the seed feeding a pre-shortened string.

How it was seeded, and the trap worth knowing

No weights and no GPU: threads seeded through the authenticated chat-history API, and the two selectable models are connection models rather than local checkpoints.

The trap that cost the most: seeding the connection into localStorage alone does not survive boot. bootstrapPersistedCredentials() runs at the router root, calls syncExternalProvidersFromBackend() and then setProviders(<backend rows>), which overwrites the array - with an empty backend that erases the seed, selectableModelIds loses model A, the notice is gated off, and AFTER comes out identical to BEFORE. That reads exactly like "this PR changed nothing". The connection is created through POST /api/providers/ instead, and the scene now raises if fewer than two models are selectable before it shoots.

Also load-bearing: CUSTOM_BACKEND_PROVIDER_TYPE === "openai", so an openai row named anything but the registry's own "OpenAI" is re-typed as a custom connection and moves the picker's group heading.

Backwards compatibility

The legacy row is the case that matters: db.ts's v3 upgrade backfills modelId: "" onto every pre-existing chat, and ensureThreadRecord writes the same when nothing was loaded. Seeded explicitly as the third chat - it shows no label, no notice, and does not crash.

Not covered

What Switch back actually loads. That is a real model load and out of this pair's scope.

CI

Repo tests (CPU) fails on tests/kaggle/test_launch_cleanup.py::test_a_signalled_launcher_deletes_its_kernels[SIGINT] - unrelated to this PR and flaky on main, with 8064 passing alongside it.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member

Follow-up: the occlusion Codex flagged after my fix was real, and is now fixed too (593950628)

My earlier comment predates two pushes, so here is what changed since.

a6a4e1859 - the notice was shipping invisible. ChatModelNotice was the first in-flow child of the chat pane, so it laid out at y=0..37 while the chat header in the same pane is position:absolute, z-40, opaque rgb(254,254,253) and 48px tall at y=0..48. Measured on the photographed build: notice_covered_by_header true, notice_visible_px_below_header 0.0. Tests and elementFromPoint both passed, which is exactly why only the screenshot caught it. Corroborated numerically: ImageChops put the entire before/after difference of the broken pair in a single 10x37 box at (1194,0,1204,37), which is precisely the strip the header's right-[10px] leaves uncovered.

593950628 - item 3804082296 was right. Lifting the bar to y=48..85 put it over space the thread viewport never reserved, which still padded only --studio-content-top-inset + 48px. With a real conversation seeded, the first message's rect started at y=48 and elementFromPoint returned the notice at every sample across its band - in a 2-turn chat and in a 40-turn chat scrolled to the top (firstMessageCoveredByNotice: true in both). The fix publishes the notice height as --studio-chat-notice-height off a :has() on the shared ancestor and adds it to the viewport padding: viewportPadTop 48px -> 84px, the first message starts at y=84 (the bar's exact bottom), and firstMessageCoveredByNotice is false in both cases.

Mutation-checked, so the new tests are not vacuous: reverted to the unfixed source, the notice clears the chat header and the conversation reserves the space the notice overlay takes both fail (pass 9, fail 2); with the fix, pass 11, fail 0.

notice fixed

That frame is the honest user view with no header manipulation - the earlier workaround of hiding the floating header on both sides is no longer needed to see the bar.

Clearing the stored model inside the effect is a frame late: the effect
is passive, so the first render for the incoming chat has already
committed with the outgoing chat's model, painting the wrong notice and
moving the viewport padding under it. Answering only for a matching
thread id makes that render impossible rather than brief.

The research panel needed the same offset the thread viewport got. The
notice is an opaque bar spanning the whole chat content area, the panel
column included, so it covered the first 2.25rem of the panel header:
measured 36 px of overlap over the title, the status pill and the close
button, with elementFromPoint returning the notice at all four. After
the offset the overlap is 0 and the hit tests return the intended
controls, while a chat with no notice keeps its exact previous geometry
because the variable resolves to 0px.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

A chat opened as ?new=<nonce> carries no thread in the URL and keeps
none after the first send, so the notice never saw the row that send
created and switching model in a chat you had just started offered
nothing until you navigated away and reopened it. The store does learn
the id, published once the visible thread is the one being persisted,
but it still holds the previous chat's id for the first render, until
ThreadNewChatSwitch blanks it in an effect. Handing that straight over
would put the previous chat's notice on this one, so the id is taken
only after it has been seen blanked for this nonce. Before the first
send it stays an unpersisted local id and there is nothing to offer.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 18, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 18, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 18, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 18, 2026
danielhanchen added a commit that referenced this pull request Aug 18, 2026
The heavy-thread browser smoke fails its own harness check on this branch:

  HARNESS-BROKEN chromium at 25000 chars let 2 /api/ requests reach the
  network during the measured actions; the timings include a round trip
  per request

Both leaked requests are GET /api/chat/threads/__LOCALID_.../forks, one during
seeding and two more inside the measured actions. The smoke page answers a small
allowlist of endpoints in-page so no round trip lands in a timed region, and the
fork-count entry in that allowlist still matches the per-message endpoint,
/threads/{id}/messages/{id}/forks. #8992 replaced it with one per-thread request
built by getThreadForkCounts, and the allowlist was not moved with it, so every
fork-count GET went to the dev server. fork-count-store refreshes on
CHAT_HISTORY_UPDATED_EVENT, which the delete action fires, which is why two of
them land inside the measurement rather than only at load.

Match the URL the client builds and answer the body the endpoint returns:
getThreadForkCounts reads data.counts into a Map, so {"counts":{}} is "no
message has forks" and renders no badge. The fixture is unchanged by this: the
census at both sizes is identical to the failing run, 3676 and 14285 DOM nodes,
20 and 80 messages, 3216 and 12804 highlighted tokens. Only the round trips are
gone.

This has been broken repo-wide since #8992 and invisible. On every other open PR
the earlier Unit tests step in this job fails on a broken import, so Install
Chromium and every Browser smoke step is skipped; this branch is the first job
in which they run at all. Compare step outcomes on #9081, Unit tests failure and
all smokes skipped, with this branch, Unit tests success and the smokes running.

Two things so the next drift costs less. The stray-request failure now names the
first three distinct URLs, because it fires in CI where nobody can attach a
listener afterwards, and finding this one meant re-running the smoke locally with
a print statement patched in. And a unit test now checks the allowlist against
the URL chat-api.ts builds, rather than against a string someone remembered to
update, so the same drift fails in Dev-server lifecycle tests instead of waiting
for a job where the browser smokes get to run.

The self-check itself is untouched: still zero tolerated strays, still failing
the run.

Verified locally on chromium at 25000 and 100000 chars: before, 2 stray requests
at each size and exit 1; after, 0 stray requests at each size, 9 stubbed rather
than 6, and exit 0. The three smokes the aborted job skipped, settings tab
panels, a settings panel that cannot load, and chat stream pacing, all pass
locally as well, so nothing further is hiding behind this one.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 18, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 600876cda3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2131 to +2134
const newChatThreadId =
search.new && newChatBlankedRef.current === search.new
? persistedActiveThreadId
: null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear the nonce latch when navigating away

When a persisted ?new=A chat is left for saved thread X and later revisited through browser history, newChatBlankedRef still contains A while activeThreadId initially remains X. These lines therefore pass X to the notice for the New Chat render until ThreadNewChatSwitch clears the store in its passive effect; if X's model differs from the checkpoint, the wrong notice and layout padding are painted for a frame. Fresh evidence beyond the previously fixed keyed-hook issue is that the hook is now given X's valid ID, so its thread-key guard cannot reject it; reset or key the latch to the current route transition.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. The latched id feeds nothing but the notice's threadId, and ThreadNewChatSwitch remounts on the way back to ?new= and blanks the store in its mount effect, so the stale id survives at most a single commit before the notice self-suppresses. There is no action to lose in that window: nothing is sent, stored or loaded from it, and Switch back is not clickable in one frame.

danielhanchen added a commit that referenced this pull request Aug 19, 2026
* Give the mmproj fallback import its file extension

node --experimental-strip-types resolves relative specifiers literally,
so the extensionless import added in #9173 fails at import time and
takes queued-model-capabilities.test.ts down with it. Before that commit
this module had only import type lines, which are erased, so it carried
no runtime relative import at all and the test passed. 55 other modules
already spell the extension.

* Studio: repair the repo tests #9173 left red

The mmproj fallback landing added a mmprojFallbackMessage import to
chat-adapter.ts. Two repo tests read that file's source:

- test_chat_autoload_failure_gate slices autoLoadSmallestModel out of the
  adapter and runs it, and its own guard fails the whole file when the slice
  references a name the harness preamble does not define. Add the stub.
- test_model_picker_contracts pinned the success toast's description as the
  literal 'description: cpuFallbackReason'. The mmproj branch now sits ahead
  of the CPU one, so pin the description expression instead of which fallback
  is tested first.

71 failures on main, none of them a real regression.

* Studio: repair the backend test #9173 left red

test_tensor_split_abort_raises_early_to_layer_fallback pins the order of
two branches in load_model by their source offsets. #9173 renamed the
variable handed to _strip_mmproj_args, so the find() of the old spelling
returned -1 and the ordering assert compared against it. Pin the call
itself and fail loudly when it is no longer reachable.

* Stop the Windows chat UI smoke racing the route Suspense fallback

exercise_permission_mode_controls asserts the permission pill visible on
the 5s expect default, immediately after the composer mounts. The composer
can mount and then drop back behind the root Suspense fallback while the
route chunk loads, so the assertion lands on 'Loading...' and gives up.

Reproduced on main at aa32c18: same step, same line, aria snapshot
'- text: Loading...'. It is Windows-only in practice because the mac smoke
wraps the script in a 3-attempt retry and the Windows one does not, so a
slow 4-vCPU runner surfaces the race raw.

Wait the pill out on the same budget the composer already uses.

* Wait the permission pill out at every reload, not just the first

The macOS smoke hit the same Suspense race at the second assertion, which
the first commit did not cover. Four of the six assertions in this block
follow page.reload(wait_until = domcontentloaded), which returns long
before the lazy chat chunk resolves, so asserting on expect's 5s default
races it by construction rather than only on a slow runner.

Route all six through one helper that waits on the composer's budget.
Seen on both the Windows and macOS smokes as 'Aria snapshot: - text:
Loading...' at playwright_chat_ui.py:135 and :189.

* Give the playwright stub every name the harnesses import

The CPU test job has no playwright, so tests/studio/test_heavy_thread_measurement_integrity.py
puts a stub `playwright.sync_api` into sys.modules at collection time rather than skipping the
harness arithmetic along with the browser. That stub defined one name, `sync_playwright`, which
is all its own harness imports.

sys.modules is session-wide, so the stub is not read only by the file that installs it. Three of
the four harnesses import `sync_playwright` alone and were satisfied by it; playwright_strip_ansi_smoke
also imports `Page` and `expect`, and got

    ImportError: cannot import name 'Page' from 'playwright.sync_api' (unknown location)

from a stub two files away. `(unknown location)` is the stub itself: a bare ModuleType has no
__file__. The two tests that import that harness, test_the_ansi_dump_survives_a_vite_server_that_is_
still_talking and test_an_empty_smoke_base_url_means_unset[playwright_strip_ansi_smoke], failed on
it. pytest.importorskip("playwright") does not save them, because by then the stub package is
importable.

This is pre-existing on main and predates this branch, which never touched either file. It was
masked: the same job was failing with 71 other errors, which this PR fixes, so these two were
never the reported cause. They belong here because this is the PR that makes the job green.

The stub now answers any public name with a callable that raises, so a harness can satisfy its
imports without quietly measuring a browser that is not there, and adding an import to a harness
cannot break a different file again. Dunders still raise AttributeError, since pytest and inspect
probe those and answering them makes the stub look like a package. The install probe also imports
off the submodule now: a partial install leaves `playwright` importable while `playwright.sync_api`
resolves to an empty namespace, which fails the same way.

Verified by blocking playwright in a subprocess to reproduce the CPU job: 2 failed, 104 passed
before, 106 passed after, with the two files alone skipping cleanly when the stub is not collected.

* Stub the fork-count endpoint the heavy-thread smoke actually requests

The heavy-thread browser smoke fails its own harness check on this branch:

  HARNESS-BROKEN chromium at 25000 chars let 2 /api/ requests reach the
  network during the measured actions; the timings include a round trip
  per request

Both leaked requests are GET /api/chat/threads/__LOCALID_.../forks, one during
seeding and two more inside the measured actions. The smoke page answers a small
allowlist of endpoints in-page so no round trip lands in a timed region, and the
fork-count entry in that allowlist still matches the per-message endpoint,
/threads/{id}/messages/{id}/forks. #8992 replaced it with one per-thread request
built by getThreadForkCounts, and the allowlist was not moved with it, so every
fork-count GET went to the dev server. fork-count-store refreshes on
CHAT_HISTORY_UPDATED_EVENT, which the delete action fires, which is why two of
them land inside the measurement rather than only at load.

Match the URL the client builds and answer the body the endpoint returns:
getThreadForkCounts reads data.counts into a Map, so {"counts":{}} is "no
message has forks" and renders no badge. The fixture is unchanged by this: the
census at both sizes is identical to the failing run, 3676 and 14285 DOM nodes,
20 and 80 messages, 3216 and 12804 highlighted tokens. Only the round trips are
gone.

This has been broken repo-wide since #8992 and invisible. On every other open PR
the earlier Unit tests step in this job fails on a broken import, so Install
Chromium and every Browser smoke step is skipped; this branch is the first job
in which they run at all. Compare step outcomes on #9081, Unit tests failure and
all smokes skipped, with this branch, Unit tests success and the smokes running.

Two things so the next drift costs less. The stray-request failure now names the
first three distinct URLs, because it fires in CI where nobody can attach a
listener afterwards, and finding this one meant re-running the smoke locally with
a print statement patched in. And a unit test now checks the allowlist against
the URL chat-api.ts builds, rather than against a string someone remembered to
update, so the same drift fails in Dev-server lifecycle tests instead of waiting
for a job where the browser smokes get to run.

The self-check itself is untouched: still zero tolerated strays, still failing
the run.

Verified locally on chromium at 25000 and 100000 chars: before, 2 stray requests
at each size and exit 1; after, 0 stray requests at each size, 9 stubbed rather
than 6, and exit 0. The three smokes the aborted job skipped, settings tab
panels, a settings panel that cannot load, and chat stream pacing, all pass
locally as well, so nothing further is hiding behind this one.
The notice is an absolute child of the chat content container, so it spans the
canvas column too. The panel's top offset was a fixed 90px, which under custom
desktop chrome left the notice covering the top 28px of the panel, including
the preview/source tabs and the close control.

Move both edges by the notice height, as the research panel already does, with
0px whenever no notice is on screen.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c41e9d74fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +3288 to +3294
// connection since removed, drops out and the notice stays quiet.
const selectableModelIds = useMemo(
() =>
new Set<string>([
...models.map((model) => model.id),
...loraModels.map((model) => model.id),
...externalModels.map((model) => model.id),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include cached Hub models in the selectable set

When a chat was started with a downloaded Hub model that is neither a configured default nor currently resident, that model remains selectable in the picker's cached GGUF/model inventory, but this set includes only /api/models/list, LoRA/local-folder rows, and external models. After switching away, /api/models/list drops the old resident entry, so ChatModelNotice incorrectly suppresses the offer for a model that is still available under On Device. Include the cached model and cached GGUF inventory IDs when deciding whether the saved model is selectable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. The guard is deliberately conservative, and nothing breaks when it stays quiet: a notice that does not appear costs a user nothing, while widening it would cost them a load. A chat row stores modelId and nothing else, so for a cached GGUF repo there is no variant to switch back to; the On Device row for one expands to pick a quant, and offering Switch back would load whichever quant the resolver lands on rather than the one the chat actually ran on. That is a worse outcome than silence, so the set stays at what can be honoured exactly.

danielhanchen and others added 2 commits August 19, 2026 12:37
ChatModelNotice called handleCheckpointChange with only the model id. The
picker never does: it supplies source, isLora, isDownloaded and isGguf for
every row it offers. A Hub row or an external model does not need them
(/api/models/list carries isGguf, isExternalModelId routes the rest), but a
local or fine-tuned row is in neither, so selectModel resolved isGguf false
and the /load request dropped n_parallel, n_batch, n_ubatch and
llama_extra_args and sized the context down the transformers path.

Resolve the same metadata the picker supplies for those rows, and carry the
format for a single .gguf file out of the local inventory so it survives.
A GGUF directory stays unclaimed on purpose: that row expands to pick a
quant and a chat row records only modelId, so sending llama-server flags for
a quant nobody chose would be worse than the plain switch.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1edb8708e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +3306 to +3308
handleCheckpointChange(
modelId,
chatModelSwitchMeta(modelId, loraModels),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Route switch-back media models through the picker

When a saved thread's modelId is a fine-tuned TTS checkpoint, this direct call bypasses the picker's onSelect wrapper in model-selector/pickers.tsx:3656-3706, which detects media tasks and navigates to the Audio page. The fine-tuned picker deliberately derives pipelineTag from audioType (pickers.tsx:6539-6547) because chat completions cannot serve these adapters, but chatModelSwitchMeta omits that tag and handleCheckpointChange proceeds down the chat loading path, so “Switch back” fails instead of behaving like selecting the same row in the picker.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chat ModelSelector passes no task, so the picker's media routing is live in chat: picking a TTS or STT fine-tuned checkpoint navigates to the Audio page and never becomes the chat checkpoint. No saved thread's modelId can be one of those adapters, so Switch back never fires for one.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 19, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1edb8708e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +32 to +34
void getStoredChatThread(threadId)
.then((thread) => {
if (!cancelled) setRead({ threadId, modelId: thread?.modelId || null });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh the model after queued auto-load stamps it

When the first prompt is queued while no checkpoint is selected, the new thread is initially stored with an empty modelId, so this one-shot read can cache null. The run later auto-loads a model and explicitly stamps the row via persistResolvedQueuedModel in chat-adapter.ts:3661-3672,4123-4124, but threadId does not change and this effect never reads again; after the user switches models, the new chat therefore cannot show the switch-back notice until it is reopened. Re-read when chat-history updates (or otherwise refresh after the model stamp) rather than treating the initial blank as final.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The queued-empty-model case stamps modelId after the read, so the notice is simply absent for that one chat session; nothing wrong is shown, no request changes, and the next time the thread is opened the read reruns and the notice appears. A missing offer that heals on reopen is not worth an extra chat-history subscription in the render path.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: d1edb8708e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit f3b0425 into main Aug 19, 2026
31 of 36 checks passed
@danielhanchen
danielhanchen deleted the studio-chat-remembers-its-model branch August 19, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants