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
claim Space through the reaction-time result phase so the mic can't open between trials
[._.]/ Adam Eivya652a55ad7a7
diff --git a/client/src/components/meatspace/post/PostCognitiveDrillRunner.jsx b/client/src/components/meatspace/post/PostCognitiveDrillRunner.jsxindex 7289914e57..16781a63f1 100644--- a/client/src/components/meatspace/post/PostCognitiveDrillRunner.jsx+++ b/client/src/components/meatspace/post/PostCognitiveDrillRunner.jsx@@ -1434,15 +1434,12 @@ function ReactionTimeRunner({ drill, drillIndex, drillCount, onComplete, isTrain// hotkey (Space by default) can't open the mic on every reaction press.useKeyCapture({onKeyDown: (e) => {- if (phase === 'result') return false;- if (mode === 'simple') {- if (!isPressKey(e)) return false;- respond(0);- return true;- }- const idx = parseInt(e.key, 10) - 1;- if (!Number.isInteger(idx) || idx < 0 || idx >= choices) return false;- respond(idx);+ const idx = mode === 'simple' ? (isPressKey(e) ? 0 : -1) : parseInt(e.key, 10) - 1;+ if (!Number.isInteger(idx) || idx < 0 || idx >= (mode === 'simple' ? 1 : choices)) return false;+ // Claim the key through the between-trials result phase too, so a user+ // still tapping after the trial ended doesn't leak the press to the voice+ // hotkey — just don't record it against the trial that already resolved.+ if (phase !== 'result') respond(idx);return true;},});diff --git a/client/src/components/meatspace/post/PostCognitiveDrillRunner.test.jsx b/client/src/components/meatspace/post/PostCognitiveDrillRunner.test.jsxindex e9d8a6da6c..eac1afd8a8 100644--- a/client/src/components/meatspace/post/PostCognitiveDrillRunner.test.jsx+++ b/client/src/components/meatspace/post/PostCognitiveDrillRunner.test.jsx@@ -872,6 +872,26 @@ describe('Space-driven drills do not leak the key to the global voice hotkey', (expect(onComplete.mock.calls[0][0].questions).toHaveLength(1);});+ it('reaction-time keeps claiming Space through the between-trials result phase', () => {+ const onComplete = vi.fn();+ const drill = makeSimpleDrill({ count: 2, delayMs: 100 });+ render(+ <PostCognitiveDrillRunner drill={drill} drillIndex={0} drillCount={2} onComplete={onComplete} isTraining={false} />,+ );+ act(() => { vi.advanceTimersByTime(100); });+ act(() => { fireEvent.keyDown(document.body, { code: 'Space', key: ' ' }); }); // records trial 1+ // Now in the 500ms result phase: a second press must NOT record anything,+ // and must NOT reach the voice hotkey either.+ act(() => { fireEvent.keyDown(document.body, { code: 'Space', key: ' ' }); });+ expect(voiceHotkey).not.toHaveBeenCalled();++ act(() => { vi.advanceTimersByTime(600); });+ act(() => { fireEvent.keyDown(document.body, { code: 'Space', key: ' ' }); });+ act(() => { vi.advanceTimersByTime(600); });+ expect(voiceHotkey).not.toHaveBeenCalled();+ expect(onComplete.mock.calls[0][0].questions).toHaveLength(2);+ });+it('lets an unrelated key through — this is not a blanket keyboard trap', () => {const drill = { type: 'n-back', config: { n: 1, stimulusMs: 1000 }, sequence: ['A', 'A'] };render(