Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(conversations): handle empty conversation list gracefully

Steven Enamakele44b7743f720
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsx
index 0119a85b69..88b694a7ac 100644
--- a/app/src/features/conversations/Conversations.tsx
+++ b/app/src/features/conversations/Conversations.tsx
@@ -462,8 +462,11 @@ const Conversations = ({
onCancel: () => {},
});
const [resolvedModel, setResolvedModel] = useState<string | null>(null);
- // A picker choice belongs to this composer session. It overrides the model
- // route for subsequent sends without mutating shared configuration.
+ // The composer's picker choice. It overrides the model route for subsequent
+ // sends immediately, and is also written to the core's `default_model` so
+ // the pick survives an app restart and is what every managed turn runs on
+ // (the same field Settings → Routing → "Default model" edits). `null` clears
+ // the pin back to the managed default.
const [composerModelOverride, setComposerModelOverride] = useState<string | null>(null);
// `undefined` means no explicit picker selection, so usage-reported context
// remains authoritative. `null` means the selected model did not report a
@@ -471,6 +474,26 @@ const Conversations = ({
const [composerModelContextWindow, setComposerModelContextWindow] = useState<
number | null | undefined
>(undefined);
+ const applyComposerModel = useCallback((value: string | null, contextWindow?: number | null) => {
+ setComposerModelOverride(value);
+ setComposerModelContextWindow(contextWindow ?? null);
+ void callCoreRpc({
+ method: 'openhuman.inference_update_model_settings',
+ params: { default_model: value ?? '' },
+ })
+ .then(() => {
+ console.debug('[chat][composer-model] persisted default_model', {
+ pinned: value !== null,
+ });
+ })
+ .catch((err: unknown) => {
+ // The in-session override still applies; only persistence failed.
+ console.warn('[chat][composer-model] failed to persist default_model', {
+ message: err instanceof Error ? err.message : String(err),
+ });
+ });
+ }, []);
+
// Whether the resolved model accepts image input.
// Managed tiers do; custom/BYOK models only when the user flagged them. Gates
// the composer's image-attachment affordance (docs flow regardless). Resolved
@@ -2386,10 +2409,7 @@ const Conversations = ({
]}
mascotDock={mascotDock}
modelOverride={composerModelOverride ?? resolvedModel}
- onModelOverrideChange={(value, contextWindow) => {
- setComposerModelOverride(value);
- setComposerModelContextWindow(contextWindow ?? null);
- }}
+ onModelOverrideChange={applyComposerModel}
/>
</>
) : (
@@ -2556,10 +2576,7 @@ const Conversations = ({
// The settled turn's one-line footer opens the process rail on THAT
// turn's trail, which the footer carries with the click.
onOpenTurnProcess={setTurnProcessTrail}
- onModelChange={(value, contextWindow) => {
- setComposerModelOverride(value);
- setComposerModelContextWindow(contextWindow ?? null);
- }}
+ onModelChange={applyComposerModel}
/>
{/* The three transcript-local modals. `ChatThreadView` hosts an identical
trio, but it is the legacy panel's transcript and is not mounted here,