Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(meetings): replace the post-recording cooldown instead of stacking it (#2898)
Henry Su101e7fe174cd
diff --git a/src/helpers/meetingDetectionEngine.js b/src/helpers/meetingDetectionEngine.jsindex 33ba8cfe5..72f5bf204 100644--- a/src/helpers/meetingDetectionEngine.js+++ b/src/helpers/meetingDetectionEngine.js@@ -689,6 +689,13 @@ class MeetingDetectionEngine {return;}+ // A card closing on its own can flush mid-dictation or mid-cooldown; the+ // cooldown that follows the recording flushes the queue instead.+ if (this._userRecording || this._postRecordingCooldown) {+ debugLogger.info("Holding queued notifications — user is recording", {}, "meeting");+ return;+ }+// A dictation's post-recording cooldown can flush while a meeting recording// is still live; hold the queue for the flush that follows the recording.if (this._recordingSession) {@@ -732,12 +739,14 @@ class MeetingDetectionEngine {this._userRecording = active;this.audioActivityDetector.setUserRecording(active);- if (active) {- if (this._postRecordingCooldown) {- clearTimeout(this._postRecordingCooldown);- this._postRecordingCooldown = null;- }- } else {+ // Dictation reports preparing, processing and idle as not recording, so one+ // gap between dictations reports it several times; a replaced timer must+ // not flush during the next one.+ if (this._postRecordingCooldown) {+ clearTimeout(this._postRecordingCooldown);+ this._postRecordingCooldown = null;+ }+ if (!active) {this._postRecordingCooldown = setTimeout(() => {this._postRecordingCooldown = null;this._flushNotificationQueue();diff --git a/test/helpers/meetingDetectionEngine.test.js b/test/helpers/meetingDetectionEngine.test.jsindex ea5553301..8192d8326 100644--- a/test/helpers/meetingDetectionEngine.test.js+++ b/test/helpers/meetingDetectionEngine.test.js@@ -538,3 +538,44 @@ test("coalesced audio detections cannot suppress the next meeting after a queuedengine._handleDetection("audio", "sustained-audio", {});assert.equal(shown.length, 2);});++test("a dictation's end cooldown cannot show a queued prompt during the next dictation", (t) => {+ t.mock.timers.enable({ apis: ["setTimeout"] });+ const { engine, shown } = createEngine();+ engine.setPreferences({ audioDetection: true, processDetection: true });++ engine.setUserRecording(true);+ engine.handleCalendarReminder({ id: "standup", summary: "Standup" });+ // The dictation lifecycle reports recording -> processing -> idle ->+ // preparing -> recording, and all three states between mean "not recording".+ engine.setUserRecording(false);+ t.mock.timers.tick(500);+ engine.setUserRecording(false);+ t.mock.timers.tick(500);+ engine.setUserRecording(false);+ t.mock.timers.tick(500);+ engine.setUserRecording(true);+ t.mock.timers.tick(5000);++ assert.equal(shown.length, 0, "the reminder must wait until the next dictation ends");+ engine.setUserRecording(false);+ t.mock.timers.tick(2500);+ assert.equal(shown.length, 1);+});++test("a card closing on its own during a dictation holds the queue until the dictation ends", (t) => {+ t.mock.timers.enable({ apis: ["setTimeout"] });+ const { engine, audioDetector, shown } = createEngine();+ engine.setPreferences({ audioDetection: true, processDetection: true });+ audioDetector.emit("sustained-audio-detected", { durationMs: 2000, detectedAt: 0 });+ assert.equal(shown.length, 1);++ engine.setUserRecording(true);+ engine.handleCalendarReminder({ id: "standup", summary: "Standup" });+ engine.handleDetectionNotificationClosed(shown[0].detectionId);+ assert.equal(shown.length, 1, "the reminder must not appear mid-dictation");++ engine.setUserRecording(false);+ t.mock.timers.tick(2500);+ assert.equal(shown.length, 2);+});