fix(team): trim bootstrap stderr breadcrumb

This commit is contained in:
777genius 2026-05-19 21:23:44 +03:00
parent 7646716884
commit 568c0f237e
2 changed files with 11 additions and 13 deletions

View file

@ -341,7 +341,7 @@ export function extractLaunchBootstrapTransportBreadcrumb(
).map(redactLaunchFailureArtifactText); ).map(redactLaunchFailureArtifactText);
const retryableRaw = retryableMatches.at(-1)?.[1]?.toLowerCase(); const retryableRaw = retryableMatches.at(-1)?.[1]?.toLowerCase();
return { 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( submitRejected: /bootstrap_submit_rejected|submit rejected by local prompt handler/i.test(
combined 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 }> { async function readBoundedTextFile(sourcePath: string): Promise<{ text?: string; issue?: string }> {
try { try {
const stat = await fs.promises.stat(sourcePath); const stat = await fs.promises.stat(sourcePath);

View file

@ -190,6 +190,7 @@ describe('TeamLaunchFailureArtifactPack', () => {
expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap');
expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({
lastTransportStage: 'mailbox_bootstrap_written',
noStdinWarning: true, noStdinWarning: true,
bootstrapSubmitted: false, bootstrapSubmitted: false,
}); });
@ -210,9 +211,7 @@ describe('TeamLaunchFailureArtifactPack', () => {
expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap');
expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({
lastTransportStage: expect.stringContaining( lastTransportStage: 'inbox_poller_ready: initial poll observed bootstrap prompt',
'inbox_poller_ready: initial poll observed bootstrap prompt'
),
noStdinWarning: true, noStdinWarning: true,
bootstrapSubmitted: false, bootstrapSubmitted: false,
}); });
@ -233,9 +232,7 @@ describe('TeamLaunchFailureArtifactPack', () => {
expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap');
expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({
lastTransportStage: expect.stringContaining( lastTransportStage: 'bootstrap_submit_attempted: submitting bootstrap prompt',
'bootstrap_submit_attempted: submitting bootstrap prompt'
),
noStdinWarning: true, noStdinWarning: true,
bootstrapSubmitted: false, bootstrapSubmitted: false,
}); });
@ -257,9 +254,7 @@ describe('TeamLaunchFailureArtifactPack', () => {
expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap');
expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({
lastTransportStage: expect.stringContaining( lastTransportStage: 'bootstrap_submit_attempted: submitting bootstrap prompt',
'bootstrap_submit_attempted: submitting bootstrap prompt'
),
noStdinWarning: true, noStdinWarning: true,
bootstrapSubmitted: false, bootstrapSubmitted: false,
}); });
@ -281,9 +276,7 @@ describe('TeamLaunchFailureArtifactPack', () => {
expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap'); expect(classifyLaunchFailureArtifact(input).code).toBe('model_no_bootstrap');
expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({ expect(extractLaunchBootstrapTransportBreadcrumb(input)).toMatchObject({
lastTransportStage: expect.stringContaining( lastTransportStage: 'bootstrap_submitted: messageId=bootstrap-alice-1',
'bootstrap_submitted: messageId=bootstrap-alice-1'
),
noStdinWarning: true, noStdinWarning: true,
bootstrapSubmitted: true, bootstrapSubmitted: true,
}); });