/chat read the model from location.state, which a refresh does not have
The composer showed the bare harness "claude-code" instead of the model. Root
cause: NewChat called useChat(undefined, locationState?.model). location.state
is only set by an in-app navigation, so on a refresh or a deep link it is empty
and the model argument was undefined. That is what useChat seeds selectedModel
from, so the composer sent NO model — confirmed live in the log as
"Model selected for chat … clientModel=null" on the owner's own session. The
server then fell back to DEFAULT_MODEL, the bare harness, which names no tier,
so the picker rendered the raw string.
The same file already knew this. Twelve lines down,
initialModel={props.model ?? locationState?.model} carries a comment saying
locationState.model "is written by nothing, so it was the only source and always
undefined on resume". That was applied to the child prop and missed on the
useChat call above it — the call that decides what gets sent. props.model is
detail.officerModel, correct and populated on every refresh.
Why it looked random: clicking a session from the list carries location state,
so the picker was right; only a refresh lost it. And it never healed, because no
model sent means the server re-derives the bare harness and record() rightly
refuses to store a tierless one.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Officer-Session: f7a62308-0977-4cf4-aa29-c020853fd420
This commit is contained in:
@@ -192,7 +192,15 @@ function NewChat(props: NewChatProps) {
|
||||
|
||||
// context 'chat' tells the backend to run this session from the caller's own home, so
|
||||
// its transcript lands in Claude's own store as an isolated project group (source of truth).
|
||||
const chat = useChat(undefined, locationState?.model, {
|
||||
//
|
||||
// `props.model` first, for the reason spelled out on `initialModel` below: `locationState.model` is
|
||||
// written by nothing and is always undefined on a resume. That was fixed there and missed HERE, which
|
||||
// is the call that matters — this is the model `useChat` seeds `selectedModel` from, so leaving it
|
||||
// undefined meant the composer sent no model at all. The server then fell back to `DEFAULT_MODEL`, the
|
||||
// bare harness, which names no tier: the picker rendered the raw string `claude-code`, and `record()`
|
||||
// rightly refused to store it, so nothing ever wrote a real value and the next turn did the same again.
|
||||
// Clicking a session from the list hid it — that navigation DOES carry location state.
|
||||
const chat = useChat(undefined, props.model ?? locationState?.model, {
|
||||
resumeSummary,
|
||||
resumeSessionId,
|
||||
initialMessages,
|
||||
|
||||
Reference in New Issue
Block a user