@resolveio/server-lib 22.3.184 → 22.3.186

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -381,9 +381,55 @@ export interface ResolveIOSupportEvidenceFreshness {
381
381
  changedFiles: string[];
382
382
  artifactPaths: string[];
383
383
  }
384
+ export type ResolveIOSupportPreflightCheckName = 'puppeteer_module' | 'chrome_executable' | 'chrome_launch' | 'node_version' | 'npm_install' | 'settings_file' | 'mongo_connection' | 'server_startup' | 'client_startup' | 'port_availability' | 'compile' | 'cache_state' | 'seed_data' | 'unknown';
385
+ export type ResolveIOSupportPreflightCheckStatus = 'pass' | 'fail' | 'blocked' | 'warn' | 'unknown';
386
+ export interface ResolveIOSupportPreflightCheck {
387
+ name: ResolveIOSupportPreflightCheckName;
388
+ status: ResolveIOSupportPreflightCheckStatus;
389
+ summary: string;
390
+ failureClass: 'infra' | 'compile' | 'unknown';
391
+ command?: string;
392
+ durationMs?: number;
393
+ artifactPaths: string[];
394
+ evidence: string[];
395
+ recordedAt: string;
396
+ }
397
+ export type ResolveIOSupportPreflightGateStatus = 'passed' | 'missing' | 'infra_failed' | 'compile_failed' | 'blocked' | 'unknown';
398
+ export type ResolveIOSupportPreflightNextCommand = 'continue_to_diagnosis' | 'run_support_v5_preflight' | 'run_support_v5_infra_repair' | 'run_support_v5_compile_repair';
399
+ export interface ResolveIOSupportPreflightGateInput {
400
+ required?: boolean;
401
+ status?: ResolveIOSupportPreflightGateStatus | string;
402
+ ready?: boolean;
403
+ checks?: any[];
404
+ infraChecks?: any[];
405
+ compileResult?: any;
406
+ startupChecks?: any[];
407
+ blockers?: any;
408
+ requiredEvidence?: any;
409
+ artifactPaths?: any;
410
+ evidenceHash?: string;
411
+ recordedAt?: Date | string;
412
+ }
413
+ export interface ResolveIOSupportPreflightGate {
414
+ ready: boolean;
415
+ required: boolean;
416
+ status: ResolveIOSupportPreflightGateStatus;
417
+ failureClass: 'infra' | 'compile' | 'unknown';
418
+ checks: ResolveIOSupportPreflightCheck[];
419
+ failedChecks: ResolveIOSupportPreflightCheck[];
420
+ blockers: string[];
421
+ requiredEvidence: string[];
422
+ artifactPaths: string[];
423
+ nextCommand: ResolveIOSupportPreflightNextCommand;
424
+ blocksProductRepair: boolean;
425
+ blocksModelRepair: boolean;
426
+ evidenceHash: string;
427
+ recordedAt: string;
428
+ }
384
429
  export type ResolveIOSupportV5RepairGateAction = 'diagnose_only' | 'infra_repair_only' | 'allow_product_repair' | 'reject_out_of_scope' | 'park_repeated_failure';
385
430
  export interface ResolveIOSupportV5RepairGateInput {
386
431
  diagnosisGate?: any;
432
+ preflightGate?: ResolveIOSupportPreflightGateInput | ResolveIOSupportPreflightGate;
387
433
  activeStepType?: ResolveIOSupportV5StepType | string;
388
434
  changedFiles?: any;
389
435
  artifactPaths?: any;
@@ -404,6 +450,7 @@ export interface ResolveIOSupportV5RepairGateDecision {
404
450
  issueClass?: ResolveIOSupportIssueClass;
405
451
  proofPlan?: ResolveIOSupportDiagnosisProofPlan;
406
452
  outsideOwnerFiles: string[];
453
+ preflightGate: ResolveIOSupportPreflightGate;
407
454
  repeatedFailure?: ResolveIOSupportV5RepeatStopDecision;
408
455
  diagnosisValidation: ResolveIOSupportDiagnosisGateValidation;
409
456
  recoveryPlan: ResolveIOAIManagerRecoveryPlan;
@@ -530,6 +577,7 @@ export interface ResolveIOSupportV5StepRecord {
530
577
  changedFiles?: string[];
531
578
  artifactPaths?: string[];
532
579
  diagnosisGate?: ResolveIOSupportDiagnosisGate;
580
+ preflightGate?: ResolveIOSupportPreflightGate;
533
581
  failureClass?: ResolveIOSupportV5FailureClass | string;
534
582
  blockerFingerprint?: string;
535
583
  evidenceHash?: string;
@@ -549,6 +597,7 @@ export interface ResolveIOSupportV5StateBundle {
549
597
  supportV5DiagnosisGate?: ResolveIOSupportDiagnosisGate;
550
598
  supportV5DiagnosisEvidencePack?: ResolveIOSupportDiagnosisEvidencePack;
551
599
  supportV5IssueClassProbePlan?: ResolveIOSupportIssueClassProbePlan;
600
+ supportV5PreflightGate?: ResolveIOSupportPreflightGate;
552
601
  supportV5LaneMemory: {
553
602
  build: ResolveIOSupportV5LaneMemory;
554
603
  qa: ResolveIOSupportV5LaneMemory;
@@ -597,6 +646,7 @@ export interface ResolveIOSupportV5StepInput {
597
646
  changedFiles?: string[];
598
647
  artifactPaths?: string[];
599
648
  diagnosisGate?: ResolveIOSupportDiagnosisGate;
649
+ preflightGate?: ResolveIOSupportPreflightGateInput | ResolveIOSupportPreflightGate;
600
650
  failureClass?: ResolveIOSupportV5FailureClass | string;
601
651
  evidenceHash?: string;
602
652
  activeQaRow?: ResolveIOSupportV5LaneMemory['activeQaRow'];
@@ -648,6 +698,9 @@ export interface ResolveIOSupportRootCauseReadiness {
648
698
  canDraftCustomerReply: boolean;
649
699
  requiresHumanDecision: boolean;
650
700
  issueClassProbePlanReady: boolean;
701
+ preflightReady: boolean;
702
+ preflightStatus: ResolveIOSupportPreflightGateStatus;
703
+ preflightFailureClass: 'infra' | 'compile' | 'unknown';
651
704
  reason: string;
652
705
  blockers: string[];
653
706
  ownerFiles: string[];
@@ -659,6 +712,7 @@ export interface ResolveIOSupportRootCauseReadiness {
659
712
  proofFingerprint?: string;
660
713
  artifactFingerprint?: string;
661
714
  proofFreshness?: ResolveIOSupportBusinessProofReadiness['proofFreshness'];
715
+ preflightGate?: ResolveIOSupportPreflightGate;
662
716
  }
663
717
  export type ResolveIOSupportNextActionCostRisk = 'free_or_deterministic' | 'small_model_or_qa' | 'expensive_model' | 'release_or_customer_send' | 'manual_blocked';
664
718
  export interface ResolveIOSupportNextActionContract {
@@ -687,6 +741,10 @@ export interface ResolveIOSupportNextActionContract {
687
741
  evidenceHash: string;
688
742
  sameFailureCount: number;
689
743
  issueClassProbePlanReady: boolean;
744
+ preflightReady: boolean;
745
+ preflightStatus: ResolveIOSupportPreflightGateStatus;
746
+ preflightFailureClass: 'infra' | 'compile' | 'unknown';
747
+ preflightEvidenceHash: string;
690
748
  hotfixCommitRequired: boolean;
691
749
  liveHotfixBlockedUntilCommit: boolean;
692
750
  };
@@ -720,6 +778,7 @@ export interface ResolveIOSupportV5AutonomousDecisionInput {
720
778
  hotfixEvidence?: any;
721
779
  releasePolicy?: ResolveIOAIManagerHotfixFirstReleasePolicy;
722
780
  releaseGatePassed?: boolean;
781
+ preflightGate?: ResolveIOSupportPreflightGateInput | ResolveIOSupportPreflightGate;
723
782
  maxOwnerFiles?: number;
724
783
  now?: Date | string;
725
784
  }
@@ -757,6 +816,7 @@ export interface ResolveIOSupportV5AutonomousDecision {
757
816
  customerReplyPolicy: ResolveIOSupportCustomerReplyPolicy;
758
817
  businessProofReadiness: ResolveIOSupportBusinessProofReadiness;
759
818
  evidenceFreshness: ResolveIOSupportEvidenceFreshness;
819
+ preflightGate: ResolveIOSupportPreflightGate;
760
820
  rootCauseReadiness: ResolveIOSupportRootCauseReadiness;
761
821
  continuationProofCheckpoint: ResolveIOSupportContinuationProofCheckpoint;
762
822
  nextActionContract: ResolveIOSupportNextActionContract;
@@ -765,6 +825,7 @@ export interface ResolveIOSupportV5AutonomousDecision {
765
825
  hotfixContinuation?: ResolveIOAIManagerHotfixContinuationDecision;
766
826
  recordedAt: string;
767
827
  }
828
+ export declare function evaluateResolveIOSupportPreflightGate(input?: ResolveIOSupportPreflightGateInput | ResolveIOSupportPreflightGate | any, nowValue?: Date | string): ResolveIOSupportPreflightGate;
768
829
  export declare function selectResolveIOSupportSimilarCaseHints(input?: ResolveIOSupportSimilarCaseSelectionInput): ResolveIOSupportSimilarCaseSelection;
769
830
  export declare function buildResolveIOSupportDiagnosisEvidencePack(input?: ResolveIOSupportDiagnosisEvidencePackInput): ResolveIOSupportDiagnosisEvidencePack;
770
831
  export declare function evaluateResolveIOSupportDiagnosisEvidenceQuality(value: any): ResolveIOSupportDiagnosisEvidenceQuality;
@@ -47,6 +47,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
47
47
  return to.concat(ar || Array.prototype.slice.call(from));
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.evaluateResolveIOSupportPreflightGate = evaluateResolveIOSupportPreflightGate;
50
51
  exports.selectResolveIOSupportSimilarCaseHints = selectResolveIOSupportSimilarCaseHints;
51
52
  exports.buildResolveIOSupportDiagnosisEvidencePack = buildResolveIOSupportDiagnosisEvidencePack;
52
53
  exports.evaluateResolveIOSupportDiagnosisEvidenceQuality = evaluateResolveIOSupportDiagnosisEvidenceQuality;
@@ -127,6 +128,196 @@ function cleanList(values, limit, max) {
127
128
  function cleanObject(value) {
128
129
  return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
129
130
  }
131
+ function normalizeResolveIOSupportPreflightCheckName(value) {
132
+ var normalized = cleanText(value, 120)
133
+ .toLowerCase()
134
+ .replace(/[\s-]+/g, '_');
135
+ var aliases = {
136
+ puppeteer: 'puppeteer_module',
137
+ puppeteer_module: 'puppeteer_module',
138
+ chrome: 'chrome_executable',
139
+ chrome_path: 'chrome_executable',
140
+ chrome_executable: 'chrome_executable',
141
+ chrome_launch: 'chrome_launch',
142
+ browser_launch: 'chrome_launch',
143
+ node: 'node_version',
144
+ node_version: 'node_version',
145
+ npm: 'npm_install',
146
+ npm_install: 'npm_install',
147
+ settings: 'settings_file',
148
+ settings_file: 'settings_file',
149
+ mongo: 'mongo_connection',
150
+ mongodb: 'mongo_connection',
151
+ mongo_connection: 'mongo_connection',
152
+ server: 'server_startup',
153
+ server_startup: 'server_startup',
154
+ client: 'client_startup',
155
+ client_startup: 'client_startup',
156
+ port: 'port_availability',
157
+ ports: 'port_availability',
158
+ port_availability: 'port_availability',
159
+ build: 'compile',
160
+ compile: 'compile',
161
+ cache: 'cache_state',
162
+ cache_state: 'cache_state',
163
+ seed: 'seed_data',
164
+ seed_data: 'seed_data'
165
+ };
166
+ return aliases[normalized] || 'unknown';
167
+ }
168
+ function normalizeResolveIOSupportPreflightCheckStatus(value, source) {
169
+ var normalized = cleanText(value, 80).toLowerCase();
170
+ if (['pass', 'passed', 'ok', 'success', 'ready'].includes(normalized) || source.passed === true || source.ok === true || source.ready === true) {
171
+ return 'pass';
172
+ }
173
+ if (['fail', 'failed', 'failure', 'error'].includes(normalized) || source.passed === false || source.ok === false) {
174
+ return 'fail';
175
+ }
176
+ if (['blocked', 'block', 'missing'].includes(normalized) || source.blocked === true) {
177
+ return 'blocked';
178
+ }
179
+ if (['warn', 'warning'].includes(normalized)) {
180
+ return 'warn';
181
+ }
182
+ return 'unknown';
183
+ }
184
+ function normalizeResolveIOSupportPreflightFailureClass(name, source, status) {
185
+ var normalized = cleanText(source.failureClass || source.failure_class || source.class, 80).toLowerCase();
186
+ if (normalized === 'compile' || normalized === 'build') {
187
+ return 'compile';
188
+ }
189
+ if (normalized === 'infra' || normalized === 'infrastructure') {
190
+ return 'infra';
191
+ }
192
+ if (status === 'pass' || status === 'warn') {
193
+ return 'unknown';
194
+ }
195
+ return name === 'compile' ? 'compile' : 'infra';
196
+ }
197
+ function normalizeResolveIOSupportPreflightCheck(input, now) {
198
+ var source = typeof input === 'string'
199
+ ? { summary: input, name: 'unknown', status: 'unknown' }
200
+ : cleanObject(input);
201
+ var name = normalizeResolveIOSupportPreflightCheckName(source.name || source.check || source.checkName || source.id || source.type);
202
+ var status = normalizeResolveIOSupportPreflightCheckStatus(source.status || source.state || source.outcome, source);
203
+ var artifactPaths = Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(source.artifactPaths || source.artifacts, 20, 500)), false), __read(cleanList(source.artifactPath ? [source.artifactPath] : [], 1, 500)), false)));
204
+ var evidence = cleanList(source.evidence || source.logs || source.messages, 20, 500);
205
+ return {
206
+ name: name,
207
+ status: status,
208
+ summary: cleanText(source.summary || source.reason || source.error || source.message || source.status || name, 1000),
209
+ failureClass: normalizeResolveIOSupportPreflightFailureClass(name, source, status),
210
+ command: cleanText(source.command, 500) || undefined,
211
+ durationMs: Number.isFinite(Number(source.durationMs || source.duration_ms))
212
+ ? Math.max(0, Number(source.durationMs || source.duration_ms))
213
+ : undefined,
214
+ artifactPaths: artifactPaths,
215
+ evidence: evidence,
216
+ recordedAt: cleanText(source.recordedAt || source.recorded_at, 80) || now
217
+ };
218
+ }
219
+ function normalizeResolveIOSupportPreflightGateStatus(value) {
220
+ var normalized = cleanText(value, 80).toLowerCase();
221
+ var aliases = {
222
+ passed: 'passed',
223
+ pass: 'passed',
224
+ ready: 'passed',
225
+ missing: 'missing',
226
+ infra_failed: 'infra_failed',
227
+ infra: 'infra_failed',
228
+ infrastructure_failed: 'infra_failed',
229
+ compile_failed: 'compile_failed',
230
+ build_failed: 'compile_failed',
231
+ blocked: 'blocked',
232
+ unknown: 'unknown'
233
+ };
234
+ return aliases[normalized] || '';
235
+ }
236
+ function evaluateResolveIOSupportPreflightGate(input, nowValue) {
237
+ var now = isoNow(nowValue);
238
+ var source = cleanObject(input);
239
+ var compileResult = cleanObject(source.compileResult || source.compile_result);
240
+ var checksInput = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((Array.isArray(source.checks) ? source.checks : [])), false), __read((Array.isArray(source.infraChecks || source.infra_checks) ? (source.infraChecks || source.infra_checks) : [])), false), __read((Array.isArray(source.startupChecks || source.startup_checks) ? (source.startupChecks || source.startup_checks) : [])), false), __read((Object.keys(compileResult).length ? [__assign(__assign({}, compileResult), { name: compileResult.name || 'compile', failureClass: compileResult.failureClass || compileResult.failure_class || 'compile' })] : [])), false);
241
+ var checks = checksInput.map(function (check) { return normalizeResolveIOSupportPreflightCheck(check, now); });
242
+ var required = source.required === true
243
+ || source.requiredBeforeRepair === true
244
+ || source.required_before_repair === true
245
+ || source.blocksProductRepair === true
246
+ || source.blocks_product_repair === true;
247
+ var failedChecks = checks.filter(function (check) { return check.status === 'fail' || check.status === 'blocked'; });
248
+ var unknownChecks = checks.filter(function (check) { return check.status === 'unknown'; });
249
+ var directStatus = normalizeResolveIOSupportPreflightGateStatus(source.status);
250
+ var compileFailed = failedChecks.some(function (check) { return check.failureClass === 'compile' || check.name === 'compile'; })
251
+ || directStatus === 'compile_failed';
252
+ var infraFailed = failedChecks.length > 0 || directStatus === 'infra_failed';
253
+ var status;
254
+ if (compileFailed) {
255
+ status = 'compile_failed';
256
+ }
257
+ else if (infraFailed) {
258
+ status = 'infra_failed';
259
+ }
260
+ else if (directStatus === 'blocked') {
261
+ status = 'blocked';
262
+ }
263
+ else if (directStatus === 'missing' || (required && checks.length === 0)) {
264
+ status = 'missing';
265
+ }
266
+ else if (directStatus === 'passed' || source.ready === true || (checks.length > 0 && failedChecks.length === 0 && unknownChecks.length === 0)) {
267
+ status = 'passed';
268
+ }
269
+ else {
270
+ status = 'unknown';
271
+ }
272
+ var failureClass = status === 'compile_failed'
273
+ ? 'compile'
274
+ : (status === 'infra_failed' || status === 'blocked' || status === 'missing')
275
+ ? 'infra'
276
+ : 'unknown';
277
+ var artifactPaths = Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(source.artifactPaths || source.artifacts, 40, 500)), false), __read(checks.flatMap(function (check) { return check.artifactPaths; })), false))).slice(0, 80);
278
+ var blockers = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(source.blockers, 20, 500)), false), __read(failedChecks.map(function (check) { return "".concat(check.name, ": ").concat(check.summary); })), false), __read((status === 'missing' ? ['Deterministic support preflight is required before product-code repair.'] : [])), false), __read((status === 'blocked' ? ['Support preflight is blocked and must be cleared before product-code repair.'] : [])), false).filter(Boolean))).slice(0, 30);
279
+ var requiredEvidence = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(source.requiredEvidence || source.required_evidence, 20, 500)), false), __read((status === 'compile_failed' ? ['compile command output', 'artifact path or build log', 'new compile evidence hash or pass'] : [])), false), __read((status === 'infra_failed' ? ['Puppeteer/Chrome/server/client/Mongo preflight log', 'new infra evidence hash or pass'] : [])), false), __read((status === 'missing' || status === 'blocked' || (required && status === 'unknown') ? ['support preflight result with Puppeteer, Chrome, compile, startup, Mongo, port, and settings status'] : [])), false))).slice(0, 30);
280
+ var blocksProductRepair = status === 'compile_failed'
281
+ || status === 'infra_failed'
282
+ || status === 'blocked'
283
+ || status === 'missing'
284
+ || (required && status === 'unknown');
285
+ var nextCommand = status === 'compile_failed'
286
+ ? 'run_support_v5_compile_repair'
287
+ : status === 'infra_failed' || status === 'blocked'
288
+ ? 'run_support_v5_infra_repair'
289
+ : status === 'missing' || (required && status === 'unknown')
290
+ ? 'run_support_v5_preflight'
291
+ : 'continue_to_diagnosis';
292
+ var evidenceHash = cleanText(source.evidenceHash || source.evidence_hash, 80)
293
+ || hashResolveIOSupportV5Evidence({
294
+ status: status,
295
+ required: required,
296
+ failedChecks: failedChecks.map(function (check) { return ({
297
+ name: check.name,
298
+ status: check.status,
299
+ summary: check.summary,
300
+ failureClass: check.failureClass
301
+ }); }),
302
+ artifactPaths: artifactPaths
303
+ });
304
+ return {
305
+ ready: blocksProductRepair ? false : status === 'passed',
306
+ required: required,
307
+ status: status,
308
+ failureClass: failureClass,
309
+ checks: checks,
310
+ failedChecks: failedChecks,
311
+ blockers: blockers,
312
+ requiredEvidence: requiredEvidence,
313
+ artifactPaths: artifactPaths,
314
+ nextCommand: nextCommand,
315
+ blocksProductRepair: blocksProductRepair,
316
+ blocksModelRepair: blocksProductRepair,
317
+ evidenceHash: evidenceHash,
318
+ recordedAt: cleanText(source.recordedAt || source.recorded_at, 80) || now
319
+ };
320
+ }
130
321
  function pickText(source, fields, max) {
131
322
  var e_2, _a;
132
323
  if (max === void 0) { max = 1000; }
@@ -2354,9 +2545,10 @@ function changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles(diagnosisGate, c
2354
2545
  });
2355
2546
  }
2356
2547
  function decideResolveIOSupportV5RepairGate(input) {
2357
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
2548
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
2358
2549
  var activeStepType = cleanText(input.activeStepType, 80);
2359
2550
  var failureClass = cleanText(input.failureClass, 80).toLowerCase();
2551
+ var preflightGate = evaluateResolveIOSupportPreflightGate(input.preflightGate);
2360
2552
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.diagnosisGate, {
2361
2553
  maxOwnerFiles: input.maxOwnerFiles
2362
2554
  });
@@ -2437,24 +2629,31 @@ function decideResolveIOSupportV5RepairGate(input) {
2437
2629
  };
2438
2630
  if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
2439
2631
  var recoveryPlan_1 = recoveryPlanFor('park_repeated_failure', repeatedFailure.reason, repeatedFailure.failureClass, true);
2440
- return __assign({ action: 'park_repeated_failure', canEditProductCode: false, blockers: [repeatedFailure.reason], ownerFiles: ownerFiles, issueClass: (_c = diagnosisValidation.normalized) === null || _c === void 0 ? void 0 : _c.issue_class, proofPlan: (_d = diagnosisValidation.normalized) === null || _d === void 0 ? void 0 : _d.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_1));
2632
+ return __assign({ action: 'park_repeated_failure', canEditProductCode: false, blockers: [repeatedFailure.reason], ownerFiles: ownerFiles, issueClass: (_c = diagnosisValidation.normalized) === null || _c === void 0 ? void 0 : _c.issue_class, proofPlan: (_d = diagnosisValidation.normalized) === null || _d === void 0 ? void 0 : _d.proof_plan, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_1));
2633
+ }
2634
+ if (preflightGate.blocksProductRepair) {
2635
+ var recoveryFailureClass = preflightGate.failureClass === 'compile' ? 'compile' : 'infra';
2636
+ var recoveryPlan_2 = recoveryPlanFor('retry_infra', 'support_v5_preflight_gate_blocks_product_repair', recoveryFailureClass, false);
2637
+ return __assign({ action: 'infra_repair_only', canEditProductCode: false, blockers: preflightGate.blockers.length
2638
+ ? preflightGate.blockers
2639
+ : ['Deterministic support preflight must pass before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_e = diagnosisValidation.normalized) === null || _e === void 0 ? void 0 : _e.issue_class, proofPlan: (_f = diagnosisValidation.normalized) === null || _f === void 0 ? void 0 : _f.proof_plan, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_2));
2441
2640
  }
2442
2641
  if (failureClass === 'infra' || failureClass === 'compile') {
2443
- var recoveryPlan_2 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', failureClass, false);
2444
- return __assign({ action: 'infra_repair_only', canEditProductCode: false, blockers: ['Infra/compile/Puppeteer/startup failures must be repaired in the harness lane before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_e = diagnosisValidation.normalized) === null || _e === void 0 ? void 0 : _e.issue_class, proofPlan: (_f = diagnosisValidation.normalized) === null || _f === void 0 ? void 0 : _f.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_2));
2642
+ var recoveryPlan_3 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', failureClass, false);
2643
+ return __assign({ action: 'infra_repair_only', canEditProductCode: false, blockers: ['Infra/compile/Puppeteer/startup failures must be repaired in the harness lane before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_g = diagnosisValidation.normalized) === null || _g === void 0 ? void 0 : _g.issue_class, proofPlan: (_h = diagnosisValidation.normalized) === null || _h === void 0 ? void 0 : _h.proof_plan, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_3));
2445
2644
  }
2446
2645
  if (activeStepType === 'diagnosis_gate' || !diagnosisValidation.valid) {
2447
- var recoveryPlan_3 = recoveryPlanFor('continue', 'support_v5_diagnosis_gate_required', 'diagnosis', false);
2646
+ var recoveryPlan_4 = recoveryPlanFor('continue', 'support_v5_diagnosis_gate_required', 'diagnosis', false);
2448
2647
  return __assign({ action: 'diagnose_only', canEditProductCode: false, blockers: diagnosisValidation.blockers.length
2449
2648
  ? diagnosisValidation.blockers
2450
- : ['SupportDiagnosisGate is required before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_g = diagnosisValidation.normalized) === null || _g === void 0 ? void 0 : _g.issue_class, proofPlan: (_h = diagnosisValidation.normalized) === null || _h === void 0 ? void 0 : _h.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_3));
2649
+ : ['SupportDiagnosisGate is required before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_j = diagnosisValidation.normalized) === null || _j === void 0 ? void 0 : _j.issue_class, proofPlan: (_k = diagnosisValidation.normalized) === null || _k === void 0 ? void 0 : _k.proof_plan, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_4));
2451
2650
  }
2452
2651
  if (outsideOwnerFiles.length) {
2453
- var recoveryPlan_4 = recoveryPlanFor('continue', 'support_v5_out_of_scope_requires_diagnosis_revision', 'owner_scope', false);
2454
- return __assign({ action: 'reject_out_of_scope', canEditProductCode: false, blockers: ["Changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))], ownerFiles: ownerFiles, issueClass: (_j = diagnosisValidation.normalized) === null || _j === void 0 ? void 0 : _j.issue_class, proofPlan: (_k = diagnosisValidation.normalized) === null || _k === void 0 ? void 0 : _k.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_4));
2652
+ var recoveryPlan_5 = recoveryPlanFor('continue', 'support_v5_out_of_scope_requires_diagnosis_revision', 'owner_scope', false);
2653
+ return __assign({ action: 'reject_out_of_scope', canEditProductCode: false, blockers: ["Changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))], ownerFiles: ownerFiles, issueClass: (_l = diagnosisValidation.normalized) === null || _l === void 0 ? void 0 : _l.issue_class, proofPlan: (_m = diagnosisValidation.normalized) === null || _m === void 0 ? void 0 : _m.proof_plan, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_5));
2455
2654
  }
2456
2655
  var recoveryPlan = recoveryPlanFor('continue', 'support_v5_product_repair_allowed_after_diagnosis', failureClass || 'product_code', true);
2457
- return __assign({ action: 'allow_product_repair', canEditProductCode: true, blockers: [], ownerFiles: ownerFiles, issueClass: (_l = diagnosisValidation.normalized) === null || _l === void 0 ? void 0 : _l.issue_class, proofPlan: (_m = diagnosisValidation.normalized) === null || _m === void 0 ? void 0 : _m.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan));
2656
+ return __assign({ action: 'allow_product_repair', canEditProductCode: true, blockers: [], ownerFiles: ownerFiles, issueClass: (_o = diagnosisValidation.normalized) === null || _o === void 0 ? void 0 : _o.issue_class, proofPlan: (_p = diagnosisValidation.normalized) === null || _p === void 0 ? void 0 : _p.proof_plan, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan));
2458
2657
  }
2459
2658
  function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
2460
2659
  var _a;
@@ -2683,6 +2882,7 @@ function initializeResolveIOSupportV5State(input) {
2683
2882
  var qaThreadKey = cleanText(input.qaThreadKey || ((_b = existingLaneMemory.qa) === null || _b === void 0 ? void 0 : _b.threadKey) || "support:".concat(input.ticketId || input.jobId, ":job:").concat(input.jobId, ":qa"), 240);
2684
2883
  var budget = buildResolveIOSupportV5Budget(existing.supportV5Budget);
2685
2884
  var existingDiagnosisGate = normalizeResolveIOSupportDiagnosisGate(existing.supportV5DiagnosisGate);
2885
+ var existingPreflightGate = evaluateResolveIOSupportPreflightGate(existing.supportV5PreflightGate || existing.support_v5_preflight_gate, now);
2686
2886
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(existingDiagnosisGate);
2687
2887
  var existingProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(existing.supportV5IssueClassProbePlan || existing.support_v5_issue_class_probe_plan, diagnosisValidation.normalized || existingDiagnosisGate, now);
2688
2888
  var scopeDigest = cleanText(existing.supportV5ScopeDigest, 4000) || buildResolveIOSupportV5ScopeDigest({
@@ -2719,6 +2919,9 @@ function initializeResolveIOSupportV5State(input) {
2719
2919
  supportV5DiagnosisGate: diagnosisValidation.valid ? diagnosisValidation.normalized : existingDiagnosisGate,
2720
2920
  supportV5DiagnosisEvidencePack: existing.supportV5DiagnosisEvidencePack || existing.support_v5_diagnosis_evidence_pack,
2721
2921
  supportV5IssueClassProbePlan: existingProbePlanValidation.normalized,
2922
+ supportV5PreflightGate: existingPreflightGate.status === 'unknown' && existingPreflightGate.checks.length === 0
2923
+ ? undefined
2924
+ : existingPreflightGate,
2722
2925
  supportV5LaneMemory: {
2723
2926
  build: {
2724
2927
  lane: 'build',
@@ -2785,6 +2988,9 @@ function recordResolveIOSupportV5Step(bundle, step) {
2785
2988
  var normalizedDiagnosisGate = step.diagnosisGate
2786
2989
  ? normalizeResolveIOSupportDiagnosisGate(step.diagnosisGate, now)
2787
2990
  : undefined;
2991
+ var normalizedPreflightGate = step.preflightGate
2992
+ ? evaluateResolveIOSupportPreflightGate(step.preflightGate, now)
2993
+ : undefined;
2788
2994
  var blockerFingerprint = step.blocker || step.summary
2789
2995
  ? fingerprintResolveIOSupportV5Blocker(step.blocker || step.summary || '')
2790
2996
  : undefined;
@@ -2798,8 +3004,9 @@ function recordResolveIOSupportV5Step(bundle, step) {
2798
3004
  changedFiles: step.changedFiles,
2799
3005
  artifactPaths: step.artifactPaths
2800
3006
  }));
2801
- var record = __assign(__assign({}, (microtaskId ? { microtaskId: microtaskId } : {})), { stepType: step.stepType, outcome: step.outcome, lane: step.lane, model: cleanText(step.model, 80), threadKey: cleanText(step.threadKey, 240), promptTokenEstimate: promptTokens || undefined, runtimeMs: runtimeMs || undefined, summary: cleanText(step.summary || step.blocker || step.outcome, 1200), blocker: cleanText(step.blocker, 1200), changedFiles: cleanList(step.changedFiles, 80, 500), artifactPaths: cleanList(step.artifactPaths, 80, 500), diagnosisGate: normalizedDiagnosisGate, failureClass: cleanText(step.failureClass, 80) || undefined, blockerFingerprint: blockerFingerprint, evidenceHash: evidenceHash, recordedAt: now });
3007
+ var record = __assign(__assign({}, (microtaskId ? { microtaskId: microtaskId } : {})), { stepType: step.stepType, outcome: step.outcome, lane: step.lane, model: cleanText(step.model, 80), threadKey: cleanText(step.threadKey, 240), promptTokenEstimate: promptTokens || undefined, runtimeMs: runtimeMs || undefined, summary: cleanText(step.summary || step.blocker || step.outcome, 1200), blocker: cleanText(step.blocker, 1200), changedFiles: cleanList(step.changedFiles, 80, 500), artifactPaths: cleanList(step.artifactPaths, 80, 500), diagnosisGate: normalizedDiagnosisGate, preflightGate: normalizedPreflightGate, failureClass: cleanText(step.failureClass, 80) || undefined, blockerFingerprint: blockerFingerprint, evidenceHash: evidenceHash, recordedAt: now });
2802
3008
  var diagnosisGate = normalizedDiagnosisGate || bundle.supportV5DiagnosisGate;
3009
+ var preflightGate = normalizedPreflightGate || bundle.supportV5PreflightGate;
2803
3010
  var laneMemory = __assign({}, bundle.supportV5LaneMemory);
2804
3011
  if (step.lane === 'build' || step.lane === 'qa') {
2805
3012
  var previous = laneMemory[step.lane];
@@ -2845,7 +3052,7 @@ function recordResolveIOSupportV5Step(bundle, step) {
2845
3052
  ? 1
2846
3053
  : bundle.supportV5Budget.loopCount + 1;
2847
3054
  var nextMicrotask = selectResolveIOSupportV5ActiveMicrotask(ledger, bundle.supportV5ActiveMicrotaskId);
2848
- var nextBundle = __assign(__assign({}, bundle), { supportV5SupervisorState: supervisor, supportV5DiagnosisGate: diagnosisGate, supportV5LaneMemory: laneMemory, supportV5StepHistory: __spreadArray(__spreadArray([], __read(bundle.supportV5StepHistory), false), [record], false).slice(-100), supportV5Budget: __assign(__assign({}, bundle.supportV5Budget), { totalPromptTokenEstimate: bundle.supportV5Budget.totalPromptTokenEstimate + promptTokens, totalRuntimeMs: bundle.supportV5Budget.totalRuntimeMs + runtimeMs, loopCount: nextLoopCount }), supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextMicrotask === null || nextMicrotask === void 0 ? void 0 : nextMicrotask.microtaskId, supportV5MicrotaskUsageHistory: bundle.supportV5MicrotaskUsageHistory || [], supportV5FailureFingerprints: failureFingerprint
3055
+ var nextBundle = __assign(__assign({}, bundle), { supportV5SupervisorState: supervisor, supportV5DiagnosisGate: diagnosisGate, supportV5PreflightGate: preflightGate, supportV5LaneMemory: laneMemory, supportV5StepHistory: __spreadArray(__spreadArray([], __read(bundle.supportV5StepHistory), false), [record], false).slice(-100), supportV5Budget: __assign(__assign({}, bundle.supportV5Budget), { totalPromptTokenEstimate: bundle.supportV5Budget.totalPromptTokenEstimate + promptTokens, totalRuntimeMs: bundle.supportV5Budget.totalRuntimeMs + runtimeMs, loopCount: nextLoopCount }), supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextMicrotask === null || nextMicrotask === void 0 ? void 0 : nextMicrotask.microtaskId, supportV5MicrotaskUsageHistory: bundle.supportV5MicrotaskUsageHistory || [], supportV5FailureFingerprints: failureFingerprint
2849
3056
  ? __spreadArray(__spreadArray([], __read((bundle.supportV5FailureFingerprints || [])), false), [failureFingerprint], false).slice(-200)
2850
3057
  : (bundle.supportV5FailureFingerprints || []), supportV5RecoveryPlan: managerDecision.recoveryPlan, supportV5RecoveryCheckpoint: managerDecision.recoveryCheckpoint, supportV5RecoveryEvidenceProbe: managerDecision.recoveryEvidenceProbe, supportV5RecoveryAction: managerDecision.recoveryAction });
2851
3058
  if (normalizedDiagnosisGate && validateResolveIOSupportDiagnosisGate(normalizedDiagnosisGate).valid) {
@@ -2927,34 +3134,34 @@ function decideResolveIOSupportV5Continuation(bundle) {
2927
3134
  };
2928
3135
  };
2929
3136
  if (budgetExceeded) {
2930
- var recoveryPlan_5 = recoveryPlanFor('manual_handoff', 'support_v5_budget_guard', {
3137
+ var recoveryPlan_6 = recoveryPlanFor('manual_handoff', 'support_v5_budget_guard', {
2931
3138
  productRepairFailure: false
2932
3139
  });
2933
- return __assign({ action: 'park', reason: 'support_v5_budget_guard', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_5));
3140
+ return __assign({ action: 'park', reason: 'support_v5_budget_guard', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_6));
2934
3141
  }
2935
3142
  var lastFailureClass = cleanText(last === null || last === void 0 ? void 0 : last.failureClass, 80).toLowerCase();
2936
3143
  var materialEvidenceRetryAllowed = (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) === false
2937
3144
  && repeatedFailure.newEvidence === true
2938
3145
  && repeatedFailure.materialEvidence === true;
2939
3146
  if (repeatedNoProgressCount > budget.maxRepeatedNoProgress && /^(infra|compile)$/.test(lastFailureClass)) {
2940
- var recoveryPlan_6 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', {
3147
+ var recoveryPlan_7 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', {
2941
3148
  failureClass: lastFailureClass,
2942
3149
  productRepairFailure: false
2943
3150
  });
2944
- return __assign({ action: 'continue', reason: 'support_v5_infra_or_compile_repair_required', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'compile_check', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_6));
3151
+ return __assign({ action: 'continue', reason: 'support_v5_infra_or_compile_repair_required', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'compile_check', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_7));
2945
3152
  }
2946
3153
  if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
2947
- var recoveryPlan_7 = recoveryPlanFor(repeatedFailure.reason === 'support_v5_ping_pong_failure_loop' ? 'park_ping_pong' : 'park_repeated_failure', repeatedFailure.reason, {
3154
+ var recoveryPlan_8 = recoveryPlanFor(repeatedFailure.reason === 'support_v5_ping_pong_failure_loop' ? 'park_ping_pong' : 'park_repeated_failure', repeatedFailure.reason, {
2948
3155
  failureClass: repeatedFailure.failureClass,
2949
3156
  productRepairFailure: true
2950
3157
  });
2951
- return __assign({ action: 'park', reason: repeatedFailure.reason, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedFailure.repeatedCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_7));
3158
+ return __assign({ action: 'park', reason: repeatedFailure.reason, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedFailure.repeatedCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_8));
2952
3159
  }
2953
3160
  if (repeatedNoProgressCount > budget.maxRepeatedNoProgress && !materialEvidenceRetryAllowed) {
2954
- var recoveryPlan_8 = recoveryPlanFor('park_repeated_failure', 'support_v5_repeated_no_progress', {
3161
+ var recoveryPlan_9 = recoveryPlanFor('park_repeated_failure', 'support_v5_repeated_no_progress', {
2955
3162
  productRepairFailure: true
2956
3163
  });
2957
- return __assign({ action: 'park', reason: 'support_v5_repeated_no_progress', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_8));
3164
+ return __assign({ action: 'park', reason: 'support_v5_repeated_no_progress', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_9));
2958
3165
  }
2959
3166
  var recoveryPlan = recoveryPlanFor('continue', 'support_v5_continue');
2960
3167
  return __assign({ action: 'continue', reason: 'support_v5_continue', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.supportV5SupervisorState.activeStep, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, recoveryFieldsFor(recoveryPlan));
@@ -2962,6 +3169,7 @@ function decideResolveIOSupportV5Continuation(bundle) {
2962
3169
  function decideResolveIOSupportV5AutonomousNextAction(input) {
2963
3170
  var _a, _b, _c, _d, _e, _f, _g, _h;
2964
3171
  var bundle = input.bundle;
3172
+ var preflightGate = evaluateResolveIOSupportPreflightGate(input.preflightGate || bundle.supportV5PreflightGate, input.now);
2965
3173
  var activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(bundle.supportV5MicrotaskLedger || [], bundle.supportV5ActiveMicrotaskId);
2966
3174
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(bundle.supportV5DiagnosisGate, {
2967
3175
  maxOwnerFiles: input.maxOwnerFiles
@@ -2969,6 +3177,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2969
3177
  var activeStepType = cleanText((activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.type) || (!diagnosisValidation.valid ? bundle.supportV5SupervisorState.activeStep : 'cleanup') || 'diagnosis_gate', 80);
2970
3178
  var repairGate = decideResolveIOSupportV5RepairGate({
2971
3179
  diagnosisGate: bundle.supportV5DiagnosisGate,
3180
+ preflightGate: preflightGate,
2972
3181
  activeStepType: activeStepType,
2973
3182
  changedFiles: input.changedFiles,
2974
3183
  failureClass: input.failureClass,
@@ -3077,7 +3286,8 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3077
3286
  var ownerFilesReady = diagnosisValid && ownerFiles.length > 0;
3078
3287
  var proofPlanReady = diagnosisValid && !!proofContract;
3079
3288
  var issueClassProbePlanReady = issueClassProbePlanValidation.valid === true;
3080
- var rootCauseFirstSatisfied = diagnosisValid && ownerFilesReady && proofPlanReady && issueClassProbePlanReady;
3289
+ var preflightReady = preflightGate.blocksProductRepair !== true;
3290
+ var rootCauseFirstSatisfied = diagnosisValid && ownerFilesReady && proofPlanReady && issueClassProbePlanReady && preflightReady;
3081
3291
  var sameFailureParked = evidenceFreshness.mustCollectNewEvidence === true
3082
3292
  || (action === 'collect_new_evidence' && /repeated|no_progress|ping_pong|same failure|same evidence/i.test(reason));
3083
3293
  return {
@@ -3099,8 +3309,11 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3099
3309
  || action === 'ask_customer_clarification',
3100
3310
  requiresHumanDecision: action === 'park_manual' || fields.canRunAutonomously !== true,
3101
3311
  issueClassProbePlanReady: issueClassProbePlanReady,
3312
+ preflightReady: preflightReady,
3313
+ preflightStatus: preflightGate.status,
3314
+ preflightFailureClass: preflightGate.failureClass,
3102
3315
  reason: reason,
3103
- blockers: Array.from(new Set(__spreadArray(__spreadArray([], __read(blockers), false), __read(issueClassProbePlanValidation.blockers), false))),
3316
+ blockers: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(blockers), false), __read(issueClassProbePlanValidation.blockers), false), __read(preflightGate.blockers), false))),
3104
3317
  ownerFiles: ownerFiles,
3105
3318
  issueClass: ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.issue_class) || repairGate.issueClass,
3106
3319
  expectedProof: expectedProof,
@@ -3109,7 +3322,8 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3109
3322
  businessProofStatus: businessProofReadiness.status,
3110
3323
  proofFingerprint: businessProofReadiness.proofFingerprint,
3111
3324
  artifactFingerprint: businessProofReadiness.artifactFingerprint,
3112
- proofFreshness: businessProofReadiness.proofFreshness
3325
+ proofFreshness: businessProofReadiness.proofFreshness,
3326
+ preflightGate: preflightGate
3113
3327
  };
3114
3328
  };
3115
3329
  var nextActionExpectedTransition = function (action, primaryCommand) {
@@ -3232,6 +3446,10 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3232
3446
  evidenceHash: evidenceFreshness.evidenceHash,
3233
3447
  sameFailureCount: evidenceFreshness.sameFailureCount,
3234
3448
  issueClassProbePlanReady: rootCauseReadiness.issueClassProbePlanReady === true,
3449
+ preflightReady: rootCauseReadiness.preflightReady === true,
3450
+ preflightStatus: preflightGate.status,
3451
+ preflightFailureClass: preflightGate.failureClass,
3452
+ preflightEvidenceHash: preflightGate.evidenceHash,
3235
3453
  hotfixCommitRequired: hotfixCommitRequired,
3236
3454
  liveHotfixBlockedUntilCommit: liveHotfixBlockedUntilCommit
3237
3455
  },
@@ -3448,6 +3666,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3448
3666
  customerReplyPolicy: customerReplyPolicy,
3449
3667
  businessProofReadiness: businessProofReadiness,
3450
3668
  evidenceFreshness: evidenceFreshness,
3669
+ preflightGate: preflightGate,
3451
3670
  rootCauseReadiness: rootCauseReadiness,
3452
3671
  continuationProofCheckpoint: continuationProofCheckpoint,
3453
3672
  nextActionContract: nextActionContract,
@@ -3522,16 +3741,27 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3522
3741
  });
3523
3742
  }
3524
3743
  if (repairGate.action === 'infra_repair_only') {
3525
- return makeDecision('repair_infra_only', 'Repair Infra Only', 'support_v5_infra_failure_before_product_repair', {
3744
+ var compileOnly = repairGate.preflightGate.failureClass === 'compile' || input.failureClass === 'compile';
3745
+ var preflightNextCommand = repairGate.preflightGate.nextCommand === 'continue_to_diagnosis'
3746
+ ? undefined
3747
+ : repairGate.preflightGate.nextCommand;
3748
+ return makeDecision('repair_infra_only', compileOnly ? 'Repair Compile Only' : 'Repair Infra Only', 'support_v5_infra_failure_before_product_repair', {
3526
3749
  canRunAutonomously: true,
3527
3750
  canRunModel: false,
3528
3751
  canEditProductCode: false,
3529
3752
  canRunQa: true,
3530
3753
  lane: 'qa',
3531
3754
  stepType: activeStepType,
3532
- primaryCommand: 'run_support_v5_infra_repair',
3533
- nextCommands: ['rerun_puppeteer_compile_startup_preflight', 'repair_harness_or_cache_only', 'record_infra_artifact'],
3534
- requiredEvidence: ['preflight log', 'compile/startup/browser status', 'new infra blocker hash or pass'],
3755
+ primaryCommand: preflightNextCommand || (compileOnly ? 'run_support_v5_compile_repair' : 'run_support_v5_infra_repair'),
3756
+ nextCommands: Array.from(new Set([
3757
+ preflightNextCommand || (compileOnly ? 'run_support_v5_compile_repair' : 'run_support_v5_infra_repair'),
3758
+ 'rerun_puppeteer_compile_startup_preflight',
3759
+ compileOnly ? 'repair_compile_or_cache_only' : 'repair_harness_or_cache_only',
3760
+ 'record_infra_artifact'
3761
+ ])),
3762
+ requiredEvidence: repairGate.preflightGate.requiredEvidence.length
3763
+ ? repairGate.preflightGate.requiredEvidence
3764
+ : ['preflight log', 'compile/startup/browser status', 'new infra blocker hash or pass'],
3535
3765
  blockers: repairGate.blockers,
3536
3766
  forbiddenActions: ['Do not charge infra failures as product-code repair failures.']
3537
3767
  });