fix(tui): populate reasoning_effort from updateArgs as fallback when API omits it

The Letta API _to_model_settings() for Anthropic was not including
effort in the GET response (backend bug), so agentState.model_settings.effort
and llm_config.reasoning_effort both came back null after a /model switch.
deriveReasoningEffort then had nothing to work with.

Client-side fix: after updateAgentLLMConfig returns, merge reasoning_effort
from model.updateArgs (/model switch) and desired.effort (Tab cycle flush)
into the llmConfig state we set. This populates the fallback path in
deriveReasoningEffort reliably regardless of what the API echoes back.

The actual root cause is fixed in letta-cloud: _to_model_settings() now
includes effort=self.effort for Anthropic models.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>
This commit is contained in:
cpacker
2026-02-18 19:00:07 -08:00
parent 35291d9094
commit 6b7c59b0be

View File

@@ -10094,7 +10094,15 @@ ${SYSTEM_REMINDER_CLOSE}
modelHandle, modelHandle,
model.updateArgs, model.updateArgs,
); );
setLlmConfig(updatedAgent.llm_config); // The API may not echo reasoning_effort back in llm_config or model_settings.effort,
// so populate it from model.updateArgs as a reliable fallback.
const rawEffort = modelUpdateArgs?.reasoning_effort;
setLlmConfig({
...updatedAgent.llm_config,
...(typeof rawEffort === "string"
? { reasoning_effort: rawEffort as ModelReasoningEffort }
: {}),
});
// Refresh agentState so model_settings (canonical reasoning effort source) is current // Refresh agentState so model_settings (canonical reasoning effort source) is current
setAgentState((prev) => setAgentState((prev) =>
prev prev
@@ -10777,7 +10785,11 @@ ${SYSTEM_REMINDER_CLOSE}
}, },
); );
setLlmConfig(updatedAgent.llm_config); // The API may not echo reasoning_effort back; populate from desired.effort.
setLlmConfig({
...updatedAgent.llm_config,
reasoning_effort: desired.effort as ModelReasoningEffort,
});
// Refresh agentState so model_settings (canonical reasoning effort source) is current // Refresh agentState so model_settings (canonical reasoning effort source) is current
setAgentState((prev) => setAgentState((prev) =>
prev prev