fix: keep 50 messages in getTeamData for backward compatibility

Returning messages: [] broke the slash command annotation test and
any code relying on getTeamData.messages (notifications, dedup).

Keep a small batch (50 newest) in getTeamData for compatibility.
Full message history is available via getMessagesPage() API.
This commit is contained in:
Artem Rootman 2026-04-05 17:45:44 +00:00
parent 0c0e0240a3
commit 7d2282c35c
No known key found for this signature in database
GPG key ID: B7C30676209A822C

View file

@ -723,15 +723,19 @@ export class TeamDataService {
this.processHealthTeams.delete(teamName); this.processHealthTeams.delete(teamName);
} }
// Messages are now served separately via getMessagesPage() for pagination. // Cap messages to keep IPC payloads small. Full history is available
// Sending an empty array here keeps the TeamData shape unchanged while // via the paginated getMessagesPage() API. We still include a small
// eliminating the ~1MB messages payload from every getTeamData refresh. // batch here for backward compatibility (notifications, dedup, etc.).
const MAX_RETURN_MESSAGES = 50;
const cappedMessages =
messages.length > MAX_RETURN_MESSAGES ? messages.slice(0, MAX_RETURN_MESSAGES) : messages;
return { return {
teamName, teamName,
config, config,
tasks: tasksWithKanban, tasks: tasksWithKanban,
members, members,
messages: [], messages: cappedMessages,
kanbanState, kanbanState,
processes, processes,
warnings: warnings.length > 0 ? warnings : undefined, warnings: warnings.length > 0 ? warnings : undefined,