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([issue-2100]): review recs fetch rep on demand, never fall back to a normal session (codex review)
Adam Eivye123a1bb9914
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.jsx b/client/src/components/meatspace/post/PostSessionLauncher.jsxindex c4677edfbc..5606489dbd 100644--- a/client/src/components/meatspace/post/PostSessionLauncher.jsx+++ b/client/src/components/meatspace/post/PostSessionLauncher.jsx@@ -89,7 +89,7 @@ export default function PostSessionLauncher({ config, recentSessions, stats, stauseEffect(() => {getProviders().then(p => setProviders((p || []).filter(pr => pr.enabled && isApiProvider(pr)))).catch(err => console.warn('⚠️ Failed to load providers: ' + err.message));- getPostReviewReps(2).then(r => setReviewReps(r?.reps || [])).catch(() => setReviewReps([]));+ getPostReviewReps(5).then(r => setReviewReps(r?.reps || [])).catch(() => setReviewReps([]));getPostRecommendations().then(r => setRecommendations(r?.recommendations || [])).catch(() => setRecommendations([]));}, []);@@ -367,13 +367,19 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta// Launch a single due maintenance-review rep from an "Up next" skill-review// recommendation (issue #2100). The rep carries the `review`/`reviewSkillId`- // markers the server needs to record the re-verification — a plain focus- // session would NOT resolve the scheduled review. Falls back to a Full POST- // when no runnable rep matches (e.g. reps not yet loaded).- function startReviewRep(rec) {+ // markers the server needs to record the re-verification — a plain focus/Full+ // session would NOT resolve the scheduled review, so we NEVER fall back to one.+ // If the matching rep isn't in the preloaded set (still pending, or beyond the+ // first page), fetch fresh on demand; if it still can't be found there's no+ // runnable rep, so do nothing rather than start an unrelated session.+ async function startReviewRep(rec) {const skillId = rec.id.replace(/^skill-review:/, '');- const rep = reviewReps.find(r => r.skillId === skillId);- if (!rep) return hasSessionDrills ? handleStart() : undefined;+ let rep = reviewReps.find(r => r.skillId === skillId);+ if (!rep) {+ const fresh = await getPostReviewReps(5).then(r => r?.reps || []).catch(() => []);+ rep = fresh.find(r => r.skillId === skillId);+ }+ if (!rep) return;const drillConfig = {type: rep.type,domain: DRILL_TO_DOMAIN[rep.type],diff --git a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx b/client/src/components/meatspace/post/PostSessionLauncher.test.jsxindex 8676c7ea4e..0728b2af90 100644--- a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx+++ b/client/src/components/meatspace/post/PostSessionLauncher.test.jsx@@ -198,6 +198,35 @@ describe('PostSessionLauncher render (issue #2100)', () => {expect(drills[0].config.reviewSkillId).toBe('multiplication:L1');});+ it('fetches a review rep on demand when it was not preloaded, without starting a normal session', async () => {+ const onStart = vi.fn();+ const rep = { skillId: 'cognitive:n-back:L0', label: 'n-back L0', type: 'n-back', module: 'cognitive', config: { level: 0, review: true, reviewSkillId: 'cognitive:n-back:L0' } };+ // First call (mount preload) returns nothing; the on-demand click fetch finds it.+ getPostReviewReps.mockResolvedValueOnce({ reps: [] }).mockResolvedValue({ reps: [rep] });+ getPostRecommendations.mockResolvedValue({ recommendations: [+ { id: 'skill-review:cognitive:n-back:L0', kind: 'skill-review', title: 'Re-verify n-back L0', deepLink: '/post/launcher', drillType: 'n-back', priority: 0 },+ ] });+ renderLauncher({ onStart });+ await waitFor(() => expect(screen.getByText('Re-verify n-back L0')).toBeTruthy());+ fireEvent.click(screen.getByText('Re-verify n-back L0').closest('button'));+ await waitFor(() => expect(onStart).toHaveBeenCalledTimes(1));+ expect(onStart.mock.calls[0][0][0].config.reviewSkillId).toBe('cognitive:n-back:L0');+ });++ it('does not start any session when a skill-review rep cannot be found', async () => {+ const onStart = vi.fn();+ getPostReviewReps.mockResolvedValue({ reps: [] }); // never resolves to the rep+ getPostRecommendations.mockResolvedValue({ recommendations: [+ { id: 'skill-review:multiplication:L1', kind: 'skill-review', title: 'Re-verify Multiplication', deepLink: '/post/launcher', drillType: 'multiplication', priority: 0 },+ ] });+ renderLauncher({ onStart });+ await waitFor(() => expect(screen.getByText('Re-verify Multiplication')).toBeTruthy());+ fireEvent.click(screen.getByText('Re-verify Multiplication').closest('button'));+ // A missing rep must NOT fall back to a normal Full POST.+ await new Promise(r => setTimeout(r, 0));+ expect(onStart).not.toHaveBeenCalled();+ });+it('counts training-log time toward the daily-minutes goal', async () => {getPostProgress.mockResolvedValue({ series: { byDay: [{ date: new Date().toISOString().split('T')[0], minutes: 15 }] } });renderLauncher({ config: { ...baseConfig, goals: { dailyMinutes: 20 } } });