From 2b3e0cfc2d549cec36c2b4918ae3a821a3a29cf4 Mon Sep 17 00:00:00 2001 From: iliya Date: Wed, 4 Mar 2026 17:34:58 +0200 Subject: [PATCH] fix: improve inbox notification handling for orphaned team directories - Updated notification logic to skip inbox notifications for orphaned team directories lacking a config.json file, preventing duplicate notifications with incorrect team names. - Enhanced clarity in the notification process by ensuring only valid team configurations trigger alerts. --- src/main/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/index.ts b/src/main/index.ts index 69a4f8d3..ff729dae 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -47,7 +47,7 @@ import { HttpServer } from './services/infrastructure/HttpServer'; import { TeamInboxReader } from './services/team/TeamInboxReader'; import { TeamSentMessagesStore } from './services/team/TeamSentMessagesStore'; import { getAppIconPath } from './utils/appIcon'; -import { getProjectsBasePath, getTodosBasePath } from './utils/pathDecoder'; +import { getProjectsBasePath, getTeamsBasePath, getTodosBasePath } from './utils/pathDecoder'; import { CliInstallerService, configManager, @@ -192,6 +192,15 @@ async function notifyNewInboxMessages(teamName: string, detail: string): Promise const config = configManager.getConfig(); if (!config.notifications.enabled) return; + // Skip orphaned team directories without config.json (e.g., "default"). + // Claude Code may write to these when its internal teamContext is lost after session resume. + // Our stdout capture in TeamProvisioningService already persists these messages under the + // correct team name via sentMessages.json, so inbox notifications from orphaned dirs + // would be duplicates with a wrong team name. + if (!existsSync(join(getTeamsBasePath(), teamName, 'config.json'))) { + return; // No config.json → orphaned team dir, skip notification + } + // detail is like "inboxes/carol.json" — extract member name const match = /^inboxes\/(.+)\.json$/.exec(detail); if (!match) return;