From 1da3394cafb70fcdfb40f02241552360899f855c Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Thu, 5 Mar 2026 18:13:28 -0800 Subject: [PATCH] =?UTF-8?q?fix(mcp-server):=20social-fast-coordinator-pipe?= =?UTF-8?q?line=20=E2=80=94=20stage=5Ftransition=20used=20non-existent=20c?= =?UTF-8?q?urrentStage=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FastingSessionDoc has stages: unknown[] not currentStage: string. - Replace currentStage cast with hasStages check (session.stages.length > 0) - Fix protocolId extraction to use direct field (session?.protocolId) - Report currentStage derived from stages.length as 'stage_N' indicator --- .../a2a/social-fast-coordinator-pipeline.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/services/mcp-server/src/modules/a2a/social-fast-coordinator-pipeline.ts b/services/mcp-server/src/modules/a2a/social-fast-coordinator-pipeline.ts index 1b911dca..031026da 100644 --- a/services/mcp-server/src/modules/a2a/social-fast-coordinator-pipeline.ts +++ b/services/mcp-server/src/modules/a2a/social-fast-coordinator-pipeline.ts @@ -83,9 +83,10 @@ async function notifyMembers( }); } - // If session has a current stage, fire stage_transition milestone push - const stage = (session as unknown as Record)?.['currentStage']; - if (stage && typeof stage === 'string') { + // If session has stage entries (fast is progressing), fire stage_transition milestone push + const hasStages = + session !== null && Array.isArray(session.stages) && session.stages.length > 0; + if (hasStages) { try { await nomgapPushFire({ type: 'stage_transition', userId }, opts); results.push({ userId, type: 'stage_transition', outcome: 'fired' }); @@ -128,9 +129,10 @@ async function sendWeeklyDigestAndReport( const fired = notifications.filter(n => n.outcome === 'fired').length; const failed = notifications.filter(n => n.outcome === 'failed').length; const stage = - ((session as unknown as Record)?.['currentStage'] as string | null) ?? null; - const protocolId = - ((session as unknown as Record)?.['protocolId'] as string | null) ?? null; + session && Array.isArray(session.stages) && session.stages.length > 0 + ? `stage_${session.stages.length}` + : null; + const protocolId = session?.protocolId ?? null; const summary = memberUserIds.length === 0