Skip to content

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

fix([issue-2100]): address codex review — clearable goals, no stalled recs on fresh install, honor sessionModules

Adam Eivyf74c41e05ae7
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.jsx b/client/src/components/meatspace/post/PostSessionLauncher.jsx
index 9ab6803b56..f2fd5737cd 100644
--- a/client/src/components/meatspace/post/PostSessionLauncher.jsx
+++ b/client/src/components/meatspace/post/PostSessionLauncher.jsx
@@ -130,8 +130,19 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta
choices: cfg.choices,
});
+ // Composed sessions (Full POST / Quick) honor `sessionModules` (issue #2100):
+ // a module's drills are only added when it's listed. The default
+ // (mental-math + cognitive + memory) excludes LLM drills, so wit/verbal work
+ // is never auto-added to a default session — provider-cost consent stays
+ // opt-in (CLAUDE.md AI-provider policy). An empty/absent list means "all
+ // enabled" (back-compat). Focus-practice on a specific weak domain bypasses
+ // this filter (it's an explicit user choice, not a default composition).
+ const sessionModules = Array.isArray(config.sessionModules) ? config.sessionModules : [];
+ const SOURCE_TO_MODULE = { math: 'mental-math', llm: 'llm-drills', cognitive: 'cognitive' };
+ const moduleAllowed = (source) => sessionModules.length === 0 || sessionModules.includes(SOURCE_TO_MODULE[source]);
+
function handleStart() {
- const mathConfigs = enabledMathDrills.map(([type, cfg]) => ({
+ const mathConfigs = (moduleAllowed('math') ? enabledMathDrills : []).map(([type, cfg]) => ({
type,
domain: DRILL_TO_DOMAIN[type],
config: {
@@ -147,7 +158,7 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta
timeLimitSec: cfg.timeLimitSec || 120
}));
- const llmConfigs = enabledLlmDrills.map(([type, cfg]) => ({
+ const llmConfigs = (moduleAllowed('llm') ? enabledLlmDrills : []).map(([type, cfg]) => ({
type,
domain: DRILL_TO_DOMAIN[type],
config: { count: cfg.count || 5 },
@@ -156,7 +167,7 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta
model: cfg.model || llmModel
}));
- const cognitiveConfigs = enabledCognitiveDrills.map(([type, cfg]) => ({
+ const cognitiveConfigs = (moduleAllowed('cognitive') ? enabledCognitiveDrills : []).map(([type, cfg]) => ({
type,
domain: DRILL_TO_DOMAIN[type],
config: cognitiveDrillConfig(cfg)
@@ -187,6 +198,15 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta
enabledDomains[domain].push({ type, cfg, source });
}
+ // Domains eligible for a COMPOSED (Full/Quick) session, after the
+ // sessionModules filter — so a default Quick session never silently pulls in
+ // an opt-out module's drills (issue #2100).
+ const sessionEnabledDomains = {};
+ for (const [domainKey, drills] of Object.entries(enabledDomains)) {
+ const allowed = drills.filter(d => moduleAllowed(d.source));
+ if (allowed.length) sessionEnabledDomains[domainKey] = allowed;
+ }
+
function handleQuickSession() {
// Bias toward the top recommendation instead of pure random (issue #2100):
// if it names a drill type in an enabled domain, run that domain first and
@@ -194,14 +214,14 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta
const topRec = recommendations[0] || null;
const recDrill = topRec?.drillType || null;
const recDomain = recDrill ? DRILL_TO_DOMAIN[recDrill] : null;
- const domainKeys = Object.keys(enabledDomains);
- const orderedKeys = recDomain && enabledDomains[recDomain]
+ const domainKeys = Object.keys(sessionEnabledDomains);
+ const orderedKeys = recDomain && sessionEnabledDomains[recDomain]
? [recDomain, ...domainKeys.filter(k => k !== recDomain)]
: domainKeys;
const drillConfigs = [];
for (const domainKey of orderedKeys) {
- const drills = enabledDomains[domainKey];
+ const drills = sessionEnabledDomains[domainKey];
const domain = DOMAINS[domainKey];
// Prefer the recommended drill in its domain; otherwise pick at random.
const recommendedPick = domainKey === recDomain
@@ -303,7 +323,9 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta
}
const hasAnyDrills = enabledMathDrills.length > 0 || enabledLlmDrills.length > 0 || enabledCognitiveDrills.length > 0;
- const domainCount = Object.keys(enabledDomains).length;
+ // Quick-session domain count reflects the sessionModules-filtered set, so the
+ // "Quick 5 Min (N domains)" button matches what it will actually run.
+ const domainCount = Object.keys(sessionEnabledDomains).length;
// Analytics derived from the 30-day stats window. Streaks span all history.
const hasStats = stats && stats.sessionCount > 0;
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx b/client/src/components/meatspace/post/PostSessionLauncher.test.jsx
index 6569771f33..b8c7fc4279 100644
--- a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx
+++ b/client/src/components/meatspace/post/PostSessionLauncher.test.jsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { render, screen, waitFor } from '@testing-library/react';
+import { render, screen, waitFor, fireEvent } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
// Mock the API surface the launcher touches on mount (providers + review reps +
@@ -165,4 +165,22 @@ describe('PostSessionLauncher render (issue #2100)', () => {
await waitFor(() => expect(getPostRecommendations).toHaveBeenCalled());
expect(screen.queryByText('Goals')).toBeNull();
});
+
+ it('excludes LLM drills from Full POST when sessionModules omits llm-drills', async () => {
+ const onStart = vi.fn();
+ renderLauncher({
+ onStart,
+ config: {
+ ...baseConfig,
+ sessionModules: ['mental-math', 'cognitive'],
+ llmDrills: { enabled: true, drillTypes: { 'wit-comeback': { enabled: true, count: 3 } } },
+ },
+ });
+ await waitFor(() => expect(getPostRecommendations).toHaveBeenCalled());
+ fireEvent.click(screen.getByText('Full POST'));
+ expect(onStart).toHaveBeenCalledTimes(1);
+ const drills = onStart.mock.calls[0][0];
+ expect(drills.some(d => d.type === 'wit-comeback')).toBe(false);
+ expect(drills.some(d => d.type === 'multiplication')).toBe(true);
+ });
});
diff --git a/server/services/meatspacePost.js b/server/services/meatspacePost.js
index 976654bf42..a756981a9a 100644
--- a/server/services/meatspacePost.js
+++ b/server/services/meatspacePost.js
@@ -153,6 +153,15 @@ export async function updatePostConfig(updates) {
// active for.
merged.reminder = { ...merged.reminder, updatedAt: new Date().toISOString() };
}
+ // `goals` is REPLACED wholesale when present in the patch, not deep-merged
+ // (issue #2100). deepMerge would otherwise make a set goal impossible to
+ // clear: JSON can't send `undefined`, `0` is out of the schema's range, and
+ // `{}` would merge into the existing object rather than replace it. Sending
+ // the full desired goals object — including `{}` to clear every goal — now
+ // takes effect and the launcher/widget goal rows hide again.
+ if (updates?.goals !== undefined) {
+ merged.goals = { ...updates.goals };
+ }
await ensureMeatspaceDir();
await atomicWrite(CONFIG_FILE, merged);
console.log(`🧪 POST config updated`);
@@ -882,6 +891,12 @@ export function stalledProgressions(mulProgress, cogProgress, morse) {
if (!prog || prog.atHardest || prog.currentMastered) return null;
const cur = (prog.levels || []).find((r) => r.level === prog.level);
if (!cur) return null;
+ // Only surface a ladder the user has actually engaged with. A fresh install
+ // sits at level 0 with 0 samples and an unearned floor — telling it to "keep
+ // climbing" a drill that's never been run is noise, and it would also crowd
+ // out the fresh-state "run your first POST" default (issue #2100 review).
+ const engaged = (cur.samples || 0) > 0 || (prog.floorLevel || 0) > 0 || prog.level > 0;
+ if (!engaged) return null;
const next = (prog.levels || []).find((r) => r.level === prog.level + 1);
const minSamples = prog.thresholds?.minSamples ?? 0;
const remaining = Math.max(1, minSamples - (cur.samples || 0));
diff --git a/server/services/meatspacePostRecommendations.test.js b/server/services/meatspacePostRecommendations.test.js
index 17c70377c8..0428675719 100644
--- a/server/services/meatspacePostRecommendations.test.js
+++ b/server/services/meatspacePostRecommendations.test.js
@@ -4,7 +4,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
// (composePostRecommendations / weakestSkillFromStats / stalledProgressions)
// need no mocks; getPostRecommendations is exercised through the same
// mocked-fileUtils harness the other POST service tests use.
-const state = { sessions: [], memoryItems: [], reviewSchedule: { skills: {} }, morse: { kochLevel: null, settings: null, rounds: [] } };
+const state = { sessions: [], memoryItems: [], reviewSchedule: { skills: {} }, morse: { kochLevel: null, settings: null, rounds: [] }, config: {} };
vi.mock('../lib/fileUtils.js', () => ({
atomicWrite: vi.fn().mockResolvedValue(undefined),
@@ -17,7 +17,7 @@ vi.mock('../lib/fileUtils.js', () => ({
if (path.includes('memory-items')) return Promise.resolve({ items: state.memoryItems });
if (path.includes('post-review-schedule')) return Promise.resolve(state.reviewSchedule);
if (path.includes('post-morse')) return Promise.resolve(state.morse);
- if (path.includes('post-config')) return Promise.resolve({});
+ if (path.includes('post-config')) return Promise.resolve(state.config);
}
return Promise.resolve(defaultValue);
}),
@@ -28,15 +28,26 @@ import {
weakestSkillFromStats,
stalledProgressions,
getPostRecommendations,
+ updatePostConfig,
} from './meatspacePost.js';
+import { atomicWrite } from '../lib/fileUtils.js';
beforeEach(() => {
state.sessions = [];
state.memoryItems = [];
state.reviewSchedule = { skills: {} };
state.morse = { kochLevel: null, settings: null, rounds: [] };
+ state.config = {};
+ atomicWrite.mockClear();
});
+// Read back the config object written to post-config.json by the most recent
+// updatePostConfig call (atomicWrite is the mocked writer).
+function lastWrittenConfig() {
+ const call = [...atomicWrite.mock.calls].reverse().find(([p]) => typeof p === 'string' && p.includes('post-config'));
+ return call?.[1];
+}
+
describe('weakestSkillFromStats', () => {
it('returns the lowest-accuracy drill with samples', () => {
const stats = {
@@ -100,6 +111,46 @@ describe('stalledProgressions', () => {
const out = stalledProgressions(null, {}, { kochLevel: 2, kochLevelSet: false, maxKochLevel: 41 });
expect(out.find(o => o.drillType === 'morse-copy')).toBeUndefined();
});
+
+ it('skips an untouched ladder (fresh install: level 0, no samples, no floor)', () => {
+ const fresh = { level: 0, floorLevel: 0, atHardest: false, currentMastered: false, thresholds: { minSamples: 12 }, levels: [
+ { level: 0, label: '1×1-digit', samples: 0, mastered: false },
+ { level: 1, label: '1×2-digit', samples: 0, mastered: false },
+ ] };
+ expect(stalledProgressions(fresh, { 'n-back': fresh }, {})).toHaveLength(0);
+ });
+
+ it('surfaces a ladder once the user has earned a higher floor even with no windowed samples', () => {
+ const earned = { level: 1, floorLevel: 1, atHardest: false, currentMastered: false, thresholds: { minSamples: 12 }, levels: [
+ { level: 0, label: '1×1-digit', samples: 0, mastered: true },
+ { level: 1, label: '1×2-digit', samples: 0, mastered: false },
+ { level: 2, label: '1×1×1-digit', samples: 0, mastered: false },
+ ] };
+ const out = stalledProgressions(earned, {}, {});
+ expect(out).toHaveLength(1);
+ expect(out[0].remaining).toBe(12);
+ });
+});
+
+describe('updatePostConfig goals (issue #2100)', () => {
+ it('replaces the goals block wholesale so a goal can be cleared', async () => {
+ state.config = { goals: { streakTarget: 5, dailyMinutes: 20 } };
+ // A partial goals patch replaces (not deep-merges) — dailyMinutes drops.
+ await updatePostConfig({ goals: { streakTarget: 10 } });
+ expect(lastWrittenConfig().goals).toEqual({ streakTarget: 10 });
+ });
+
+ it('clears all goals when sent an empty goals object', async () => {
+ state.config = { goals: { streakTarget: 5 } };
+ await updatePostConfig({ goals: {} });
+ expect(lastWrittenConfig().goals).toEqual({});
+ });
+
+ it('leaves goals untouched when the patch omits them', async () => {
+ state.config = { goals: { streakTarget: 5 } };
+ await updatePostConfig({ adaptive: { enabled: true } });
+ expect(lastWrittenConfig().goals).toEqual({ streakTarget: 5 });
+ });
});
describe('composePostRecommendations priority + composition', () => {