@@ -36,7 +36,6 @@ import {
3636} from "./coverage-report.js" ;
3737import { buildQaDockerHarnessImage , writeQaDockerHarnessFiles } from "./docker-harness.js" ;
3838import { runQaDockerUp } from "./docker-up.runtime.js" ;
39- import { QaSuiteArtifactError , QaSuiteInfraError } from "./errors.js" ;
4039import type { QaCliBackendAuthMode } from "./gateway-child.js" ;
4140import {
4241 createMockJsonlReplayCellRunner ,
@@ -94,7 +93,11 @@ import {
9493 type QaScorecardEvidenceMode ,
9594} from "./scorecard-taxonomy.js" ;
9695import { isQaSelfCheckSuccessful } from "./self-check.js" ;
97- import { runQaFlowSuiteFromRuntime , runQaSuite } from "./suite-launch.runtime.js" ;
96+ import {
97+ runQaFlowSuiteFromRuntime ,
98+ runQaSuite ,
99+ runQaSuiteWithInfraRetry ,
100+ } from "./suite-launch.runtime.js" ;
98101import { resolveQaSuiteScenarioChannel , resolveQaSuiteScenarioChannels } from "./suite-planning.js" ;
99102import { readQaSuiteFailedOrSkippedScenarioCountFromFile } from "./suite-summary.js" ;
100103import {
@@ -108,16 +111,8 @@ import {
108111 type QaToolCoverageSuiteSummary ,
109112} from "./tool-coverage-report.js" ;
110113
111- const QA_SUITE_INFRA_RETRY_LIMIT = 1 ;
112114const QA_CREDENTIAL_PAYLOAD_MAX_BYTES_ENV = "OPENCLAW_QA_CREDENTIAL_PAYLOAD_MAX_BYTES" ;
113115const DEFAULT_QA_CREDENTIAL_PAYLOAD_MAX_BYTES = 64 * 1024 * 1024 ;
114- const QA_SUITE_INFRA_RETRY_NETWORK_ERROR_CODES = new Set ( [
115- "ECONNRESET" ,
116- "ECONNREFUSED" ,
117- "EPIPE" ,
118- "ETIMEDOUT" ,
119- "UND_ERR_SOCKET" ,
120- ] ) ;
121116type InterruptibleServer = {
122117 baseUrl : string ;
123118 stop ( ) : Promise < void > ;
@@ -345,51 +340,6 @@ function rejectNonFlowScenarioIds(params: {
345340 }
346341}
347342
348- function isQaSuiteInfraRetryableError ( error : unknown ) {
349- if ( error instanceof QaSuiteArtifactError || error instanceof QaSuiteInfraError ) {
350- return true ;
351- }
352- return hasQaSuiteRetryableNetworkCode ( error ) ;
353- }
354-
355- function hasQaSuiteRetryableNetworkCode ( error : unknown ) {
356- let current : unknown = error ;
357- for ( let depth = 0 ; depth < 4 && current ; depth += 1 ) {
358- if ( typeof current !== "object" ) {
359- return false ;
360- }
361- const record = current as { cause ?: unknown ; code ?: unknown } ;
362- if (
363- typeof record . code === "string" &&
364- QA_SUITE_INFRA_RETRY_NETWORK_ERROR_CODES . has ( record . code . toUpperCase ( ) )
365- ) {
366- return true ;
367- }
368- current = record . cause ;
369- }
370- return false ;
371- }
372-
373- async function runQaSuiteWithInfraRetry < Result > (
374- run : ( ) => Promise < Result > ,
375- maxRetries = QA_SUITE_INFRA_RETRY_LIMIT ,
376- ) {
377- for ( let attempt = 0 ; attempt <= maxRetries ; attempt += 1 ) {
378- try {
379- return await run ( ) ;
380- } catch ( error ) {
381- const retryable = isQaSuiteInfraRetryableError ( error ) ;
382- if ( ! retryable || attempt >= maxRetries ) {
383- throw error ;
384- }
385- process . stderr . write (
386- `[qa-suite] infra retry ${ attempt + 1 } /${ maxRetries } : ${ formatErrorMessage ( error ) } \n` ,
387- ) ;
388- }
389- }
390- throw new Error ( "unreachable qa suite retry state" ) ;
391- }
392-
393343async function runQaParityPreflight ( params : {
394344 repoRoot : string ;
395345 transportId : QaTransportId ;
@@ -1023,45 +973,43 @@ export async function runQaSuiteCommand(opts: QaSuiteCommandOptions) {
1023973 return undefined ;
1024974 }
1025975 const thinkingDefault = parseQaThinkingLevel ( "--thinking" , opts . thinking ) ;
1026- const runtimeResult = await runQaSuiteWithInfraRetry ( ( ) =>
1027- runQaSuite ( {
1028- repoRoot,
1029- outputDir : resolveRepoRelativeOutputDir ( repoRoot , opts . outputDir ) ,
1030- evidenceMode : opts . evidenceMode ,
1031- transportId,
1032- channelDriver,
1033- ...( liveAdapterFactories
1034- ? {
1035- adapterFactories : liveAdapterFactories ,
1036- ...( liveChannelId ? { channelId : liveChannelId } : { } ) ,
1037- adapterOptions : {
1038- repoRoot,
1039- sutAccountId : opts . sutAccountId ,
1040- credentialSource : opts . credentialSource ,
1041- credentialRole : opts . credentialRole ,
1042- explicitScenarioSelection :
1043- opts . explicitScenarioSelection ?? Boolean ( opts . scenarioIds ?. length ) ,
1044- } ,
1045- }
976+ const runtimeResult = await runQaSuite ( {
977+ repoRoot,
978+ outputDir : resolveRepoRelativeOutputDir ( repoRoot , opts . outputDir ) ,
979+ evidenceMode : opts . evidenceMode ,
980+ transportId,
981+ channelDriver,
982+ ...( liveAdapterFactories
983+ ? {
984+ adapterFactories : liveAdapterFactories ,
985+ ...( liveChannelId ? { channelId : liveChannelId } : { } ) ,
986+ adapterOptions : {
987+ repoRoot,
988+ sutAccountId : opts . sutAccountId ,
989+ credentialSource : opts . credentialSource ,
990+ credentialRole : opts . credentialRole ,
991+ explicitScenarioSelection :
992+ opts . explicitScenarioSelection ?? Boolean ( opts . scenarioIds ?. length ) ,
993+ } ,
994+ }
995+ : { } ) ,
996+ channelDriverSelection,
997+ ...( opts . providerMode !== undefined ? { providerMode } : { } ) ,
998+ primaryModel,
999+ alternateModel,
1000+ fastMode : opts . fastMode ,
1001+ failFast : opts . failFast ,
1002+ ...( thinkingDefault ? { thinkingDefault } : { } ) ,
1003+ ...( claudeCliAuthMode ? { claudeCliAuthMode } : { } ) ,
1004+ scenarioIds : liveChannelId ? scenarioIds : hostScenarioIds ,
1005+ ...( opts . enabledPluginIds !== undefined ? { enabledPluginIds : opts . enabledPluginIds } : { } ) ,
1006+ ...( liveChannelId
1007+ ? { concurrency : 1 }
1008+ : opts . concurrency !== undefined
1009+ ? { concurrency : parseQaPositiveIntegerOption ( "--concurrency" , opts . concurrency ) }
10461010 : { } ) ,
1047- channelDriverSelection,
1048- ...( opts . providerMode !== undefined ? { providerMode } : { } ) ,
1049- primaryModel,
1050- alternateModel,
1051- fastMode : opts . fastMode ,
1052- failFast : opts . failFast ,
1053- ...( thinkingDefault ? { thinkingDefault } : { } ) ,
1054- ...( claudeCliAuthMode ? { claudeCliAuthMode } : { } ) ,
1055- scenarioIds : liveChannelId ? scenarioIds : hostScenarioIds ,
1056- ...( opts . enabledPluginIds !== undefined ? { enabledPluginIds : opts . enabledPluginIds } : { } ) ,
1057- ...( liveChannelId
1058- ? { concurrency : 1 }
1059- : opts . concurrency !== undefined
1060- ? { concurrency : parseQaPositiveIntegerOption ( "--concurrency" , opts . concurrency ) }
1061- : { } ) ,
1062- ...( runtimePair ? { runtimePair } : { } ) ,
1063- } ) ,
1064- ) ;
1011+ ...( runtimePair ? { runtimePair } : { } ) ,
1012+ } ) ;
10651013 switch ( runtimeResult . executionKind ) {
10661014 case "suite" : {
10671015 const result = runtimeResult . result ;
0 commit comments