scene-capability-engine 3.2.0 → 3.3.1

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.
@@ -47,7 +47,7 @@ const AUTO_HANDOFF_POLICY_PROFILE_PRESETS = {
47
47
  require_capability_coverage: true,
48
48
  require_capability_semantic: true,
49
49
  require_capability_lexicon: true,
50
- require_release_gate_preflight: false,
50
+ require_release_gate_preflight: true,
51
51
  dependency_batching: true,
52
52
  release_evidence_window: 5
53
53
  },
@@ -66,7 +66,7 @@ const AUTO_HANDOFF_POLICY_PROFILE_PRESETS = {
66
66
  require_capability_coverage: true,
67
67
  require_capability_semantic: true,
68
68
  require_capability_lexicon: true,
69
- require_release_gate_preflight: false,
69
+ require_release_gate_preflight: true,
70
70
  dependency_batching: true,
71
71
  release_evidence_window: 5
72
72
  },
@@ -1930,6 +1930,77 @@ function registerAutoCommands(program) {
1930
1930
  }
1931
1931
  });
1932
1932
 
1933
+ autoHandoff
1934
+ .command('preflight-check')
1935
+ .description('Evaluate release-gate preflight readiness from gate-history signals')
1936
+ .option('--profile <profile>', 'Handoff policy profile: default|moqui|enterprise (default: default)', 'default')
1937
+ .option('--history-file <path>', `Release gate history file (default: ${AUTO_HANDOFF_RELEASE_GATE_HISTORY_FILE})`)
1938
+ .option('--require-release-gate-preflight', 'Gate: require release-gate preflight signal to be available and unblocked (default: enabled)')
1939
+ .option('--no-require-release-gate-preflight', 'Gate: disable release-gate preflight hard requirement (not recommended)')
1940
+ .option('--release-evidence-window <n>', 'Release evidence trend window size (2-50, default from profile)', parseInt)
1941
+ .option('--require-pass', 'Exit non-zero when preflight status is not pass')
1942
+ .option('--json', 'Output machine-readable JSON')
1943
+ .action(async (options) => {
1944
+ try {
1945
+ const result = await buildAutoHandoffPreflightCheck(process.cwd(), options);
1946
+ if (options.json) {
1947
+ console.log(JSON.stringify(result, null, 2));
1948
+ } else {
1949
+ console.log(chalk.blue('Auto handoff preflight check:'));
1950
+ console.log(chalk.gray(` Status: ${result.status}`));
1951
+ console.log(chalk.gray(` Profile: ${result.policy.profile}`));
1952
+ console.log(chalk.gray(` Hard-gate preflight: ${result.policy.require_release_gate_preflight ? 'enabled' : 'advisory'}`));
1953
+ console.log(chalk.gray(` History file: ${result.release_gate_preflight.file || 'n/a'}`));
1954
+ console.log(chalk.gray(` Preflight available: ${result.release_gate_preflight.available === true ? 'yes' : 'no'}`));
1955
+ console.log(chalk.gray(` Preflight blocked: ${result.release_gate_preflight.blocked === true ? 'yes' : 'no'}`));
1956
+ if (result.release_gate_preflight.latest_tag) {
1957
+ console.log(chalk.gray(` Latest tag: ${result.release_gate_preflight.latest_tag}`));
1958
+ }
1959
+ if (
1960
+ Number.isFinite(Number(result.release_gate_preflight.latest_weekly_ops_runtime_block_rate_percent)) ||
1961
+ Number.isFinite(Number(result.release_gate_preflight.latest_weekly_ops_runtime_ui_mode_violation_total))
1962
+ ) {
1963
+ const runtimeBlockRateText = Number.isFinite(Number(result.release_gate_preflight.latest_weekly_ops_runtime_block_rate_percent))
1964
+ ? `${result.release_gate_preflight.latest_weekly_ops_runtime_block_rate_percent}%`
1965
+ : 'n/a';
1966
+ const runtimeUiModeTotalText = Number.isFinite(Number(result.release_gate_preflight.latest_weekly_ops_runtime_ui_mode_violation_total))
1967
+ ? `${result.release_gate_preflight.latest_weekly_ops_runtime_ui_mode_violation_total}`
1968
+ : 'n/a';
1969
+ const runtimeUiModeRateText = Number.isFinite(Number(result.release_gate_preflight.latest_weekly_ops_runtime_ui_mode_violation_rate_percent))
1970
+ ? `${result.release_gate_preflight.latest_weekly_ops_runtime_ui_mode_violation_rate_percent}%`
1971
+ : 'n/a';
1972
+ console.log(
1973
+ chalk.gray(
1974
+ ` Runtime pressure (latest): block-rate=${runtimeBlockRateText} | ui-mode=${runtimeUiModeTotalText}/${runtimeUiModeRateText}`
1975
+ )
1976
+ );
1977
+ }
1978
+ if (Array.isArray(result.reasons) && result.reasons.length > 0) {
1979
+ console.log(chalk.gray(' Reasons:'));
1980
+ result.reasons.forEach(item => {
1981
+ console.log(chalk.gray(` - ${item}`));
1982
+ });
1983
+ }
1984
+ if (Array.isArray(result.recommended_commands) && result.recommended_commands.length > 0) {
1985
+ console.log(chalk.gray(' Recommended commands:'));
1986
+ result.recommended_commands.slice(0, 5).forEach(item => {
1987
+ console.log(chalk.gray(` - ${item}`));
1988
+ });
1989
+ }
1990
+ }
1991
+ if (options.requirePass && result.status !== 'pass') {
1992
+ process.exit(1);
1993
+ }
1994
+ } catch (error) {
1995
+ if (options.json) {
1996
+ console.log(JSON.stringify({ success: false, error: error.message }, null, 2));
1997
+ } else {
1998
+ console.error(chalk.red(`Error: ${error.message}`));
1999
+ }
2000
+ process.exit(1);
2001
+ }
2002
+ });
2003
+
1933
2004
  autoHandoff
1934
2005
  .command('run')
1935
2006
  .description('Execute handoff integration pipeline: plan -> queue -> close-loop-batch -> observability')
@@ -1969,8 +2040,8 @@ function registerAutoCommands(program) {
1969
2040
  .option('--no-require-capability-coverage', 'Gate: disable capability coverage requirement (not recommended)')
1970
2041
  .option('--require-capability-lexicon', 'Gate: require capability lexicon normalization (unknown expected/provided aliases not allowed, default: enabled)')
1971
2042
  .option('--no-require-capability-lexicon', 'Gate: disable capability lexicon normalization requirement (not recommended)')
1972
- .option('--require-release-gate-preflight', 'Gate: require release-gate preflight signal to be available and unblocked (default: disabled/advisory)')
1973
- .option('--no-require-release-gate-preflight', 'Gate: disable release-gate preflight hard requirement (default)')
2043
+ .option('--require-release-gate-preflight', 'Gate: require release-gate preflight signal to be available and unblocked (default: enabled)')
2044
+ .option('--no-require-release-gate-preflight', 'Gate: disable release-gate preflight hard requirement (not recommended)')
1974
2045
  .option('--release-evidence-window <n>', 'Release evidence trend window size (2-50, default: 5)', parseInt)
1975
2046
  .option('--json', 'Output machine-readable JSON')
1976
2047
  .action(async (options) => {
@@ -2006,6 +2077,25 @@ function registerAutoCommands(program) {
2006
2077
  if (preflight.latest_tag) {
2007
2078
  console.log(chalk.gray(` Latest tag: ${preflight.latest_tag}`));
2008
2079
  }
2080
+ if (
2081
+ Number.isFinite(Number(preflight.latest_weekly_ops_runtime_block_rate_percent)) ||
2082
+ Number.isFinite(Number(preflight.latest_weekly_ops_runtime_ui_mode_violation_total))
2083
+ ) {
2084
+ const runtimeBlockRateText = Number.isFinite(Number(preflight.latest_weekly_ops_runtime_block_rate_percent))
2085
+ ? `${preflight.latest_weekly_ops_runtime_block_rate_percent}%`
2086
+ : 'n/a';
2087
+ const runtimeUiModeTotalText = Number.isFinite(Number(preflight.latest_weekly_ops_runtime_ui_mode_violation_total))
2088
+ ? `${preflight.latest_weekly_ops_runtime_ui_mode_violation_total}`
2089
+ : 'n/a';
2090
+ const runtimeUiModeRateText = Number.isFinite(Number(preflight.latest_weekly_ops_runtime_ui_mode_violation_rate_percent))
2091
+ ? `${preflight.latest_weekly_ops_runtime_ui_mode_violation_rate_percent}%`
2092
+ : 'n/a';
2093
+ console.log(
2094
+ chalk.gray(
2095
+ ` Runtime pressure: block-rate=${runtimeBlockRateText} | ui-mode=${runtimeUiModeTotalText}/${runtimeUiModeRateText}`
2096
+ )
2097
+ );
2098
+ }
2009
2099
  if (preflight.reasons && preflight.reasons.length > 0) {
2010
2100
  console.log(chalk.gray(` Reasons: ${preflight.reasons.join(' | ')}`));
2011
2101
  }
@@ -5197,6 +5287,50 @@ async function runCloseLoopBatchWithRetries(goals, options) {
5197
5287
  'Goal was not processed.'
5198
5288
  ));
5199
5289
  const effectivePerformedRounds = Math.min(retryMaxRounds, Math.max(0, retryHistory.length - 1));
5290
+ const totalRateLimitSignals = retryHistory.reduce((sum, item) => {
5291
+ return sum + (Number(item && item.rate_limit_signals) || 0);
5292
+ }, 0);
5293
+ const totalRateLimitBackoffMs = retryHistory.reduce((sum, item) => {
5294
+ return sum + (Number(item && item.rate_limit_backoff_ms) || 0);
5295
+ }, 0);
5296
+ const totalRateLimitLaunchHoldMs = retryHistory.reduce((sum, item) => {
5297
+ return sum + (Number(item && item.rate_limit_launch_hold_ms) || 0);
5298
+ }, 0);
5299
+ const rateLimitPressureDetected =
5300
+ totalRateLimitSignals > 0 || totalRateLimitBackoffMs > 0 || totalRateLimitLaunchHoldMs > 0;
5301
+ const rateLimitRecoveryRecommended = exhausted && rateLimitPressureDetected;
5302
+
5303
+ const safeBatchParallel = Number.isInteger(configuredBatchParallel)
5304
+ ? configuredBatchParallel
5305
+ : 1;
5306
+ const safeBatchAgentBudget = Number.isInteger(configuredBatchAgentBudget)
5307
+ ? configuredBatchAgentBudget
5308
+ : null;
5309
+ const recommendedBatchParallel = Math.max(1, Math.min(2, safeBatchParallel));
5310
+ const recommendedBatchAgentBudget = safeBatchAgentBudget === null
5311
+ ? 2
5312
+ : Math.max(1, Math.min(2, safeBatchAgentBudget));
5313
+ const recommendedRetryMaxRounds = Math.max(2, Math.min(20, retryMaxRounds + 2));
5314
+ const recoveryPatch = rateLimitRecoveryRecommended
5315
+ ? {
5316
+ batch_parallel: recommendedBatchParallel,
5317
+ batch_agent_budget: recommendedBatchAgentBudget,
5318
+ batch_retry_until_complete: true,
5319
+ batch_retry_strategy: 'adaptive',
5320
+ batch_retry_max_rounds: recommendedRetryMaxRounds
5321
+ }
5322
+ : null;
5323
+ const recoverySuggestedCommand = rateLimitRecoveryRecommended
5324
+ ? [
5325
+ 'sce auto close-loop-recover latest',
5326
+ `--batch-parallel ${recommendedBatchParallel}`,
5327
+ `--batch-agent-budget ${recommendedBatchAgentBudget}`,
5328
+ '--batch-retry-until-complete',
5329
+ '--batch-retry-strategy adaptive',
5330
+ `--batch-retry-max-rounds ${recommendedRetryMaxRounds}`,
5331
+ '--json'
5332
+ ].join(' ')
5333
+ : null;
5200
5334
 
5201
5335
  return {
5202
5336
  effectiveParallel,
@@ -5211,6 +5345,13 @@ async function runCloseLoopBatchWithRetries(goals, options) {
5211
5345
  max_rounds: retryMaxRounds,
5212
5346
  performed_rounds: effectivePerformedRounds,
5213
5347
  exhausted,
5348
+ rate_limit_pressure_detected: rateLimitPressureDetected,
5349
+ total_rate_limit_signals: totalRateLimitSignals,
5350
+ total_rate_limit_backoff_ms: totalRateLimitBackoffMs,
5351
+ total_rate_limit_launch_hold_ms: totalRateLimitLaunchHoldMs,
5352
+ recovery_recommended: rateLimitRecoveryRecommended,
5353
+ recovery_patch: recoveryPatch,
5354
+ recovery_suggested_command: recoverySuggestedCommand,
5214
5355
  history: retryHistory
5215
5356
  }
5216
5357
  };
@@ -6536,6 +6677,15 @@ function printCloseLoopBatchSummary(summary, options) {
6536
6677
  ` Batch retry: ${summary.batch_retry.performed_rounds}/${summary.batch_retry.configured_rounds} extra rounds`
6537
6678
  ));
6538
6679
  }
6680
+ if (summary.batch_retry && summary.batch_retry.recovery_recommended) {
6681
+ console.log(chalk.yellow(
6682
+ ` Rate-limit recovery recommended: signals=${summary.batch_retry.total_rate_limit_signals || 0}, ` +
6683
+ `backoff=${summary.batch_retry.total_rate_limit_backoff_ms || 0}ms`
6684
+ ));
6685
+ if (summary.batch_retry.recovery_suggested_command) {
6686
+ console.log(chalk.yellow(` Suggested command: ${summary.batch_retry.recovery_suggested_command}`));
6687
+ }
6688
+ }
6539
6689
  if (summary.resource_plan.agent_budget !== null) {
6540
6690
  console.log(chalk.gray(
6541
6691
  ` Agent budget: ${summary.resource_plan.agent_budget} ` +
@@ -9287,6 +9437,162 @@ function buildAutoHandoffReleaseGateHistoryEntry(entry = {}, options = {}) {
9287
9437
  ? entry.drift_evaluated_at
9288
9438
  : drift.evaluated_at
9289
9439
  );
9440
+ const weeklyOps = entry && typeof entry.weekly_ops === 'object' && !Array.isArray(entry.weekly_ops)
9441
+ ? entry.weekly_ops
9442
+ : {};
9443
+ const weeklyOpsSignals = weeklyOps && typeof weeklyOps.signals === 'object' && !Array.isArray(weeklyOps.signals)
9444
+ ? weeklyOps.signals
9445
+ : {};
9446
+ const weeklyOpsViolations = Array.isArray(weeklyOps.violations)
9447
+ ? weeklyOps.violations.map(item => `${item}`)
9448
+ : [];
9449
+ const weeklyOpsWarnings = Array.isArray(weeklyOps.warnings)
9450
+ ? weeklyOps.warnings.map(item => `${item}`)
9451
+ : [];
9452
+ const weeklyOpsConfigWarnings = Array.isArray(weeklyOps.config_warnings)
9453
+ ? weeklyOps.config_warnings.map(item => `${item}`)
9454
+ : [];
9455
+ const weeklyOpsAvailable = parseAutoHandoffGateBoolean(entry.weekly_ops_available, null) === true
9456
+ || Object.keys(weeklyOps).length > 0;
9457
+ const weeklyOpsBlocked = parseAutoHandoffGateBoolean(
9458
+ entry.weekly_ops_blocked !== undefined
9459
+ ? entry.weekly_ops_blocked
9460
+ : weeklyOps.blocked,
9461
+ null
9462
+ );
9463
+ const weeklyOpsRiskRaw = normalizeHandoffText(
9464
+ entry.weekly_ops_risk_level !== undefined
9465
+ ? entry.weekly_ops_risk_level
9466
+ : weeklyOpsSignals.risk
9467
+ );
9468
+ const weeklyOpsRiskLevel = weeklyOpsRiskRaw
9469
+ ? normalizeAutoHandoffGateRiskLevel(weeklyOpsRiskRaw)
9470
+ : null;
9471
+ const weeklyOpsGovernanceStatus = normalizeHandoffText(
9472
+ entry.weekly_ops_governance_status !== undefined
9473
+ ? entry.weekly_ops_governance_status
9474
+ : weeklyOpsSignals.governance_status
9475
+ ) || null;
9476
+ const weeklyOpsAuthorizationTierBlockRatePercentCandidate = (
9477
+ entry.weekly_ops_authorization_tier_block_rate_percent !== undefined
9478
+ ? entry.weekly_ops_authorization_tier_block_rate_percent
9479
+ : weeklyOpsSignals.authorization_tier_block_rate_percent
9480
+ );
9481
+ const weeklyOpsDialogueAuthorizationBlockRatePercentCandidate = (
9482
+ entry.weekly_ops_dialogue_authorization_block_rate_percent !== undefined
9483
+ ? entry.weekly_ops_dialogue_authorization_block_rate_percent
9484
+ : weeklyOpsSignals.dialogue_authorization_block_rate_percent
9485
+ );
9486
+ const weeklyOpsMatrixRegressionPositiveRatePercentCandidate = (
9487
+ entry.weekly_ops_matrix_regression_positive_rate_percent !== undefined
9488
+ ? entry.weekly_ops_matrix_regression_positive_rate_percent
9489
+ : weeklyOpsSignals.matrix_regression_positive_rate_percent
9490
+ );
9491
+ const weeklyOpsRuntimeBlockRatePercentCandidate = (
9492
+ entry.weekly_ops_runtime_block_rate_percent !== undefined
9493
+ ? entry.weekly_ops_runtime_block_rate_percent
9494
+ : weeklyOpsSignals.runtime_block_rate_percent
9495
+ );
9496
+ const weeklyOpsRuntimeUiModeViolationTotalCandidate = (
9497
+ entry.weekly_ops_runtime_ui_mode_violation_total !== undefined
9498
+ ? entry.weekly_ops_runtime_ui_mode_violation_total
9499
+ : weeklyOpsSignals.runtime_ui_mode_violation_total
9500
+ );
9501
+ const weeklyOpsRuntimeUiModeViolationRatePercentCandidate = (
9502
+ entry.weekly_ops_runtime_ui_mode_violation_rate_percent !== undefined
9503
+ ? entry.weekly_ops_runtime_ui_mode_violation_rate_percent
9504
+ : weeklyOpsSignals.runtime_ui_mode_violation_rate_percent
9505
+ );
9506
+ const weeklyOpsViolationsCountCandidate = (
9507
+ entry.weekly_ops_violations_count !== undefined
9508
+ ? entry.weekly_ops_violations_count
9509
+ : (
9510
+ weeklyOps.violations_count !== undefined
9511
+ ? weeklyOps.violations_count
9512
+ : (weeklyOpsAvailable ? weeklyOpsViolations.length : null)
9513
+ )
9514
+ );
9515
+ const weeklyOpsWarningCountCandidate = (
9516
+ entry.weekly_ops_warning_count !== undefined
9517
+ ? entry.weekly_ops_warning_count
9518
+ : (
9519
+ weeklyOps.warning_count !== undefined
9520
+ ? weeklyOps.warning_count
9521
+ : (weeklyOpsAvailable ? weeklyOpsWarnings.length : null)
9522
+ )
9523
+ );
9524
+ const weeklyOpsConfigWarningCountCandidate = (
9525
+ entry.weekly_ops_config_warning_count !== undefined
9526
+ ? entry.weekly_ops_config_warning_count
9527
+ : (
9528
+ weeklyOps.config_warning_count !== undefined
9529
+ ? weeklyOps.config_warning_count
9530
+ : (weeklyOpsAvailable ? weeklyOpsConfigWarnings.length : null)
9531
+ )
9532
+ );
9533
+ const weeklyOpsAuthorizationTierBlockRatePercent = (
9534
+ weeklyOpsAuthorizationTierBlockRatePercentCandidate === null
9535
+ || weeklyOpsAuthorizationTierBlockRatePercentCandidate === undefined
9536
+ || weeklyOpsAuthorizationTierBlockRatePercentCandidate === ''
9537
+ )
9538
+ ? null
9539
+ : parseAutoHandoffGateNumber(weeklyOpsAuthorizationTierBlockRatePercentCandidate);
9540
+ const weeklyOpsDialogueAuthorizationBlockRatePercent = (
9541
+ weeklyOpsDialogueAuthorizationBlockRatePercentCandidate === null
9542
+ || weeklyOpsDialogueAuthorizationBlockRatePercentCandidate === undefined
9543
+ || weeklyOpsDialogueAuthorizationBlockRatePercentCandidate === ''
9544
+ )
9545
+ ? null
9546
+ : parseAutoHandoffGateNumber(weeklyOpsDialogueAuthorizationBlockRatePercentCandidate);
9547
+ const weeklyOpsMatrixRegressionPositiveRatePercent = (
9548
+ weeklyOpsMatrixRegressionPositiveRatePercentCandidate === null
9549
+ || weeklyOpsMatrixRegressionPositiveRatePercentCandidate === undefined
9550
+ || weeklyOpsMatrixRegressionPositiveRatePercentCandidate === ''
9551
+ )
9552
+ ? null
9553
+ : parseAutoHandoffGateNumber(weeklyOpsMatrixRegressionPositiveRatePercentCandidate);
9554
+ const weeklyOpsRuntimeBlockRatePercent = (
9555
+ weeklyOpsRuntimeBlockRatePercentCandidate === null
9556
+ || weeklyOpsRuntimeBlockRatePercentCandidate === undefined
9557
+ || weeklyOpsRuntimeBlockRatePercentCandidate === ''
9558
+ )
9559
+ ? null
9560
+ : parseAutoHandoffGateNumber(weeklyOpsRuntimeBlockRatePercentCandidate);
9561
+ const weeklyOpsRuntimeUiModeViolationTotal = (
9562
+ weeklyOpsRuntimeUiModeViolationTotalCandidate === null
9563
+ || weeklyOpsRuntimeUiModeViolationTotalCandidate === undefined
9564
+ || weeklyOpsRuntimeUiModeViolationTotalCandidate === ''
9565
+ )
9566
+ ? null
9567
+ : parseAutoHandoffGateNumber(weeklyOpsRuntimeUiModeViolationTotalCandidate);
9568
+ const weeklyOpsRuntimeUiModeViolationRatePercent = (
9569
+ weeklyOpsRuntimeUiModeViolationRatePercentCandidate === null
9570
+ || weeklyOpsRuntimeUiModeViolationRatePercentCandidate === undefined
9571
+ || weeklyOpsRuntimeUiModeViolationRatePercentCandidate === ''
9572
+ )
9573
+ ? null
9574
+ : parseAutoHandoffGateNumber(weeklyOpsRuntimeUiModeViolationRatePercentCandidate);
9575
+ const weeklyOpsViolationsCount = (
9576
+ weeklyOpsViolationsCountCandidate === null
9577
+ || weeklyOpsViolationsCountCandidate === undefined
9578
+ || weeklyOpsViolationsCountCandidate === ''
9579
+ )
9580
+ ? null
9581
+ : parseAutoHandoffGateNumber(weeklyOpsViolationsCountCandidate);
9582
+ const weeklyOpsWarningCount = (
9583
+ weeklyOpsWarningCountCandidate === null
9584
+ || weeklyOpsWarningCountCandidate === undefined
9585
+ || weeklyOpsWarningCountCandidate === ''
9586
+ )
9587
+ ? null
9588
+ : parseAutoHandoffGateNumber(weeklyOpsWarningCountCandidate);
9589
+ const weeklyOpsConfigWarningCount = (
9590
+ weeklyOpsConfigWarningCountCandidate === null
9591
+ || weeklyOpsConfigWarningCountCandidate === undefined
9592
+ || weeklyOpsConfigWarningCountCandidate === ''
9593
+ )
9594
+ ? null
9595
+ : parseAutoHandoffGateNumber(weeklyOpsConfigWarningCountCandidate);
9290
9596
  const violations = Array.isArray(entry.violations)
9291
9597
  ? entry.violations.map(item => `${item}`)
9292
9598
  : [];
@@ -9351,6 +9657,37 @@ function buildAutoHandoffReleaseGateHistoryEntry(entry = {}, options = {}) {
9351
9657
  drift_blocked: typeof driftBlocked === 'boolean' ? driftBlocked : null,
9352
9658
  drift_enforce: typeof driftEnforce === 'boolean' ? driftEnforce : null,
9353
9659
  drift_evaluated_at: driftEvaluatedAt || null,
9660
+ weekly_ops_available: weeklyOpsAvailable,
9661
+ weekly_ops_blocked: typeof weeklyOpsBlocked === 'boolean' ? weeklyOpsBlocked : null,
9662
+ weekly_ops_risk_level: weeklyOpsRiskLevel,
9663
+ weekly_ops_governance_status: weeklyOpsGovernanceStatus,
9664
+ weekly_ops_authorization_tier_block_rate_percent: Number.isFinite(weeklyOpsAuthorizationTierBlockRatePercent)
9665
+ ? weeklyOpsAuthorizationTierBlockRatePercent
9666
+ : null,
9667
+ weekly_ops_dialogue_authorization_block_rate_percent: Number.isFinite(weeklyOpsDialogueAuthorizationBlockRatePercent)
9668
+ ? weeklyOpsDialogueAuthorizationBlockRatePercent
9669
+ : null,
9670
+ weekly_ops_matrix_regression_positive_rate_percent: Number.isFinite(weeklyOpsMatrixRegressionPositiveRatePercent)
9671
+ ? weeklyOpsMatrixRegressionPositiveRatePercent
9672
+ : null,
9673
+ weekly_ops_runtime_block_rate_percent: Number.isFinite(weeklyOpsRuntimeBlockRatePercent)
9674
+ ? weeklyOpsRuntimeBlockRatePercent
9675
+ : null,
9676
+ weekly_ops_runtime_ui_mode_violation_total: Number.isFinite(weeklyOpsRuntimeUiModeViolationTotal)
9677
+ ? Math.max(0, Number(weeklyOpsRuntimeUiModeViolationTotal))
9678
+ : null,
9679
+ weekly_ops_runtime_ui_mode_violation_rate_percent: Number.isFinite(weeklyOpsRuntimeUiModeViolationRatePercent)
9680
+ ? Math.max(0, Number(weeklyOpsRuntimeUiModeViolationRatePercent))
9681
+ : null,
9682
+ weekly_ops_violations_count: Number.isFinite(weeklyOpsViolationsCount)
9683
+ ? Math.max(0, Number(weeklyOpsViolationsCount))
9684
+ : null,
9685
+ weekly_ops_warning_count: Number.isFinite(weeklyOpsWarningCount)
9686
+ ? Math.max(0, Number(weeklyOpsWarningCount))
9687
+ : null,
9688
+ weekly_ops_config_warning_count: Number.isFinite(weeklyOpsConfigWarningCount)
9689
+ ? Math.max(0, Number(weeklyOpsConfigWarningCount))
9690
+ : null,
9354
9691
  violations_count: Math.max(0, Number(violationsCount) || 0),
9355
9692
  config_warning_count: Math.max(0, Number(configWarningCount) || 0),
9356
9693
  thresholds,
@@ -9496,6 +9833,20 @@ function buildAutoHandoffReleaseGateHistoryAggregates(entries = []) {
9496
9833
  let driftAlertRuns = 0;
9497
9834
  let driftBlockedRuns = 0;
9498
9835
  let driftKnownRuns = 0;
9836
+ let weeklyOpsKnownRuns = 0;
9837
+ let weeklyOpsBlockedRuns = 0;
9838
+ let weeklyOpsViolationsTotal = 0;
9839
+ let weeklyOpsWarningsTotal = 0;
9840
+ let weeklyOpsConfigWarningsTotal = 0;
9841
+ let weeklyOpsConfigWarningRuns = 0;
9842
+ let weeklyOpsRuntimeUiModeViolationKnownRuns = 0;
9843
+ let weeklyOpsRuntimeUiModeViolationRuns = 0;
9844
+ let weeklyOpsRuntimeUiModeViolationTotal = 0;
9845
+ const weeklyOpsAuthorizationTierBlockRates = [];
9846
+ const weeklyOpsDialogueAuthorizationBlockRates = [];
9847
+ const weeklyOpsMatrixRegressionPositiveRates = [];
9848
+ const weeklyOpsRuntimeBlockRates = [];
9849
+ const weeklyOpsRuntimeUiModeViolationRates = [];
9499
9850
  let preflightKnownRuns = 0;
9500
9851
  let preflightAvailableRuns = 0;
9501
9852
  let preflightBlockedRuns = 0;
@@ -9630,6 +9981,145 @@ function buildAutoHandoffReleaseGateHistoryAggregates(entries = []) {
9630
9981
  driftKnownRuns += 1;
9631
9982
  }
9632
9983
 
9984
+ const weeklyOpsBlocked = parseAutoHandoffGateBoolean(entry && entry.weekly_ops_blocked, null);
9985
+ const weeklyOpsViolationsCountRaw = entry && entry.weekly_ops_violations_count;
9986
+ const weeklyOpsWarningCountRaw = entry && entry.weekly_ops_warning_count;
9987
+ const weeklyOpsConfigWarningCountRaw = entry && entry.weekly_ops_config_warning_count;
9988
+ const weeklyOpsAuthorizationTierBlockRateRaw = entry && entry.weekly_ops_authorization_tier_block_rate_percent;
9989
+ const weeklyOpsDialogueAuthorizationBlockRateRaw = entry && entry.weekly_ops_dialogue_authorization_block_rate_percent;
9990
+ const weeklyOpsMatrixRegressionPositiveRateRaw = entry && entry.weekly_ops_matrix_regression_positive_rate_percent;
9991
+ const weeklyOpsRuntimeBlockRateRaw = entry && entry.weekly_ops_runtime_block_rate_percent;
9992
+ const weeklyOpsRuntimeUiModeViolationTotalRaw = entry && entry.weekly_ops_runtime_ui_mode_violation_total;
9993
+ const weeklyOpsRuntimeUiModeViolationRateRaw = entry && entry.weekly_ops_runtime_ui_mode_violation_rate_percent;
9994
+ const weeklyOpsViolationsCount = (
9995
+ weeklyOpsViolationsCountRaw === null
9996
+ || weeklyOpsViolationsCountRaw === undefined
9997
+ || weeklyOpsViolationsCountRaw === ''
9998
+ )
9999
+ ? null
10000
+ : parseAutoHandoffGateNumber(weeklyOpsViolationsCountRaw);
10001
+ const weeklyOpsWarningCount = (
10002
+ weeklyOpsWarningCountRaw === null
10003
+ || weeklyOpsWarningCountRaw === undefined
10004
+ || weeklyOpsWarningCountRaw === ''
10005
+ )
10006
+ ? null
10007
+ : parseAutoHandoffGateNumber(weeklyOpsWarningCountRaw);
10008
+ const weeklyOpsConfigWarningCount = (
10009
+ weeklyOpsConfigWarningCountRaw === null
10010
+ || weeklyOpsConfigWarningCountRaw === undefined
10011
+ || weeklyOpsConfigWarningCountRaw === ''
10012
+ )
10013
+ ? null
10014
+ : parseAutoHandoffGateNumber(weeklyOpsConfigWarningCountRaw);
10015
+ const weeklyOpsAuthorizationTierBlockRate = (
10016
+ weeklyOpsAuthorizationTierBlockRateRaw === null
10017
+ || weeklyOpsAuthorizationTierBlockRateRaw === undefined
10018
+ || weeklyOpsAuthorizationTierBlockRateRaw === ''
10019
+ )
10020
+ ? null
10021
+ : parseAutoHandoffGateNumber(weeklyOpsAuthorizationTierBlockRateRaw);
10022
+ const weeklyOpsDialogueAuthorizationBlockRate = (
10023
+ weeklyOpsDialogueAuthorizationBlockRateRaw === null
10024
+ || weeklyOpsDialogueAuthorizationBlockRateRaw === undefined
10025
+ || weeklyOpsDialogueAuthorizationBlockRateRaw === ''
10026
+ )
10027
+ ? null
10028
+ : parseAutoHandoffGateNumber(weeklyOpsDialogueAuthorizationBlockRateRaw);
10029
+ const weeklyOpsMatrixRegressionPositiveRate = (
10030
+ weeklyOpsMatrixRegressionPositiveRateRaw === null
10031
+ || weeklyOpsMatrixRegressionPositiveRateRaw === undefined
10032
+ || weeklyOpsMatrixRegressionPositiveRateRaw === ''
10033
+ )
10034
+ ? null
10035
+ : parseAutoHandoffGateNumber(weeklyOpsMatrixRegressionPositiveRateRaw);
10036
+ const weeklyOpsRuntimeBlockRate = (
10037
+ weeklyOpsRuntimeBlockRateRaw === null
10038
+ || weeklyOpsRuntimeBlockRateRaw === undefined
10039
+ || weeklyOpsRuntimeBlockRateRaw === ''
10040
+ )
10041
+ ? null
10042
+ : parseAutoHandoffGateNumber(weeklyOpsRuntimeBlockRateRaw);
10043
+ const weeklyOpsRuntimeUiModeViolationTotalCount = (
10044
+ weeklyOpsRuntimeUiModeViolationTotalRaw === null
10045
+ || weeklyOpsRuntimeUiModeViolationTotalRaw === undefined
10046
+ || weeklyOpsRuntimeUiModeViolationTotalRaw === ''
10047
+ )
10048
+ ? null
10049
+ : parseAutoHandoffGateNumber(weeklyOpsRuntimeUiModeViolationTotalRaw);
10050
+ const weeklyOpsRuntimeUiModeViolationRate = (
10051
+ weeklyOpsRuntimeUiModeViolationRateRaw === null
10052
+ || weeklyOpsRuntimeUiModeViolationRateRaw === undefined
10053
+ || weeklyOpsRuntimeUiModeViolationRateRaw === ''
10054
+ )
10055
+ ? null
10056
+ : parseAutoHandoffGateNumber(weeklyOpsRuntimeUiModeViolationRateRaw);
10057
+ const weeklyOpsHasSignal = (
10058
+ entry && entry.weekly_ops_available === true
10059
+ || weeklyOpsBlocked === true
10060
+ || weeklyOpsBlocked === false
10061
+ || Number.isFinite(weeklyOpsViolationsCount)
10062
+ || Number.isFinite(weeklyOpsWarningCount)
10063
+ || Number.isFinite(weeklyOpsConfigWarningCount)
10064
+ || Number.isFinite(weeklyOpsAuthorizationTierBlockRate)
10065
+ || Number.isFinite(weeklyOpsDialogueAuthorizationBlockRate)
10066
+ || Number.isFinite(weeklyOpsMatrixRegressionPositiveRate)
10067
+ || Number.isFinite(weeklyOpsRuntimeBlockRate)
10068
+ || Number.isFinite(weeklyOpsRuntimeUiModeViolationTotalCount)
10069
+ || Number.isFinite(weeklyOpsRuntimeUiModeViolationRate)
10070
+ );
10071
+ if (weeklyOpsHasSignal) {
10072
+ weeklyOpsKnownRuns += 1;
10073
+ if (weeklyOpsBlocked === true) {
10074
+ weeklyOpsBlockedRuns += 1;
10075
+ }
10076
+ const normalizedWeeklyViolations = Number.isFinite(weeklyOpsViolationsCount)
10077
+ ? Math.max(0, Number(weeklyOpsViolationsCount))
10078
+ : 0;
10079
+ const normalizedWeeklyWarnings = Number.isFinite(weeklyOpsWarningCount)
10080
+ ? Math.max(0, Number(weeklyOpsWarningCount))
10081
+ : 0;
10082
+ const normalizedWeeklyConfigWarnings = Number.isFinite(weeklyOpsConfigWarningCount)
10083
+ ? Math.max(0, Number(weeklyOpsConfigWarningCount))
10084
+ : 0;
10085
+ weeklyOpsViolationsTotal += normalizedWeeklyViolations;
10086
+ weeklyOpsWarningsTotal += normalizedWeeklyWarnings;
10087
+ weeklyOpsConfigWarningsTotal += normalizedWeeklyConfigWarnings;
10088
+ if (normalizedWeeklyConfigWarnings > 0) {
10089
+ weeklyOpsConfigWarningRuns += 1;
10090
+ }
10091
+ if (Number.isFinite(weeklyOpsAuthorizationTierBlockRate)) {
10092
+ weeklyOpsAuthorizationTierBlockRates.push(Math.max(0, Number(weeklyOpsAuthorizationTierBlockRate)));
10093
+ }
10094
+ if (Number.isFinite(weeklyOpsDialogueAuthorizationBlockRate)) {
10095
+ weeklyOpsDialogueAuthorizationBlockRates.push(Math.max(0, Number(weeklyOpsDialogueAuthorizationBlockRate)));
10096
+ }
10097
+ if (Number.isFinite(weeklyOpsMatrixRegressionPositiveRate)) {
10098
+ weeklyOpsMatrixRegressionPositiveRates.push(Math.max(0, Number(weeklyOpsMatrixRegressionPositiveRate)));
10099
+ }
10100
+ if (Number.isFinite(weeklyOpsRuntimeBlockRate)) {
10101
+ weeklyOpsRuntimeBlockRates.push(Math.max(0, Number(weeklyOpsRuntimeBlockRate)));
10102
+ }
10103
+ const hasRuntimeUiModeSignal = (
10104
+ Number.isFinite(weeklyOpsRuntimeUiModeViolationTotalCount) ||
10105
+ Number.isFinite(weeklyOpsRuntimeUiModeViolationRate) ||
10106
+ Number.isFinite(weeklyOpsRuntimeBlockRate)
10107
+ );
10108
+ if (hasRuntimeUiModeSignal) {
10109
+ weeklyOpsRuntimeUiModeViolationKnownRuns += 1;
10110
+ }
10111
+ if (Number.isFinite(weeklyOpsRuntimeUiModeViolationTotalCount)) {
10112
+ const normalizedRuntimeUiModeViolationTotal = Math.max(0, Number(weeklyOpsRuntimeUiModeViolationTotalCount));
10113
+ weeklyOpsRuntimeUiModeViolationTotal += normalizedRuntimeUiModeViolationTotal;
10114
+ if (normalizedRuntimeUiModeViolationTotal > 0) {
10115
+ weeklyOpsRuntimeUiModeViolationRuns += 1;
10116
+ }
10117
+ }
10118
+ if (Number.isFinite(weeklyOpsRuntimeUiModeViolationRate)) {
10119
+ weeklyOpsRuntimeUiModeViolationRates.push(Math.max(0, Number(weeklyOpsRuntimeUiModeViolationRate)));
10120
+ }
10121
+ }
10122
+
9633
10123
  violationsTotal += Math.max(0, Number(entry && entry.violations_count) || 0);
9634
10124
  configWarningsTotal += Math.max(0, Number(entry && entry.config_warning_count) || 0);
9635
10125
  });
@@ -9680,6 +10170,45 @@ function buildAutoHandoffReleaseGateHistoryAggregates(entries = []) {
9680
10170
  const driftBlockRate = driftKnownRuns > 0
9681
10171
  ? Number(((driftBlockedRuns / driftKnownRuns) * 100).toFixed(2))
9682
10172
  : null;
10173
+ const weeklyOpsBlockRate = weeklyOpsKnownRuns > 0
10174
+ ? Number(((weeklyOpsBlockedRuns / weeklyOpsKnownRuns) * 100).toFixed(2))
10175
+ : null;
10176
+ const weeklyOpsConfigWarningRunRate = weeklyOpsKnownRuns > 0
10177
+ ? Number(((weeklyOpsConfigWarningRuns / weeklyOpsKnownRuns) * 100).toFixed(2))
10178
+ : null;
10179
+ const weeklyOpsAuthorizationTierBlockRateAvg = weeklyOpsAuthorizationTierBlockRates.length > 0
10180
+ ? Number((weeklyOpsAuthorizationTierBlockRates.reduce((sum, value) => sum + value, 0) / weeklyOpsAuthorizationTierBlockRates.length).toFixed(2))
10181
+ : null;
10182
+ const weeklyOpsAuthorizationTierBlockRateMax = weeklyOpsAuthorizationTierBlockRates.length > 0
10183
+ ? Number(Math.max(...weeklyOpsAuthorizationTierBlockRates).toFixed(2))
10184
+ : null;
10185
+ const weeklyOpsDialogueAuthorizationBlockRateAvg = weeklyOpsDialogueAuthorizationBlockRates.length > 0
10186
+ ? Number((weeklyOpsDialogueAuthorizationBlockRates.reduce((sum, value) => sum + value, 0) / weeklyOpsDialogueAuthorizationBlockRates.length).toFixed(2))
10187
+ : null;
10188
+ const weeklyOpsDialogueAuthorizationBlockRateMax = weeklyOpsDialogueAuthorizationBlockRates.length > 0
10189
+ ? Number(Math.max(...weeklyOpsDialogueAuthorizationBlockRates).toFixed(2))
10190
+ : null;
10191
+ const weeklyOpsMatrixRegressionPositiveRateAvg = weeklyOpsMatrixRegressionPositiveRates.length > 0
10192
+ ? Number((weeklyOpsMatrixRegressionPositiveRates.reduce((sum, value) => sum + value, 0) / weeklyOpsMatrixRegressionPositiveRates.length).toFixed(2))
10193
+ : null;
10194
+ const weeklyOpsMatrixRegressionPositiveRateMax = weeklyOpsMatrixRegressionPositiveRates.length > 0
10195
+ ? Number(Math.max(...weeklyOpsMatrixRegressionPositiveRates).toFixed(2))
10196
+ : null;
10197
+ const weeklyOpsRuntimeBlockRateAvg = weeklyOpsRuntimeBlockRates.length > 0
10198
+ ? Number((weeklyOpsRuntimeBlockRates.reduce((sum, value) => sum + value, 0) / weeklyOpsRuntimeBlockRates.length).toFixed(2))
10199
+ : null;
10200
+ const weeklyOpsRuntimeBlockRateMax = weeklyOpsRuntimeBlockRates.length > 0
10201
+ ? Number(Math.max(...weeklyOpsRuntimeBlockRates).toFixed(2))
10202
+ : null;
10203
+ const weeklyOpsRuntimeUiModeViolationRateAvg = weeklyOpsRuntimeUiModeViolationRates.length > 0
10204
+ ? Number((weeklyOpsRuntimeUiModeViolationRates.reduce((sum, value) => sum + value, 0) / weeklyOpsRuntimeUiModeViolationRates.length).toFixed(2))
10205
+ : null;
10206
+ const weeklyOpsRuntimeUiModeViolationRateMax = weeklyOpsRuntimeUiModeViolationRates.length > 0
10207
+ ? Number(Math.max(...weeklyOpsRuntimeUiModeViolationRates).toFixed(2))
10208
+ : null;
10209
+ const weeklyOpsRuntimeUiModeViolationRunRate = weeklyOpsRuntimeUiModeViolationKnownRuns > 0
10210
+ ? Number(((weeklyOpsRuntimeUiModeViolationRuns / weeklyOpsRuntimeUiModeViolationKnownRuns) * 100).toFixed(2))
10211
+ : null;
9683
10212
  const preflightAvailabilityRate = preflightKnownRuns > 0
9684
10213
  ? Number(((preflightAvailableRuns / preflightKnownRuns) * 100).toFixed(2))
9685
10214
  : null;
@@ -9722,6 +10251,28 @@ function buildAutoHandoffReleaseGateHistoryAggregates(entries = []) {
9722
10251
  drift_blocked_runs: driftBlockedRuns,
9723
10252
  drift_alert_rate_percent: driftAlertRate,
9724
10253
  drift_block_rate_percent: driftBlockRate,
10254
+ weekly_ops_known_runs: weeklyOpsKnownRuns,
10255
+ weekly_ops_blocked_runs: weeklyOpsBlockedRuns,
10256
+ weekly_ops_block_rate_percent: weeklyOpsBlockRate,
10257
+ weekly_ops_violations_total: weeklyOpsViolationsTotal,
10258
+ weekly_ops_warnings_total: weeklyOpsWarningsTotal,
10259
+ weekly_ops_config_warnings_total: weeklyOpsConfigWarningsTotal,
10260
+ weekly_ops_config_warning_runs: weeklyOpsConfigWarningRuns,
10261
+ weekly_ops_config_warning_run_rate_percent: weeklyOpsConfigWarningRunRate,
10262
+ weekly_ops_authorization_tier_block_rate_avg_percent: weeklyOpsAuthorizationTierBlockRateAvg,
10263
+ weekly_ops_authorization_tier_block_rate_max_percent: weeklyOpsAuthorizationTierBlockRateMax,
10264
+ weekly_ops_dialogue_authorization_block_rate_avg_percent: weeklyOpsDialogueAuthorizationBlockRateAvg,
10265
+ weekly_ops_dialogue_authorization_block_rate_max_percent: weeklyOpsDialogueAuthorizationBlockRateMax,
10266
+ weekly_ops_matrix_regression_positive_rate_avg_percent: weeklyOpsMatrixRegressionPositiveRateAvg,
10267
+ weekly_ops_matrix_regression_positive_rate_max_percent: weeklyOpsMatrixRegressionPositiveRateMax,
10268
+ weekly_ops_runtime_block_rate_avg_percent: weeklyOpsRuntimeBlockRateAvg,
10269
+ weekly_ops_runtime_block_rate_max_percent: weeklyOpsRuntimeBlockRateMax,
10270
+ weekly_ops_runtime_ui_mode_violation_known_runs: weeklyOpsRuntimeUiModeViolationKnownRuns,
10271
+ weekly_ops_runtime_ui_mode_violation_runs: weeklyOpsRuntimeUiModeViolationRuns,
10272
+ weekly_ops_runtime_ui_mode_violation_run_rate_percent: weeklyOpsRuntimeUiModeViolationRunRate,
10273
+ weekly_ops_runtime_ui_mode_violation_total: weeklyOpsRuntimeUiModeViolationTotal,
10274
+ weekly_ops_runtime_ui_mode_violation_rate_avg_percent: weeklyOpsRuntimeUiModeViolationRateAvg,
10275
+ weekly_ops_runtime_ui_mode_violation_rate_max_percent: weeklyOpsRuntimeUiModeViolationRateMax,
9725
10276
  release_gate_preflight_known_runs: preflightKnownRuns,
9726
10277
  release_gate_preflight_available_runs: preflightAvailableRuns,
9727
10278
  release_gate_preflight_blocked_runs: preflightBlockedRuns,
@@ -9786,6 +10337,18 @@ async function buildAutoHandoffReleaseGateHistoryIndex(projectPath, options = {}
9786
10337
  release_gate_preflight_available: latestEntry.release_gate_preflight_available,
9787
10338
  release_gate_preflight_blocked: latestEntry.release_gate_preflight_blocked,
9788
10339
  require_release_gate_preflight: latestEntry.require_release_gate_preflight,
10340
+ weekly_ops_blocked: latestEntry.weekly_ops_blocked,
10341
+ weekly_ops_risk_level: latestEntry.weekly_ops_risk_level,
10342
+ weekly_ops_governance_status: latestEntry.weekly_ops_governance_status,
10343
+ weekly_ops_authorization_tier_block_rate_percent: latestEntry.weekly_ops_authorization_tier_block_rate_percent,
10344
+ weekly_ops_dialogue_authorization_block_rate_percent: latestEntry.weekly_ops_dialogue_authorization_block_rate_percent,
10345
+ weekly_ops_matrix_regression_positive_rate_percent: latestEntry.weekly_ops_matrix_regression_positive_rate_percent,
10346
+ weekly_ops_runtime_block_rate_percent: latestEntry.weekly_ops_runtime_block_rate_percent,
10347
+ weekly_ops_runtime_ui_mode_violation_total: latestEntry.weekly_ops_runtime_ui_mode_violation_total,
10348
+ weekly_ops_runtime_ui_mode_violation_rate_percent: latestEntry.weekly_ops_runtime_ui_mode_violation_rate_percent,
10349
+ weekly_ops_violations_count: latestEntry.weekly_ops_violations_count,
10350
+ weekly_ops_warning_count: latestEntry.weekly_ops_warning_count,
10351
+ weekly_ops_config_warning_count: latestEntry.weekly_ops_config_warning_count,
9789
10352
  drift_alert_count: latestEntry.drift_alert_count,
9790
10353
  drift_blocked: latestEntry.drift_blocked
9791
10354
  }
@@ -9833,6 +10396,18 @@ function renderAutoHandoffReleaseGateHistoryMarkdown(payload = {}) {
9833
10396
  lines.push(`- Release preflight available: ${latest.release_gate_preflight_available === true ? 'yes' : (latest.release_gate_preflight_available === false ? 'no' : 'n/a')}`);
9834
10397
  lines.push(`- Release preflight blocked: ${latest.release_gate_preflight_blocked === true ? 'yes' : (latest.release_gate_preflight_blocked === false ? 'no' : 'n/a')}`);
9835
10398
  lines.push(`- Release preflight hard-gate: ${latest.require_release_gate_preflight === true ? 'enabled' : (latest.require_release_gate_preflight === false ? 'advisory' : 'n/a')}`);
10399
+ lines.push(`- Weekly ops blocked: ${latest.weekly_ops_blocked === true ? 'yes' : (latest.weekly_ops_blocked === false ? 'no' : 'n/a')}`);
10400
+ lines.push(`- Weekly ops risk: ${formatAutoHandoffRegressionValue(latest.weekly_ops_risk_level)}`);
10401
+ lines.push(`- Weekly ops governance status: ${formatAutoHandoffRegressionValue(latest.weekly_ops_governance_status)}`);
10402
+ lines.push(`- Weekly ops auth-tier block rate: ${formatAutoHandoffRegressionValue(latest.weekly_ops_authorization_tier_block_rate_percent)}%`);
10403
+ lines.push(`- Weekly ops dialogue-auth block rate: ${formatAutoHandoffRegressionValue(latest.weekly_ops_dialogue_authorization_block_rate_percent)}%`);
10404
+ lines.push(`- Weekly ops matrix regression-positive rate: ${formatAutoHandoffRegressionValue(latest.weekly_ops_matrix_regression_positive_rate_percent)}%`);
10405
+ lines.push(`- Weekly ops runtime block rate: ${formatAutoHandoffRegressionValue(latest.weekly_ops_runtime_block_rate_percent)}%`);
10406
+ lines.push(`- Weekly ops runtime ui-mode violations: ${formatAutoHandoffRegressionValue(latest.weekly_ops_runtime_ui_mode_violation_total, '0')}`);
10407
+ lines.push(`- Weekly ops runtime ui-mode violation rate: ${formatAutoHandoffRegressionValue(latest.weekly_ops_runtime_ui_mode_violation_rate_percent)}%`);
10408
+ lines.push(`- Weekly ops violations: ${formatAutoHandoffRegressionValue(latest.weekly_ops_violations_count, '0')}`);
10409
+ lines.push(`- Weekly ops warnings: ${formatAutoHandoffRegressionValue(latest.weekly_ops_warning_count, '0')}`);
10410
+ lines.push(`- Weekly ops config warnings: ${formatAutoHandoffRegressionValue(latest.weekly_ops_config_warning_count, '0')}`);
9836
10411
  lines.push(`- Drift alerts: ${formatAutoHandoffRegressionValue(latest.drift_alert_count, '0')}`);
9837
10412
  lines.push(`- Drift blocked: ${latest.drift_blocked === true ? 'yes' : (latest.drift_blocked === false ? 'no' : 'n/a')}`);
9838
10413
  lines.push('');
@@ -9861,6 +10436,23 @@ function renderAutoHandoffReleaseGateHistoryMarkdown(payload = {}) {
9861
10436
  lines.push(`- Drift blocked runs: ${formatAutoHandoffRegressionValue(aggregates.drift_blocked_runs, '0')}`);
9862
10437
  lines.push(`- Drift alert rate: ${formatAutoHandoffRegressionValue(aggregates.drift_alert_rate_percent)}%`);
9863
10438
  lines.push(`- Drift block rate: ${formatAutoHandoffRegressionValue(aggregates.drift_block_rate_percent)}%`);
10439
+ lines.push(`- Weekly ops known runs: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_known_runs, '0')}`);
10440
+ lines.push(`- Weekly ops blocked runs: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_blocked_runs, '0')}`);
10441
+ lines.push(`- Weekly ops block rate: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_block_rate_percent)}%`);
10442
+ lines.push(`- Weekly ops violations total: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_violations_total, '0')}`);
10443
+ lines.push(`- Weekly ops warnings total: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_warnings_total, '0')}`);
10444
+ lines.push(`- Weekly ops config warnings total: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_config_warnings_total, '0')}`);
10445
+ lines.push(`- Weekly ops config warning runs: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_config_warning_runs, '0')}`);
10446
+ lines.push(`- Weekly ops config warning run rate: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_config_warning_run_rate_percent)}%`);
10447
+ lines.push(`- Weekly ops auth-tier block rate avg/max: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_authorization_tier_block_rate_avg_percent)}/${formatAutoHandoffRegressionValue(aggregates.weekly_ops_authorization_tier_block_rate_max_percent)}%`);
10448
+ lines.push(`- Weekly ops dialogue-auth block rate avg/max: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_dialogue_authorization_block_rate_avg_percent)}/${formatAutoHandoffRegressionValue(aggregates.weekly_ops_dialogue_authorization_block_rate_max_percent)}%`);
10449
+ lines.push(`- Weekly ops matrix regression-positive rate avg/max: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_matrix_regression_positive_rate_avg_percent)}/${formatAutoHandoffRegressionValue(aggregates.weekly_ops_matrix_regression_positive_rate_max_percent)}%`);
10450
+ lines.push(`- Weekly ops runtime block rate avg/max: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_runtime_block_rate_avg_percent)}/${formatAutoHandoffRegressionValue(aggregates.weekly_ops_runtime_block_rate_max_percent)}%`);
10451
+ lines.push(`- Weekly ops runtime ui-mode known runs: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_runtime_ui_mode_violation_known_runs, '0')}`);
10452
+ lines.push(`- Weekly ops runtime ui-mode violation runs: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_runtime_ui_mode_violation_runs, '0')}`);
10453
+ lines.push(`- Weekly ops runtime ui-mode violation run rate: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_runtime_ui_mode_violation_run_rate_percent)}%`);
10454
+ lines.push(`- Weekly ops runtime ui-mode violations total: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_runtime_ui_mode_violation_total, '0')}`);
10455
+ lines.push(`- Weekly ops runtime ui-mode violation rate avg/max: ${formatAutoHandoffRegressionValue(aggregates.weekly_ops_runtime_ui_mode_violation_rate_avg_percent)}/${formatAutoHandoffRegressionValue(aggregates.weekly_ops_runtime_ui_mode_violation_rate_max_percent)}%`);
9864
10456
  lines.push(`- Release preflight known runs: ${formatAutoHandoffRegressionValue(aggregates.release_gate_preflight_known_runs, '0')}`);
9865
10457
  lines.push(`- Release preflight available runs: ${formatAutoHandoffRegressionValue(aggregates.release_gate_preflight_available_runs, '0')}`);
9866
10458
  lines.push(`- Release preflight blocked runs: ${formatAutoHandoffRegressionValue(aggregates.release_gate_preflight_blocked_runs, '0')}`);
@@ -9906,11 +10498,38 @@ function renderAutoHandoffReleaseGateHistoryMarkdown(payload = {}) {
9906
10498
  const driftBlocked = entry && entry.drift_blocked === true
9907
10499
  ? 'yes'
9908
10500
  : (entry && entry.drift_blocked === false ? 'no' : 'n/a');
10501
+ const weeklyOpsBlocked = entry && entry.weekly_ops_blocked === true
10502
+ ? 'yes'
10503
+ : (entry && entry.weekly_ops_blocked === false ? 'no' : 'n/a');
10504
+ const weeklyOpsConfigWarnings = formatAutoHandoffRegressionValue(
10505
+ entry && entry.weekly_ops_config_warning_count,
10506
+ '0'
10507
+ );
10508
+ const weeklyOpsDialogueRate = formatAutoHandoffRegressionValue(
10509
+ entry && entry.weekly_ops_dialogue_authorization_block_rate_percent
10510
+ );
10511
+ const weeklyOpsAuthTierRate = formatAutoHandoffRegressionValue(
10512
+ entry && entry.weekly_ops_authorization_tier_block_rate_percent
10513
+ );
10514
+ const weeklyOpsRuntimeBlockRate = formatAutoHandoffRegressionValue(
10515
+ entry && entry.weekly_ops_runtime_block_rate_percent
10516
+ );
10517
+ const weeklyOpsRuntimeUiModeViolationTotal = formatAutoHandoffRegressionValue(
10518
+ entry && entry.weekly_ops_runtime_ui_mode_violation_total,
10519
+ '0'
10520
+ );
10521
+ const weeklyOpsRuntimeUiModeViolationRate = formatAutoHandoffRegressionValue(
10522
+ entry && entry.weekly_ops_runtime_ui_mode_violation_rate_percent
10523
+ );
9909
10524
  lines.push(
9910
10525
  `- ${tag} | passed=${passed} | risk=${risk} | scene-batch=${sceneBatch} | ` +
9911
10526
  `scene-failures=${sceneBatchFailures} | capability-unknown=${capabilityExpectedUnknown}/${capabilityProvidedUnknown} | ` +
9912
10527
  `preflight-blocked=${preflightBlocked} | hard-gate=${preflightHardGate} | ` +
9913
10528
  `drift-alerts=${driftAlerts} | drift-blocked=${driftBlocked} | ` +
10529
+ `weekly-blocked=${weeklyOpsBlocked} | weekly-config-warnings=${weeklyOpsConfigWarnings} | ` +
10530
+ `weekly-auth-tier-rate=${weeklyOpsAuthTierRate}% | weekly-dialogue-rate=${weeklyOpsDialogueRate}% | ` +
10531
+ `weekly-runtime-block-rate=${weeklyOpsRuntimeBlockRate}% | ` +
10532
+ `weekly-runtime-ui-mode=${weeklyOpsRuntimeUiModeViolationTotal}/${weeklyOpsRuntimeUiModeViolationRate}% | ` +
9914
10533
  `success=${successRate} | violations=${violations} | at=${evaluatedAt}`
9915
10534
  );
9916
10535
  });
@@ -10239,6 +10858,9 @@ function renderAutoHandoffEvidenceReviewMarkdown(payload = {}) {
10239
10858
  `- Scene batch pass rate: ${formatAutoHandoffRegressionValue(releaseGatePreflight.scene_package_batch_pass_rate_percent)}%`,
10240
10859
  `- Drift alert rate: ${formatAutoHandoffRegressionValue(releaseGatePreflight.drift_alert_rate_percent)}%`,
10241
10860
  `- Drift blocked runs: ${formatAutoHandoffRegressionValue(releaseGatePreflight.drift_blocked_runs)}`,
10861
+ `- Runtime block rate (latest/max): ${formatAutoHandoffRegressionValue(releaseGatePreflight.latest_weekly_ops_runtime_block_rate_percent)}/${formatAutoHandoffRegressionValue(releaseGatePreflight.weekly_ops_runtime_block_rate_max_percent)}%`,
10862
+ `- Runtime ui-mode violations (latest/total): ${formatAutoHandoffRegressionValue(releaseGatePreflight.latest_weekly_ops_runtime_ui_mode_violation_total, '0')}/${formatAutoHandoffRegressionValue(releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_total, '0')}`,
10863
+ `- Runtime ui-mode violation rate (latest/run-rate/max): ${formatAutoHandoffRegressionValue(releaseGatePreflight.latest_weekly_ops_runtime_ui_mode_violation_rate_percent)}/${formatAutoHandoffRegressionValue(releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_run_rate_percent)}/${formatAutoHandoffRegressionValue(releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_rate_max_percent)}%`,
10242
10864
  `- Reasons: ${Array.isArray(releaseGatePreflight.reasons) && releaseGatePreflight.reasons.length > 0 ? releaseGatePreflight.reasons.join(' | ') : 'none'}`,
10243
10865
  `- Parse error: ${formatAutoHandoffRegressionValue(releaseGatePreflight.parse_error)}`,
10244
10866
  '',
@@ -10547,6 +11169,9 @@ function renderAutoHandoffReleaseNotesDraft(payload = {}, context = {}) {
10547
11169
  `- Release gate preflight blocked: ${releaseGatePreflight.blocked === true ? 'yes' : 'no'}`,
10548
11170
  `- Release gate preflight hard-gate: ${currentPolicy.require_release_gate_preflight === true ? 'enabled' : 'advisory'}`,
10549
11171
  `- Release gate preflight reasons: ${Array.isArray(releaseGatePreflight.reasons) && releaseGatePreflight.reasons.length > 0 ? releaseGatePreflight.reasons.join(' | ') : 'none'}`,
11172
+ `- Release gate runtime block rate (latest/max): ${formatAutoHandoffRegressionValue(releaseGatePreflight.latest_weekly_ops_runtime_block_rate_percent)}/${formatAutoHandoffRegressionValue(releaseGatePreflight.weekly_ops_runtime_block_rate_max_percent)}%`,
11173
+ `- Release gate runtime ui-mode violations (latest/total): ${formatAutoHandoffRegressionValue(releaseGatePreflight.latest_weekly_ops_runtime_ui_mode_violation_total, '0')}/${formatAutoHandoffRegressionValue(releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_total, '0')}`,
11174
+ `- Release gate runtime ui-mode violation rate (latest/run-rate/max): ${formatAutoHandoffRegressionValue(releaseGatePreflight.latest_weekly_ops_runtime_ui_mode_violation_rate_percent)}/${formatAutoHandoffRegressionValue(releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_run_rate_percent)}/${formatAutoHandoffRegressionValue(releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_rate_max_percent)}%`,
10550
11175
  `- Failure summary highlights: ${Array.isArray(failureSummary.highlights) && failureSummary.highlights.length > 0 ? failureSummary.highlights.join(' | ') : 'none'}`,
10551
11176
  `- Spec success rate: ${formatAutoHandoffRegressionValue(gateActual.spec_success_rate_percent)}`,
10552
11177
  `- Risk level: ${formatAutoHandoffRegressionValue(gateActual.risk_level)}`,
@@ -11636,73 +12261,351 @@ function buildAutoHandoffReleaseGatePreflight(signals = null) {
11636
12261
  drift_alert_rate_percent: toNumber(source.drift_alert_rate_percent),
11637
12262
  drift_alert_runs: toNumber(source.drift_alert_runs),
11638
12263
  drift_blocked_runs: toNumber(source.drift_blocked_runs),
12264
+ latest_weekly_ops_runtime_block_rate_percent: toNumber(
12265
+ source.latest_weekly_ops_runtime_block_rate_percent
12266
+ ),
12267
+ latest_weekly_ops_runtime_ui_mode_violation_total: toNumber(
12268
+ source.latest_weekly_ops_runtime_ui_mode_violation_total
12269
+ ),
12270
+ latest_weekly_ops_runtime_ui_mode_violation_rate_percent: toNumber(
12271
+ source.latest_weekly_ops_runtime_ui_mode_violation_rate_percent
12272
+ ),
12273
+ weekly_ops_runtime_block_rate_max_percent: toNumber(
12274
+ source.weekly_ops_runtime_block_rate_max_percent
12275
+ ),
12276
+ weekly_ops_runtime_ui_mode_violation_total: toNumber(
12277
+ source.weekly_ops_runtime_ui_mode_violation_total
12278
+ ),
12279
+ weekly_ops_runtime_ui_mode_violation_run_rate_percent: toNumber(
12280
+ source.weekly_ops_runtime_ui_mode_violation_run_rate_percent
12281
+ ),
12282
+ weekly_ops_runtime_ui_mode_violation_rate_max_percent: toNumber(
12283
+ source.weekly_ops_runtime_ui_mode_violation_rate_max_percent
12284
+ ),
11639
12285
  parse_error: normalizeHandoffText(source.parse_error),
11640
12286
  blocked: blockState.blocked === true,
11641
12287
  reasons: Array.isArray(blockState.reasons) ? blockState.reasons : []
11642
12288
  };
11643
12289
  }
11644
12290
 
11645
- function buildAutoHandoffRunFailureSummary(result = {}) {
11646
- const phases = Array.isArray(result && result.phases) ? result.phases : [];
11647
- const failedPhase = phases.find(item => item && item.status === 'failed') || null;
11648
- const gates = result && result.gates && typeof result.gates === 'object'
11649
- ? result.gates
12291
+ function buildAutoHandoffPreflightCheckRecommendations(projectPath, result = {}) {
12292
+ const recommendations = [];
12293
+ const seen = new Set();
12294
+ const push = value => {
12295
+ const text = `${value || ''}`.trim();
12296
+ if (!text || seen.has(text)) {
12297
+ return;
12298
+ }
12299
+ seen.add(text);
12300
+ recommendations.push(text);
12301
+ };
12302
+
12303
+ const policy = result && result.policy && typeof result.policy === 'object'
12304
+ ? result.policy
11650
12305
  : {};
11651
- const gateReasons = Array.isArray(gates.reasons) ? gates.reasons : [];
11652
- const releaseGatePreflight = result && result.release_gate_preflight && typeof result.release_gate_preflight === 'object'
12306
+ const preflight = result && result.release_gate_preflight && typeof result.release_gate_preflight === 'object'
11653
12307
  ? result.release_gate_preflight
11654
- : null;
11655
- const releaseGateReasons = releaseGatePreflight && Array.isArray(releaseGatePreflight.reasons)
11656
- ? releaseGatePreflight.reasons
11657
- : [];
11658
- const moquiBaseline = result && result.moqui_baseline && typeof result.moqui_baseline === 'object'
11659
- ? result.moqui_baseline
11660
- : null;
11661
- const moquiCompare = moquiBaseline && moquiBaseline.compare && typeof moquiBaseline.compare === 'object'
11662
- ? moquiBaseline.compare
11663
12308
  : {};
11664
- const moquiMatrixRegressions = buildAutoHandoffMoquiCoverageRegressions(moquiCompare);
11665
- const highlights = [];
11666
- if (typeof result.error === 'string' && result.error.trim()) {
11667
- highlights.push(`error: ${result.error.trim()}`);
12309
+ const reasons = Array.isArray(result.reasons) ? result.reasons : [];
12310
+ const windowSize = Number.isInteger(policy.release_evidence_window)
12311
+ ? policy.release_evidence_window
12312
+ : 5;
12313
+
12314
+ if (preflight.available !== true || preflight.parse_error) {
12315
+ push(
12316
+ 'sce auto handoff gate-index ' +
12317
+ '--dir .kiro/reports/release-evidence ' +
12318
+ '--out .kiro/reports/release-evidence/release-gate-history.json --json'
12319
+ );
11668
12320
  }
11669
- if (gateReasons.length > 0) {
11670
- highlights.push(`gate: ${gateReasons.join('; ')}`);
12321
+ if (result.status !== 'pass' || preflight.blocked === true) {
12322
+ push(`sce auto handoff evidence --window ${windowSize} --json`);
11671
12323
  }
11672
- if (releaseGatePreflight && releaseGatePreflight.blocked === true) {
11673
- highlights.push(
11674
- `release_gate_preflight: ${releaseGateReasons.length > 0 ? releaseGateReasons.join('; ') : 'blocked'}`
12324
+
12325
+ if (preflight.blocked === true) {
12326
+ const governanceRecommendations = buildGovernanceCloseLoopRecommendations(
12327
+ {
12328
+ health: {
12329
+ recommendations: []
12330
+ }
12331
+ },
12332
+ 'release-gate-blocked',
12333
+ {
12334
+ reasons: Array.isArray(preflight.reasons) ? preflight.reasons : []
12335
+ }
11675
12336
  );
12337
+ for (const item of governanceRecommendations) {
12338
+ push(item);
12339
+ }
11676
12340
  }
11677
- if (failedPhase && failedPhase.id) {
11678
- highlights.push(`phase: ${failedPhase.id}${failedPhase.error ? ` (${failedPhase.error})` : ''}`);
12341
+
12342
+ if (reasons.some(item => `${item}`.includes('parse error'))) {
12343
+ push(
12344
+ 'Review and repair release gate history JSON, then rerun `sce auto handoff preflight-check --json`.'
12345
+ );
11679
12346
  }
11680
- if (moquiMatrixRegressions.length > 0) {
11681
- highlights.push(
11682
- `moqui_matrix_regression: ${moquiMatrixRegressions.slice(0, 3).map(item => `${item.label}:${item.delta_rate_percent}%`).join(' | ')}`
12347
+ if (
12348
+ reasons.some(item => `${item}`.includes('unavailable') || `${item}`.includes('snapshot missing'))
12349
+ ) {
12350
+ push(
12351
+ 'Ensure release workflow publishes `release-gate-history.json` and rerun preflight check.'
11683
12352
  );
11684
12353
  }
11685
- return {
11686
- status: normalizeHandoffText(result && result.status),
11687
- failed_phase: failedPhase
11688
- ? {
11689
- id: normalizeHandoffText(failedPhase.id),
11690
- title: normalizeHandoffText(failedPhase.title),
11691
- error: normalizeHandoffText(failedPhase.error)
11692
- }
11693
- : null,
11694
- gate_failed: gates.passed === false,
11695
- gate_reasons: gateReasons,
11696
- moqui_matrix_regressions: moquiMatrixRegressions,
11697
- release_gate_preflight_blocked: Boolean(releaseGatePreflight && releaseGatePreflight.blocked === true),
11698
- release_gate_preflight_reasons: releaseGateReasons,
11699
- highlights
11700
- };
12354
+
12355
+ return recommendations;
11701
12356
  }
11702
12357
 
11703
- function collectHandoffBlockers(resultItem) {
11704
- const blockers = [];
11705
- if (!resultItem) {
12358
+ async function buildAutoHandoffPreflightCheck(projectPath, options = {}) {
12359
+ const policy = buildAutoHandoffRunPolicy(options);
12360
+ const releaseGateSignals = await loadGovernanceReleaseGateSignals(projectPath, {
12361
+ historyFile: options.historyFile
12362
+ });
12363
+ const releaseGatePreflight = buildAutoHandoffReleaseGatePreflight(releaseGateSignals);
12364
+ const hardGateReasons = evaluateAutoHandoffReleaseGatePreflightGateReasons(
12365
+ policy,
12366
+ releaseGatePreflight
12367
+ );
12368
+
12369
+ const advisoryReasons = [];
12370
+ if (hardGateReasons.length === 0) {
12371
+ if (releaseGatePreflight.parse_error) {
12372
+ advisoryReasons.push(`release gate preflight parse error: ${releaseGatePreflight.parse_error}`);
12373
+ } else if (releaseGatePreflight.available !== true) {
12374
+ advisoryReasons.push('release gate preflight unavailable (advisory mode)');
12375
+ } else if (releaseGatePreflight.blocked === true) {
12376
+ const reasonText = Array.isArray(releaseGatePreflight.reasons) && releaseGatePreflight.reasons.length > 0
12377
+ ? releaseGatePreflight.reasons.join('; ')
12378
+ : 'release gate blocked';
12379
+ advisoryReasons.push(`release gate preflight blocked (advisory mode): ${reasonText}`);
12380
+ }
12381
+ }
12382
+
12383
+ const status = hardGateReasons.length > 0
12384
+ ? 'blocked'
12385
+ : (advisoryReasons.length > 0 ? 'warning' : 'pass');
12386
+ const reasons = hardGateReasons.length > 0 ? hardGateReasons : advisoryReasons;
12387
+ const result = {
12388
+ mode: 'auto-handoff-preflight-check',
12389
+ generated_at: new Date().toISOString(),
12390
+ status,
12391
+ reasons,
12392
+ hard_gate_reasons: hardGateReasons,
12393
+ policy: {
12394
+ profile: policy.profile,
12395
+ require_release_gate_preflight: policy.require_release_gate_preflight === true,
12396
+ release_evidence_window: policy.release_evidence_window
12397
+ },
12398
+ release_gate_preflight: releaseGatePreflight,
12399
+ signals: {
12400
+ history_file: releaseGateSignals.file || releaseGatePreflight.file || null,
12401
+ total_entries: releaseGateSignals.total_entries,
12402
+ latest: {
12403
+ tag: releaseGatePreflight.latest_tag,
12404
+ gate_passed: releaseGatePreflight.latest_gate_passed,
12405
+ risk_level: releaseGatePreflight.latest_risk_level,
12406
+ weekly_ops_runtime_block_rate_percent:
12407
+ releaseGatePreflight.latest_weekly_ops_runtime_block_rate_percent,
12408
+ weekly_ops_runtime_ui_mode_violation_total:
12409
+ releaseGatePreflight.latest_weekly_ops_runtime_ui_mode_violation_total,
12410
+ weekly_ops_runtime_ui_mode_violation_rate_percent:
12411
+ releaseGatePreflight.latest_weekly_ops_runtime_ui_mode_violation_rate_percent
12412
+ },
12413
+ aggregates: {
12414
+ pass_rate_percent: releaseGatePreflight.pass_rate_percent,
12415
+ scene_package_batch_pass_rate_percent: releaseGatePreflight.scene_package_batch_pass_rate_percent,
12416
+ drift_alert_rate_percent: releaseGatePreflight.drift_alert_rate_percent,
12417
+ drift_blocked_runs: releaseGatePreflight.drift_blocked_runs,
12418
+ weekly_ops_runtime_block_rate_max_percent:
12419
+ releaseGatePreflight.weekly_ops_runtime_block_rate_max_percent,
12420
+ weekly_ops_runtime_ui_mode_violation_total:
12421
+ releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_total,
12422
+ weekly_ops_runtime_ui_mode_violation_run_rate_percent:
12423
+ releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_run_rate_percent,
12424
+ weekly_ops_runtime_ui_mode_violation_rate_max_percent:
12425
+ releaseGatePreflight.weekly_ops_runtime_ui_mode_violation_rate_max_percent
12426
+ }
12427
+ },
12428
+ recommended_commands: []
12429
+ };
12430
+ result.recommended_commands = buildAutoHandoffPreflightCheckRecommendations(projectPath, result);
12431
+ return result;
12432
+ }
12433
+
12434
+ function extractAutoObservabilityWeeklyOpsStopTelemetry(observabilitySnapshotCandidate) {
12435
+ const observabilitySnapshot = observabilitySnapshotCandidate &&
12436
+ typeof observabilitySnapshotCandidate === 'object' &&
12437
+ !Array.isArray(observabilitySnapshotCandidate)
12438
+ ? observabilitySnapshotCandidate
12439
+ : null;
12440
+ if (!observabilitySnapshot) {
12441
+ return null;
12442
+ }
12443
+ const highlights = observabilitySnapshot.highlights && typeof observabilitySnapshot.highlights === 'object'
12444
+ ? observabilitySnapshot.highlights
12445
+ : {};
12446
+ const snapshots = observabilitySnapshot.snapshots && typeof observabilitySnapshot.snapshots === 'object'
12447
+ ? observabilitySnapshot.snapshots
12448
+ : {};
12449
+ const weeklyOpsStop = snapshots.governance_weekly_ops_stop && typeof snapshots.governance_weekly_ops_stop === 'object'
12450
+ ? snapshots.governance_weekly_ops_stop
12451
+ : {};
12452
+ const toNumber = value => {
12453
+ const parsed = Number(value);
12454
+ return Number.isFinite(parsed) ? parsed : null;
12455
+ };
12456
+ const pickNumber = (primary, fallback) => (
12457
+ Number.isFinite(primary) ? primary : (Number.isFinite(fallback) ? fallback : null)
12458
+ );
12459
+
12460
+ const sessions = pickNumber(
12461
+ toNumber(highlights.governance_weekly_ops_stop_sessions),
12462
+ toNumber(weeklyOpsStop.sessions)
12463
+ );
12464
+ const sessionRatePercent = pickNumber(
12465
+ toNumber(highlights.governance_weekly_ops_stop_session_rate_percent),
12466
+ toNumber(weeklyOpsStop.session_rate_percent)
12467
+ );
12468
+ const highPressureSessions = pickNumber(
12469
+ toNumber(highlights.governance_weekly_ops_high_pressure_sessions),
12470
+ toNumber(weeklyOpsStop.high_pressure_sessions)
12471
+ );
12472
+ const highPressureRatePercent = pickNumber(
12473
+ toNumber(highlights.governance_weekly_ops_high_pressure_rate_percent),
12474
+ toNumber(weeklyOpsStop.high_pressure_session_rate_percent)
12475
+ );
12476
+ const configWarningPositiveSessions = pickNumber(
12477
+ toNumber(highlights.governance_weekly_ops_config_warning_positive_sessions),
12478
+ toNumber(weeklyOpsStop.config_warning_positive_sessions)
12479
+ );
12480
+ const authTierPressureSessions = pickNumber(
12481
+ toNumber(highlights.governance_weekly_ops_auth_tier_pressure_sessions),
12482
+ toNumber(weeklyOpsStop.auth_tier_pressure_sessions)
12483
+ );
12484
+ const dialogueAuthorizationPressureSessions = pickNumber(
12485
+ toNumber(highlights.governance_weekly_ops_dialogue_authorization_pressure_sessions),
12486
+ toNumber(weeklyOpsStop.dialogue_authorization_pressure_sessions)
12487
+ );
12488
+ const runtimeBlockRateHighSessions = pickNumber(
12489
+ toNumber(highlights.governance_weekly_ops_runtime_block_rate_high_sessions),
12490
+ toNumber(weeklyOpsStop.runtime_block_rate_high_sessions)
12491
+ );
12492
+ const runtimeUiModeViolationHighSessions = pickNumber(
12493
+ toNumber(highlights.governance_weekly_ops_runtime_ui_mode_violation_high_sessions),
12494
+ toNumber(weeklyOpsStop.runtime_ui_mode_violation_high_sessions)
12495
+ );
12496
+ const runtimeUiModeViolationTotalSum = pickNumber(
12497
+ toNumber(highlights.governance_weekly_ops_runtime_ui_mode_violation_total_sum),
12498
+ toNumber(weeklyOpsStop.runtime_ui_mode_violation_total_sum)
12499
+ );
12500
+ const hasSignal = (
12501
+ Number.isFinite(sessions) ||
12502
+ Number.isFinite(sessionRatePercent) ||
12503
+ Number.isFinite(highPressureSessions) ||
12504
+ Number.isFinite(highPressureRatePercent) ||
12505
+ Number.isFinite(configWarningPositiveSessions) ||
12506
+ Number.isFinite(authTierPressureSessions) ||
12507
+ Number.isFinite(dialogueAuthorizationPressureSessions) ||
12508
+ Number.isFinite(runtimeBlockRateHighSessions) ||
12509
+ Number.isFinite(runtimeUiModeViolationHighSessions) ||
12510
+ Number.isFinite(runtimeUiModeViolationTotalSum)
12511
+ );
12512
+ if (!hasSignal) {
12513
+ return null;
12514
+ }
12515
+ return {
12516
+ sessions,
12517
+ session_rate_percent: sessionRatePercent,
12518
+ high_pressure_sessions: highPressureSessions,
12519
+ high_pressure_rate_percent: highPressureRatePercent,
12520
+ config_warning_positive_sessions: configWarningPositiveSessions,
12521
+ auth_tier_pressure_sessions: authTierPressureSessions,
12522
+ dialogue_authorization_pressure_sessions: dialogueAuthorizationPressureSessions,
12523
+ runtime_block_rate_high_sessions: runtimeBlockRateHighSessions,
12524
+ runtime_ui_mode_violation_high_sessions: runtimeUiModeViolationHighSessions,
12525
+ runtime_ui_mode_violation_total_sum: runtimeUiModeViolationTotalSum
12526
+ };
12527
+ }
12528
+
12529
+ function buildAutoHandoffRunFailureSummary(result = {}) {
12530
+ const phases = Array.isArray(result && result.phases) ? result.phases : [];
12531
+ const failedPhase = phases.find(item => item && item.status === 'failed') || null;
12532
+ const gates = result && result.gates && typeof result.gates === 'object'
12533
+ ? result.gates
12534
+ : {};
12535
+ const gateReasons = Array.isArray(gates.reasons) ? gates.reasons : [];
12536
+ const releaseGatePreflight = result && result.release_gate_preflight && typeof result.release_gate_preflight === 'object'
12537
+ ? result.release_gate_preflight
12538
+ : null;
12539
+ const releaseGateReasons = releaseGatePreflight && Array.isArray(releaseGatePreflight.reasons)
12540
+ ? releaseGatePreflight.reasons
12541
+ : [];
12542
+ const moquiBaseline = result && result.moqui_baseline && typeof result.moqui_baseline === 'object'
12543
+ ? result.moqui_baseline
12544
+ : null;
12545
+ const moquiCompare = moquiBaseline && moquiBaseline.compare && typeof moquiBaseline.compare === 'object'
12546
+ ? moquiBaseline.compare
12547
+ : {};
12548
+ const moquiMatrixRegressions = buildAutoHandoffMoquiCoverageRegressions(moquiCompare);
12549
+ const observabilityWeeklyOps = extractAutoObservabilityWeeklyOpsStopTelemetry(
12550
+ result && result.observability_snapshot
12551
+ );
12552
+ const highlights = [];
12553
+ if (typeof result.error === 'string' && result.error.trim()) {
12554
+ highlights.push(`error: ${result.error.trim()}`);
12555
+ }
12556
+ if (gateReasons.length > 0) {
12557
+ highlights.push(`gate: ${gateReasons.join('; ')}`);
12558
+ }
12559
+ if (releaseGatePreflight && releaseGatePreflight.blocked === true) {
12560
+ highlights.push(
12561
+ `release_gate_preflight: ${releaseGateReasons.length > 0 ? releaseGateReasons.join('; ') : 'blocked'}`
12562
+ );
12563
+ }
12564
+ if (failedPhase && failedPhase.id) {
12565
+ highlights.push(`phase: ${failedPhase.id}${failedPhase.error ? ` (${failedPhase.error})` : ''}`);
12566
+ }
12567
+ if (moquiMatrixRegressions.length > 0) {
12568
+ highlights.push(
12569
+ `moqui_matrix_regression: ${moquiMatrixRegressions.slice(0, 3).map(item => `${item.label}:${item.delta_rate_percent}%`).join(' | ')}`
12570
+ );
12571
+ }
12572
+ if (
12573
+ observabilityWeeklyOps &&
12574
+ Number.isFinite(observabilityWeeklyOps.sessions) &&
12575
+ observabilityWeeklyOps.sessions > 0
12576
+ ) {
12577
+ highlights.push(
12578
+ `observability_weekly_ops_stop: sessions=${observabilityWeeklyOps.sessions}, ` +
12579
+ `high_pressure=${Number.isFinite(observabilityWeeklyOps.high_pressure_sessions) ? observabilityWeeklyOps.high_pressure_sessions : 0}, ` +
12580
+ `config_warning=${Number.isFinite(observabilityWeeklyOps.config_warning_positive_sessions) ? observabilityWeeklyOps.config_warning_positive_sessions : 0}, ` +
12581
+ `auth_tier=${Number.isFinite(observabilityWeeklyOps.auth_tier_pressure_sessions) ? observabilityWeeklyOps.auth_tier_pressure_sessions : 0}, ` +
12582
+ `dialogue=${Number.isFinite(observabilityWeeklyOps.dialogue_authorization_pressure_sessions) ? observabilityWeeklyOps.dialogue_authorization_pressure_sessions : 0}, ` +
12583
+ `runtime_block=${Number.isFinite(observabilityWeeklyOps.runtime_block_rate_high_sessions) ? observabilityWeeklyOps.runtime_block_rate_high_sessions : 0}, ` +
12584
+ `runtime_ui_mode=${Number.isFinite(observabilityWeeklyOps.runtime_ui_mode_violation_high_sessions) ? observabilityWeeklyOps.runtime_ui_mode_violation_high_sessions : 0}, ` +
12585
+ `runtime_ui_mode_total=${Number.isFinite(observabilityWeeklyOps.runtime_ui_mode_violation_total_sum) ? observabilityWeeklyOps.runtime_ui_mode_violation_total_sum : 0}`
12586
+ );
12587
+ }
12588
+ return {
12589
+ status: normalizeHandoffText(result && result.status),
12590
+ failed_phase: failedPhase
12591
+ ? {
12592
+ id: normalizeHandoffText(failedPhase.id),
12593
+ title: normalizeHandoffText(failedPhase.title),
12594
+ error: normalizeHandoffText(failedPhase.error)
12595
+ }
12596
+ : null,
12597
+ gate_failed: gates.passed === false,
12598
+ gate_reasons: gateReasons,
12599
+ moqui_matrix_regressions: moquiMatrixRegressions,
12600
+ release_gate_preflight_blocked: Boolean(releaseGatePreflight && releaseGatePreflight.blocked === true),
12601
+ release_gate_preflight_reasons: releaseGateReasons,
12602
+ highlights
12603
+ };
12604
+ }
12605
+
12606
+ function collectHandoffBlockers(resultItem) {
12607
+ const blockers = [];
12608
+ if (!resultItem) {
11706
12609
  return blockers;
11707
12610
  }
11708
12611
  if (typeof resultItem.error === 'string' && resultItem.error.trim().length > 0) {
@@ -11937,6 +12840,9 @@ function buildAutoHandoffRunRecommendations(projectPath, result) {
11937
12840
  ? moquiBaseline.compare
11938
12841
  : {};
11939
12842
  const moquiCoverageRegressions = buildAutoHandoffMoquiCoverageRegressions(moquiCompare);
12843
+ const observabilityWeeklyOps = extractAutoObservabilityWeeklyOpsStopTelemetry(
12844
+ result && result.observability_snapshot
12845
+ );
11940
12846
  const pushMoquiClusterFirstRecoverySequence = () => {
11941
12847
  const lines = buildMoquiRegressionRecoverySequenceLines({
11942
12848
  clusterGoalsArg: quoteCliArg(AUTO_HANDOFF_MOQUI_CLUSTER_REMEDIATION_FILE),
@@ -12034,6 +12940,61 @@ function buildAutoHandoffRunRecommendations(projectPath, result) {
12034
12940
  if (riskLevel === 'high') {
12035
12941
  push('sce auto governance stats --days 14 --json');
12036
12942
  }
12943
+ if (
12944
+ observabilityWeeklyOps &&
12945
+ Number.isFinite(observabilityWeeklyOps.sessions) &&
12946
+ observabilityWeeklyOps.sessions > 0
12947
+ ) {
12948
+ push('node scripts/release-ops-weekly-summary.js --json');
12949
+ push('node scripts/release-weekly-ops-gate.js');
12950
+ if (
12951
+ Number.isFinite(observabilityWeeklyOps.config_warning_positive_sessions) &&
12952
+ observabilityWeeklyOps.config_warning_positive_sessions > 0
12953
+ ) {
12954
+ push(
12955
+ 'Fix invalid weekly ops threshold variables (`KSE_RELEASE_WEEKLY_OPS_*`) and rerun release gates ' +
12956
+ 'to clear config warnings.'
12957
+ );
12958
+ }
12959
+ if (
12960
+ Number.isFinite(observabilityWeeklyOps.auth_tier_pressure_sessions) &&
12961
+ observabilityWeeklyOps.auth_tier_pressure_sessions > 0
12962
+ ) {
12963
+ push(
12964
+ 'node scripts/interactive-authorization-tier-evaluate.js ' +
12965
+ '--policy docs/interactive-customization/authorization-tier-policy-baseline.json --json'
12966
+ );
12967
+ }
12968
+ if (
12969
+ Number.isFinite(observabilityWeeklyOps.dialogue_authorization_pressure_sessions) &&
12970
+ observabilityWeeklyOps.dialogue_authorization_pressure_sessions > 0
12971
+ ) {
12972
+ push(
12973
+ 'node scripts/interactive-dialogue-governance.js ' +
12974
+ '--policy docs/interactive-customization/dialogue-governance-policy-baseline.json ' +
12975
+ '--authorization-dialogue-policy docs/interactive-customization/authorization-dialogue-policy-baseline.json --json'
12976
+ );
12977
+ }
12978
+ if (
12979
+ Number.isFinite(observabilityWeeklyOps.runtime_ui_mode_violation_high_sessions) &&
12980
+ observabilityWeeklyOps.runtime_ui_mode_violation_high_sessions > 0
12981
+ ) {
12982
+ push('node scripts/interactive-governance-report.js --period weekly --fail-on-alert --json');
12983
+ push(
12984
+ 'Review runtime ui-mode contract in docs/interactive-customization/runtime-mode-policy-baseline.json ' +
12985
+ 'to keep user-app suggestion-only and route apply actions to ops-console.'
12986
+ );
12987
+ }
12988
+ if (
12989
+ Number.isFinite(observabilityWeeklyOps.runtime_block_rate_high_sessions) &&
12990
+ observabilityWeeklyOps.runtime_block_rate_high_sessions > 0
12991
+ ) {
12992
+ push(
12993
+ 'Tune runtime deny/review pressure and rerun ' +
12994
+ 'node scripts/interactive-governance-report.js --period weekly --json'
12995
+ );
12996
+ }
12997
+ }
12037
12998
 
12038
12999
  if (result && result.remediation_queue && result.remediation_queue.file) {
12039
13000
  push(
@@ -14193,7 +15154,21 @@ async function runAutoHandoff(projectPath, options = {}) {
14193
15154
  available: result.release_gate_preflight.available,
14194
15155
  blocked: result.release_gate_preflight.blocked,
14195
15156
  latest_tag: result.release_gate_preflight.latest_tag,
14196
- latest_gate_passed: result.release_gate_preflight.latest_gate_passed
15157
+ latest_gate_passed: result.release_gate_preflight.latest_gate_passed,
15158
+ latest_weekly_ops_runtime_block_rate_percent:
15159
+ result.release_gate_preflight.latest_weekly_ops_runtime_block_rate_percent,
15160
+ latest_weekly_ops_runtime_ui_mode_violation_total:
15161
+ result.release_gate_preflight.latest_weekly_ops_runtime_ui_mode_violation_total,
15162
+ latest_weekly_ops_runtime_ui_mode_violation_rate_percent:
15163
+ result.release_gate_preflight.latest_weekly_ops_runtime_ui_mode_violation_rate_percent,
15164
+ weekly_ops_runtime_block_rate_max_percent:
15165
+ result.release_gate_preflight.weekly_ops_runtime_block_rate_max_percent,
15166
+ weekly_ops_runtime_ui_mode_violation_total:
15167
+ result.release_gate_preflight.weekly_ops_runtime_ui_mode_violation_total,
15168
+ weekly_ops_runtime_ui_mode_violation_run_rate_percent:
15169
+ result.release_gate_preflight.weekly_ops_runtime_ui_mode_violation_run_rate_percent,
15170
+ weekly_ops_runtime_ui_mode_violation_rate_max_percent:
15171
+ result.release_gate_preflight.weekly_ops_runtime_ui_mode_violation_rate_max_percent
14197
15172
  }
14198
15173
  });
14199
15174
  const ontologyGateReasons = evaluateAutoHandoffOntologyGateReasons(
@@ -14452,10 +15427,35 @@ async function runAutoHandoff(projectPath, options = {}) {
14452
15427
  const observabilityPhase = beginAutoHandoffRunPhase(result, 'observability', 'Observability snapshot');
14453
15428
  try {
14454
15429
  result.observability_snapshot = await buildAutoObservabilitySnapshot(projectPath, options);
15430
+ const observabilityWeeklyOps = extractAutoObservabilityWeeklyOpsStopTelemetry(result.observability_snapshot);
14455
15431
  completeAutoHandoffRunPhase(observabilityPhase, {
14456
15432
  risk_level: result.observability_snapshot && result.observability_snapshot.highlights
14457
15433
  ? result.observability_snapshot.highlights.governance_risk_level
14458
- : null
15434
+ : null,
15435
+ weekly_ops_stop_sessions: Number(
15436
+ observabilityWeeklyOps && observabilityWeeklyOps.sessions
15437
+ ) || 0,
15438
+ weekly_ops_high_pressure_sessions: Number(
15439
+ observabilityWeeklyOps && observabilityWeeklyOps.high_pressure_sessions
15440
+ ) || 0,
15441
+ weekly_ops_config_warning_positive_sessions: Number(
15442
+ observabilityWeeklyOps && observabilityWeeklyOps.config_warning_positive_sessions
15443
+ ) || 0,
15444
+ weekly_ops_auth_tier_pressure_sessions: Number(
15445
+ observabilityWeeklyOps && observabilityWeeklyOps.auth_tier_pressure_sessions
15446
+ ) || 0,
15447
+ weekly_ops_dialogue_authorization_pressure_sessions: Number(
15448
+ observabilityWeeklyOps && observabilityWeeklyOps.dialogue_authorization_pressure_sessions
15449
+ ) || 0,
15450
+ weekly_ops_runtime_block_rate_high_sessions: Number(
15451
+ observabilityWeeklyOps && observabilityWeeklyOps.runtime_block_rate_high_sessions
15452
+ ) || 0,
15453
+ weekly_ops_runtime_ui_mode_violation_high_sessions: Number(
15454
+ observabilityWeeklyOps && observabilityWeeklyOps.runtime_ui_mode_violation_high_sessions
15455
+ ) || 0,
15456
+ weekly_ops_runtime_ui_mode_violation_total_sum: Number(
15457
+ observabilityWeeklyOps && observabilityWeeklyOps.runtime_ui_mode_violation_total_sum
15458
+ ) || 0
14459
15459
  });
14460
15460
  } catch (error) {
14461
15461
  failAutoHandoffRunPhase(observabilityPhase, error);
@@ -15634,6 +16634,178 @@ function normalizeGovernanceReleaseGateSnapshot(snapshotCandidate) {
15634
16634
  };
15635
16635
  }
15636
16636
 
16637
+ function normalizeGovernanceWeeklyOpsStopDetail(detailCandidate) {
16638
+ if (!detailCandidate || typeof detailCandidate !== 'object' || Array.isArray(detailCandidate)) {
16639
+ return null;
16640
+ }
16641
+ const latestCandidate = detailCandidate.latest && typeof detailCandidate.latest === 'object'
16642
+ ? detailCandidate.latest
16643
+ : {};
16644
+ const aggregatesCandidate = detailCandidate.aggregates && typeof detailCandidate.aggregates === 'object'
16645
+ ? detailCandidate.aggregates
16646
+ : {};
16647
+ const pressureCandidate = detailCandidate.pressure && typeof detailCandidate.pressure === 'object'
16648
+ ? detailCandidate.pressure
16649
+ : {};
16650
+
16651
+ const latestRiskLevelRaw = normalizeHandoffText(latestCandidate.risk_level);
16652
+ const latestRiskLevel = latestRiskLevelRaw
16653
+ ? normalizeAutoHandoffGateRiskLevel(latestRiskLevelRaw)
16654
+ : null;
16655
+ const normalized = {
16656
+ latest: {
16657
+ blocked: parseAutoHandoffGateBoolean(latestCandidate.blocked, null),
16658
+ risk_level: latestRiskLevel,
16659
+ governance_status: normalizeHandoffText(latestCandidate.governance_status),
16660
+ authorization_tier_block_rate_percent: toGovernanceReleaseGateNumber(
16661
+ latestCandidate.authorization_tier_block_rate_percent
16662
+ ),
16663
+ dialogue_authorization_block_rate_percent: toGovernanceReleaseGateNumber(
16664
+ latestCandidate.dialogue_authorization_block_rate_percent
16665
+ ),
16666
+ config_warning_count: toGovernanceReleaseGateNumber(latestCandidate.config_warning_count),
16667
+ runtime_block_rate_percent: toGovernanceReleaseGateNumber(
16668
+ latestCandidate.runtime_block_rate_percent
16669
+ ),
16670
+ runtime_ui_mode_violation_total: toGovernanceReleaseGateNumber(
16671
+ latestCandidate.runtime_ui_mode_violation_total
16672
+ ),
16673
+ runtime_ui_mode_violation_rate_percent: toGovernanceReleaseGateNumber(
16674
+ latestCandidate.runtime_ui_mode_violation_rate_percent
16675
+ )
16676
+ },
16677
+ aggregates: {
16678
+ blocked_runs: toGovernanceReleaseGateNumber(aggregatesCandidate.blocked_runs),
16679
+ block_rate_percent: toGovernanceReleaseGateNumber(aggregatesCandidate.block_rate_percent),
16680
+ violations_total: toGovernanceReleaseGateNumber(aggregatesCandidate.violations_total),
16681
+ warnings_total: toGovernanceReleaseGateNumber(aggregatesCandidate.warnings_total),
16682
+ config_warnings_total: toGovernanceReleaseGateNumber(aggregatesCandidate.config_warnings_total),
16683
+ authorization_tier_block_rate_max_percent: toGovernanceReleaseGateNumber(
16684
+ aggregatesCandidate.authorization_tier_block_rate_max_percent
16685
+ ),
16686
+ dialogue_authorization_block_rate_max_percent: toGovernanceReleaseGateNumber(
16687
+ aggregatesCandidate.dialogue_authorization_block_rate_max_percent
16688
+ ),
16689
+ runtime_block_rate_max_percent: toGovernanceReleaseGateNumber(
16690
+ aggregatesCandidate.runtime_block_rate_max_percent
16691
+ ),
16692
+ runtime_ui_mode_violation_total: toGovernanceReleaseGateNumber(
16693
+ aggregatesCandidate.runtime_ui_mode_violation_total
16694
+ ),
16695
+ runtime_ui_mode_violation_run_rate_percent: toGovernanceReleaseGateNumber(
16696
+ aggregatesCandidate.runtime_ui_mode_violation_run_rate_percent
16697
+ ),
16698
+ runtime_ui_mode_violation_rate_max_percent: toGovernanceReleaseGateNumber(
16699
+ aggregatesCandidate.runtime_ui_mode_violation_rate_max_percent
16700
+ )
16701
+ },
16702
+ pressure: {
16703
+ blocked: parseAutoHandoffGateBoolean(pressureCandidate.blocked, null),
16704
+ high: parseAutoHandoffGateBoolean(pressureCandidate.high, null),
16705
+ config_warning_positive: parseAutoHandoffGateBoolean(pressureCandidate.config_warning_positive, null),
16706
+ auth_tier_block_rate_high: parseAutoHandoffGateBoolean(pressureCandidate.auth_tier_block_rate_high, null),
16707
+ dialogue_authorization_block_rate_high: parseAutoHandoffGateBoolean(
16708
+ pressureCandidate.dialogue_authorization_block_rate_high,
16709
+ null
16710
+ ),
16711
+ runtime_block_rate_high: parseAutoHandoffGateBoolean(pressureCandidate.runtime_block_rate_high, null),
16712
+ runtime_ui_mode_violation_high: parseAutoHandoffGateBoolean(
16713
+ pressureCandidate.runtime_ui_mode_violation_high,
16714
+ null
16715
+ )
16716
+ }
16717
+ };
16718
+ const hasSignal = (
16719
+ typeof normalized.latest.blocked === 'boolean' ||
16720
+ !!normalized.latest.risk_level ||
16721
+ !!normalized.latest.governance_status ||
16722
+ Number.isFinite(normalized.latest.authorization_tier_block_rate_percent) ||
16723
+ Number.isFinite(normalized.latest.dialogue_authorization_block_rate_percent) ||
16724
+ Number.isFinite(normalized.latest.config_warning_count) ||
16725
+ Number.isFinite(normalized.latest.runtime_block_rate_percent) ||
16726
+ Number.isFinite(normalized.latest.runtime_ui_mode_violation_total) ||
16727
+ Number.isFinite(normalized.latest.runtime_ui_mode_violation_rate_percent) ||
16728
+ Number.isFinite(normalized.aggregates.blocked_runs) ||
16729
+ Number.isFinite(normalized.aggregates.block_rate_percent) ||
16730
+ Number.isFinite(normalized.aggregates.violations_total) ||
16731
+ Number.isFinite(normalized.aggregates.warnings_total) ||
16732
+ Number.isFinite(normalized.aggregates.config_warnings_total) ||
16733
+ Number.isFinite(normalized.aggregates.authorization_tier_block_rate_max_percent) ||
16734
+ Number.isFinite(normalized.aggregates.dialogue_authorization_block_rate_max_percent) ||
16735
+ Number.isFinite(normalized.aggregates.runtime_block_rate_max_percent) ||
16736
+ Number.isFinite(normalized.aggregates.runtime_ui_mode_violation_total) ||
16737
+ Number.isFinite(normalized.aggregates.runtime_ui_mode_violation_run_rate_percent) ||
16738
+ Number.isFinite(normalized.aggregates.runtime_ui_mode_violation_rate_max_percent) ||
16739
+ typeof normalized.pressure.blocked === 'boolean' ||
16740
+ typeof normalized.pressure.high === 'boolean' ||
16741
+ typeof normalized.pressure.config_warning_positive === 'boolean' ||
16742
+ typeof normalized.pressure.auth_tier_block_rate_high === 'boolean' ||
16743
+ typeof normalized.pressure.dialogue_authorization_block_rate_high === 'boolean' ||
16744
+ typeof normalized.pressure.runtime_block_rate_high === 'boolean' ||
16745
+ typeof normalized.pressure.runtime_ui_mode_violation_high === 'boolean'
16746
+ );
16747
+ return hasSignal ? normalized : null;
16748
+ }
16749
+
16750
+ function deriveGovernanceWeeklyOpsReasonFlags(reasonsCandidate) {
16751
+ const reasons = Array.isArray(reasonsCandidate)
16752
+ ? reasonsCandidate.map(item => `${item || ''}`.trim().toLowerCase()).filter(Boolean)
16753
+ : [];
16754
+ const hasWeeklyOpsReason = reasons.some(reason => reason.startsWith('weekly-ops-'));
16755
+ const hasBlockedReason = reasons.some(reason => (
16756
+ reason === 'weekly-ops-latest-blocked' ||
16757
+ reason.startsWith('weekly-ops-blocked-runs-positive:') ||
16758
+ reason.startsWith('weekly-ops-block-rate-positive:')
16759
+ ));
16760
+ const hasHighReason = reasons.some(reason => (
16761
+ reason === 'weekly-ops-latest-risk-high' ||
16762
+ reason.startsWith('weekly-ops-auth-tier-block-rate-high:') ||
16763
+ reason.startsWith('weekly-ops-dialogue-authorization-block-rate-high:') ||
16764
+ reason.startsWith('weekly-ops-latest-auth-tier-block-rate-high:') ||
16765
+ reason.startsWith('weekly-ops-latest-dialogue-authorization-block-rate-high:') ||
16766
+ reason.startsWith('weekly-ops-latest-runtime-block-rate-high:') ||
16767
+ reason.startsWith('weekly-ops-runtime-block-rate-high:') ||
16768
+ reason.startsWith('weekly-ops-latest-runtime-ui-mode-violations-positive:') ||
16769
+ reason.startsWith('weekly-ops-runtime-ui-mode-violations-positive:') ||
16770
+ reason.startsWith('weekly-ops-latest-runtime-ui-mode-violation-rate-positive:') ||
16771
+ reason.startsWith('weekly-ops-runtime-ui-mode-violation-run-rate-positive:') ||
16772
+ reason.startsWith('weekly-ops-runtime-ui-mode-violation-rate-high:')
16773
+ ));
16774
+ const hasConfigWarningReason = reasons.some(reason => (
16775
+ reason.startsWith('weekly-ops-config-warnings-positive:') ||
16776
+ reason.startsWith('weekly-ops-latest-config-warnings-positive:')
16777
+ ));
16778
+ const hasAuthTierHighReason = reasons.some(reason => (
16779
+ reason.startsWith('weekly-ops-auth-tier-block-rate-high:') ||
16780
+ reason.startsWith('weekly-ops-latest-auth-tier-block-rate-high:')
16781
+ ));
16782
+ const hasDialogueHighReason = reasons.some(reason => (
16783
+ reason.startsWith('weekly-ops-dialogue-authorization-block-rate-high:') ||
16784
+ reason.startsWith('weekly-ops-latest-dialogue-authorization-block-rate-high:')
16785
+ ));
16786
+ const hasRuntimeBlockRateHighReason = reasons.some(reason => (
16787
+ reason.startsWith('weekly-ops-latest-runtime-block-rate-high:') ||
16788
+ reason.startsWith('weekly-ops-runtime-block-rate-high:')
16789
+ ));
16790
+ const hasRuntimeUiModeViolationReason = reasons.some(reason => (
16791
+ reason.startsWith('weekly-ops-latest-runtime-ui-mode-violations-positive:') ||
16792
+ reason.startsWith('weekly-ops-runtime-ui-mode-violations-positive:') ||
16793
+ reason.startsWith('weekly-ops-latest-runtime-ui-mode-violation-rate-positive:') ||
16794
+ reason.startsWith('weekly-ops-runtime-ui-mode-violation-run-rate-positive:') ||
16795
+ reason.startsWith('weekly-ops-runtime-ui-mode-violation-rate-high:')
16796
+ ));
16797
+ return {
16798
+ has_weekly_ops_reason: hasWeeklyOpsReason,
16799
+ blocked: hasBlockedReason,
16800
+ high: hasHighReason,
16801
+ config_warning_positive: hasConfigWarningReason,
16802
+ auth_tier_block_rate_high: hasAuthTierHighReason,
16803
+ dialogue_authorization_block_rate_high: hasDialogueHighReason,
16804
+ runtime_block_rate_high: hasRuntimeBlockRateHighReason,
16805
+ runtime_ui_mode_violation_high: hasRuntimeUiModeViolationReason
16806
+ };
16807
+ }
16808
+
15637
16809
  function normalizeGovernanceHandoffQualitySnapshot(snapshotCandidate) {
15638
16810
  if (!snapshotCandidate || typeof snapshotCandidate !== 'object' || Array.isArray(snapshotCandidate)) {
15639
16811
  return null;
@@ -15754,6 +16926,91 @@ async function readGovernanceCloseLoopSessionEntries(projectPath) {
15754
16926
  : null
15755
16927
  );
15756
16928
  const roundReleaseGateTelemetry = summarizeGovernanceRoundReleaseGateTelemetry(payload && payload.rounds);
16929
+ const stopDetail = payload && payload.stop_detail && typeof payload.stop_detail === 'object'
16930
+ ? payload.stop_detail
16931
+ : null;
16932
+ const stopDetailReasons = Array.isArray(stopDetail && stopDetail.reasons)
16933
+ ? stopDetail.reasons
16934
+ : [];
16935
+ const stopDetailWeeklyOps = normalizeGovernanceWeeklyOpsStopDetail(
16936
+ stopDetail && stopDetail.weekly_ops
16937
+ );
16938
+ const stopDetailWeeklyOpsReasonFlags = deriveGovernanceWeeklyOpsReasonFlags(stopDetailReasons);
16939
+ const stopDetailWeeklyOpsAuthTierBlockRatePercent = (
16940
+ stopDetailWeeklyOps &&
16941
+ stopDetailWeeklyOps.latest &&
16942
+ Number.isFinite(stopDetailWeeklyOps.latest.authorization_tier_block_rate_percent)
16943
+ )
16944
+ ? stopDetailWeeklyOps.latest.authorization_tier_block_rate_percent
16945
+ : (
16946
+ stopDetailWeeklyOps &&
16947
+ stopDetailWeeklyOps.aggregates &&
16948
+ Number.isFinite(stopDetailWeeklyOps.aggregates.authorization_tier_block_rate_max_percent)
16949
+ )
16950
+ ? stopDetailWeeklyOps.aggregates.authorization_tier_block_rate_max_percent
16951
+ : null;
16952
+ const stopDetailWeeklyOpsDialogueAuthorizationBlockRatePercent = (
16953
+ stopDetailWeeklyOps &&
16954
+ stopDetailWeeklyOps.latest &&
16955
+ Number.isFinite(stopDetailWeeklyOps.latest.dialogue_authorization_block_rate_percent)
16956
+ )
16957
+ ? stopDetailWeeklyOps.latest.dialogue_authorization_block_rate_percent
16958
+ : (
16959
+ stopDetailWeeklyOps &&
16960
+ stopDetailWeeklyOps.aggregates &&
16961
+ Number.isFinite(stopDetailWeeklyOps.aggregates.dialogue_authorization_block_rate_max_percent)
16962
+ )
16963
+ ? stopDetailWeeklyOps.aggregates.dialogue_authorization_block_rate_max_percent
16964
+ : null;
16965
+ const stopDetailWeeklyOpsRuntimeBlockRatePercent = (
16966
+ stopDetailWeeklyOps &&
16967
+ stopDetailWeeklyOps.latest &&
16968
+ Number.isFinite(stopDetailWeeklyOps.latest.runtime_block_rate_percent)
16969
+ )
16970
+ ? stopDetailWeeklyOps.latest.runtime_block_rate_percent
16971
+ : (
16972
+ stopDetailWeeklyOps &&
16973
+ stopDetailWeeklyOps.aggregates &&
16974
+ Number.isFinite(stopDetailWeeklyOps.aggregates.runtime_block_rate_max_percent)
16975
+ )
16976
+ ? stopDetailWeeklyOps.aggregates.runtime_block_rate_max_percent
16977
+ : null;
16978
+ const stopDetailWeeklyOpsRuntimeUiModeViolationTotal = (
16979
+ stopDetailWeeklyOps &&
16980
+ stopDetailWeeklyOps.latest &&
16981
+ Number.isFinite(stopDetailWeeklyOps.latest.runtime_ui_mode_violation_total)
16982
+ )
16983
+ ? stopDetailWeeklyOps.latest.runtime_ui_mode_violation_total
16984
+ : (
16985
+ stopDetailWeeklyOps &&
16986
+ stopDetailWeeklyOps.aggregates &&
16987
+ Number.isFinite(stopDetailWeeklyOps.aggregates.runtime_ui_mode_violation_total)
16988
+ )
16989
+ ? stopDetailWeeklyOps.aggregates.runtime_ui_mode_violation_total
16990
+ : null;
16991
+ const stopDetailWeeklyOpsRuntimeUiModeViolationRatePercent = (
16992
+ stopDetailWeeklyOps &&
16993
+ stopDetailWeeklyOps.latest &&
16994
+ Number.isFinite(stopDetailWeeklyOps.latest.runtime_ui_mode_violation_rate_percent)
16995
+ )
16996
+ ? stopDetailWeeklyOps.latest.runtime_ui_mode_violation_rate_percent
16997
+ : (
16998
+ stopDetailWeeklyOps &&
16999
+ stopDetailWeeklyOps.aggregates &&
17000
+ Number.isFinite(stopDetailWeeklyOps.aggregates.runtime_ui_mode_violation_rate_max_percent)
17001
+ )
17002
+ ? stopDetailWeeklyOps.aggregates.runtime_ui_mode_violation_rate_max_percent
17003
+ : (
17004
+ stopDetailWeeklyOps &&
17005
+ stopDetailWeeklyOps.aggregates &&
17006
+ Number.isFinite(stopDetailWeeklyOps.aggregates.runtime_ui_mode_violation_run_rate_percent)
17007
+ )
17008
+ ? stopDetailWeeklyOps.aggregates.runtime_ui_mode_violation_run_rate_percent
17009
+ : null;
17010
+ const stopDetailWeeklyOpsAvailable = Boolean(
17011
+ stopDetailWeeklyOps ||
17012
+ stopDetailWeeklyOpsReasonFlags.has_weekly_ops_reason
17013
+ );
15757
17014
 
15758
17015
  sessions.push({
15759
17016
  id: payload && payload.governance_session && payload.governance_session.id
@@ -15801,6 +17058,44 @@ async function readGovernanceCloseLoopSessionEntries(projectPath) {
15801
17058
  release_gate_drift_blocked_runs: finalReleaseGate ? finalReleaseGate.drift_blocked_runs : null,
15802
17059
  round_release_gate_observed: roundReleaseGateTelemetry.observed_rounds,
15803
17060
  round_release_gate_changed: roundReleaseGateTelemetry.changed_rounds,
17061
+ stop_detail_weekly_ops_available: stopDetailWeeklyOpsAvailable,
17062
+ stop_detail_weekly_ops_blocked: stopDetailWeeklyOps
17063
+ ? stopDetailWeeklyOps.pressure.blocked
17064
+ : (stopDetailWeeklyOpsReasonFlags.blocked ? true : null),
17065
+ stop_detail_weekly_ops_high_pressure: stopDetailWeeklyOps
17066
+ ? stopDetailWeeklyOps.pressure.high
17067
+ : (stopDetailWeeklyOpsReasonFlags.high ? true : null),
17068
+ stop_detail_weekly_ops_config_warning_positive: stopDetailWeeklyOps
17069
+ ? stopDetailWeeklyOps.pressure.config_warning_positive
17070
+ : (stopDetailWeeklyOpsReasonFlags.config_warning_positive ? true : null),
17071
+ stop_detail_weekly_ops_auth_tier_block_rate_high: stopDetailWeeklyOps
17072
+ ? stopDetailWeeklyOps.pressure.auth_tier_block_rate_high
17073
+ : (stopDetailWeeklyOpsReasonFlags.auth_tier_block_rate_high ? true : null),
17074
+ stop_detail_weekly_ops_dialogue_authorization_block_rate_high: stopDetailWeeklyOps
17075
+ ? stopDetailWeeklyOps.pressure.dialogue_authorization_block_rate_high
17076
+ : (stopDetailWeeklyOpsReasonFlags.dialogue_authorization_block_rate_high ? true : null),
17077
+ stop_detail_weekly_ops_runtime_block_rate_high: stopDetailWeeklyOps
17078
+ ? stopDetailWeeklyOps.pressure.runtime_block_rate_high
17079
+ : (stopDetailWeeklyOpsReasonFlags.runtime_block_rate_high ? true : null),
17080
+ stop_detail_weekly_ops_runtime_ui_mode_violation_high: stopDetailWeeklyOps
17081
+ ? stopDetailWeeklyOps.pressure.runtime_ui_mode_violation_high
17082
+ : (stopDetailWeeklyOpsReasonFlags.runtime_ui_mode_violation_high ? true : null),
17083
+ stop_detail_weekly_ops_blocked_runs: stopDetailWeeklyOps && stopDetailWeeklyOps.aggregates
17084
+ ? stopDetailWeeklyOps.aggregates.blocked_runs
17085
+ : null,
17086
+ stop_detail_weekly_ops_block_rate_percent: stopDetailWeeklyOps && stopDetailWeeklyOps.aggregates
17087
+ ? stopDetailWeeklyOps.aggregates.block_rate_percent
17088
+ : null,
17089
+ stop_detail_weekly_ops_config_warnings_total: stopDetailWeeklyOps && stopDetailWeeklyOps.aggregates
17090
+ ? stopDetailWeeklyOps.aggregates.config_warnings_total
17091
+ : null,
17092
+ stop_detail_weekly_ops_auth_tier_block_rate_percent: stopDetailWeeklyOpsAuthTierBlockRatePercent,
17093
+ stop_detail_weekly_ops_dialogue_authorization_block_rate_percent:
17094
+ stopDetailWeeklyOpsDialogueAuthorizationBlockRatePercent,
17095
+ stop_detail_weekly_ops_runtime_block_rate_percent: stopDetailWeeklyOpsRuntimeBlockRatePercent,
17096
+ stop_detail_weekly_ops_runtime_ui_mode_violation_total: stopDetailWeeklyOpsRuntimeUiModeViolationTotal,
17097
+ stop_detail_weekly_ops_runtime_ui_mode_violation_rate_percent:
17098
+ stopDetailWeeklyOpsRuntimeUiModeViolationRatePercent,
15804
17099
  stop_reason: payload && typeof payload.stop_reason === 'string'
15805
17100
  ? payload.stop_reason
15806
17101
  : null,
@@ -17277,6 +18572,27 @@ async function listGovernanceCloseLoopSessions(projectPath, options = {}) {
17277
18572
  release_gate_drift_alert_rate_percent: item.release_gate_drift_alert_rate_percent,
17278
18573
  round_release_gate_observed: item.round_release_gate_observed,
17279
18574
  round_release_gate_changed: item.round_release_gate_changed,
18575
+ stop_detail_weekly_ops_available: item.stop_detail_weekly_ops_available,
18576
+ stop_detail_weekly_ops_blocked: item.stop_detail_weekly_ops_blocked,
18577
+ stop_detail_weekly_ops_high_pressure: item.stop_detail_weekly_ops_high_pressure,
18578
+ stop_detail_weekly_ops_config_warning_positive: item.stop_detail_weekly_ops_config_warning_positive,
18579
+ stop_detail_weekly_ops_auth_tier_block_rate_high: item.stop_detail_weekly_ops_auth_tier_block_rate_high,
18580
+ stop_detail_weekly_ops_dialogue_authorization_block_rate_high:
18581
+ item.stop_detail_weekly_ops_dialogue_authorization_block_rate_high,
18582
+ stop_detail_weekly_ops_runtime_block_rate_high: item.stop_detail_weekly_ops_runtime_block_rate_high,
18583
+ stop_detail_weekly_ops_runtime_ui_mode_violation_high:
18584
+ item.stop_detail_weekly_ops_runtime_ui_mode_violation_high,
18585
+ stop_detail_weekly_ops_blocked_runs: item.stop_detail_weekly_ops_blocked_runs,
18586
+ stop_detail_weekly_ops_block_rate_percent: item.stop_detail_weekly_ops_block_rate_percent,
18587
+ stop_detail_weekly_ops_config_warnings_total: item.stop_detail_weekly_ops_config_warnings_total,
18588
+ stop_detail_weekly_ops_auth_tier_block_rate_percent: item.stop_detail_weekly_ops_auth_tier_block_rate_percent,
18589
+ stop_detail_weekly_ops_dialogue_authorization_block_rate_percent:
18590
+ item.stop_detail_weekly_ops_dialogue_authorization_block_rate_percent,
18591
+ stop_detail_weekly_ops_runtime_block_rate_percent: item.stop_detail_weekly_ops_runtime_block_rate_percent,
18592
+ stop_detail_weekly_ops_runtime_ui_mode_violation_total:
18593
+ item.stop_detail_weekly_ops_runtime_ui_mode_violation_total,
18594
+ stop_detail_weekly_ops_runtime_ui_mode_violation_rate_percent:
18595
+ item.stop_detail_weekly_ops_runtime_ui_mode_violation_rate_percent,
17280
18596
  stop_reason: item.stop_reason,
17281
18597
  resumed_from_governance_session_id: item.resumed_from_governance_session_id,
17282
18598
  updated_at: item.updated_at,
@@ -17321,6 +18637,30 @@ async function statsGovernanceCloseLoopSessions(projectPath, options = {}) {
17321
18637
  let releaseGateDriftAlertRateCount = 0;
17322
18638
  let roundReleaseGateObservedSum = 0;
17323
18639
  let roundReleaseGateChangedSum = 0;
18640
+ let weeklyOpsStopSessions = 0;
18641
+ let weeklyOpsBlockedStopSessions = 0;
18642
+ let weeklyOpsHighPressureStopSessions = 0;
18643
+ let weeklyOpsConfigWarningPositiveStopSessions = 0;
18644
+ let weeklyOpsAuthTierPressureStopSessions = 0;
18645
+ let weeklyOpsDialoguePressureStopSessions = 0;
18646
+ let weeklyOpsRuntimeBlockRateHighStopSessions = 0;
18647
+ let weeklyOpsRuntimeUiModeViolationHighStopSessions = 0;
18648
+ let weeklyOpsBlockedRunsSum = 0;
18649
+ let weeklyOpsBlockedRunsCount = 0;
18650
+ let weeklyOpsBlockRateSum = 0;
18651
+ let weeklyOpsBlockRateCount = 0;
18652
+ let weeklyOpsConfigWarningsTotalSum = 0;
18653
+ let weeklyOpsConfigWarningsTotalCount = 0;
18654
+ let weeklyOpsAuthTierBlockRateSum = 0;
18655
+ let weeklyOpsAuthTierBlockRateCount = 0;
18656
+ let weeklyOpsDialogueBlockRateSum = 0;
18657
+ let weeklyOpsDialogueBlockRateCount = 0;
18658
+ let weeklyOpsRuntimeBlockRateSum = 0;
18659
+ let weeklyOpsRuntimeBlockRateCount = 0;
18660
+ let weeklyOpsRuntimeUiModeViolationTotalSum = 0;
18661
+ let weeklyOpsRuntimeUiModeViolationTotalCount = 0;
18662
+ let weeklyOpsRuntimeUiModeViolationRateSum = 0;
18663
+ let weeklyOpsRuntimeUiModeViolationRateCount = 0;
17324
18664
  const stopReasonCounts = {};
17325
18665
  const finalRiskCounts = {};
17326
18666
  const resumedFromCounts = {};
@@ -17390,6 +18730,86 @@ async function statsGovernanceCloseLoopSessions(projectPath, options = {}) {
17390
18730
  roundReleaseGateChangedSum += roundReleaseGateChanged;
17391
18731
  }
17392
18732
  }
18733
+ if (session && session.stop_detail_weekly_ops_available === true) {
18734
+ weeklyOpsStopSessions += 1;
18735
+ }
18736
+ if (session && session.stop_detail_weekly_ops_blocked === true) {
18737
+ weeklyOpsBlockedStopSessions += 1;
18738
+ }
18739
+ if (session && session.stop_detail_weekly_ops_high_pressure === true) {
18740
+ weeklyOpsHighPressureStopSessions += 1;
18741
+ }
18742
+ if (session && session.stop_detail_weekly_ops_config_warning_positive === true) {
18743
+ weeklyOpsConfigWarningPositiveStopSessions += 1;
18744
+ }
18745
+ if (session && session.stop_detail_weekly_ops_auth_tier_block_rate_high === true) {
18746
+ weeklyOpsAuthTierPressureStopSessions += 1;
18747
+ }
18748
+ if (session && session.stop_detail_weekly_ops_dialogue_authorization_block_rate_high === true) {
18749
+ weeklyOpsDialoguePressureStopSessions += 1;
18750
+ }
18751
+ if (session && session.stop_detail_weekly_ops_runtime_block_rate_high === true) {
18752
+ weeklyOpsRuntimeBlockRateHighStopSessions += 1;
18753
+ }
18754
+ if (session && session.stop_detail_weekly_ops_runtime_ui_mode_violation_high === true) {
18755
+ weeklyOpsRuntimeUiModeViolationHighStopSessions += 1;
18756
+ }
18757
+ const weeklyOpsBlockedRuns = toGovernanceReleaseGateNumber(
18758
+ session && session.stop_detail_weekly_ops_blocked_runs
18759
+ );
18760
+ if (Number.isFinite(weeklyOpsBlockedRuns)) {
18761
+ weeklyOpsBlockedRunsSum += weeklyOpsBlockedRuns;
18762
+ weeklyOpsBlockedRunsCount += 1;
18763
+ }
18764
+ const weeklyOpsBlockRate = toGovernanceReleaseGateNumber(
18765
+ session && session.stop_detail_weekly_ops_block_rate_percent
18766
+ );
18767
+ if (Number.isFinite(weeklyOpsBlockRate)) {
18768
+ weeklyOpsBlockRateSum += weeklyOpsBlockRate;
18769
+ weeklyOpsBlockRateCount += 1;
18770
+ }
18771
+ const weeklyOpsConfigWarningsTotal = toGovernanceReleaseGateNumber(
18772
+ session && session.stop_detail_weekly_ops_config_warnings_total
18773
+ );
18774
+ if (Number.isFinite(weeklyOpsConfigWarningsTotal)) {
18775
+ weeklyOpsConfigWarningsTotalSum += weeklyOpsConfigWarningsTotal;
18776
+ weeklyOpsConfigWarningsTotalCount += 1;
18777
+ }
18778
+ const weeklyOpsAuthTierBlockRate = toGovernanceReleaseGateNumber(
18779
+ session && session.stop_detail_weekly_ops_auth_tier_block_rate_percent
18780
+ );
18781
+ if (Number.isFinite(weeklyOpsAuthTierBlockRate)) {
18782
+ weeklyOpsAuthTierBlockRateSum += weeklyOpsAuthTierBlockRate;
18783
+ weeklyOpsAuthTierBlockRateCount += 1;
18784
+ }
18785
+ const weeklyOpsDialogueBlockRate = toGovernanceReleaseGateNumber(
18786
+ session && session.stop_detail_weekly_ops_dialogue_authorization_block_rate_percent
18787
+ );
18788
+ if (Number.isFinite(weeklyOpsDialogueBlockRate)) {
18789
+ weeklyOpsDialogueBlockRateSum += weeklyOpsDialogueBlockRate;
18790
+ weeklyOpsDialogueBlockRateCount += 1;
18791
+ }
18792
+ const weeklyOpsRuntimeBlockRate = toGovernanceReleaseGateNumber(
18793
+ session && session.stop_detail_weekly_ops_runtime_block_rate_percent
18794
+ );
18795
+ if (Number.isFinite(weeklyOpsRuntimeBlockRate)) {
18796
+ weeklyOpsRuntimeBlockRateSum += weeklyOpsRuntimeBlockRate;
18797
+ weeklyOpsRuntimeBlockRateCount += 1;
18798
+ }
18799
+ const weeklyOpsRuntimeUiModeViolationTotal = toGovernanceReleaseGateNumber(
18800
+ session && session.stop_detail_weekly_ops_runtime_ui_mode_violation_total
18801
+ );
18802
+ if (Number.isFinite(weeklyOpsRuntimeUiModeViolationTotal)) {
18803
+ weeklyOpsRuntimeUiModeViolationTotalSum += weeklyOpsRuntimeUiModeViolationTotal;
18804
+ weeklyOpsRuntimeUiModeViolationTotalCount += 1;
18805
+ }
18806
+ const weeklyOpsRuntimeUiModeViolationRate = toGovernanceReleaseGateNumber(
18807
+ session && session.stop_detail_weekly_ops_runtime_ui_mode_violation_rate_percent
18808
+ );
18809
+ if (Number.isFinite(weeklyOpsRuntimeUiModeViolationRate)) {
18810
+ weeklyOpsRuntimeUiModeViolationRateSum += weeklyOpsRuntimeUiModeViolationRate;
18811
+ weeklyOpsRuntimeUiModeViolationRateCount += 1;
18812
+ }
17393
18813
 
17394
18814
  const stopReason = `${session && session.stop_reason ? session.stop_reason : ''}`.trim().toLowerCase() || 'unknown';
17395
18815
  stopReasonCounts[stopReason] = (stopReasonCounts[stopReason] || 0) + 1;
@@ -17454,7 +18874,64 @@ async function statsGovernanceCloseLoopSessions(projectPath, options = {}) {
17454
18874
  : null,
17455
18875
  round_telemetry_observed: roundReleaseGateObservedSum,
17456
18876
  round_telemetry_changed: roundReleaseGateChangedSum,
17457
- round_telemetry_change_rate_percent: calculatePercent(roundReleaseGateChangedSum, roundReleaseGateObservedSum)
18877
+ round_telemetry_change_rate_percent: calculatePercent(roundReleaseGateChangedSum, roundReleaseGateObservedSum),
18878
+ weekly_ops_stop: {
18879
+ sessions: weeklyOpsStopSessions,
18880
+ session_rate_percent: calculatePercent(weeklyOpsStopSessions, totalSessions),
18881
+ blocked_sessions: weeklyOpsBlockedStopSessions,
18882
+ blocked_session_rate_percent: calculatePercent(weeklyOpsBlockedStopSessions, weeklyOpsStopSessions),
18883
+ high_pressure_sessions: weeklyOpsHighPressureStopSessions,
18884
+ high_pressure_session_rate_percent: calculatePercent(weeklyOpsHighPressureStopSessions, weeklyOpsStopSessions),
18885
+ config_warning_positive_sessions: weeklyOpsConfigWarningPositiveStopSessions,
18886
+ config_warning_positive_rate_percent: calculatePercent(
18887
+ weeklyOpsConfigWarningPositiveStopSessions,
18888
+ weeklyOpsStopSessions
18889
+ ),
18890
+ auth_tier_pressure_sessions: weeklyOpsAuthTierPressureStopSessions,
18891
+ auth_tier_pressure_rate_percent: calculatePercent(weeklyOpsAuthTierPressureStopSessions, weeklyOpsStopSessions),
18892
+ dialogue_authorization_pressure_sessions: weeklyOpsDialoguePressureStopSessions,
18893
+ dialogue_authorization_pressure_rate_percent: calculatePercent(
18894
+ weeklyOpsDialoguePressureStopSessions,
18895
+ weeklyOpsStopSessions
18896
+ ),
18897
+ runtime_block_rate_high_sessions: weeklyOpsRuntimeBlockRateHighStopSessions,
18898
+ runtime_block_rate_high_rate_percent: calculatePercent(
18899
+ weeklyOpsRuntimeBlockRateHighStopSessions,
18900
+ weeklyOpsStopSessions
18901
+ ),
18902
+ runtime_ui_mode_violation_high_sessions: weeklyOpsRuntimeUiModeViolationHighStopSessions,
18903
+ runtime_ui_mode_violation_high_rate_percent: calculatePercent(
18904
+ weeklyOpsRuntimeUiModeViolationHighStopSessions,
18905
+ weeklyOpsStopSessions
18906
+ ),
18907
+ blocked_runs_sum: weeklyOpsBlockedRunsSum,
18908
+ average_blocked_runs: weeklyOpsBlockedRunsCount > 0
18909
+ ? Number((weeklyOpsBlockedRunsSum / weeklyOpsBlockedRunsCount).toFixed(2))
18910
+ : null,
18911
+ average_block_rate_percent: weeklyOpsBlockRateCount > 0
18912
+ ? Number((weeklyOpsBlockRateSum / weeklyOpsBlockRateCount).toFixed(2))
18913
+ : null,
18914
+ config_warnings_total_sum: weeklyOpsConfigWarningsTotalSum,
18915
+ average_config_warnings_total: weeklyOpsConfigWarningsTotalCount > 0
18916
+ ? Number((weeklyOpsConfigWarningsTotalSum / weeklyOpsConfigWarningsTotalCount).toFixed(2))
18917
+ : null,
18918
+ average_auth_tier_block_rate_percent: weeklyOpsAuthTierBlockRateCount > 0
18919
+ ? Number((weeklyOpsAuthTierBlockRateSum / weeklyOpsAuthTierBlockRateCount).toFixed(2))
18920
+ : null,
18921
+ average_dialogue_authorization_block_rate_percent: weeklyOpsDialogueBlockRateCount > 0
18922
+ ? Number((weeklyOpsDialogueBlockRateSum / weeklyOpsDialogueBlockRateCount).toFixed(2))
18923
+ : null,
18924
+ average_runtime_block_rate_percent: weeklyOpsRuntimeBlockRateCount > 0
18925
+ ? Number((weeklyOpsRuntimeBlockRateSum / weeklyOpsRuntimeBlockRateCount).toFixed(2))
18926
+ : null,
18927
+ runtime_ui_mode_violation_total_sum: weeklyOpsRuntimeUiModeViolationTotalSum,
18928
+ average_runtime_ui_mode_violation_total: weeklyOpsRuntimeUiModeViolationTotalCount > 0
18929
+ ? Number((weeklyOpsRuntimeUiModeViolationTotalSum / weeklyOpsRuntimeUiModeViolationTotalCount).toFixed(2))
18930
+ : null,
18931
+ average_runtime_ui_mode_violation_rate_percent: weeklyOpsRuntimeUiModeViolationRateCount > 0
18932
+ ? Number((weeklyOpsRuntimeUiModeViolationRateSum / weeklyOpsRuntimeUiModeViolationRateCount).toFixed(2))
18933
+ : null
18934
+ }
17458
18935
  },
17459
18936
  status_counts: buildStatusCounts(filteredSessions),
17460
18937
  stop_reason_counts: stopReasonCounts,
@@ -17478,6 +18955,27 @@ async function statsGovernanceCloseLoopSessions(projectPath, options = {}) {
17478
18955
  release_gate_drift_alert_rate_percent: item.release_gate_drift_alert_rate_percent,
17479
18956
  round_release_gate_observed: item.round_release_gate_observed,
17480
18957
  round_release_gate_changed: item.round_release_gate_changed,
18958
+ stop_detail_weekly_ops_available: item.stop_detail_weekly_ops_available,
18959
+ stop_detail_weekly_ops_blocked: item.stop_detail_weekly_ops_blocked,
18960
+ stop_detail_weekly_ops_high_pressure: item.stop_detail_weekly_ops_high_pressure,
18961
+ stop_detail_weekly_ops_config_warning_positive: item.stop_detail_weekly_ops_config_warning_positive,
18962
+ stop_detail_weekly_ops_auth_tier_block_rate_high: item.stop_detail_weekly_ops_auth_tier_block_rate_high,
18963
+ stop_detail_weekly_ops_dialogue_authorization_block_rate_high:
18964
+ item.stop_detail_weekly_ops_dialogue_authorization_block_rate_high,
18965
+ stop_detail_weekly_ops_runtime_block_rate_high: item.stop_detail_weekly_ops_runtime_block_rate_high,
18966
+ stop_detail_weekly_ops_runtime_ui_mode_violation_high:
18967
+ item.stop_detail_weekly_ops_runtime_ui_mode_violation_high,
18968
+ stop_detail_weekly_ops_blocked_runs: item.stop_detail_weekly_ops_blocked_runs,
18969
+ stop_detail_weekly_ops_block_rate_percent: item.stop_detail_weekly_ops_block_rate_percent,
18970
+ stop_detail_weekly_ops_config_warnings_total: item.stop_detail_weekly_ops_config_warnings_total,
18971
+ stop_detail_weekly_ops_auth_tier_block_rate_percent: item.stop_detail_weekly_ops_auth_tier_block_rate_percent,
18972
+ stop_detail_weekly_ops_dialogue_authorization_block_rate_percent:
18973
+ item.stop_detail_weekly_ops_dialogue_authorization_block_rate_percent,
18974
+ stop_detail_weekly_ops_runtime_block_rate_percent: item.stop_detail_weekly_ops_runtime_block_rate_percent,
18975
+ stop_detail_weekly_ops_runtime_ui_mode_violation_total:
18976
+ item.stop_detail_weekly_ops_runtime_ui_mode_violation_total,
18977
+ stop_detail_weekly_ops_runtime_ui_mode_violation_rate_percent:
18978
+ item.stop_detail_weekly_ops_runtime_ui_mode_violation_rate_percent,
17481
18979
  stop_reason: item.stop_reason,
17482
18980
  resumed_from_governance_session_id: item.resumed_from_governance_session_id,
17483
18981
  updated_at: item.updated_at,
@@ -18251,8 +19749,15 @@ function buildTopCountEntries(counterMap, limit = 10) {
18251
19749
  .slice(0, maxItems);
18252
19750
  }
18253
19751
 
18254
- async function loadGovernanceReleaseGateSignals(projectPath) {
18255
- const historyFile = resolveAutoHandoffReleaseGateHistoryFile(projectPath);
19752
+ async function loadGovernanceReleaseGateSignals(projectPath, options = {}) {
19753
+ const historyFileCandidate = typeof options.historyFile === 'string' && options.historyFile.trim().length > 0
19754
+ ? options.historyFile.trim()
19755
+ : null;
19756
+ const historyFile = historyFileCandidate
19757
+ ? (path.isAbsolute(historyFileCandidate)
19758
+ ? historyFileCandidate
19759
+ : path.join(projectPath, historyFileCandidate))
19760
+ : resolveAutoHandoffReleaseGateHistoryFile(projectPath);
18256
19761
  const toNumber = value => {
18257
19762
  if (value === null || value === undefined || value === '') {
18258
19763
  return null;
@@ -18273,6 +19778,31 @@ async function loadGovernanceReleaseGateSignals(projectPath) {
18273
19778
  drift_alert_rate_percent: null,
18274
19779
  drift_alert_runs: null,
18275
19780
  drift_blocked_runs: null,
19781
+ latest_weekly_ops_blocked: null,
19782
+ latest_weekly_ops_risk_level: null,
19783
+ latest_weekly_ops_governance_status: null,
19784
+ latest_weekly_ops_authorization_tier_block_rate_percent: null,
19785
+ latest_weekly_ops_dialogue_authorization_block_rate_percent: null,
19786
+ latest_weekly_ops_config_warning_count: null,
19787
+ latest_weekly_ops_runtime_block_rate_percent: null,
19788
+ latest_weekly_ops_runtime_ui_mode_violation_total: null,
19789
+ latest_weekly_ops_runtime_ui_mode_violation_rate_percent: null,
19790
+ weekly_ops_known_runs: null,
19791
+ weekly_ops_blocked_runs: null,
19792
+ weekly_ops_block_rate_percent: null,
19793
+ weekly_ops_violations_total: null,
19794
+ weekly_ops_warnings_total: null,
19795
+ weekly_ops_config_warnings_total: null,
19796
+ weekly_ops_authorization_tier_block_rate_max_percent: null,
19797
+ weekly_ops_dialogue_authorization_block_rate_max_percent: null,
19798
+ weekly_ops_runtime_block_rate_avg_percent: null,
19799
+ weekly_ops_runtime_block_rate_max_percent: null,
19800
+ weekly_ops_runtime_ui_mode_violation_known_runs: null,
19801
+ weekly_ops_runtime_ui_mode_violation_runs: null,
19802
+ weekly_ops_runtime_ui_mode_violation_run_rate_percent: null,
19803
+ weekly_ops_runtime_ui_mode_violation_total: null,
19804
+ weekly_ops_runtime_ui_mode_violation_rate_avg_percent: null,
19805
+ weekly_ops_runtime_ui_mode_violation_rate_max_percent: null,
18276
19806
  parse_error: null
18277
19807
  };
18278
19808
  if (!(await fs.pathExists(historyFile))) {
@@ -18301,6 +19831,7 @@ async function loadGovernanceReleaseGateSignals(projectPath) {
18301
19831
  ? payload.aggregates
18302
19832
  : {};
18303
19833
  const latestRiskLevel = normalizeHandoffText(latest && latest.risk_level);
19834
+ const latestWeeklyOpsRiskLevel = normalizeHandoffText(latest && latest.weekly_ops_risk_level);
18304
19835
  return {
18305
19836
  ...base,
18306
19837
  available: true,
@@ -18316,6 +19847,67 @@ async function loadGovernanceReleaseGateSignals(projectPath) {
18316
19847
  drift_alert_rate_percent: toNumber(aggregates.drift_alert_rate_percent),
18317
19848
  drift_alert_runs: toNumber(aggregates.drift_alert_runs),
18318
19849
  drift_blocked_runs: toNumber(aggregates.drift_blocked_runs),
19850
+ latest_weekly_ops_blocked: parseAutoHandoffGateBoolean(latest && latest.weekly_ops_blocked, null),
19851
+ latest_weekly_ops_risk_level: latestWeeklyOpsRiskLevel
19852
+ ? normalizeAutoHandoffGateRiskLevel(latestWeeklyOpsRiskLevel)
19853
+ : null,
19854
+ latest_weekly_ops_governance_status: normalizeHandoffText(
19855
+ latest && latest.weekly_ops_governance_status
19856
+ ) || null,
19857
+ latest_weekly_ops_authorization_tier_block_rate_percent: toNumber(
19858
+ latest && latest.weekly_ops_authorization_tier_block_rate_percent
19859
+ ),
19860
+ latest_weekly_ops_dialogue_authorization_block_rate_percent: toNumber(
19861
+ latest && latest.weekly_ops_dialogue_authorization_block_rate_percent
19862
+ ),
19863
+ latest_weekly_ops_config_warning_count: toNumber(
19864
+ latest && latest.weekly_ops_config_warning_count
19865
+ ),
19866
+ latest_weekly_ops_runtime_block_rate_percent: toNumber(
19867
+ latest && latest.weekly_ops_runtime_block_rate_percent
19868
+ ),
19869
+ latest_weekly_ops_runtime_ui_mode_violation_total: toNumber(
19870
+ latest && latest.weekly_ops_runtime_ui_mode_violation_total
19871
+ ),
19872
+ latest_weekly_ops_runtime_ui_mode_violation_rate_percent: toNumber(
19873
+ latest && latest.weekly_ops_runtime_ui_mode_violation_rate_percent
19874
+ ),
19875
+ weekly_ops_known_runs: toNumber(aggregates.weekly_ops_known_runs),
19876
+ weekly_ops_blocked_runs: toNumber(aggregates.weekly_ops_blocked_runs),
19877
+ weekly_ops_block_rate_percent: toNumber(aggregates.weekly_ops_block_rate_percent),
19878
+ weekly_ops_violations_total: toNumber(aggregates.weekly_ops_violations_total),
19879
+ weekly_ops_warnings_total: toNumber(aggregates.weekly_ops_warnings_total),
19880
+ weekly_ops_config_warnings_total: toNumber(aggregates.weekly_ops_config_warnings_total),
19881
+ weekly_ops_authorization_tier_block_rate_max_percent: toNumber(
19882
+ aggregates.weekly_ops_authorization_tier_block_rate_max_percent
19883
+ ),
19884
+ weekly_ops_dialogue_authorization_block_rate_max_percent: toNumber(
19885
+ aggregates.weekly_ops_dialogue_authorization_block_rate_max_percent
19886
+ ),
19887
+ weekly_ops_runtime_block_rate_avg_percent: toNumber(
19888
+ aggregates.weekly_ops_runtime_block_rate_avg_percent
19889
+ ),
19890
+ weekly_ops_runtime_block_rate_max_percent: toNumber(
19891
+ aggregates.weekly_ops_runtime_block_rate_max_percent
19892
+ ),
19893
+ weekly_ops_runtime_ui_mode_violation_known_runs: toNumber(
19894
+ aggregates.weekly_ops_runtime_ui_mode_violation_known_runs
19895
+ ),
19896
+ weekly_ops_runtime_ui_mode_violation_runs: toNumber(
19897
+ aggregates.weekly_ops_runtime_ui_mode_violation_runs
19898
+ ),
19899
+ weekly_ops_runtime_ui_mode_violation_run_rate_percent: toNumber(
19900
+ aggregates.weekly_ops_runtime_ui_mode_violation_run_rate_percent
19901
+ ),
19902
+ weekly_ops_runtime_ui_mode_violation_total: toNumber(
19903
+ aggregates.weekly_ops_runtime_ui_mode_violation_total
19904
+ ),
19905
+ weekly_ops_runtime_ui_mode_violation_rate_avg_percent: toNumber(
19906
+ aggregates.weekly_ops_runtime_ui_mode_violation_rate_avg_percent
19907
+ ),
19908
+ weekly_ops_runtime_ui_mode_violation_rate_max_percent: toNumber(
19909
+ aggregates.weekly_ops_runtime_ui_mode_violation_rate_max_percent
19910
+ ),
18319
19911
  parse_error: null
18320
19912
  };
18321
19913
  }
@@ -18695,6 +20287,39 @@ function deriveGovernanceRiskLevel(summary) {
18695
20287
  const sceneBatchPassRate = Number(releaseGate.scene_package_batch_pass_rate_percent);
18696
20288
  const driftAlertRate = Number(releaseGate.drift_alert_rate_percent);
18697
20289
  const driftBlockedRuns = Number(releaseGate.drift_blocked_runs);
20290
+ const weeklyOpsKnownRuns = Number(releaseGate.weekly_ops_known_runs);
20291
+ const weeklyOpsBlockedRuns = Number(releaseGate.weekly_ops_blocked_runs);
20292
+ const weeklyOpsBlockRate = Number(releaseGate.weekly_ops_block_rate_percent);
20293
+ const weeklyOpsViolationsTotal = Number(releaseGate.weekly_ops_violations_total);
20294
+ const weeklyOpsWarningsTotal = Number(releaseGate.weekly_ops_warnings_total);
20295
+ const weeklyOpsConfigWarningsTotal = Number(releaseGate.weekly_ops_config_warnings_total);
20296
+ const weeklyOpsAuthTierBlockRateMax = Number(
20297
+ releaseGate.weekly_ops_authorization_tier_block_rate_max_percent
20298
+ );
20299
+ const weeklyOpsDialogueBlockRateMax = Number(
20300
+ releaseGate.weekly_ops_dialogue_authorization_block_rate_max_percent
20301
+ );
20302
+ const weeklyOpsLatestRuntimeBlockRate = Number(
20303
+ releaseGate.latest_weekly_ops_runtime_block_rate_percent
20304
+ );
20305
+ const weeklyOpsLatestRuntimeUiModeViolationTotal = Number(
20306
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_total
20307
+ );
20308
+ const weeklyOpsLatestRuntimeUiModeViolationRate = Number(
20309
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_rate_percent
20310
+ );
20311
+ const weeklyOpsRuntimeBlockRateMax = Number(
20312
+ releaseGate.weekly_ops_runtime_block_rate_max_percent
20313
+ );
20314
+ const weeklyOpsRuntimeUiModeViolationTotal = Number(
20315
+ releaseGate.weekly_ops_runtime_ui_mode_violation_total
20316
+ );
20317
+ const weeklyOpsRuntimeUiModeViolationRunRate = Number(
20318
+ releaseGate.weekly_ops_runtime_ui_mode_violation_run_rate_percent
20319
+ );
20320
+ const weeklyOpsRuntimeUiModeViolationRateMax = Number(
20321
+ releaseGate.weekly_ops_runtime_ui_mode_violation_rate_max_percent
20322
+ );
18698
20323
  const handoffQuality = summary && summary.handoff_quality && typeof summary.handoff_quality === 'object'
18699
20324
  ? summary.handoff_quality
18700
20325
  : {};
@@ -18762,14 +20387,42 @@ function deriveGovernanceRiskLevel(summary) {
18762
20387
  (Number.isFinite(releaseGatePassRate) && releaseGatePassRate < 60) ||
18763
20388
  (Number.isFinite(sceneBatchPassRate) && sceneBatchPassRate < 60)
18764
20389
  );
20390
+ const hasHighWeeklyOpsPressure = (
20391
+ (Number.isFinite(weeklyOpsBlockedRuns) && weeklyOpsBlockedRuns > 0) ||
20392
+ (Number.isFinite(weeklyOpsBlockRate) && weeklyOpsBlockRate >= 40) ||
20393
+ (Number.isFinite(weeklyOpsAuthTierBlockRateMax) && weeklyOpsAuthTierBlockRateMax >= 60) ||
20394
+ (Number.isFinite(weeklyOpsDialogueBlockRateMax) && weeklyOpsDialogueBlockRateMax >= 60) ||
20395
+ (Number.isFinite(weeklyOpsLatestRuntimeUiModeViolationTotal) && weeklyOpsLatestRuntimeUiModeViolationTotal > 0) ||
20396
+ (Number.isFinite(weeklyOpsRuntimeUiModeViolationTotal) && weeklyOpsRuntimeUiModeViolationTotal > 0) ||
20397
+ (Number.isFinite(weeklyOpsRuntimeUiModeViolationRunRate) && weeklyOpsRuntimeUiModeViolationRunRate > 0) ||
20398
+ (Number.isFinite(weeklyOpsLatestRuntimeUiModeViolationRate) && weeklyOpsLatestRuntimeUiModeViolationRate > 0) ||
20399
+ (Number.isFinite(weeklyOpsRuntimeUiModeViolationRateMax) && weeklyOpsRuntimeUiModeViolationRateMax > 0) ||
20400
+ (Number.isFinite(weeklyOpsLatestRuntimeBlockRate) && weeklyOpsLatestRuntimeBlockRate >= 40) ||
20401
+ (Number.isFinite(weeklyOpsRuntimeBlockRateMax) && weeklyOpsRuntimeBlockRateMax >= 40)
20402
+ );
20403
+ const hasMediumWeeklyOpsPressure = (
20404
+ (Number.isFinite(weeklyOpsKnownRuns) && weeklyOpsKnownRuns > 0) && (
20405
+ (Number.isFinite(weeklyOpsViolationsTotal) && weeklyOpsViolationsTotal > 0) ||
20406
+ (Number.isFinite(weeklyOpsWarningsTotal) && weeklyOpsWarningsTotal > 0) ||
20407
+ (Number.isFinite(weeklyOpsConfigWarningsTotal) && weeklyOpsConfigWarningsTotal > 0) ||
20408
+ (Number.isFinite(weeklyOpsAuthTierBlockRateMax) && weeklyOpsAuthTierBlockRateMax > 40) ||
20409
+ (Number.isFinite(weeklyOpsDialogueBlockRateMax) && weeklyOpsDialogueBlockRateMax > 40) ||
20410
+ (Number.isFinite(weeklyOpsBlockRate) && weeklyOpsBlockRate > 0) ||
20411
+ (Number.isFinite(weeklyOpsLatestRuntimeBlockRate) && weeklyOpsLatestRuntimeBlockRate > 0) ||
20412
+ (Number.isFinite(weeklyOpsRuntimeBlockRateMax) && weeklyOpsRuntimeBlockRateMax > 0)
20413
+ )
20414
+ );
18765
20415
  if (releaseGatePassed === false && (hasHighDriftPressure || hasLowPassRate)) {
18766
20416
  riskLevel = 'high';
20417
+ } else if (hasHighWeeklyOpsPressure) {
20418
+ riskLevel = 'high';
18767
20419
  } else if (
18768
20420
  riskLevel !== 'high' && (
18769
20421
  releaseGatePassed === false ||
18770
20422
  (Number.isFinite(releaseGatePassRate) && releaseGatePassRate < 85) ||
18771
20423
  (Number.isFinite(sceneBatchPassRate) && sceneBatchPassRate < 85) ||
18772
- (Number.isFinite(driftAlertRate) && driftAlertRate > 0)
20424
+ (Number.isFinite(driftAlertRate) && driftAlertRate > 0) ||
20425
+ hasMediumWeeklyOpsPressure
18773
20426
  )
18774
20427
  ) {
18775
20428
  riskLevel = 'medium';
@@ -18828,6 +20481,39 @@ function buildGovernanceConcerns(summary) {
18828
20481
  const sceneBatchPassRate = Number(releaseGate.scene_package_batch_pass_rate_percent);
18829
20482
  const driftAlertRate = Number(releaseGate.drift_alert_rate_percent);
18830
20483
  const driftBlockedRuns = Number(releaseGate.drift_blocked_runs);
20484
+ const weeklyOpsKnownRuns = Number(releaseGate.weekly_ops_known_runs);
20485
+ const weeklyOpsBlockedRuns = Number(releaseGate.weekly_ops_blocked_runs);
20486
+ const weeklyOpsBlockRate = Number(releaseGate.weekly_ops_block_rate_percent);
20487
+ const weeklyOpsViolationsTotal = Number(releaseGate.weekly_ops_violations_total);
20488
+ const weeklyOpsWarningsTotal = Number(releaseGate.weekly_ops_warnings_total);
20489
+ const weeklyOpsConfigWarningsTotal = Number(releaseGate.weekly_ops_config_warnings_total);
20490
+ const weeklyOpsAuthTierBlockRateMax = Number(
20491
+ releaseGate.weekly_ops_authorization_tier_block_rate_max_percent
20492
+ );
20493
+ const weeklyOpsDialogueBlockRateMax = Number(
20494
+ releaseGate.weekly_ops_dialogue_authorization_block_rate_max_percent
20495
+ );
20496
+ const weeklyOpsLatestRuntimeBlockRate = Number(
20497
+ releaseGate.latest_weekly_ops_runtime_block_rate_percent
20498
+ );
20499
+ const weeklyOpsLatestRuntimeUiModeViolationTotal = Number(
20500
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_total
20501
+ );
20502
+ const weeklyOpsLatestRuntimeUiModeViolationRate = Number(
20503
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_rate_percent
20504
+ );
20505
+ const weeklyOpsRuntimeBlockRateMax = Number(
20506
+ releaseGate.weekly_ops_runtime_block_rate_max_percent
20507
+ );
20508
+ const weeklyOpsRuntimeUiModeViolationTotal = Number(
20509
+ releaseGate.weekly_ops_runtime_ui_mode_violation_total
20510
+ );
20511
+ const weeklyOpsRuntimeUiModeViolationRunRate = Number(
20512
+ releaseGate.weekly_ops_runtime_ui_mode_violation_run_rate_percent
20513
+ );
20514
+ const weeklyOpsRuntimeUiModeViolationRateMax = Number(
20515
+ releaseGate.weekly_ops_runtime_ui_mode_violation_rate_max_percent
20516
+ );
18831
20517
  const handoffQuality = summary && summary.handoff_quality && typeof summary.handoff_quality === 'object'
18832
20518
  ? summary.handoff_quality
18833
20519
  : {};
@@ -18892,6 +20578,65 @@ function buildGovernanceConcerns(summary) {
18892
20578
  if (Number.isFinite(driftBlockedRuns) && driftBlockedRuns > 0) {
18893
20579
  concerns.push(`${driftBlockedRuns} release(s) were blocked by drift alerts.`);
18894
20580
  }
20581
+ if (Number.isFinite(weeklyOpsKnownRuns) && weeklyOpsKnownRuns > 0) {
20582
+ concerns.push(`Weekly ops signals observed in ${weeklyOpsKnownRuns} release gate run(s).`);
20583
+ }
20584
+ if (Number.isFinite(weeklyOpsBlockedRuns) && weeklyOpsBlockedRuns > 0) {
20585
+ concerns.push(`${weeklyOpsBlockedRuns} release run(s) were blocked by weekly ops gate.`);
20586
+ }
20587
+ if (Number.isFinite(weeklyOpsBlockRate) && weeklyOpsBlockRate > 0) {
20588
+ concerns.push(`Weekly ops block rate is ${weeklyOpsBlockRate}%.`);
20589
+ }
20590
+ if (Number.isFinite(weeklyOpsViolationsTotal) && weeklyOpsViolationsTotal > 0) {
20591
+ concerns.push(`Weekly ops violations total is ${weeklyOpsViolationsTotal}.`);
20592
+ }
20593
+ if (Number.isFinite(weeklyOpsWarningsTotal) && weeklyOpsWarningsTotal > 0) {
20594
+ concerns.push(`Weekly ops warnings total is ${weeklyOpsWarningsTotal}.`);
20595
+ }
20596
+ if (Number.isFinite(weeklyOpsConfigWarningsTotal) && weeklyOpsConfigWarningsTotal > 0) {
20597
+ concerns.push(`Weekly ops config warnings total is ${weeklyOpsConfigWarningsTotal}.`);
20598
+ }
20599
+ if (Number.isFinite(weeklyOpsAuthTierBlockRateMax) && weeklyOpsAuthTierBlockRateMax > 40) {
20600
+ concerns.push(`Weekly ops authorization-tier block-rate max is ${weeklyOpsAuthTierBlockRateMax}%.`);
20601
+ }
20602
+ if (Number.isFinite(weeklyOpsDialogueBlockRateMax) && weeklyOpsDialogueBlockRateMax > 40) {
20603
+ concerns.push(`Weekly ops dialogue-authorization block-rate max is ${weeklyOpsDialogueBlockRateMax}%.`);
20604
+ }
20605
+ if (Number.isFinite(weeklyOpsLatestRuntimeBlockRate) && weeklyOpsLatestRuntimeBlockRate > 0) {
20606
+ concerns.push(`Weekly ops latest runtime block rate is ${weeklyOpsLatestRuntimeBlockRate}%.`);
20607
+ }
20608
+ if (Number.isFinite(weeklyOpsRuntimeBlockRateMax) && weeklyOpsRuntimeBlockRateMax > 0) {
20609
+ concerns.push(`Weekly ops runtime block-rate max is ${weeklyOpsRuntimeBlockRateMax}%.`);
20610
+ }
20611
+ if (
20612
+ Number.isFinite(weeklyOpsLatestRuntimeUiModeViolationTotal) &&
20613
+ weeklyOpsLatestRuntimeUiModeViolationTotal > 0
20614
+ ) {
20615
+ concerns.push(
20616
+ `Weekly ops latest runtime ui-mode violations total is ${weeklyOpsLatestRuntimeUiModeViolationTotal}.`
20617
+ );
20618
+ }
20619
+ if (
20620
+ Number.isFinite(weeklyOpsLatestRuntimeUiModeViolationRate) &&
20621
+ weeklyOpsLatestRuntimeUiModeViolationRate > 0
20622
+ ) {
20623
+ concerns.push(
20624
+ `Weekly ops latest runtime ui-mode violation rate is ${weeklyOpsLatestRuntimeUiModeViolationRate}%.`
20625
+ );
20626
+ }
20627
+ if (Number.isFinite(weeklyOpsRuntimeUiModeViolationTotal) && weeklyOpsRuntimeUiModeViolationTotal > 0) {
20628
+ concerns.push(`Weekly ops runtime ui-mode violations total is ${weeklyOpsRuntimeUiModeViolationTotal}.`);
20629
+ }
20630
+ if (Number.isFinite(weeklyOpsRuntimeUiModeViolationRunRate) && weeklyOpsRuntimeUiModeViolationRunRate > 0) {
20631
+ concerns.push(
20632
+ `Weekly ops runtime ui-mode violation run rate is ${weeklyOpsRuntimeUiModeViolationRunRate}%.`
20633
+ );
20634
+ }
20635
+ if (Number.isFinite(weeklyOpsRuntimeUiModeViolationRateMax) && weeklyOpsRuntimeUiModeViolationRateMax > 0) {
20636
+ concerns.push(
20637
+ `Weekly ops runtime ui-mode violation rate max is ${weeklyOpsRuntimeUiModeViolationRateMax}%.`
20638
+ );
20639
+ }
18895
20640
  }
18896
20641
  if (!handoffAvailable) {
18897
20642
  concerns.push('Handoff release evidence is unavailable; governance lacks handoff quality context.');
@@ -18989,6 +20734,39 @@ function buildGovernanceRecommendations(summary) {
18989
20734
  const driftAlertRate = Number(releaseGate.drift_alert_rate_percent);
18990
20735
  const releaseGatePassRate = Number(releaseGate.pass_rate_percent);
18991
20736
  const sceneBatchPassRate = Number(releaseGate.scene_package_batch_pass_rate_percent);
20737
+ const weeklyOpsKnownRuns = Number(releaseGate.weekly_ops_known_runs);
20738
+ const weeklyOpsBlockedRuns = Number(releaseGate.weekly_ops_blocked_runs);
20739
+ const weeklyOpsBlockRate = Number(releaseGate.weekly_ops_block_rate_percent);
20740
+ const weeklyOpsViolationsTotal = Number(releaseGate.weekly_ops_violations_total);
20741
+ const weeklyOpsWarningsTotal = Number(releaseGate.weekly_ops_warnings_total);
20742
+ const weeklyOpsConfigWarningsTotal = Number(releaseGate.weekly_ops_config_warnings_total);
20743
+ const weeklyOpsAuthTierBlockRateMax = Number(
20744
+ releaseGate.weekly_ops_authorization_tier_block_rate_max_percent
20745
+ );
20746
+ const weeklyOpsDialogueBlockRateMax = Number(
20747
+ releaseGate.weekly_ops_dialogue_authorization_block_rate_max_percent
20748
+ );
20749
+ const weeklyOpsLatestRuntimeBlockRate = Number(
20750
+ releaseGate.latest_weekly_ops_runtime_block_rate_percent
20751
+ );
20752
+ const weeklyOpsLatestRuntimeUiModeViolationTotal = Number(
20753
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_total
20754
+ );
20755
+ const weeklyOpsLatestRuntimeUiModeViolationRate = Number(
20756
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_rate_percent
20757
+ );
20758
+ const weeklyOpsRuntimeBlockRateMax = Number(
20759
+ releaseGate.weekly_ops_runtime_block_rate_max_percent
20760
+ );
20761
+ const weeklyOpsRuntimeUiModeViolationTotal = Number(
20762
+ releaseGate.weekly_ops_runtime_ui_mode_violation_total
20763
+ );
20764
+ const weeklyOpsRuntimeUiModeViolationRunRate = Number(
20765
+ releaseGate.weekly_ops_runtime_ui_mode_violation_run_rate_percent
20766
+ );
20767
+ const weeklyOpsRuntimeUiModeViolationRateMax = Number(
20768
+ releaseGate.weekly_ops_runtime_ui_mode_violation_rate_max_percent
20769
+ );
18992
20770
  const handoffQuality = summary && summary.handoff_quality && typeof summary.handoff_quality === 'object'
18993
20771
  ? summary.handoff_quality
18994
20772
  : {};
@@ -19047,6 +20825,71 @@ function buildGovernanceRecommendations(summary) {
19047
20825
  '`sce scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --dry-run --json`.'
19048
20826
  );
19049
20827
  }
20828
+ if (
20829
+ (Number.isFinite(weeklyOpsKnownRuns) && weeklyOpsKnownRuns > 0) &&
20830
+ (
20831
+ (Number.isFinite(weeklyOpsBlockedRuns) && weeklyOpsBlockedRuns > 0) ||
20832
+ (Number.isFinite(weeklyOpsBlockRate) && weeklyOpsBlockRate > 0) ||
20833
+ (Number.isFinite(weeklyOpsViolationsTotal) && weeklyOpsViolationsTotal > 0) ||
20834
+ (Number.isFinite(weeklyOpsWarningsTotal) && weeklyOpsWarningsTotal > 0) ||
20835
+ (Number.isFinite(weeklyOpsRuntimeBlockRateMax) && weeklyOpsRuntimeBlockRateMax > 0) ||
20836
+ (Number.isFinite(weeklyOpsRuntimeUiModeViolationTotal) && weeklyOpsRuntimeUiModeViolationTotal > 0) ||
20837
+ (Number.isFinite(weeklyOpsRuntimeUiModeViolationRunRate) && weeklyOpsRuntimeUiModeViolationRunRate > 0)
20838
+ )
20839
+ ) {
20840
+ recommendations.push(
20841
+ 'Rebuild weekly ops summary and gate evidence with ' +
20842
+ '`node scripts/release-ops-weekly-summary.js --json` + `node scripts/release-weekly-ops-gate.js`.'
20843
+ );
20844
+ recommendations.push(
20845
+ 'Export weekly/drift remediation pack with ' +
20846
+ '`node scripts/release-risk-remediation-bundle.js --gate-report .kiro/reports/release-evidence/release-gate.json --json`.'
20847
+ );
20848
+ }
20849
+ if (Number.isFinite(weeklyOpsConfigWarningsTotal) && weeklyOpsConfigWarningsTotal > 0) {
20850
+ recommendations.push(
20851
+ 'Fix invalid weekly ops threshold variables (`KSE_RELEASE_WEEKLY_OPS_*`) and rerun release gates ' +
20852
+ 'to clear config warnings.'
20853
+ );
20854
+ }
20855
+ if (
20856
+ (Number.isFinite(weeklyOpsLatestRuntimeUiModeViolationTotal) && weeklyOpsLatestRuntimeUiModeViolationTotal > 0) ||
20857
+ (Number.isFinite(weeklyOpsRuntimeUiModeViolationTotal) && weeklyOpsRuntimeUiModeViolationTotal > 0) ||
20858
+ (Number.isFinite(weeklyOpsLatestRuntimeUiModeViolationRate) && weeklyOpsLatestRuntimeUiModeViolationRate > 0) ||
20859
+ (Number.isFinite(weeklyOpsRuntimeUiModeViolationRateMax) && weeklyOpsRuntimeUiModeViolationRateMax > 0) ||
20860
+ (Number.isFinite(weeklyOpsRuntimeUiModeViolationRunRate) && weeklyOpsRuntimeUiModeViolationRunRate > 0)
20861
+ ) {
20862
+ recommendations.push(
20863
+ 'Rebuild interactive runtime governance evidence with ' +
20864
+ '`node scripts/interactive-governance-report.js --period weekly --fail-on-alert --json`.'
20865
+ );
20866
+ recommendations.push(
20867
+ 'Review runtime ui-mode policy baseline (`docs/interactive-customization/runtime-mode-policy-baseline.json`) ' +
20868
+ 'to keep `user-app` suggestion-only and route apply traffic to `ops-console`.'
20869
+ );
20870
+ }
20871
+ if (
20872
+ (Number.isFinite(weeklyOpsLatestRuntimeBlockRate) && weeklyOpsLatestRuntimeBlockRate > 40) ||
20873
+ (Number.isFinite(weeklyOpsRuntimeBlockRateMax) && weeklyOpsRuntimeBlockRateMax > 40)
20874
+ ) {
20875
+ recommendations.push(
20876
+ 'Reduce runtime deny/review pressure by tuning authorization and runtime mode policy, then rerun ' +
20877
+ '`node scripts/interactive-governance-report.js --period weekly --json`.'
20878
+ );
20879
+ }
20880
+ if (
20881
+ (Number.isFinite(weeklyOpsAuthTierBlockRateMax) && weeklyOpsAuthTierBlockRateMax > 40) ||
20882
+ (Number.isFinite(weeklyOpsDialogueBlockRateMax) && weeklyOpsDialogueBlockRateMax > 40)
20883
+ ) {
20884
+ recommendations.push(
20885
+ 'Tune authorization-tier policy pressure with ' +
20886
+ '`node scripts/interactive-authorization-tier-evaluate.js --policy docs/interactive-customization/authorization-tier-policy-baseline.json --json`.'
20887
+ );
20888
+ recommendations.push(
20889
+ 'Tune dialogue authorization policy pressure with ' +
20890
+ '`node scripts/interactive-dialogue-governance.js --policy docs/interactive-customization/dialogue-governance-policy-baseline.json --authorization-dialogue-policy docs/interactive-customization/authorization-dialogue-policy-baseline.json --json`.'
20891
+ );
20892
+ }
19050
20893
  }
19051
20894
  if (!handoffAvailable) {
19052
20895
  recommendations.push(
@@ -19263,6 +21106,12 @@ async function buildAutoObservabilitySnapshot(projectPath, options = {}) {
19263
21106
  (Number(batchStats.failed_sessions) || 0) +
19264
21107
  (Number(controllerStats.failed_sessions) || 0) +
19265
21108
  (Number(governanceSessionStats.failed_sessions) || 0);
21109
+ const governanceWeeklyOpsStop = governanceSessionStats &&
21110
+ governanceSessionStats.release_gate &&
21111
+ governanceSessionStats.release_gate.weekly_ops_stop &&
21112
+ typeof governanceSessionStats.release_gate.weekly_ops_stop === 'object'
21113
+ ? governanceSessionStats.release_gate.weekly_ops_stop
21114
+ : null;
19266
21115
 
19267
21116
  return {
19268
21117
  mode: 'auto-observability-snapshot',
@@ -19284,6 +21133,36 @@ async function buildAutoObservabilitySnapshot(projectPath, options = {}) {
19284
21133
  governance_risk_level: governanceHealth && governanceHealth.health
19285
21134
  ? governanceHealth.health.risk_level
19286
21135
  : 'unknown',
21136
+ governance_weekly_ops_stop_sessions: Number(
21137
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.sessions
21138
+ ) || 0,
21139
+ governance_weekly_ops_stop_session_rate_percent: Number(
21140
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.session_rate_percent
21141
+ ) || 0,
21142
+ governance_weekly_ops_high_pressure_sessions: Number(
21143
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.high_pressure_sessions
21144
+ ) || 0,
21145
+ governance_weekly_ops_high_pressure_rate_percent: Number(
21146
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.high_pressure_session_rate_percent
21147
+ ) || 0,
21148
+ governance_weekly_ops_config_warning_positive_sessions: Number(
21149
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.config_warning_positive_sessions
21150
+ ) || 0,
21151
+ governance_weekly_ops_auth_tier_pressure_sessions: Number(
21152
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.auth_tier_pressure_sessions
21153
+ ) || 0,
21154
+ governance_weekly_ops_dialogue_authorization_pressure_sessions: Number(
21155
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.dialogue_authorization_pressure_sessions
21156
+ ) || 0,
21157
+ governance_weekly_ops_runtime_block_rate_high_sessions: Number(
21158
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.runtime_block_rate_high_sessions
21159
+ ) || 0,
21160
+ governance_weekly_ops_runtime_ui_mode_violation_high_sessions: Number(
21161
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.runtime_ui_mode_violation_high_sessions
21162
+ ) || 0,
21163
+ governance_weekly_ops_runtime_ui_mode_violation_total_sum: Number(
21164
+ governanceWeeklyOpsStop && governanceWeeklyOpsStop.runtime_ui_mode_violation_total_sum
21165
+ ) || 0,
19287
21166
  kpi_anomaly_count: Array.isArray(trend.anomalies) ? trend.anomalies.length : 0
19288
21167
  },
19289
21168
  snapshots: {
@@ -19291,6 +21170,7 @@ async function buildAutoObservabilitySnapshot(projectPath, options = {}) {
19291
21170
  batch_session: batchStats,
19292
21171
  controller_session: controllerStats,
19293
21172
  governance_session: governanceSessionStats,
21173
+ governance_weekly_ops_stop: governanceWeeklyOpsStop,
19294
21174
  governance_health: governanceHealth,
19295
21175
  kpi_trend: trend
19296
21176
  }
@@ -20400,8 +22280,12 @@ function resolveGovernanceCloseLoopRunStatus(stopReason, converged) {
20400
22280
  }
20401
22281
 
20402
22282
  function evaluateGovernanceReleaseGateBlockState(assessment) {
22283
+ const releaseGate = assessment && assessment.health && assessment.health.release_gate &&
22284
+ typeof assessment.health.release_gate === 'object'
22285
+ ? assessment.health.release_gate
22286
+ : {};
20403
22287
  const snapshot = normalizeGovernanceReleaseGateSnapshot(
20404
- assessment && assessment.health ? assessment.health.release_gate : null
22288
+ releaseGate
20405
22289
  );
20406
22290
  const handoffSnapshot = normalizeGovernanceHandoffQualitySnapshot(
20407
22291
  assessment && assessment.health ? assessment.health.handoff_quality : null
@@ -20424,6 +22308,49 @@ function evaluateGovernanceReleaseGateBlockState(assessment) {
20424
22308
 
20425
22309
  const reasons = [];
20426
22310
  if (snapshot && snapshot.available === true) {
22311
+ const weeklyOpsLatestBlocked = parseAutoHandoffGateBoolean(releaseGate.latest_weekly_ops_blocked, null);
22312
+ const weeklyOpsLatestRiskLevel = `${releaseGate.latest_weekly_ops_risk_level || ''}`.trim().toLowerCase();
22313
+ const weeklyOpsLatestGovernanceStatus = `${releaseGate.latest_weekly_ops_governance_status || ''}`.trim().toLowerCase();
22314
+ const weeklyOpsLatestConfigWarningCount = Number(releaseGate.latest_weekly_ops_config_warning_count);
22315
+ const weeklyOpsLatestAuthorizationTierBlockRate = Number(
22316
+ releaseGate.latest_weekly_ops_authorization_tier_block_rate_percent
22317
+ );
22318
+ const weeklyOpsLatestDialogueAuthorizationBlockRate = Number(
22319
+ releaseGate.latest_weekly_ops_dialogue_authorization_block_rate_percent
22320
+ );
22321
+ const weeklyOpsLatestRuntimeBlockRate = Number(
22322
+ releaseGate.latest_weekly_ops_runtime_block_rate_percent
22323
+ );
22324
+ const weeklyOpsLatestRuntimeUiModeViolationTotal = Number(
22325
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_total
22326
+ );
22327
+ const weeklyOpsLatestRuntimeUiModeViolationRate = Number(
22328
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_rate_percent
22329
+ );
22330
+ const weeklyOpsBlockedRuns = Number(releaseGate.weekly_ops_blocked_runs);
22331
+ const weeklyOpsBlockRate = Number(releaseGate.weekly_ops_block_rate_percent);
22332
+ const weeklyOpsViolationsTotal = Number(releaseGate.weekly_ops_violations_total);
22333
+ const weeklyOpsWarningsTotal = Number(releaseGate.weekly_ops_warnings_total);
22334
+ const weeklyOpsConfigWarningsTotal = Number(releaseGate.weekly_ops_config_warnings_total);
22335
+ const weeklyOpsAuthorizationTierBlockRateMax = Number(
22336
+ releaseGate.weekly_ops_authorization_tier_block_rate_max_percent
22337
+ );
22338
+ const weeklyOpsDialogueAuthorizationBlockRateMax = Number(
22339
+ releaseGate.weekly_ops_dialogue_authorization_block_rate_max_percent
22340
+ );
22341
+ const weeklyOpsRuntimeBlockRateMax = Number(
22342
+ releaseGate.weekly_ops_runtime_block_rate_max_percent
22343
+ );
22344
+ const weeklyOpsRuntimeUiModeViolationTotal = Number(
22345
+ releaseGate.weekly_ops_runtime_ui_mode_violation_total
22346
+ );
22347
+ const weeklyOpsRuntimeUiModeViolationRunRate = Number(
22348
+ releaseGate.weekly_ops_runtime_ui_mode_violation_run_rate_percent
22349
+ );
22350
+ const weeklyOpsRuntimeUiModeViolationRateMax = Number(
22351
+ releaseGate.weekly_ops_runtime_ui_mode_violation_rate_max_percent
22352
+ );
22353
+
20427
22354
  if (snapshot.latest_gate_passed === false) {
20428
22355
  reasons.push('latest-release-gate-failed');
20429
22356
  }
@@ -20442,6 +22369,107 @@ function evaluateGovernanceReleaseGateBlockState(assessment) {
20442
22369
  if (Number.isFinite(snapshot.drift_blocked_runs) && snapshot.drift_blocked_runs > 0) {
20443
22370
  reasons.push(`drift-blocked-runs-positive:${snapshot.drift_blocked_runs}`);
20444
22371
  }
22372
+ if (weeklyOpsLatestBlocked === true) {
22373
+ reasons.push('weekly-ops-latest-blocked');
22374
+ }
22375
+ if (weeklyOpsLatestRiskLevel === 'high') {
22376
+ reasons.push('weekly-ops-latest-risk-high');
22377
+ }
22378
+ if (weeklyOpsLatestGovernanceStatus && ['alert', 'blocked', 'degraded'].includes(weeklyOpsLatestGovernanceStatus)) {
22379
+ reasons.push(`weekly-ops-governance-status:${weeklyOpsLatestGovernanceStatus}`);
22380
+ }
22381
+ if (Number.isFinite(weeklyOpsLatestConfigWarningCount) && weeklyOpsLatestConfigWarningCount > 0) {
22382
+ reasons.push(`weekly-ops-latest-config-warnings-positive:${weeklyOpsLatestConfigWarningCount}`);
22383
+ }
22384
+ if (
22385
+ Number.isFinite(weeklyOpsLatestAuthorizationTierBlockRate) &&
22386
+ weeklyOpsLatestAuthorizationTierBlockRate > 40
22387
+ ) {
22388
+ reasons.push(
22389
+ `weekly-ops-latest-auth-tier-block-rate-high:${weeklyOpsLatestAuthorizationTierBlockRate}`
22390
+ );
22391
+ }
22392
+ if (
22393
+ Number.isFinite(weeklyOpsLatestDialogueAuthorizationBlockRate) &&
22394
+ weeklyOpsLatestDialogueAuthorizationBlockRate > 40
22395
+ ) {
22396
+ reasons.push(
22397
+ `weekly-ops-latest-dialogue-authorization-block-rate-high:` +
22398
+ `${weeklyOpsLatestDialogueAuthorizationBlockRate}`
22399
+ );
22400
+ }
22401
+ if (Number.isFinite(weeklyOpsLatestRuntimeBlockRate) && weeklyOpsLatestRuntimeBlockRate > 40) {
22402
+ reasons.push(`weekly-ops-latest-runtime-block-rate-high:${weeklyOpsLatestRuntimeBlockRate}`);
22403
+ }
22404
+ if (
22405
+ Number.isFinite(weeklyOpsLatestRuntimeUiModeViolationTotal) &&
22406
+ weeklyOpsLatestRuntimeUiModeViolationTotal > 0
22407
+ ) {
22408
+ reasons.push(
22409
+ `weekly-ops-latest-runtime-ui-mode-violations-positive:${weeklyOpsLatestRuntimeUiModeViolationTotal}`
22410
+ );
22411
+ }
22412
+ if (
22413
+ Number.isFinite(weeklyOpsLatestRuntimeUiModeViolationRate) &&
22414
+ weeklyOpsLatestRuntimeUiModeViolationRate > 0
22415
+ ) {
22416
+ reasons.push(
22417
+ `weekly-ops-latest-runtime-ui-mode-violation-rate-positive:${weeklyOpsLatestRuntimeUiModeViolationRate}`
22418
+ );
22419
+ }
22420
+ if (Number.isFinite(weeklyOpsBlockedRuns) && weeklyOpsBlockedRuns > 0) {
22421
+ reasons.push(`weekly-ops-blocked-runs-positive:${weeklyOpsBlockedRuns}`);
22422
+ }
22423
+ if (Number.isFinite(weeklyOpsBlockRate) && weeklyOpsBlockRate > 0) {
22424
+ reasons.push(`weekly-ops-block-rate-positive:${weeklyOpsBlockRate}`);
22425
+ }
22426
+ if (Number.isFinite(weeklyOpsViolationsTotal) && weeklyOpsViolationsTotal > 0) {
22427
+ reasons.push(`weekly-ops-violations-positive:${weeklyOpsViolationsTotal}`);
22428
+ }
22429
+ if (Number.isFinite(weeklyOpsWarningsTotal) && weeklyOpsWarningsTotal > 0) {
22430
+ reasons.push(`weekly-ops-warnings-positive:${weeklyOpsWarningsTotal}`);
22431
+ }
22432
+ if (Number.isFinite(weeklyOpsConfigWarningsTotal) && weeklyOpsConfigWarningsTotal > 0) {
22433
+ reasons.push(`weekly-ops-config-warnings-positive:${weeklyOpsConfigWarningsTotal}`);
22434
+ }
22435
+ if (
22436
+ Number.isFinite(weeklyOpsAuthorizationTierBlockRateMax) &&
22437
+ weeklyOpsAuthorizationTierBlockRateMax > 40
22438
+ ) {
22439
+ reasons.push(
22440
+ `weekly-ops-auth-tier-block-rate-high:${weeklyOpsAuthorizationTierBlockRateMax}`
22441
+ );
22442
+ }
22443
+ if (
22444
+ Number.isFinite(weeklyOpsDialogueAuthorizationBlockRateMax) &&
22445
+ weeklyOpsDialogueAuthorizationBlockRateMax > 40
22446
+ ) {
22447
+ reasons.push(
22448
+ `weekly-ops-dialogue-authorization-block-rate-high:${weeklyOpsDialogueAuthorizationBlockRateMax}`
22449
+ );
22450
+ }
22451
+ if (Number.isFinite(weeklyOpsRuntimeBlockRateMax) && weeklyOpsRuntimeBlockRateMax > 40) {
22452
+ reasons.push(`weekly-ops-runtime-block-rate-high:${weeklyOpsRuntimeBlockRateMax}`);
22453
+ }
22454
+ if (Number.isFinite(weeklyOpsRuntimeUiModeViolationTotal) && weeklyOpsRuntimeUiModeViolationTotal > 0) {
22455
+ reasons.push(`weekly-ops-runtime-ui-mode-violations-positive:${weeklyOpsRuntimeUiModeViolationTotal}`);
22456
+ }
22457
+ if (
22458
+ Number.isFinite(weeklyOpsRuntimeUiModeViolationRunRate) &&
22459
+ weeklyOpsRuntimeUiModeViolationRunRate > 0
22460
+ ) {
22461
+ reasons.push(
22462
+ `weekly-ops-runtime-ui-mode-violation-run-rate-positive:${weeklyOpsRuntimeUiModeViolationRunRate}`
22463
+ );
22464
+ }
22465
+ if (
22466
+ Number.isFinite(weeklyOpsRuntimeUiModeViolationRateMax) &&
22467
+ weeklyOpsRuntimeUiModeViolationRateMax > 0
22468
+ ) {
22469
+ reasons.push(
22470
+ `weekly-ops-runtime-ui-mode-violation-rate-high:${weeklyOpsRuntimeUiModeViolationRateMax}`
22471
+ );
22472
+ }
20445
22473
  }
20446
22474
 
20447
22475
  if (
@@ -20535,6 +22563,26 @@ function evaluateGovernanceReleaseGateBlockState(assessment) {
20535
22563
  (Number.isFinite(snapshot.drift_blocked_runs) && snapshot.drift_blocked_runs > 0)
20536
22564
  )
20537
22565
  );
22566
+ const blockedByWeeklyOps = reasons.some(item => (
22567
+ `${item}` === 'weekly-ops-latest-blocked'
22568
+ || `${item}` === 'weekly-ops-latest-risk-high'
22569
+ || `${item}`.startsWith('weekly-ops-governance-status:')
22570
+ || `${item}`.startsWith('weekly-ops-latest-config-warnings-positive:')
22571
+ || `${item}`.startsWith('weekly-ops-config-warnings-positive:')
22572
+ || `${item}`.startsWith('weekly-ops-blocked-runs-positive:')
22573
+ || `${item}`.startsWith('weekly-ops-block-rate-positive:')
22574
+ || `${item}`.startsWith('weekly-ops-latest-auth-tier-block-rate-high:')
22575
+ || `${item}`.startsWith('weekly-ops-auth-tier-block-rate-high:')
22576
+ || `${item}`.startsWith('weekly-ops-latest-dialogue-authorization-block-rate-high:')
22577
+ || `${item}`.startsWith('weekly-ops-dialogue-authorization-block-rate-high:')
22578
+ || `${item}`.startsWith('weekly-ops-latest-runtime-block-rate-high:')
22579
+ || `${item}`.startsWith('weekly-ops-runtime-block-rate-high:')
22580
+ || `${item}`.startsWith('weekly-ops-latest-runtime-ui-mode-violations-positive:')
22581
+ || `${item}`.startsWith('weekly-ops-runtime-ui-mode-violations-positive:')
22582
+ || `${item}`.startsWith('weekly-ops-latest-runtime-ui-mode-violation-rate-positive:')
22583
+ || `${item}`.startsWith('weekly-ops-runtime-ui-mode-violation-run-rate-positive:')
22584
+ || `${item}`.startsWith('weekly-ops-runtime-ui-mode-violation-rate-high:')
22585
+ ));
20538
22586
  const blockedByHandoffQuality = reasons.some(item => (
20539
22587
  `${item}`.startsWith('handoff-latest-status:')
20540
22588
  || `${item}` === 'handoff-latest-gate-failed'
@@ -20548,7 +22596,7 @@ function evaluateGovernanceReleaseGateBlockState(assessment) {
20548
22596
  || `${item}`.startsWith('handoff-moqui-matrix-regressions-positive:')
20549
22597
  || `${item}`.startsWith('handoff-moqui-matrix-regressions-over-gate:')
20550
22598
  ));
20551
- const blocked = reasons.length > 0 && (blockedByReleaseGate || blockedByHandoffQuality);
22599
+ const blocked = reasons.length > 0 && (blockedByReleaseGate || blockedByWeeklyOps || blockedByHandoffQuality);
20552
22600
  return {
20553
22601
  blocked,
20554
22602
  reasons,
@@ -20581,6 +22629,46 @@ function buildGovernanceCloseLoopRecommendations(finalAssessment, stopReason, st
20581
22629
  'Rerun and stabilize scene batch quality: `sce scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --dry-run --json`.'
20582
22630
  );
20583
22631
  }
22632
+ if (reasons.some(item => `${item}`.startsWith('weekly-ops-'))) {
22633
+ base.push(
22634
+ 'Rebuild weekly release pressure signals with `node scripts/release-ops-weekly-summary.js --json` + ' +
22635
+ '`node scripts/release-weekly-ops-gate.js`.'
22636
+ );
22637
+ }
22638
+ if (reasons.some(item => `${item}`.includes('weekly-ops-config-warnings'))) {
22639
+ base.push(
22640
+ 'Fix invalid weekly ops threshold variables (`KSE_RELEASE_WEEKLY_OPS_*`) and rerun release gates ' +
22641
+ 'to clear config warnings.'
22642
+ );
22643
+ }
22644
+ if (reasons.some(item => `${item}`.includes('weekly-ops-auth-tier-block-rate'))) {
22645
+ base.push(
22646
+ 'Tune authorization-tier policy pressure with ' +
22647
+ '`node scripts/interactive-authorization-tier-evaluate.js --policy docs/interactive-customization/authorization-tier-policy-baseline.json --json`.'
22648
+ );
22649
+ }
22650
+ if (reasons.some(item => `${item}`.includes('weekly-ops-dialogue-authorization-block-rate'))) {
22651
+ base.push(
22652
+ 'Tune dialogue authorization policy pressure with ' +
22653
+ '`node scripts/interactive-dialogue-governance.js --policy docs/interactive-customization/dialogue-governance-policy-baseline.json --authorization-dialogue-policy docs/interactive-customization/authorization-dialogue-policy-baseline.json --json`.'
22654
+ );
22655
+ }
22656
+ if (reasons.some(item => `${item}`.includes('runtime-ui-mode'))) {
22657
+ base.push(
22658
+ 'Regenerate runtime governance evidence with ' +
22659
+ '`node scripts/interactive-governance-report.js --period weekly --fail-on-alert --json`.'
22660
+ );
22661
+ base.push(
22662
+ 'Review runtime ui-mode contract in `docs/interactive-customization/runtime-mode-policy-baseline.json` ' +
22663
+ 'to keep `user-app` suggestion-only and route apply actions to `ops-console`.'
22664
+ );
22665
+ }
22666
+ if (reasons.some(item => `${item}`.includes('runtime-block-rate'))) {
22667
+ base.push(
22668
+ 'Reduce runtime deny/review pressure by tuning runtime mode policy and rerunning ' +
22669
+ '`node scripts/interactive-governance-report.js --period weekly --json`.'
22670
+ );
22671
+ }
20584
22672
  if (reasons.some(item => `${item}`.startsWith('handoff-'))) {
20585
22673
  base.push('Review handoff quality with `sce auto handoff evidence --window 5 --json`.');
20586
22674
  base.push(
@@ -20631,6 +22719,161 @@ function extractGovernanceReleaseGateSnapshot(assessment) {
20631
22719
  };
20632
22720
  }
20633
22721
 
22722
+ function extractGovernanceWeeklyOpsStopDetail(releaseGateCandidate) {
22723
+ const releaseGate = releaseGateCandidate && typeof releaseGateCandidate === 'object' && !Array.isArray(releaseGateCandidate)
22724
+ ? releaseGateCandidate
22725
+ : null;
22726
+ if (!releaseGate) {
22727
+ return null;
22728
+ }
22729
+
22730
+ const latestRiskLevelRaw = normalizeHandoffText(releaseGate.latest_weekly_ops_risk_level);
22731
+ const latestRiskLevel = latestRiskLevelRaw
22732
+ ? normalizeAutoHandoffGateRiskLevel(latestRiskLevelRaw)
22733
+ : null;
22734
+ const latestGovernanceStatus = normalizeHandoffText(releaseGate.latest_weekly_ops_governance_status);
22735
+ const latestBlocked = parseAutoHandoffGateBoolean(releaseGate.latest_weekly_ops_blocked, null);
22736
+ const latestAuthorizationTierBlockRatePercent = toGovernanceReleaseGateNumber(
22737
+ releaseGate.latest_weekly_ops_authorization_tier_block_rate_percent
22738
+ );
22739
+ const latestDialogueAuthorizationBlockRatePercent = toGovernanceReleaseGateNumber(
22740
+ releaseGate.latest_weekly_ops_dialogue_authorization_block_rate_percent
22741
+ );
22742
+ const latestConfigWarningCount = toGovernanceReleaseGateNumber(
22743
+ releaseGate.latest_weekly_ops_config_warning_count
22744
+ );
22745
+ const latestRuntimeBlockRatePercent = toGovernanceReleaseGateNumber(
22746
+ releaseGate.latest_weekly_ops_runtime_block_rate_percent
22747
+ );
22748
+ const latestRuntimeUiModeViolationTotal = toGovernanceReleaseGateNumber(
22749
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_total
22750
+ );
22751
+ const latestRuntimeUiModeViolationRatePercent = toGovernanceReleaseGateNumber(
22752
+ releaseGate.latest_weekly_ops_runtime_ui_mode_violation_rate_percent
22753
+ );
22754
+ const blockedRuns = toGovernanceReleaseGateNumber(releaseGate.weekly_ops_blocked_runs);
22755
+ const blockRatePercent = toGovernanceReleaseGateNumber(releaseGate.weekly_ops_block_rate_percent);
22756
+ const violationsTotal = toGovernanceReleaseGateNumber(releaseGate.weekly_ops_violations_total);
22757
+ const warningsTotal = toGovernanceReleaseGateNumber(releaseGate.weekly_ops_warnings_total);
22758
+ const configWarningsTotal = toGovernanceReleaseGateNumber(releaseGate.weekly_ops_config_warnings_total);
22759
+ const authorizationTierBlockRateMaxPercent = toGovernanceReleaseGateNumber(
22760
+ releaseGate.weekly_ops_authorization_tier_block_rate_max_percent
22761
+ );
22762
+ const dialogueAuthorizationBlockRateMaxPercent = toGovernanceReleaseGateNumber(
22763
+ releaseGate.weekly_ops_dialogue_authorization_block_rate_max_percent
22764
+ );
22765
+ const runtimeBlockRateMaxPercent = toGovernanceReleaseGateNumber(
22766
+ releaseGate.weekly_ops_runtime_block_rate_max_percent
22767
+ );
22768
+ const runtimeUiModeViolationTotal = toGovernanceReleaseGateNumber(
22769
+ releaseGate.weekly_ops_runtime_ui_mode_violation_total
22770
+ );
22771
+ const runtimeUiModeViolationRunRatePercent = toGovernanceReleaseGateNumber(
22772
+ releaseGate.weekly_ops_runtime_ui_mode_violation_run_rate_percent
22773
+ );
22774
+ const runtimeUiModeViolationRateMaxPercent = toGovernanceReleaseGateNumber(
22775
+ releaseGate.weekly_ops_runtime_ui_mode_violation_rate_max_percent
22776
+ );
22777
+
22778
+ const hasSignal = (
22779
+ typeof latestBlocked === 'boolean' ||
22780
+ !!latestRiskLevel ||
22781
+ !!latestGovernanceStatus ||
22782
+ Number.isFinite(latestAuthorizationTierBlockRatePercent) ||
22783
+ Number.isFinite(latestDialogueAuthorizationBlockRatePercent) ||
22784
+ Number.isFinite(latestConfigWarningCount) ||
22785
+ Number.isFinite(latestRuntimeBlockRatePercent) ||
22786
+ Number.isFinite(latestRuntimeUiModeViolationTotal) ||
22787
+ Number.isFinite(latestRuntimeUiModeViolationRatePercent) ||
22788
+ Number.isFinite(blockedRuns) ||
22789
+ Number.isFinite(blockRatePercent) ||
22790
+ Number.isFinite(violationsTotal) ||
22791
+ Number.isFinite(warningsTotal) ||
22792
+ Number.isFinite(configWarningsTotal) ||
22793
+ Number.isFinite(authorizationTierBlockRateMaxPercent) ||
22794
+ Number.isFinite(dialogueAuthorizationBlockRateMaxPercent) ||
22795
+ Number.isFinite(runtimeBlockRateMaxPercent) ||
22796
+ Number.isFinite(runtimeUiModeViolationTotal) ||
22797
+ Number.isFinite(runtimeUiModeViolationRunRatePercent) ||
22798
+ Number.isFinite(runtimeUiModeViolationRateMaxPercent)
22799
+ );
22800
+ if (!hasSignal) {
22801
+ return null;
22802
+ }
22803
+
22804
+ const latestAuthTierPressureRate = Number.isFinite(latestAuthorizationTierBlockRatePercent)
22805
+ ? latestAuthorizationTierBlockRatePercent
22806
+ : authorizationTierBlockRateMaxPercent;
22807
+ const latestDialoguePressureRate = Number.isFinite(latestDialogueAuthorizationBlockRatePercent)
22808
+ ? latestDialogueAuthorizationBlockRatePercent
22809
+ : dialogueAuthorizationBlockRateMaxPercent;
22810
+ const highPressure = (
22811
+ latestBlocked === true ||
22812
+ latestRiskLevel === 'high' ||
22813
+ (Number.isFinite(blockedRuns) && blockedRuns > 0) ||
22814
+ (Number.isFinite(blockRatePercent) && blockRatePercent >= 40) ||
22815
+ (Number.isFinite(latestAuthTierPressureRate) && latestAuthTierPressureRate >= 60) ||
22816
+ (Number.isFinite(latestDialoguePressureRate) && latestDialoguePressureRate >= 60) ||
22817
+ (Number.isFinite(latestRuntimeUiModeViolationTotal) && latestRuntimeUiModeViolationTotal > 0) ||
22818
+ (Number.isFinite(runtimeUiModeViolationTotal) && runtimeUiModeViolationTotal > 0) ||
22819
+ (Number.isFinite(latestRuntimeUiModeViolationRatePercent) && latestRuntimeUiModeViolationRatePercent > 0) ||
22820
+ (Number.isFinite(runtimeUiModeViolationRunRatePercent) && runtimeUiModeViolationRunRatePercent > 0) ||
22821
+ (Number.isFinite(runtimeUiModeViolationRateMaxPercent) && runtimeUiModeViolationRateMaxPercent > 0) ||
22822
+ (Number.isFinite(latestRuntimeBlockRatePercent) && latestRuntimeBlockRatePercent >= 40) ||
22823
+ (Number.isFinite(runtimeBlockRateMaxPercent) && runtimeBlockRateMaxPercent >= 40)
22824
+ );
22825
+
22826
+ return {
22827
+ latest: {
22828
+ blocked: latestBlocked,
22829
+ risk_level: latestRiskLevel,
22830
+ governance_status: latestGovernanceStatus || null,
22831
+ authorization_tier_block_rate_percent: latestAuthorizationTierBlockRatePercent,
22832
+ dialogue_authorization_block_rate_percent: latestDialogueAuthorizationBlockRatePercent,
22833
+ config_warning_count: latestConfigWarningCount,
22834
+ runtime_block_rate_percent: latestRuntimeBlockRatePercent,
22835
+ runtime_ui_mode_violation_total: latestRuntimeUiModeViolationTotal,
22836
+ runtime_ui_mode_violation_rate_percent: latestRuntimeUiModeViolationRatePercent
22837
+ },
22838
+ aggregates: {
22839
+ blocked_runs: blockedRuns,
22840
+ block_rate_percent: blockRatePercent,
22841
+ violations_total: violationsTotal,
22842
+ warnings_total: warningsTotal,
22843
+ config_warnings_total: configWarningsTotal,
22844
+ authorization_tier_block_rate_max_percent: authorizationTierBlockRateMaxPercent,
22845
+ dialogue_authorization_block_rate_max_percent: dialogueAuthorizationBlockRateMaxPercent,
22846
+ runtime_block_rate_max_percent: runtimeBlockRateMaxPercent,
22847
+ runtime_ui_mode_violation_total: runtimeUiModeViolationTotal,
22848
+ runtime_ui_mode_violation_run_rate_percent: runtimeUiModeViolationRunRatePercent,
22849
+ runtime_ui_mode_violation_rate_max_percent: runtimeUiModeViolationRateMaxPercent
22850
+ },
22851
+ pressure: {
22852
+ blocked: latestBlocked === true || (Number.isFinite(blockedRuns) && blockedRuns > 0),
22853
+ high: highPressure,
22854
+ config_warning_positive: (
22855
+ (Number.isFinite(latestConfigWarningCount) && latestConfigWarningCount > 0) ||
22856
+ (Number.isFinite(configWarningsTotal) && configWarningsTotal > 0)
22857
+ ),
22858
+ auth_tier_block_rate_high: Number.isFinite(latestAuthTierPressureRate) && latestAuthTierPressureRate > 40,
22859
+ dialogue_authorization_block_rate_high: (
22860
+ Number.isFinite(latestDialoguePressureRate) && latestDialoguePressureRate > 40
22861
+ ),
22862
+ runtime_block_rate_high: (
22863
+ (Number.isFinite(latestRuntimeBlockRatePercent) && latestRuntimeBlockRatePercent > 40) ||
22864
+ (Number.isFinite(runtimeBlockRateMaxPercent) && runtimeBlockRateMaxPercent > 40)
22865
+ ),
22866
+ runtime_ui_mode_violation_high: (
22867
+ (Number.isFinite(latestRuntimeUiModeViolationTotal) && latestRuntimeUiModeViolationTotal > 0) ||
22868
+ (Number.isFinite(runtimeUiModeViolationTotal) && runtimeUiModeViolationTotal > 0) ||
22869
+ (Number.isFinite(latestRuntimeUiModeViolationRatePercent) && latestRuntimeUiModeViolationRatePercent > 0) ||
22870
+ (Number.isFinite(runtimeUiModeViolationRunRatePercent) && runtimeUiModeViolationRunRatePercent > 0) ||
22871
+ (Number.isFinite(runtimeUiModeViolationRateMaxPercent) && runtimeUiModeViolationRateMaxPercent > 0)
22872
+ )
22873
+ }
22874
+ };
22875
+ }
22876
+
20634
22877
  async function runAutoGovernanceCloseLoop(projectPath, options = {}) {
20635
22878
  let resumedGovernanceSession = null;
20636
22879
  if (options.governanceResume) {
@@ -20949,11 +23192,17 @@ async function runAutoGovernanceCloseLoop(projectPath, options = {}) {
20949
23192
  }
20950
23193
  const releaseGateBlockState = evaluateGovernanceReleaseGateBlockState(effectiveAfterAssessment);
20951
23194
  if (releaseGateBlockState.blocked) {
23195
+ const weeklyOpsStopDetail = extractGovernanceWeeklyOpsStopDetail(
23196
+ effectiveAfterAssessment &&
23197
+ effectiveAfterAssessment.health &&
23198
+ effectiveAfterAssessment.health.release_gate
23199
+ );
20952
23200
  stopReason = 'release-gate-blocked';
20953
23201
  stopDetail = {
20954
23202
  type: 'release-gate-block',
20955
23203
  reasons: releaseGateBlockState.reasons,
20956
- release_gate: releaseGateBlockState.snapshot
23204
+ release_gate: releaseGateBlockState.snapshot,
23205
+ weekly_ops: weeklyOpsStopDetail
20957
23206
  };
20958
23207
  break;
20959
23208
  }