Skip to content

fix(tui): don't clear conversation model override on transient retrieve errors#1269

Merged
jnjpng merged 1 commit intomainfrom
fix/conversation-model-error-fallback
Mar 5, 2026
Merged

fix(tui): don't clear conversation model override on transient retrieve errors#1269
jnjpng merged 1 commit intomainfrom
fix/conversation-model-error-fallback

Conversation

@jnjpng
Copy link
Contributor

@jnjpng jnjpng commented Mar 5, 2026

Summary

  • The model sync effect's catch block was calling applyAgentModelLocally() on any conversations.retrieve failure, which cleared hasConversationModelOverride and reset the model display to agent defaults — even though the override was still persisted in the DB.
  • This caused intermittent model snap-back that didn't require a recent /model to trigger: any transient network error during the sync cycle would discard local override state, and without another agentState change to re-trigger the effect, the reset persisted.
  • Fix: preserve current local state on error. The next sync cycle retries the retrieve and self-corrects.

Context

This addresses the error-path fallback identified during review of #1229 and #1238. Those PRs target the narrow race between handleModelSelect and the first-chunk syncAgentState, but the observed snap-back (without recent /model) is more likely caused by this error-path resetting the override flag on transient failures.

Test plan

  • bun run typecheck — pre-existing errors only, no new issues
  • bun run lint — clean (warnings only, pre-existing)
  • bun test src/tests/agent/model-preset-refresh.wiring.test.ts — 9/9 pass

👾 Generated with Letta Code

…ve errors

The sync effect's catch block was calling applyAgentModelLocally() on any
conversations.retrieve failure, which cleared the hasConversationModelOverride
flag and reset the model display to agent defaults — even though the override
was still persisted in the DB. This caused intermittent model snap-back that
didn't require a recent /model command to trigger: any transient network error
during the sync cycle would discard the local override knowledge, and without
another agentState change to re-trigger the effect, the reset persisted for
the remainder of the turn.

The fix simply preserves current local state on error. The next sync cycle
will retry the retrieve and self-correct if needed.

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

Co-Authored-By: Letta Code <noreply@letta.com>
@jnjpng jnjpng force-pushed the fix/conversation-model-error-fallback branch from ace3465 to abb4d57 Compare March 5, 2026 01:46
@jnjpng jnjpng merged commit 0092e6a into main Mar 5, 2026
13 checks passed
@jnjpng jnjpng deleted the fix/conversation-model-error-fallback branch March 5, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant