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-2095]): address codex review — forward manual stimulusMs/showMs, gate cognitive mastery on completion
Adam Eivy486b85c0defc
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.jsx b/client/src/components/meatspace/post/PostSessionLauncher.jsxindex 0be92a27ef..468e7bf6df 100644--- a/client/src/components/meatspace/post/PostSessionLauncher.jsx+++ b/client/src/components/meatspace/post/PostSessionLauncher.jsx@@ -44,17 +44,18 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta: [];// Only the fields each cognitive generator reads; extras are harmless.- // stimulusMs/showMs are intentionally NOT forwarded here — no UI field ever- // sets them (PostDrillConfig.jsx exposes no such control), so this config- // never carries them; the generators always fall back to their own internal- // defaults (server/services/meatspacePostCognitive.js). Forwarding them- // would have been dead pass-through (issue #2008).+ // stimulusMs (n-back) / showMs (digit-span) are forwarded so that manual mode+ // (Progressive off) actually uses the presentation-speed values the user set+ // in PostDrillConfig.jsx (issue #2095) — under the progressive ladder the+ // server overrides them per rung anyway, so forwarding is safe in both modes.const cognitiveDrillConfig = (cfg) => ({n: cfg.n,length: cfg.length,+ stimulusMs: cfg.stimulusMs,direction: cfg.direction,startLength: cfg.startLength,maxLength: cfg.maxLength,+ showMs: cfg.showMs,count: cfg.count,size: cfg.size,mode: cfg.mode,diff --git a/server/lib/postProgression.js b/server/lib/postProgression.jsindex 26edf9dcbd..2abb924861 100644--- a/server/lib/postProgression.js+++ b/server/lib/postProgression.js@@ -180,6 +180,12 @@ export const COGNITIVE_MASTERY_DEFAULTS = {// question), so a handful of clean runs is enough to advance.minSamples: 3,targetAccuracy: 0.85,+ // A run must reach at least this fraction of its trials to count toward+ // mastery. Accuracy is answered-only, so without this a digit-span run that+ // answers just the one easy sequence and leaves the hard ones blank banks a+ // 100%-accuracy "sample" — skipped trials could otherwise promote the rung.+ // (n-back completion is always 1 — go/no-go — so this never gates it.)+ minCompletion: 0.75,windowDays: 30,};diff --git a/server/services/meatspacePost.js b/server/services/meatspacePost.jsindex 8492543084..80343d2d78 100644--- a/server/services/meatspacePost.js+++ b/server/services/meatspacePost.js@@ -703,6 +703,12 @@ async function getCognitiveLevelStats(type, windowDays = COGNITIVE_MASTERY_DEFAUif (cutoffStr && session.date < cutoffStr) continue;const acc = Number.isFinite(task.accuracy) ? task.accuracy : null;if (acc == null) continue;+ // Skip low-completion runs: accuracy is answered-only, so a run that+ // leaves the harder trials blank must not bank a high-accuracy sample and+ // promote the rung (issue #2095 review). A null completion (legacy tasks)+ // is treated as complete so old history still counts.+ const comp = Number.isFinite(task.completion) ? task.completion : null;+ if (comp != null && comp < COGNITIVE_MASTERY_DEFAULTS.minCompletion) continue;const bucket = byLevel[level] || (byLevel[level] = { samples: 0, accSum: 0 });bucket.samples += 1;bucket.accSum += acc;diff --git a/server/services/meatspacePost.test.js b/server/services/meatspacePost.test.jsindex 03574b6c57..711690e2d3 100644--- a/server/services/meatspacePost.test.js+++ b/server/services/meatspacePost.test.js@@ -913,6 +913,18 @@ describe('progressive cognitive drills', () => {expect(config.n).toBe(2);});+ it('does not advance on high-accuracy but low-completion runs (skipped hard trials)', async () => {+ // Answered only the easy sequence (100% accuracy) but left the rest blank —+ // low completion must not bank a mastery sample (issue #2095 review).+ const lowCompletion = (level, date = today) => ({+ date,+ tasks: [{ module: 'cognitive', type: 'digit-span', config: { level }, accuracy: 1, completion: 0.25, totalCount: 4, questions: [{ answered: '1' }] }],+ });+ mockSessions([lowCompletion(0), lowCompletion(0), lowCompletion(0)]);+ const { progression } = await resolveDrillConfig('digit-span', {});+ expect(progression.level).toBe(0);+ });+it('does not advance when accuracy is below the mastery bar', async () => {mockSessions([cognitiveSession('n-back', 0, 0.6),