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);
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);

View file

@ -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,
});