From d1a69559312161f55df2faf3591d97ff0a62d951 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 19 Jan 2026 17:22:55 +0100 Subject: [PATCH] fix(ui): prevent duplicate loop completion notifications Add deduplication guard to prevent spamming the same completion toast. Uses a Set to track shown completions per session, with 30s expiry to allow re-notification if loop restarts. Co-Authored-By: Claude Opus 4.5 --- src/web/public/app.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/web/public/app.js b/src/web/public/app.js index 592bab19..a2b35de5 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -498,6 +498,18 @@ class ClaudemanApp { this.eventSource.addEventListener('session:innerCompletionDetected', (e) => { const data = JSON.parse(e.data); + // Prevent duplicate notifications for the same completion + const completionKey = `${data.sessionId}:${data.phrase}`; + if (this._shownCompletions?.has(completionKey)) { + return; + } + if (!this._shownCompletions) { + this._shownCompletions = new Set(); + } + this._shownCompletions.add(completionKey); + // Clear after 30 seconds to allow re-notification if loop restarts + setTimeout(() => this._shownCompletions?.delete(completionKey), 30000); + this.showToast(`Loop completed: ${data.phrase}`, 'success'); // Update inner state to mark loop as inactive const existing = this.innerStates.get(data.sessionId) || {};