Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(post): read the provider list through useProviderModels so the launcher stops throwing on mount
[._.]/ Adam Eivyb3caaadf2d06
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.jsx b/client/src/components/meatspace/post/PostSessionLauncher.jsxindex 88bbbce28e..daa117392c 100644--- a/client/src/components/meatspace/post/PostSessionLauncher.jsx+++ b/client/src/components/meatspace/post/PostSessionLauncher.jsx@@ -1,9 +1,10 @@import { useState, useEffect } from 'react';import { Link } from 'react-router-dom';import { Zap, History, Settings, Play, Brain, BookOpen, Dumbbell, Timer, Radio, Target, TrendingUp, TrendingDown, Minus, Compass, ArrowRight, ChevronRight, Layers } from 'lucide-react';-import { getProviders, getPostReviewReps, getPostRecommendations, getMorseProgress, getPostProgress, getMemoryItems } from '../../../services/api';+import { getPostReviewReps, getPostRecommendations, getMorseProgress, getPostProgress, getMemoryItems } from '../../../services/api';import { FormField } from '../../ui/FormField';-import { isApiProvider } from '../../../utils/providers';+import { enabledApiProviderFilter } from '../../../utils/providers';+import useProviderModels from '../../../hooks/useProviderModels.js';import { DOMAINS, DRILL_TO_DOMAIN, DRILL_LABELS, computeDomainAverages, computeGoalProgress, isTopicEnabled, selectMemoryItemForDrill, resolveTopicForDrillType } from './constants';import { streakGlyph } from '../../../lib/streakGlyph.js';import useUserTimezone from '../../../hooks/useUserTimezone.js';@@ -80,7 +81,17 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta// lives above it, so collapsing never discards typed values.const [showConditions, setShowConditions] = useState(false);const [mode, setMode] = useState('test'); // 'test' | 'train'- const [providers, setProviders] = useState([]);+ // `getProviders()` resolves `{ activeProvider, providers }`, not a bare array.+ // Unwrapping it by hand here read the object as the list and threw on every+ // mount, so the panel below never learned which provider a run would use — go+ // through the shared hook that owns the unwrap instead of a fourth copy of it.+ // `allowDefault` keeps it from auto-selecting a provider; this is a read-only+ // "is anything configured" signal, not a picker.+ const { providers } = useProviderModels({+ filter: enabledApiProviderFilter,+ allowDefault: true,+ silent: true,+ });// Mastered-but-inactive skills due for a maintenance review (issue #2096) —// the Quick session mixes up to 2 of these in as labeled review reps. Empty// until a skill is mastered and its review interval elapses; a load failure@@ -103,7 +114,6 @@ export default function PostSessionLauncher({ config, recentSessions, stats, staconst [memoryItemsState, setMemoryItemsState] = useState({ status: 'loading', items: [] });useEffect(() => {- getProviders().then(p => setProviders((p || []).filter(pr => pr.enabled && isApiProvider(pr)))).catch(err => console.warn('⚠️ Failed to load providers: ' + err.message));getPostReviewReps(5).then(r => setReviewReps(r?.reps || [])).catch(() => setReviewReps([]));getPostRecommendations().then(r => setRecommendations(r?.recommendations || [])).catch(() => setRecommendations([]));getMemoryItems({ silent: true })diff --git a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx b/client/src/components/meatspace/post/PostSessionLauncher.test.jsxindex db9d258575..a0a5e02138 100644--- a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx+++ b/client/src/components/meatspace/post/PostSessionLauncher.test.jsx@@ -4,8 +4,17 @@ import { MemoryRouter } from 'react-router-dom';// Mock the API surface the launcher touches on mount (providers + review reps +// recommendations) so the render tests are deterministic and offline.+//+// getProviders MUST resolve the real wire shape — `{ activeProvider, providers }`,+// not a bare array. This mock used to return `[]`, which made the suite pass+// whether or not the component unwrapped the response, so it stayed green while+// the launcher threw on every mount in the real app. Mirror the server contract+// here or this file proves nothing about provider handling.vi.mock('../../../services/api', () => ({- getProviders: vi.fn().mockResolvedValue([]),+ getProviders: vi.fn().mockResolvedValue({+ activeProvider: 'openai',+ providers: [{ id: 'openai', name: 'OpenAI', type: 'api', enabled: true, defaultModel: 'gpt-4' }],+ }),getPostReviewReps: vi.fn().mockResolvedValue({ reps: [] }),getPostRecommendations: vi.fn().mockResolvedValue({ recommendations: [] }),getMorseProgress: vi.fn().mockResolvedValue({ settings: { wpm: 18, farnsworthWpm: 12 } }),@@ -290,6 +299,22 @@ describe('PostSessionLauncher render (issue #2100)', () => {expect(drills.some(d => d.type === 'wit-comeback')).toBe(false);expect(drills.some(d => d.type === 'multiplication')).toBe(true);});++ // Regression: the launcher read getProviders()'s `{ activeProvider, providers }`+ // response as if it were a bare array, so the filter threw on mount, the list+ // stayed empty, and the Wit & Memory panel never rendered its provider hint.+ // Assert the hint appears purely from a loaded provider list (no pinned+ // llmProviderId) — that only happens when the response is unwrapped.+ it('shows the Wit & Memory provider hint once the provider list loads', async () => {+ renderLauncher({+ config: {+ ...baseConfig,+ sessionModules: ['mental-math', 'llm-drills'],+ llmDrills: { enabled: true, drillTypes: { 'wit-comeback': { enabled: true, count: 3 } } },+ },+ });+ expect(await screen.findByText('system default')).toBeInTheDocument();+ });});// The launcher is the entry point to a DAILY habit, so the actions that start a