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 POST run page crash (React #130) when next drill is a cognitive drill

[._.]/ Adam Eivy5521f04ef46d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 9202aabde6..2e40288d6f 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -9,6 +9,7 @@
## Fixed
+- **POST session run page crashed (React error #130) when transitioning into a cognitive drill.** `DrillTransition.jsx`'s `DOMAIN_ICONS` map was missing a `cognitive` entry, yet `DRILL_TO_DOMAIN` maps every cognitive drill type (n-back, digit-span, stroop, schulte-table, mental-rotation, reaction-time) to the `cognitive` domain — so finishing a drill whose successor was a cognitive drill (e.g. a Doubling Chain followed by a cognitive drill) resolved the transition-card icon to `undefined` and blanked the run page with a minified React error. Added the `cognitive: Brain` icon and hardened the lookup to fall back to `ChevronRight` for any unmapped domain, so a future domain gap degrades gracefully instead of crashing. A regression test renders the transition for every `DRILL_TO_DOMAIN` type.
- **[issue-2536] Catch unhandled rejections from Telegram handlers and health/probe timers.** Several async boundaries were fire-and-forget: the Telegram client dispatched `onText`/`emitter.on` handlers without awaiting or catching, `telegram.js` ran `setInterval(healthCheck)` and a couple of sync-context `bot.sendMessage(...)` calls without a `.catch`, and `instances.js` scheduled `probeAllPeers()` from `setTimeout`/`setInterval` without one — so a rejected handler or a failed fs/network read leaked an unhandled promise rejection (process-killing on Node ≥15). The client now routes every handler invocation through a `runHandler` wrapper that logs a single emoji-prefixed line on rejection; the health-check interval and both probe timers wrap their async callback in `.catch`; and the `/start`, `/help`, and unauthorized-notice sends now await or `.catch` their promise. A vitest suite drives the client's `onText` and `message` paths with a throwing handler and asserts no `unhandledRejection` escapes.
- **[issue-2519] CoS handlers no longer flash a false-success toast after a failed API call.** Several Chief of Staff actions (`handleForceEvaluate` on the CoS page, the Tasks tab "Run Now" button, and the Config tab's Save + autonomy-level change) `.catch`-swallowed the request rejection and then unconditionally toasted success and mutated optimistic UI — so a network/server error still read as "done." Each now awaits inside try/catch and only toasts success / advances state after the request resolves: a failed Save keeps the editor open, and a failed autonomy-level change reverts the optimistic form params. Errors surface via a single `toast.error` (the calls already pass `{ silent: true }`).
- **[issue-2520] Pass `{ silent: true }` on client API calls that own a custom error toast.** Several call sites routed a request through the auto-toasting `request()` helper AND showed their own `toast.error` in `.catch`, so a failure surfaced two stacked toasts. The music managers (Artists/Albums/Tracks load + create/update/delete), MusicVideo (list/create/delete/analyze/plan/add-scene/delete-scene/reorder), and DataDog (load/save/delete/test) now pass `{ silent: true }` on those calls; CharacterSheet's local `charGet`/`charPost`/`charPut` helpers are silent-by-default (every caller owns its own catch toast or the `loadError` banner) with an opt-out. Each failing action now shows a single toast.
diff --git a/client/src/components/meatspace/post/DrillTransition.jsx b/client/src/components/meatspace/post/DrillTransition.jsx
index c25725265d..7c5d0c983d 100644
--- a/client/src/components/meatspace/post/DrillTransition.jsx
+++ b/client/src/components/meatspace/post/DrillTransition.jsx
@@ -1,13 +1,18 @@
import { useState, useEffect } from 'react';
-import { ChevronRight, Calculator, BookOpen, MessageCircle, Mic, Sparkles, Pause, Play } from 'lucide-react';
+import { ChevronRight, Calculator, BookOpen, MessageCircle, Mic, Sparkles, Brain, Pause, Play } from 'lucide-react';
import { DOMAINS, DRILL_TO_DOMAIN, DRILL_LABELS } from './constants';
+// One entry per DOMAINS key — a domain missing here would make `Icon` resolve
+// to undefined and crash the transition render (React error #130). The
+// `|| ChevronRight` fallback below is the belt-and-suspenders guard, but keep
+// this map in sync with DOMAINS so the real icon shows.
const DOMAIN_ICONS = {
math: Calculator,
memory: BookOpen,
wordplay: MessageCircle,
verbal: Mic,
imagination: Sparkles,
+ cognitive: Brain,
};
export default function DrillTransition({ nextDrillType, drillIndex, drillCount, completedResults, onContinue }) {
@@ -26,7 +31,9 @@ export default function DrillTransition({ nextDrillType, drillIndex, drillCount,
const domainKey = DRILL_TO_DOMAIN[nextDrillType];
const domain = domainKey ? DOMAINS[domainKey] : null;
- const Icon = domainKey ? DOMAIN_ICONS[domainKey] : ChevronRight;
+ // Fall back to ChevronRight for any domain not in DOMAIN_ICONS — an
+ // undefined element type here throws React error #130 and blanks the run page.
+ const Icon = DOMAIN_ICONS[domainKey] || ChevronRight;
// Auto-advance after 3 seconds, unless paused (manually or via hover/focus).
useEffect(() => {
diff --git a/client/src/components/meatspace/post/DrillTransition.test.jsx b/client/src/components/meatspace/post/DrillTransition.test.jsx
index 37b60fd5ec..3716d6a4f1 100644
--- a/client/src/components/meatspace/post/DrillTransition.test.jsx
+++ b/client/src/components/meatspace/post/DrillTransition.test.jsx
@@ -1,6 +1,7 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, screen, fireEvent, act } from '@testing-library/react';
import DrillTransition from './DrillTransition';
+import { DRILL_TO_DOMAIN } from './constants';
const baseProps = {
nextDrillType: 'multiplication',
@@ -149,4 +150,17 @@ describe('DrillTransition', () => {
await tickSeconds(5);
expect(onContinue).not.toHaveBeenCalled();
});
+
+ // Regression: DOMAIN_ICONS was missing a `cognitive` entry, so transitioning
+ // into a cognitive drill (e.g. after a math drill) resolved `Icon` to
+ // undefined and crashed the run page with React error #130. Every DOMAINS
+ // key must have a renderable icon in the transition card.
+ it('renders without crashing for every drill type in every domain', () => {
+ for (const type of Object.keys(DRILL_TO_DOMAIN)) {
+ const { unmount } = render(
+ <DrillTransition {...baseProps} nextDrillType={type} onContinue={vi.fn()} />,
+ );
+ unmount();
+ }
+ });
});