From 568c0f237ed7ba33a737e18e33a57adc91cc37d5 Mon Sep 17 00:00:00 2001 From: 777genius Date: Tue, 19 May 2026 21:23:44 +0300 Subject: [PATCH] fix(team): trim bootstrap stderr breadcrumb --- .../team/TeamLaunchFailureArtifactPack.ts | 7 ++++++- .../team/TeamLaunchFailureArtifactPack.test.ts | 17 +++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/services/team/TeamLaunchFailureArtifactPack.ts b/src/main/services/team/TeamLaunchFailureArtifactPack.ts index b623fa20..b8213729 100644 --- a/src/main/services/team/TeamLaunchFailureArtifactPack.ts +++ b/src/main/services/team/TeamLaunchFailureArtifactPack.ts @@ -341,7 +341,7 @@ export function extractLaunchBootstrapTransportBreadcrumb( ).map(redactLaunchFailureArtifactText); const retryableRaw = retryableMatches.at(-1)?.[1]?.toLowerCase(); return { - lastTransportStage: lastStageMatches.at(-1)?.[1]?.trim() ?? null, + lastTransportStage: normalizeLastTransportStage(lastStageMatches.at(-1)?.[1]), submitRejected: /bootstrap_submit_rejected|submit rejected by local prompt handler/i.test( combined ), @@ -355,6 +355,11 @@ export function extractLaunchBootstrapTransportBreadcrumb( }; } +function normalizeLastTransportStage(stage: string | undefined): string | null { + const normalized = stage?.replace(/\s+Last\s+(?:stderr|stdout):.*$/i, '').trim(); + return normalized || null; +} + async function readBoundedTextFile(sourcePath: string): Promise<{ text?: string; issue?: string }> { try { const stat = await fs.promises.stat(sourcePath); diff --git a/test/main/services/team/TeamLaunchFailureArtifactPack.test.ts b/test/main/services/team/TeamLaunchFailureArtifactPack.test.ts index ab335a11..a6a1fdb3 100644 --- a/test/main/services/team/TeamLaunchFailureArtifactPack.test.ts +++ b/test/main/services/team/TeamLaunchFailureArtifactPack.test.ts @@ -190,6 +190,7 @@ describe('TeamLaunchFailureArtifactPack', () => { expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ + lastTransportStage: 'mailbox_bootstrap_written', noStdinWarning: true, bootstrapSubmitted: false, }); @@ -210,9 +211,7 @@ describe('TeamLaunchFailureArtifactPack', () => { expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ - lastTransportStage: expect.stringContaining( - 'inbox_poller_ready: initial poll observed bootstrap prompt' - ), + lastTransportStage: 'inbox_poller_ready: initial poll observed bootstrap prompt', noStdinWarning: true, bootstrapSubmitted: false, }); @@ -233,9 +232,7 @@ describe('TeamLaunchFailureArtifactPack', () => { expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ - lastTransportStage: expect.stringContaining( - 'bootstrap_submit_attempted: submitting bootstrap prompt' - ), + lastTransportStage: 'bootstrap_submit_attempted: submitting bootstrap prompt', noStdinWarning: true, bootstrapSubmitted: false, }); @@ -257,9 +254,7 @@ describe('TeamLaunchFailureArtifactPack', () => { expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ - lastTransportStage: expect.stringContaining( - 'bootstrap_submit_attempted: submitting bootstrap prompt' - ), + lastTransportStage: 'bootstrap_submit_attempted: submitting bootstrap prompt', noStdinWarning: true, bootstrapSubmitted: false, }); @@ -281,9 +276,7 @@ describe('TeamLaunchFailureArtifactPack', () => { expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ - lastTransportStage: expect.stringContaining( - 'bootstrap_submitted: messageId=bootstrap-alice-1' - ), + lastTransportStage: 'bootstrap_submitted: messageId=bootstrap-alice-1', noStdinWarning: true, bootstrapSubmitted: true, });