@resolveio/server-lib 22.3.149 → 22.3.150
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.
- package/.nodemon.json +5 -0
- package/.vscode/settings.json +21 -0
- package/AGENTS.md +195 -0
- package/README.md +22 -0
- package/build_package.sh +5 -0
- package/compileDTS.pl +64 -0
- package/docs/ai-assistant-nightly-eval.md +65 -0
- package/docs/ai-assistant-preflight-checklist.md +23 -0
- package/docs/ai-assistant-report-builder-bridge-playbook.md +115 -0
- package/eslint-plugin-custom/index.js +7 -0
- package/eslint-plugin-custom/rules/no-filter-zero-index.js +44 -0
- package/eslint.config.js +103 -0
- package/gulpfile.js +216 -0
- package/methodAndPublicationListGenerator.py +375 -0
- package/mongodbensurers.js +2 -0
- package/mongostop.js +3 -0
- package/package.json +1 -1
- package/scripts/cleanup-bypassed-callmethod-logs.js +616 -0
- package/settings.development.json +25 -0
- package/settings.development.redacted.json +25 -0
- package/src/.env +12 -0
- package/src/ai/assistant-core-heuristics.ts +379 -0
- package/src/ai/resolveio-platform-intelligence-memory-corpus.ts +185 -0
- package/src/ai/resolveio-platform-intelligence-memory.ts +325 -0
- package/{ai/resolveio-platform-intelligence-types.d.ts → src/ai/resolveio-platform-intelligence-types.ts} +20 -15
- package/src/ai/resolveio-platform-intelligence.ts +462 -0
- package/src/client-server-app.ts +12 -0
- package/src/collections/ai-run.collection.ts +117 -0
- package/src/collections/ai-terminal-conversation.collection.ts +91 -0
- package/src/collections/ai-terminal-issue-report.collection.ts +99 -0
- package/src/collections/ai-terminal-message.collection.ts +77 -0
- package/src/collections/app-setting.collection.ts +104 -0
- package/src/collections/app-status.collection.ts +58 -0
- package/src/collections/communication-metric.collection.ts +84 -0
- package/src/collections/counter.collection.ts +56 -0
- package/src/collections/cron-job-history.collection.ts +94 -0
- package/src/collections/cron-job.collection.ts +92 -0
- package/src/collections/customer-notification.collection.ts +131 -0
- package/src/collections/customer-portal-password.collection.ts +76 -0
- package/src/collections/email-history.collection.ts +134 -0
- package/src/collections/email-verified.collection.ts +62 -0
- package/src/collections/file.collection.ts +74 -0
- package/src/collections/flag-update.collection.ts +57 -0
- package/src/collections/flag.collection.ts +57 -0
- package/src/collections/log-method-latency.collection.ts +77 -0
- package/src/collections/log-subscription.collection.ts +80 -0
- package/src/collections/log.collection.ts +93 -0
- package/src/collections/logged-in-users.collection.ts +67 -0
- package/src/collections/monitor-cpu.collection.ts +65 -0
- package/src/collections/monitor-function.collection.ts +74 -0
- package/src/collections/monitor-memory.collection.ts +77 -0
- package/src/collections/monitor-mongo.collection.ts +71 -0
- package/src/collections/notification.collection.ts +57 -0
- package/src/collections/openai-usage-ledger.collection.ts +131 -0
- package/src/collections/report-builder-dashboard-builder.collection.ts +109 -0
- package/src/collections/report-builder-library.collection.ts +89 -0
- package/src/collections/report-builder-report.collection.ts +184 -0
- package/src/collections/user-group.collection.ts +89 -0
- package/src/collections/user-guide.collection.ts +57 -0
- package/src/collections/user.collection.ts +181 -0
- package/src/cron/cron.ts +117 -0
- package/src/fixtures/cron-jobs.ts +95 -0
- package/src/fixtures/init.ts +35 -0
- package/src/http/auth.ts +818 -0
- package/src/http/health.ts +7 -0
- package/src/http/home.ts +90 -0
- package/src/http/slow-query-publication.ts +49 -0
- package/src/index.ts +1 -0
- package/src/managers/ai-assistant-codex-manager.manager.ts +1131 -0
- package/src/managers/ai-run-evidence.manager.ts +264 -0
- package/src/managers/communication-metric.manager.ts +82 -0
- package/src/managers/cron.manager.ts +333 -0
- package/src/managers/customer-notification-content.manager.ts +236 -0
- package/src/managers/diagnostic-manager-bootstrap.ts +165 -0
- package/src/managers/error-auto-fix.manager.ts +2767 -0
- package/src/managers/local-log.manager.ts +113 -0
- package/src/managers/method.manager.ts +1857 -0
- package/src/managers/mongo.manager.ts +4575 -0
- package/src/managers/monitor.manager.ts +507 -0
- package/src/managers/openai-usage-ledger.manager.ts +112 -0
- package/src/managers/slow-query-verifier.manager.ts +3590 -0
- package/src/managers/slow-query.manager.ts +519 -0
- package/src/managers/subscription.manager.ts +3128 -0
- package/src/managers/websocket.manager.ts +746 -0
- package/src/managers/worker-dispatcher.manager.ts +1360 -0
- package/src/managers/worker-server.manager.ts +536 -0
- package/src/methods/accounts.ts +532 -0
- package/src/methods/ai-terminal.ts +23524 -0
- package/src/methods/app-settings.ts +114 -0
- package/src/methods/aws.ts +649 -0
- package/src/methods/collections.ts +641 -0
- package/src/methods/counters.ts +69 -0
- package/src/methods/cron-jobs.ts +2614 -0
- package/src/methods/customer-notifications.ts +458 -0
- package/src/methods/diagnostics.ts +616 -0
- package/src/methods/flag-updates.ts +7 -0
- package/src/methods/flags.ts +7 -0
- package/src/methods/logs.ts +657 -0
- package/src/methods/mongo-explorer.ts +1880 -0
- package/src/methods/monitor.ts +540 -0
- package/src/methods/pdf.ts +1236 -0
- package/src/methods/publications.ts +129 -0
- package/src/methods/report-builder.ts +3300 -0
- package/src/methods/support.ts +335 -0
- package/src/models/ai-run.model.ts +27 -0
- package/src/models/ai-terminal-conversation.model.ts +19 -0
- package/src/models/ai-terminal-issue-report.model.ts +21 -0
- package/src/models/ai-terminal-message.model.ts +24 -0
- package/src/models/app-setting.model.ts +17 -0
- package/{models/app-status.model.d.ts → src/models/app-status.model.ts} +3 -2
- package/{models/billing-logged-in-users.model.d.ts → src/models/billing-logged-in-users.model.ts} +5 -4
- package/src/models/collection-document.model.ts +24 -0
- package/src/models/communication-metric.model.ts +23 -0
- package/{models/counter.model.d.ts → src/models/counter.model.ts} +4 -3
- package/src/models/cron-job-history.model.ts +16 -0
- package/src/models/cron-job.model.ts +15 -0
- package/src/models/customer-notification.model.ts +28 -0
- package/src/models/customer-portal-password.model.ts +12 -0
- package/src/models/dialog.model.ts +25 -0
- package/{models/email-history.model.js → src/models/email-history.model.ts} +36 -4
- package/{models/email-verified.model.d.ts → src/models/email-verified.model.ts} +6 -5
- package/{models/file.model.d.ts → src/models/file.model.ts} +8 -7
- package/{models/flag-update.model.d.ts → src/models/flag-update.model.ts} +4 -3
- package/{models/flag.model.d.ts → src/models/flag.model.ts} +4 -3
- package/src/models/log-method-latency.model.ts +11 -0
- package/{models/log-subscription.model.d.ts → src/models/log-subscription.model.ts} +11 -9
- package/src/models/log.model.ts +19 -0
- package/{models/logged-in-users.model.d.ts → src/models/logged-in-users.model.ts} +6 -5
- package/{models/method-response.model.d.ts → src/models/method-response.model.ts} +7 -6
- package/src/models/method.model.ts +25 -0
- package/{models/monitor-cpu.model.d.ts → src/models/monitor-cpu.model.ts} +9 -7
- package/src/models/monitor-function.model.ts +16 -0
- package/src/models/monitor-memory.model.ts +17 -0
- package/src/models/monitor-mongo.model.ts +15 -0
- package/{models/notification.model.d.ts → src/models/notification.model.ts} +6 -4
- package/src/models/openai-usage-ledger.model.ts +56 -0
- package/src/models/pagination.model.ts +35 -0
- package/src/models/permission.model.ts +14 -0
- package/src/models/report-builder-dashboard-builder.model.ts +29 -0
- package/src/models/report-builder-library.model.ts +20 -0
- package/src/models/report-builder-report.model.ts +136 -0
- package/src/models/report-builder.model.ts +68 -0
- package/src/models/select-data-label.model.ts +9 -0
- package/src/models/server-message.model.ts +31 -0
- package/src/models/slow-query-report.model.ts +23 -0
- package/src/models/subscription.model.ts +73 -0
- package/src/models/support-ticket.model.ts +104 -0
- package/src/models/user-group.model.ts +24 -0
- package/{models/user-guide.model.d.ts → src/models/user-guide.model.ts} +5 -4
- package/src/models/user.model.ts +96 -0
- package/src/private/images/ResolveIO.png +0 -0
- package/src/publications/ai-terminal.ts +73 -0
- package/src/publications/app-settings.ts +25 -0
- package/src/publications/app-status.ts +13 -0
- package/src/publications/cron-jobs.ts +40 -0
- package/src/publications/customer-notifications.ts +101 -0
- package/src/publications/files.ts +33 -0
- package/src/publications/flags-update.ts +19 -0
- package/src/publications/flags.ts +19 -0
- package/src/publications/logs.ts +163 -0
- package/src/publications/notifications.ts +13 -0
- package/src/publications/report-builder-dashboard-builders.ts +39 -0
- package/src/publications/report-builder-libraries.ts +41 -0
- package/src/publications/report-builder-reports.ts +47 -0
- package/src/publications/super-admin.ts +13 -0
- package/src/publications/user-groups.ts +12 -0
- package/src/publications/user-guides.ts +12 -0
- package/src/resolveio-server-app.ts +617 -0
- package/src/server-app.ts +3354 -0
- package/src/services/codex-client.ts +1231 -0
- package/src/services/openai-client.ts +265 -0
- package/src/types/error-report.ts +26 -0
- package/src/types/js-tiktoken.d.ts +11 -0
- package/src/types/slow-query-report.ts +28 -0
- package/src/util/ai-qa-policy.ts +925 -0
- package/src/util/ai-run-evidence-adapters.ts +684 -0
- package/src/util/ai-run-evidence-dashboard.ts +313 -0
- package/src/util/ai-run-evidence-eval.ts +885 -0
- package/src/util/ai-run-evidence.ts +1058 -0
- package/src/util/ai-runner-artifacts.ts +586 -0
- package/src/util/ai-runner-manager-autopilot.ts +434 -0
- package/src/util/ai-runner-manager-policy.ts +2733 -0
- package/src/util/ai-runner-qa-auth.ts +821 -0
- package/src/util/ai-runner-qa-tools.ts +3045 -0
- package/src/util/aicoder-runner-v6.ts +875 -0
- package/src/util/common.ts +649 -0
- package/src/util/customer-portal-password.ts +183 -0
- package/src/util/error-reporter.ts +332 -0
- package/src/util/error-tracking.ts +79 -0
- package/src/util/openai-usage-cost.ts +114 -0
- package/src/util/report-builder-unwinds.ts +180 -0
- package/src/util/runner-process-janitor.ts +219 -0
- package/src/util/schema-report-builder.ts +448 -0
- package/src/util/slow-query-reporter.ts +216 -0
- package/src/util/subscription-dependency-context.ts +1096 -0
- package/src/util/support-runner-v5.ts +2167 -0
- package/src/util/tokenizer.ts +38 -0
- package/src/workers/codex-runner.worker.ts +142 -0
- package/start_server.sh +5 -0
- package/tests/ai-assistant-corpus-build.ts +484 -0
- package/tests/ai-assistant-corpus-replay-e2e.ts +774 -0
- package/tests/ai-assistant-data-parity-e2e.ts +1989 -0
- package/tests/ai-assistant-eval-triage.ts +831 -0
- package/tests/ai-assistant-openai-e2e.ts +1061 -0
- package/tests/ai-assistant-openai-git-e2e.ts +155 -0
- package/tests/ai-assistant-preflight-matrix.ts +215 -0
- package/tests/ai-assistant-routing-eval.test.ts +560 -0
- package/tests/ai-assistant-snf-live-eval.ts +975 -0
- package/tests/ai-assistant-utils.test.ts +2968 -0
- package/tests/ai-manager-autopilot-snapshot.test.ts +177 -0
- package/tests/ai-manager-recovery-checkpoint.test.ts +595 -0
- package/tests/ai-run-eval.test.ts +88 -0
- package/tests/ai-run-evidence.test.ts +348 -0
- package/tests/ai-runner-contract.test.ts +488 -0
- package/tests/aicoder-runner-v6.test.ts +298 -0
- package/tests/error-reporter.test.ts +145 -0
- package/tests/method-publication-generator.test.ts +46 -0
- package/tests/report-builder-linking.test.ts +79 -0
- package/tests/resolveio-platform-intelligence.test.ts +352 -0
- package/tests/server-app-cron-owner.test.ts +127 -0
- package/tests/subscription-connect-race.test.ts +158 -0
- package/tests/subscription-dependency-context.test.ts +324 -0
- package/tests/subscription-manager-collection-tracking.test.ts +86 -0
- package/tests/subscription-manager-invalidation.test.ts +86 -0
- package/tests/support-runner-v5.test.ts +488 -0
- package/tsconfig.json +34 -0
- package/ai/assistant-core-heuristics.d.ts +0 -11
- package/ai/assistant-core-heuristics.js +0 -356
- package/ai/assistant-core-heuristics.js.map +0 -1
- package/ai/resolveio-platform-intelligence-memory-corpus.d.ts +0 -3
- package/ai/resolveio-platform-intelligence-memory-corpus.js +0 -214
- package/ai/resolveio-platform-intelligence-memory-corpus.js.map +0 -1
- package/ai/resolveio-platform-intelligence-memory.d.ts +0 -20
- package/ai/resolveio-platform-intelligence-memory.js +0 -341
- package/ai/resolveio-platform-intelligence-memory.js.map +0 -1
- package/ai/resolveio-platform-intelligence-types.js +0 -4
- package/ai/resolveio-platform-intelligence-types.js.map +0 -1
- package/ai/resolveio-platform-intelligence.d.ts +0 -6
- package/ai/resolveio-platform-intelligence.js +0 -463
- package/ai/resolveio-platform-intelligence.js.map +0 -1
- package/client-server-app.d.ts +0 -1
- package/client-server-app.js +0 -68
- package/client-server-app.js.map +0 -1
- package/collections/ai-run.collection.d.ts +0 -3
- package/collections/ai-run.collection.js +0 -170
- package/collections/ai-run.collection.js.map +0 -1
- package/collections/ai-terminal-conversation.collection.d.ts +0 -2
- package/collections/ai-terminal-conversation.collection.js +0 -140
- package/collections/ai-terminal-conversation.collection.js.map +0 -1
- package/collections/ai-terminal-issue-report.collection.d.ts +0 -2
- package/collections/ai-terminal-issue-report.collection.js +0 -148
- package/collections/ai-terminal-issue-report.collection.js.map +0 -1
- package/collections/ai-terminal-message.collection.d.ts +0 -2
- package/collections/ai-terminal-message.collection.js +0 -121
- package/collections/ai-terminal-message.collection.js.map +0 -1
- package/collections/app-setting.collection.d.ts +0 -3
- package/collections/app-setting.collection.js +0 -103
- package/collections/app-setting.collection.js.map +0 -1
- package/collections/app-status.collection.d.ts +0 -3
- package/collections/app-status.collection.js +0 -57
- package/collections/app-status.collection.js.map +0 -1
- package/collections/communication-metric.collection.d.ts +0 -2
- package/collections/communication-metric.collection.js +0 -133
- package/collections/communication-metric.collection.js.map +0 -1
- package/collections/counter.collection.d.ts +0 -3
- package/collections/counter.collection.js +0 -56
- package/collections/counter.collection.js.map +0 -1
- package/collections/cron-job-history.collection.d.ts +0 -3
- package/collections/cron-job-history.collection.js +0 -137
- package/collections/cron-job-history.collection.js.map +0 -1
- package/collections/cron-job.collection.d.ts +0 -3
- package/collections/cron-job.collection.js +0 -92
- package/collections/cron-job.collection.js.map +0 -1
- package/collections/customer-notification.collection.d.ts +0 -3
- package/collections/customer-notification.collection.js +0 -130
- package/collections/customer-notification.collection.js.map +0 -1
- package/collections/customer-portal-password.collection.d.ts +0 -3
- package/collections/customer-portal-password.collection.js +0 -75
- package/collections/customer-portal-password.collection.js.map +0 -1
- package/collections/email-history.collection.d.ts +0 -3
- package/collections/email-history.collection.js +0 -134
- package/collections/email-history.collection.js.map +0 -1
- package/collections/email-verified.collection.d.ts +0 -3
- package/collections/email-verified.collection.js +0 -62
- package/collections/email-verified.collection.js.map +0 -1
- package/collections/file.collection.d.ts +0 -3
- package/collections/file.collection.js +0 -74
- package/collections/file.collection.js.map +0 -1
- package/collections/flag-update.collection.d.ts +0 -3
- package/collections/flag-update.collection.js +0 -57
- package/collections/flag-update.collection.js.map +0 -1
- package/collections/flag.collection.d.ts +0 -3
- package/collections/flag.collection.js +0 -57
- package/collections/flag.collection.js.map +0 -1
- package/collections/log-method-latency.collection.d.ts +0 -3
- package/collections/log-method-latency.collection.js +0 -77
- package/collections/log-method-latency.collection.js.map +0 -1
- package/collections/log-subscription.collection.d.ts +0 -3
- package/collections/log-subscription.collection.js +0 -80
- package/collections/log-subscription.collection.js.map +0 -1
- package/collections/log.collection.d.ts +0 -3
- package/collections/log.collection.js +0 -93
- package/collections/log.collection.js.map +0 -1
- package/collections/logged-in-users.collection.d.ts +0 -3
- package/collections/logged-in-users.collection.js +0 -67
- package/collections/logged-in-users.collection.js.map +0 -1
- package/collections/monitor-cpu.collection.d.ts +0 -3
- package/collections/monitor-cpu.collection.js +0 -65
- package/collections/monitor-cpu.collection.js.map +0 -1
- package/collections/monitor-function.collection.d.ts +0 -3
- package/collections/monitor-function.collection.js +0 -74
- package/collections/monitor-function.collection.js.map +0 -1
- package/collections/monitor-memory.collection.d.ts +0 -3
- package/collections/monitor-memory.collection.js +0 -77
- package/collections/monitor-memory.collection.js.map +0 -1
- package/collections/monitor-mongo.collection.d.ts +0 -3
- package/collections/monitor-mongo.collection.js +0 -71
- package/collections/monitor-mongo.collection.js.map +0 -1
- package/collections/notification.collection.d.ts +0 -3
- package/collections/notification.collection.js +0 -57
- package/collections/notification.collection.js.map +0 -1
- package/collections/openai-usage-ledger.collection.d.ts +0 -2
- package/collections/openai-usage-ledger.collection.js +0 -188
- package/collections/openai-usage-ledger.collection.js.map +0 -1
- package/collections/report-builder-dashboard-builder.collection.d.ts +0 -3
- package/collections/report-builder-dashboard-builder.collection.js +0 -109
- package/collections/report-builder-dashboard-builder.collection.js.map +0 -1
- package/collections/report-builder-library.collection.d.ts +0 -3
- package/collections/report-builder-library.collection.js +0 -87
- package/collections/report-builder-library.collection.js.map +0 -1
- package/collections/report-builder-report.collection.d.ts +0 -4
- package/collections/report-builder-report.collection.js +0 -184
- package/collections/report-builder-report.collection.js.map +0 -1
- package/collections/user-group.collection.d.ts +0 -4
- package/collections/user-group.collection.js +0 -89
- package/collections/user-group.collection.js.map +0 -1
- package/collections/user-guide.collection.d.ts +0 -3
- package/collections/user-guide.collection.js +0 -57
- package/collections/user-guide.collection.js.map +0 -1
- package/collections/user.collection.d.ts +0 -4
- package/collections/user.collection.js +0 -180
- package/collections/user.collection.js.map +0 -1
- package/cron/cron.d.ts +0 -14
- package/cron/cron.js +0 -216
- package/cron/cron.js.map +0 -1
- package/fixtures/cron-jobs.d.ts +0 -1
- package/fixtures/cron-jobs.js +0 -150
- package/fixtures/cron-jobs.js.map +0 -1
- package/fixtures/init.d.ts +0 -1
- package/fixtures/init.js +0 -91
- package/fixtures/init.js.map +0 -1
- package/http/auth.d.ts +0 -2
- package/http/auth.js +0 -951
- package/http/auth.js.map +0 -1
- package/http/health.d.ts +0 -1
- package/http/health.js +0 -11
- package/http/health.js.map +0 -1
- package/http/home.d.ts +0 -1
- package/http/home.js +0 -134
- package/http/home.js.map +0 -1
- package/http/slow-query-publication.d.ts +0 -2
- package/http/slow-query-publication.js +0 -99
- package/http/slow-query-publication.js.map +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -19
- package/index.js.map +0 -1
- package/managers/ai-assistant-codex-manager.manager.d.ts +0 -67
- package/managers/ai-assistant-codex-manager.manager.js +0 -1113
- package/managers/ai-assistant-codex-manager.manager.js.map +0 -1
- package/managers/ai-run-evidence.manager.d.ts +0 -36
- package/managers/ai-run-evidence.manager.js +0 -377
- package/managers/ai-run-evidence.manager.js.map +0 -1
- package/managers/communication-metric.manager.d.ts +0 -16
- package/managers/communication-metric.manager.js +0 -134
- package/managers/communication-metric.manager.js.map +0 -1
- package/managers/cron.manager.d.ts +0 -20
- package/managers/cron.manager.js +0 -534
- package/managers/cron.manager.js.map +0 -1
- package/managers/customer-notification-content.manager.d.ts +0 -55
- package/managers/customer-notification-content.manager.js +0 -158
- package/managers/customer-notification-content.manager.js.map +0 -1
- package/managers/diagnostic-manager-bootstrap.d.ts +0 -9
- package/managers/diagnostic-manager-bootstrap.js +0 -260
- package/managers/diagnostic-manager-bootstrap.js.map +0 -1
- package/managers/error-auto-fix.manager.d.ts +0 -149
- package/managers/error-auto-fix.manager.js +0 -3064
- package/managers/error-auto-fix.manager.js.map +0 -1
- package/managers/local-log.manager.d.ts +0 -18
- package/managers/local-log.manager.js +0 -88
- package/managers/local-log.manager.js.map +0 -1
- package/managers/method.manager.d.ts +0 -84
- package/managers/method.manager.js +0 -1964
- package/managers/method.manager.js.map +0 -1
- package/managers/mongo.manager.d.ts +0 -224
- package/managers/mongo.manager.js +0 -5000
- package/managers/mongo.manager.js.map +0 -1
- package/managers/monitor.manager.d.ts +0 -70
- package/managers/monitor.manager.js +0 -550
- package/managers/monitor.manager.js.map +0 -1
- package/managers/openai-usage-ledger.manager.d.ts +0 -30
- package/managers/openai-usage-ledger.manager.js +0 -142
- package/managers/openai-usage-ledger.manager.js.map +0 -1
- package/managers/slow-query-verifier.manager.d.ts +0 -144
- package/managers/slow-query-verifier.manager.js +0 -3857
- package/managers/slow-query-verifier.manager.js.map +0 -1
- package/managers/slow-query.manager.d.ts +0 -28
- package/managers/slow-query.manager.js +0 -468
- package/managers/slow-query.manager.js.map +0 -1
- package/managers/subscription.manager.d.ts +0 -169
- package/managers/subscription.manager.js +0 -3434
- package/managers/subscription.manager.js.map +0 -1
- package/managers/websocket.manager.d.ts +0 -73
- package/managers/websocket.manager.js +0 -673
- package/managers/websocket.manager.js.map +0 -1
- package/managers/worker-dispatcher.manager.d.ts +0 -120
- package/managers/worker-dispatcher.manager.js +0 -1266
- package/managers/worker-dispatcher.manager.js.map +0 -1
- package/managers/worker-server.manager.d.ts +0 -35
- package/managers/worker-server.manager.js +0 -582
- package/managers/worker-server.manager.js.map +0 -1
- package/methods/accounts.d.ts +0 -2
- package/methods/accounts.js +0 -624
- package/methods/accounts.js.map +0 -1
- package/methods/ai-terminal.d.ts +0 -337
- package/methods/ai-terminal.js +0 -23193
- package/methods/ai-terminal.js.map +0 -1
- package/methods/app-settings.d.ts +0 -2
- package/methods/app-settings.js +0 -169
- package/methods/app-settings.js.map +0 -1
- package/methods/aws.d.ts +0 -2
- package/methods/aws.js +0 -877
- package/methods/aws.js.map +0 -1
- package/methods/collections.d.ts +0 -2
- package/methods/collections.js +0 -719
- package/methods/collections.js.map +0 -1
- package/methods/counters.d.ts +0 -2
- package/methods/counters.js +0 -113
- package/methods/counters.js.map +0 -1
- package/methods/cron-jobs.d.ts +0 -2
- package/methods/cron-jobs.js +0 -2475
- package/methods/cron-jobs.js.map +0 -1
- package/methods/customer-notifications.d.ts +0 -2
- package/methods/customer-notifications.js +0 -528
- package/methods/customer-notifications.js.map +0 -1
- package/methods/diagnostics.d.ts +0 -2
- package/methods/diagnostics.js +0 -703
- package/methods/diagnostics.js.map +0 -1
- package/methods/flag-updates.d.ts +0 -2
- package/methods/flag-updates.js +0 -8
- package/methods/flag-updates.js.map +0 -1
- package/methods/flags.d.ts +0 -2
- package/methods/flags.js +0 -8
- package/methods/flags.js.map +0 -1
- package/methods/logs.d.ts +0 -2
- package/methods/logs.js +0 -751
- package/methods/logs.js.map +0 -1
- package/methods/mongo-explorer.d.ts +0 -2
- package/methods/mongo-explorer.js +0 -1808
- package/methods/mongo-explorer.js.map +0 -1
- package/methods/monitor.d.ts +0 -2
- package/methods/monitor.js +0 -543
- package/methods/monitor.js.map +0 -1
- package/methods/pdf.d.ts +0 -2
- package/methods/pdf.js +0 -1216
- package/methods/pdf.js.map +0 -1
- package/methods/publications.d.ts +0 -1
- package/methods/publications.js +0 -183
- package/methods/publications.js.map +0 -1
- package/methods/report-builder.d.ts +0 -2
- package/methods/report-builder.js +0 -3094
- package/methods/report-builder.js.map +0 -1
- package/methods/support.d.ts +0 -2
- package/methods/support.js +0 -430
- package/methods/support.js.map +0 -1
- package/models/ai-run.model.d.ts +0 -19
- package/models/ai-run.model.js +0 -4
- package/models/ai-run.model.js.map +0 -1
- package/models/ai-terminal-conversation.model.d.ts +0 -17
- package/models/ai-terminal-conversation.model.js +0 -4
- package/models/ai-terminal-conversation.model.js.map +0 -1
- package/models/ai-terminal-issue-report.model.d.ts +0 -19
- package/models/ai-terminal-issue-report.model.js +0 -4
- package/models/ai-terminal-issue-report.model.js.map +0 -1
- package/models/ai-terminal-message.model.d.ts +0 -22
- package/models/ai-terminal-message.model.js +0 -4
- package/models/ai-terminal-message.model.js.map +0 -1
- package/models/app-setting.model.d.ts +0 -16
- package/models/app-setting.model.js +0 -4
- package/models/app-setting.model.js.map +0 -1
- package/models/app-status.model.js +0 -4
- package/models/app-status.model.js.map +0 -1
- package/models/billing-logged-in-users.model.js +0 -4
- package/models/billing-logged-in-users.model.js.map +0 -1
- package/models/collection-document.model.d.ts +0 -21
- package/models/collection-document.model.js +0 -4
- package/models/collection-document.model.js.map +0 -1
- package/models/communication-metric.model.d.ts +0 -20
- package/models/communication-metric.model.js +0 -4
- package/models/communication-metric.model.js.map +0 -1
- package/models/counter.model.js +0 -4
- package/models/counter.model.js.map +0 -1
- package/models/cron-job-history.model.d.ts +0 -15
- package/models/cron-job-history.model.js +0 -4
- package/models/cron-job-history.model.js.map +0 -1
- package/models/cron-job.model.d.ts +0 -14
- package/models/cron-job.model.js +0 -4
- package/models/cron-job.model.js.map +0 -1
- package/models/customer-notification.model.d.ts +0 -26
- package/models/customer-notification.model.js +0 -4
- package/models/customer-notification.model.js.map +0 -1
- package/models/customer-portal-password.model.d.ts +0 -11
- package/models/customer-portal-password.model.js +0 -4
- package/models/customer-portal-password.model.js.map +0 -1
- package/models/dialog.model.d.ts +0 -23
- package/models/dialog.model.js +0 -4
- package/models/dialog.model.js.map +0 -1
- package/models/email-history.model.d.ts +0 -32
- package/models/email-history.model.js.map +0 -1
- package/models/email-verified.model.js +0 -4
- package/models/email-verified.model.js.map +0 -1
- package/models/file.model.js +0 -4
- package/models/file.model.js.map +0 -1
- package/models/flag-update.model.js +0 -4
- package/models/flag-update.model.js.map +0 -1
- package/models/flag.model.js +0 -4
- package/models/flag.model.js.map +0 -1
- package/models/log-method-latency.model.d.ts +0 -10
- package/models/log-method-latency.model.js +0 -4
- package/models/log-method-latency.model.js.map +0 -1
- package/models/log-subscription.model.js +0 -4
- package/models/log-subscription.model.js.map +0 -1
- package/models/log.model.d.ts +0 -17
- package/models/log.model.js +0 -4
- package/models/log.model.js.map +0 -1
- package/models/logged-in-users.model.js +0 -4
- package/models/logged-in-users.model.js.map +0 -1
- package/models/method-response.model.js +0 -4
- package/models/method-response.model.js.map +0 -1
- package/models/method.model.d.ts +0 -26
- package/models/method.model.js +0 -4
- package/models/method.model.js.map +0 -1
- package/models/monitor-cpu.model.js +0 -4
- package/models/monitor-cpu.model.js.map +0 -1
- package/models/monitor-function.model.d.ts +0 -14
- package/models/monitor-function.model.js +0 -4
- package/models/monitor-function.model.js.map +0 -1
- package/models/monitor-memory.model.d.ts +0 -15
- package/models/monitor-memory.model.js +0 -4
- package/models/monitor-memory.model.js.map +0 -1
- package/models/monitor-mongo.model.d.ts +0 -13
- package/models/monitor-mongo.model.js +0 -4
- package/models/monitor-mongo.model.js.map +0 -1
- package/models/notification.model.js +0 -4
- package/models/notification.model.js.map +0 -1
- package/models/openai-usage-ledger.model.d.ts +0 -30
- package/models/openai-usage-ledger.model.js +0 -4
- package/models/openai-usage-ledger.model.js.map +0 -1
- package/models/pagination.model.d.ts +0 -11
- package/models/pagination.model.js +0 -28
- package/models/pagination.model.js.map +0 -1
- package/models/permission.model.d.ts +0 -12
- package/models/permission.model.js +0 -4
- package/models/permission.model.js.map +0 -1
- package/models/report-builder-dashboard-builder.model.d.ts +0 -25
- package/models/report-builder-dashboard-builder.model.js +0 -4
- package/models/report-builder-dashboard-builder.model.js.map +0 -1
- package/models/report-builder-library.model.d.ts +0 -17
- package/models/report-builder-library.model.js +0 -4
- package/models/report-builder-library.model.js.map +0 -1
- package/models/report-builder-report.model.d.ts +0 -121
- package/models/report-builder-report.model.js +0 -4
- package/models/report-builder-report.model.js.map +0 -1
- package/models/report-builder.model.d.ts +0 -61
- package/models/report-builder.model.js +0 -4
- package/models/report-builder.model.js.map +0 -1
- package/models/select-data-label.model.d.ts +0 -9
- package/models/select-data-label.model.js +0 -4
- package/models/select-data-label.model.js.map +0 -1
- package/models/server-message.model.d.ts +0 -32
- package/models/server-message.model.js +0 -4
- package/models/server-message.model.js.map +0 -1
- package/models/slow-query-report.model.d.ts +0 -23
- package/models/slow-query-report.model.js +0 -4
- package/models/slow-query-report.model.js.map +0 -1
- package/models/subscription.model.d.ts +0 -31
- package/models/subscription.model.js +0 -4
- package/models/subscription.model.js.map +0 -1
- package/models/support-ticket.model.d.ts +0 -87
- package/models/support-ticket.model.js +0 -4
- package/models/support-ticket.model.js.map +0 -1
- package/models/user-group.model.d.ts +0 -20
- package/models/user-group.model.js +0 -4
- package/models/user-group.model.js.map +0 -1
- package/models/user-guide.model.js +0 -4
- package/models/user-guide.model.js.map +0 -1
- package/models/user.model.d.ts +0 -84
- package/models/user.model.js +0 -4
- package/models/user.model.js.map +0 -1
- package/private/images/ResolveIO.png +0 -0
- package/public_api.js +0 -127
- package/public_api.js.map +0 -1
- package/publications/ai-terminal.d.ts +0 -1
- package/publications/ai-terminal.js +0 -122
- package/publications/ai-terminal.js.map +0 -1
- package/publications/app-settings.d.ts +0 -2
- package/publications/app-settings.js +0 -28
- package/publications/app-settings.js.map +0 -1
- package/publications/app-status.d.ts +0 -2
- package/publications/app-status.js +0 -16
- package/publications/app-status.js.map +0 -1
- package/publications/cron-jobs.d.ts +0 -2
- package/publications/cron-jobs.js +0 -88
- package/publications/cron-jobs.js.map +0 -1
- package/publications/customer-notifications.d.ts +0 -2
- package/publications/customer-notifications.js +0 -161
- package/publications/customer-notifications.js.map +0 -1
- package/publications/files.d.ts +0 -2
- package/publications/files.js +0 -36
- package/publications/files.js.map +0 -1
- package/publications/flags-update.d.ts +0 -2
- package/publications/flags-update.js +0 -22
- package/publications/flags-update.js.map +0 -1
- package/publications/flags.d.ts +0 -2
- package/publications/flags.js +0 -22
- package/publications/flags.js.map +0 -1
- package/publications/logs.d.ts +0 -2
- package/publications/logs.js +0 -164
- package/publications/logs.js.map +0 -1
- package/publications/notifications.d.ts +0 -2
- package/publications/notifications.js +0 -16
- package/publications/notifications.js.map +0 -1
- package/publications/report-builder-dashboard-builders.d.ts +0 -2
- package/publications/report-builder-dashboard-builders.js +0 -42
- package/publications/report-builder-dashboard-builders.js.map +0 -1
- package/publications/report-builder-libraries.d.ts +0 -2
- package/publications/report-builder-libraries.js +0 -90
- package/publications/report-builder-libraries.js.map +0 -1
- package/publications/report-builder-reports.d.ts +0 -2
- package/publications/report-builder-reports.js +0 -50
- package/publications/report-builder-reports.js.map +0 -1
- package/publications/super-admin.d.ts +0 -2
- package/publications/super-admin.js +0 -16
- package/publications/super-admin.js.map +0 -1
- package/publications/user-groups.d.ts +0 -1
- package/publications/user-groups.js +0 -16
- package/publications/user-groups.js.map +0 -1
- package/publications/user-guides.d.ts +0 -1
- package/publications/user-guides.js +0 -16
- package/publications/user-guides.js.map +0 -1
- package/resolveio-server-app.d.ts +0 -70
- package/resolveio-server-app.js +0 -801
- package/resolveio-server-app.js.map +0 -1
- package/server-app.d.ts +0 -228
- package/server-app.js +0 -3566
- package/server-app.js.map +0 -1
- package/services/codex-client.d.ts +0 -128
- package/services/codex-client.js +0 -1629
- package/services/codex-client.js.map +0 -1
- package/services/openai-client.d.ts +0 -46
- package/services/openai-client.js +0 -318
- package/services/openai-client.js.map +0 -1
- package/types/error-report.d.ts +0 -25
- package/types/error-report.js +0 -4
- package/types/error-report.js.map +0 -1
- package/types/slow-query-report.d.ts +0 -27
- package/types/slow-query-report.js +0 -6
- package/types/slow-query-report.js.map +0 -1
- package/util/ai-qa-policy.d.ts +0 -124
- package/util/ai-qa-policy.js +0 -736
- package/util/ai-qa-policy.js.map +0 -1
- package/util/ai-run-evidence-adapters.d.ts +0 -33
- package/util/ai-run-evidence-adapters.js +0 -838
- package/util/ai-run-evidence-adapters.js.map +0 -1
- package/util/ai-run-evidence-dashboard.d.ts +0 -84
- package/util/ai-run-evidence-dashboard.js +0 -336
- package/util/ai-run-evidence-dashboard.js.map +0 -1
- package/util/ai-run-evidence-eval.d.ts +0 -86
- package/util/ai-run-evidence-eval.js +0 -854
- package/util/ai-run-evidence-eval.js.map +0 -1
- package/util/ai-run-evidence.d.ts +0 -244
- package/util/ai-run-evidence.js +0 -731
- package/util/ai-run-evidence.js.map +0 -1
- package/util/ai-runner-artifacts.d.ts +0 -82
- package/util/ai-runner-artifacts.js +0 -713
- package/util/ai-runner-artifacts.js.map +0 -1
- package/util/ai-runner-manager-autopilot.d.ts +0 -112
- package/util/ai-runner-manager-autopilot.js +0 -313
- package/util/ai-runner-manager-autopilot.js.map +0 -1
- package/util/ai-runner-manager-policy.d.ts +0 -403
- package/util/ai-runner-manager-policy.js +0 -1763
- package/util/ai-runner-manager-policy.js.map +0 -1
- package/util/ai-runner-qa-auth.d.ts +0 -5
- package/util/ai-runner-qa-auth.js +0 -822
- package/util/ai-runner-qa-auth.js.map +0 -1
- package/util/ai-runner-qa-tools.d.ts +0 -26
- package/util/ai-runner-qa-tools.js +0 -3029
- package/util/ai-runner-qa-tools.js.map +0 -1
- package/util/aicoder-runner-v6.d.ts +0 -214
- package/util/aicoder-runner-v6.js +0 -507
- package/util/aicoder-runner-v6.js.map +0 -1
- package/util/common.d.ts +0 -31
- package/util/common.js +0 -683
- package/util/common.js.map +0 -1
- package/util/customer-portal-password.d.ts +0 -13
- package/util/customer-portal-password.js +0 -209
- package/util/customer-portal-password.js.map +0 -1
- package/util/error-reporter.d.ts +0 -52
- package/util/error-reporter.js +0 -326
- package/util/error-reporter.js.map +0 -1
- package/util/error-tracking.d.ts +0 -13
- package/util/error-tracking.js +0 -120
- package/util/error-tracking.js.map +0 -1
- package/util/openai-usage-cost.d.ts +0 -6
- package/util/openai-usage-cost.js +0 -103
- package/util/openai-usage-cost.js.map +0 -1
- package/util/report-builder-unwinds.d.ts +0 -15
- package/util/report-builder-unwinds.js +0 -156
- package/util/report-builder-unwinds.js.map +0 -1
- package/util/runner-process-janitor.d.ts +0 -27
- package/util/runner-process-janitor.js +0 -208
- package/util/runner-process-janitor.js.map +0 -1
- package/util/schema-report-builder.d.ts +0 -6
- package/util/schema-report-builder.js +0 -481
- package/util/schema-report-builder.js.map +0 -1
- package/util/slow-query-reporter.d.ts +0 -28
- package/util/slow-query-reporter.js +0 -226
- package/util/slow-query-reporter.js.map +0 -1
- package/util/subscription-dependency-context.d.ts +0 -34
- package/util/subscription-dependency-context.js +0 -1283
- package/util/subscription-dependency-context.js.map +0 -1
- package/util/support-runner-v5.d.ts +0 -415
- package/util/support-runner-v5.js +0 -1445
- package/util/support-runner-v5.js.map +0 -1
- package/util/tokenizer.d.ts +0 -5
- package/util/tokenizer.js +0 -41
- package/util/tokenizer.js.map +0 -1
- package/workers/codex-runner.worker.d.ts +0 -1
- package/workers/codex-runner.worker.js +0 -192
- package/workers/codex-runner.worker.js.map +0 -1
- /package/{private → src/private}/email-templates/enrollment.html +0 -0
- /package/{private → src/private}/email-templates/forgot-password.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket-deleted.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket-modified.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket.html +0 -0
- /package/{public_api.d.ts → src/public_api.ts} +0 -0
|
@@ -0,0 +1,2733 @@
|
|
|
1
|
+
export type ResolveIOAIManagerAction =
|
|
2
|
+
| 'continue'
|
|
3
|
+
| 'retry_infra'
|
|
4
|
+
| 'reset_loop_budget'
|
|
5
|
+
| 'park_repeated_failure'
|
|
6
|
+
| 'park_ping_pong'
|
|
7
|
+
| 'manual_handoff';
|
|
8
|
+
|
|
9
|
+
export interface ResolveIOAIManagerFailureRecord {
|
|
10
|
+
outcome?: string;
|
|
11
|
+
lane?: string;
|
|
12
|
+
stepType?: string;
|
|
13
|
+
failureClass?: string;
|
|
14
|
+
blocker?: string;
|
|
15
|
+
blockerFingerprint?: string;
|
|
16
|
+
evidenceHash?: string;
|
|
17
|
+
changedFiles?: string[];
|
|
18
|
+
artifactPaths?: string[];
|
|
19
|
+
summary?: string;
|
|
20
|
+
recordedAt?: Date | string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type ResolveIOAIManagerEvidenceStrength = 'none' | 'weak' | 'material' | 'proof';
|
|
24
|
+
|
|
25
|
+
export interface ResolveIOAIManagerEvidenceAssessment {
|
|
26
|
+
changed: boolean;
|
|
27
|
+
material: boolean;
|
|
28
|
+
strength: ResolveIOAIManagerEvidenceStrength;
|
|
29
|
+
signals: string[];
|
|
30
|
+
evidenceHash: string;
|
|
31
|
+
blockerFingerprint: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ResolveIOAIManagerRecoveryClass =
|
|
35
|
+
| 'advance_after_proof'
|
|
36
|
+
| 'diagnosis_only'
|
|
37
|
+
| 'diagnosis_revision'
|
|
38
|
+
| 'infra_repair'
|
|
39
|
+
| 'compile_repair'
|
|
40
|
+
| 'journey_contract_repair'
|
|
41
|
+
| 'business_proof_repair'
|
|
42
|
+
| 'release_repair'
|
|
43
|
+
| 'product_code_repair'
|
|
44
|
+
| 'blocked_until_new_evidence'
|
|
45
|
+
| 'manual_handoff'
|
|
46
|
+
| 'continue';
|
|
47
|
+
|
|
48
|
+
export interface ResolveIOAIManagerRecoveryPlan {
|
|
49
|
+
recoveryClass: ResolveIOAIManagerRecoveryClass;
|
|
50
|
+
lane: string;
|
|
51
|
+
stepType: string;
|
|
52
|
+
nextActionLabel: string;
|
|
53
|
+
objective: string;
|
|
54
|
+
allowedAction: string;
|
|
55
|
+
productRepairAllowed: boolean;
|
|
56
|
+
expensiveModelAllowed: boolean;
|
|
57
|
+
maxAttemptsBeforePark: number;
|
|
58
|
+
finiteSteps: string[];
|
|
59
|
+
requiredEvidence: string[];
|
|
60
|
+
loopResetEvidence: string[];
|
|
61
|
+
forbiddenActions: string[];
|
|
62
|
+
notes: string[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type ResolveIOAIManagerRecoveryCheckpointStatus =
|
|
66
|
+
| 'active'
|
|
67
|
+
| 'parked'
|
|
68
|
+
| 'manual_handoff'
|
|
69
|
+
| 'complete';
|
|
70
|
+
|
|
71
|
+
export interface ResolveIOAIManagerRecoveryCheckpoint {
|
|
72
|
+
checkpointId: string;
|
|
73
|
+
recoveryClass: ResolveIOAIManagerRecoveryClass;
|
|
74
|
+
status: ResolveIOAIManagerRecoveryCheckpointStatus;
|
|
75
|
+
lane: string;
|
|
76
|
+
stepType: string;
|
|
77
|
+
allowedAction: string;
|
|
78
|
+
productRepairAllowed: boolean;
|
|
79
|
+
expensiveModelAllowed: boolean;
|
|
80
|
+
attempts: number;
|
|
81
|
+
maxAttemptsBeforePark: number;
|
|
82
|
+
blockerFingerprint: string;
|
|
83
|
+
evidenceHash: string;
|
|
84
|
+
changedFiles: string[];
|
|
85
|
+
artifactPaths: string[];
|
|
86
|
+
requiredEvidence: string[];
|
|
87
|
+
loopResetEvidence: string[];
|
|
88
|
+
forbiddenActions: string[];
|
|
89
|
+
objective: string;
|
|
90
|
+
nextActionLabel: string;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
updatedAt: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type ResolveIOAIManagerRecoveryEvidenceProbeStepKind =
|
|
96
|
+
| 'read_only_diagnosis'
|
|
97
|
+
| 'rerun_same_gate'
|
|
98
|
+
| 'infra_preflight'
|
|
99
|
+
| 'compile_check'
|
|
100
|
+
| 'route_probe'
|
|
101
|
+
| 'business_assertion'
|
|
102
|
+
| 'journey_validation'
|
|
103
|
+
| 'release_status'
|
|
104
|
+
| 'diff_scope_check'
|
|
105
|
+
| 'operator_review';
|
|
106
|
+
|
|
107
|
+
export interface ResolveIOAIManagerRecoveryEvidenceProbeStep {
|
|
108
|
+
id: string;
|
|
109
|
+
kind: ResolveIOAIManagerRecoveryEvidenceProbeStepKind;
|
|
110
|
+
label: string;
|
|
111
|
+
objective: string;
|
|
112
|
+
required: boolean;
|
|
113
|
+
commandHint?: string;
|
|
114
|
+
artifactExpectation: string;
|
|
115
|
+
successSignal: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface ResolveIOAIManagerRecoveryEvidenceProbe {
|
|
119
|
+
probeId: string;
|
|
120
|
+
checkpointId: string;
|
|
121
|
+
recoveryClass: ResolveIOAIManagerRecoveryClass;
|
|
122
|
+
lane: string;
|
|
123
|
+
stepType: string;
|
|
124
|
+
objective: string;
|
|
125
|
+
evidenceOnly: boolean;
|
|
126
|
+
productRepairAllowed: boolean;
|
|
127
|
+
expensiveModelAllowed: boolean;
|
|
128
|
+
evidenceHashBefore: string;
|
|
129
|
+
blockerFingerprint: string;
|
|
130
|
+
steps: ResolveIOAIManagerRecoveryEvidenceProbeStep[];
|
|
131
|
+
requiredArtifacts: string[];
|
|
132
|
+
acceptanceEvidence: string[];
|
|
133
|
+
stopConditions: string[];
|
|
134
|
+
loopResetEvidence: string[];
|
|
135
|
+
createdAt: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export type ResolveIOAIManagerRecoveryAutomationMode =
|
|
139
|
+
| 'advance'
|
|
140
|
+
| 'collect_evidence'
|
|
141
|
+
| 'read_only_diagnosis'
|
|
142
|
+
| 'repair_infra'
|
|
143
|
+
| 'repair_compile'
|
|
144
|
+
| 'repair_journey_contract'
|
|
145
|
+
| 'repair_business_assertion'
|
|
146
|
+
| 'repair_release'
|
|
147
|
+
| 'targeted_product_repair'
|
|
148
|
+
| 'manual_review'
|
|
149
|
+
| 'continue_gate';
|
|
150
|
+
|
|
151
|
+
export interface ResolveIOAIManagerRecoveryActionRetryPolicy {
|
|
152
|
+
allowImmediateRetry: boolean;
|
|
153
|
+
requireNewEvidence: boolean;
|
|
154
|
+
resetLoopWhen: string[];
|
|
155
|
+
stopWhen: string[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type ResolveIOAIManagerHotfixFirstReleaseAction =
|
|
159
|
+
| 'wait_for_active_deploy'
|
|
160
|
+
| 'block_duplicate_deploy'
|
|
161
|
+
| 'block_duplicate_publish'
|
|
162
|
+
| 'review_force_deploy'
|
|
163
|
+
| 'hotfix_release_artifact'
|
|
164
|
+
| 'deploy_new_artifact_after_release_gate'
|
|
165
|
+
| 'build_artifact_first';
|
|
166
|
+
|
|
167
|
+
export type ResolveIOAIManagerHotfixChannel =
|
|
168
|
+
| 'static_ui'
|
|
169
|
+
| 'backend_js'
|
|
170
|
+
| 'config'
|
|
171
|
+
| 'seed_data'
|
|
172
|
+
| 'cache_invalidation'
|
|
173
|
+
| 'service_restart'
|
|
174
|
+
| 'release_artifact'
|
|
175
|
+
| 'force_deploy_review'
|
|
176
|
+
| 'new_artifact_deploy'
|
|
177
|
+
| 'artifact_build';
|
|
178
|
+
|
|
179
|
+
export interface ResolveIOAIManagerHotfixPlanStep {
|
|
180
|
+
id: string;
|
|
181
|
+
label: string;
|
|
182
|
+
channel: ResolveIOAIManagerHotfixChannel;
|
|
183
|
+
safeToAutoRun: boolean;
|
|
184
|
+
requiresFullDeploy: boolean;
|
|
185
|
+
requiredEvidence: string[];
|
|
186
|
+
successEvidence: string[];
|
|
187
|
+
blockedBy: string[];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface ResolveIOAIManagerHotfixPlan {
|
|
191
|
+
planId: string;
|
|
192
|
+
label: string;
|
|
193
|
+
recommendedChannel: ResolveIOAIManagerHotfixChannel;
|
|
194
|
+
reason: string;
|
|
195
|
+
fullDeployAvoided: boolean;
|
|
196
|
+
steps: ResolveIOAIManagerHotfixPlanStep[];
|
|
197
|
+
acceptanceEvidence: string[];
|
|
198
|
+
escalationTriggers: string[];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface ResolveIOAIManagerHotfixFirstReleasePolicyInput {
|
|
202
|
+
surface?: string;
|
|
203
|
+
activeDeploy?: boolean;
|
|
204
|
+
deployFingerprint?: string;
|
|
205
|
+
lastDeployFingerprint?: string;
|
|
206
|
+
publishFingerprint?: string;
|
|
207
|
+
lastPublishFingerprint?: string;
|
|
208
|
+
deployStatus?: string;
|
|
209
|
+
publishStatus?: string;
|
|
210
|
+
sampleDataStatus?: string;
|
|
211
|
+
forceDeploy?: boolean;
|
|
212
|
+
forcePublish?: boolean;
|
|
213
|
+
hasNewArtifact?: boolean;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface ResolveIOAIManagerHotfixFirstReleasePolicy {
|
|
217
|
+
policy: 'hotfix_first';
|
|
218
|
+
surface: string;
|
|
219
|
+
recommendedAction: ResolveIOAIManagerHotfixFirstReleaseAction;
|
|
220
|
+
label: string;
|
|
221
|
+
reason: string;
|
|
222
|
+
hotfixPreferred: boolean;
|
|
223
|
+
fullDeployAllowed: boolean;
|
|
224
|
+
duplicateDeployBlocked: boolean;
|
|
225
|
+
duplicatePublishBlocked: boolean;
|
|
226
|
+
forceDeployRequiredToRepeat: boolean;
|
|
227
|
+
forcePublishRequiredToRepeat: boolean;
|
|
228
|
+
statuses: {
|
|
229
|
+
deploy: string;
|
|
230
|
+
publish: string;
|
|
231
|
+
sampleData: string;
|
|
232
|
+
};
|
|
233
|
+
fingerprints: {
|
|
234
|
+
current: string;
|
|
235
|
+
last: string;
|
|
236
|
+
matchesLast: boolean;
|
|
237
|
+
publishCurrent: string;
|
|
238
|
+
publishLast: string;
|
|
239
|
+
publishMatchesLast: boolean;
|
|
240
|
+
};
|
|
241
|
+
hotfixPlan: ResolveIOAIManagerHotfixPlan;
|
|
242
|
+
allowedActions: string[];
|
|
243
|
+
forbiddenActions: string[];
|
|
244
|
+
requiredEvidence: string[];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface ResolveIOAIManagerRecoveryActionPacket {
|
|
248
|
+
actionId: string;
|
|
249
|
+
checkpointId: string;
|
|
250
|
+
probeId: string;
|
|
251
|
+
recoveryClass: ResolveIOAIManagerRecoveryClass;
|
|
252
|
+
mode: ResolveIOAIManagerRecoveryAutomationMode;
|
|
253
|
+
label: string;
|
|
254
|
+
lane: string;
|
|
255
|
+
stepType: string;
|
|
256
|
+
primaryStepKind: ResolveIOAIManagerRecoveryEvidenceProbeStepKind | 'none';
|
|
257
|
+
objective: string;
|
|
258
|
+
evidenceOnly: boolean;
|
|
259
|
+
autoRunnable: boolean;
|
|
260
|
+
productRepairAllowed: boolean;
|
|
261
|
+
expensiveModelAllowed: boolean;
|
|
262
|
+
canResetLoopAfterEvidence: boolean;
|
|
263
|
+
maxAttemptsBeforePark: number;
|
|
264
|
+
requiredArtifacts: string[];
|
|
265
|
+
nextCommands: string[];
|
|
266
|
+
successCriteria: string[];
|
|
267
|
+
retryPolicy: ResolveIOAIManagerRecoveryActionRetryPolicy;
|
|
268
|
+
releasePolicy?: ResolveIOAIManagerHotfixFirstReleasePolicy;
|
|
269
|
+
blockedReason?: string;
|
|
270
|
+
createdAt: string;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export type ResolveIOAIManagerRecoveryActionDispatchAction =
|
|
274
|
+
| 'run_evidence_probe'
|
|
275
|
+
| 'run_read_only_diagnosis'
|
|
276
|
+
| 'run_infra_repair'
|
|
277
|
+
| 'run_compile_repair'
|
|
278
|
+
| 'run_journey_contract_repair'
|
|
279
|
+
| 'run_business_assertion_repair'
|
|
280
|
+
| 'run_release_repair'
|
|
281
|
+
| 'run_targeted_product_repair'
|
|
282
|
+
| 'advance'
|
|
283
|
+
| 'continue_gate'
|
|
284
|
+
| 'park_manual';
|
|
285
|
+
|
|
286
|
+
export interface ResolveIOAIManagerAutoDispatchPolicyInput {
|
|
287
|
+
dispatchAction?: ResolveIOAIManagerRecoveryActionDispatchAction | string;
|
|
288
|
+
directive?: Partial<ResolveIOAIManagerRecoveryExecutionDirective>;
|
|
289
|
+
action?: Partial<ResolveIOAIManagerRecoveryActionPacket>;
|
|
290
|
+
includeJourneyContractRepair?: boolean;
|
|
291
|
+
includeReleaseRepair?: boolean;
|
|
292
|
+
includeBusinessProofRepair?: boolean;
|
|
293
|
+
includeProductRepair?: boolean;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export type ResolveIOAIManagerRecoveryActionDispatchStatus =
|
|
297
|
+
| 'queued'
|
|
298
|
+
| 'started'
|
|
299
|
+
| 'completed'
|
|
300
|
+
| 'failed'
|
|
301
|
+
| 'parked';
|
|
302
|
+
|
|
303
|
+
export interface ResolveIOAIManagerRecoveryActionDispatchRecord {
|
|
304
|
+
dispatchId: string;
|
|
305
|
+
actionId: string;
|
|
306
|
+
checkpointId: string;
|
|
307
|
+
probeId: string;
|
|
308
|
+
mode: ResolveIOAIManagerRecoveryAutomationMode;
|
|
309
|
+
dispatchAction: ResolveIOAIManagerRecoveryActionDispatchAction;
|
|
310
|
+
status: ResolveIOAIManagerRecoveryActionDispatchStatus;
|
|
311
|
+
evidenceHash: string;
|
|
312
|
+
blockerFingerprint: string;
|
|
313
|
+
productRepairAllowed: boolean;
|
|
314
|
+
expensiveModelAllowed: boolean;
|
|
315
|
+
reason: string;
|
|
316
|
+
artifactPaths: string[];
|
|
317
|
+
startedAt?: string;
|
|
318
|
+
completedAt?: string;
|
|
319
|
+
createdAt: string;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export interface ResolveIOAIManagerRecoveryActionDispatchInput {
|
|
323
|
+
action?: ResolveIOAIManagerRecoveryActionPacket;
|
|
324
|
+
history?: ResolveIOAIManagerRecoveryActionDispatchRecord[];
|
|
325
|
+
current?: ResolveIOAIManagerFailureRecord;
|
|
326
|
+
operatorApproved?: boolean;
|
|
327
|
+
now?: Date | string;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export interface ResolveIOAIManagerRecoveryActionDispatchDecision {
|
|
331
|
+
dispatchAction: ResolveIOAIManagerRecoveryActionDispatchAction;
|
|
332
|
+
allowed: boolean;
|
|
333
|
+
reason: string;
|
|
334
|
+
status: ResolveIOAIManagerRecoveryActionDispatchStatus;
|
|
335
|
+
canRunProductRepair: boolean;
|
|
336
|
+
canRunExpensiveModel: boolean;
|
|
337
|
+
shouldRecordDispatch: boolean;
|
|
338
|
+
requiresNewEvidence: boolean;
|
|
339
|
+
newEvidence: boolean;
|
|
340
|
+
dispatchRecord?: ResolveIOAIManagerRecoveryActionDispatchRecord;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export type ResolveIOAIManagerRecoveryExecutionPhase =
|
|
344
|
+
| 'evidence'
|
|
345
|
+
| 'diagnosis'
|
|
346
|
+
| 'infra'
|
|
347
|
+
| 'compile'
|
|
348
|
+
| 'journey'
|
|
349
|
+
| 'business_proof'
|
|
350
|
+
| 'release'
|
|
351
|
+
| 'product_repair'
|
|
352
|
+
| 'advance'
|
|
353
|
+
| 'manual';
|
|
354
|
+
|
|
355
|
+
export interface ResolveIOAIManagerRecoveryExecutionDirectiveInput {
|
|
356
|
+
action?: ResolveIOAIManagerRecoveryActionPacket;
|
|
357
|
+
dispatchDecision?: ResolveIOAIManagerRecoveryActionDispatchDecision;
|
|
358
|
+
current?: ResolveIOAIManagerFailureRecord;
|
|
359
|
+
surface?: string;
|
|
360
|
+
now?: Date | string;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface ResolveIOAIManagerRecoveryExecutionDirective {
|
|
364
|
+
directiveId: string;
|
|
365
|
+
surface: string;
|
|
366
|
+
dispatchAction: ResolveIOAIManagerRecoveryActionDispatchAction;
|
|
367
|
+
phase: ResolveIOAIManagerRecoveryExecutionPhase;
|
|
368
|
+
allowed: boolean;
|
|
369
|
+
status: ResolveIOAIManagerRecoveryActionDispatchStatus;
|
|
370
|
+
reason: string;
|
|
371
|
+
lane: string;
|
|
372
|
+
stepType: string;
|
|
373
|
+
nextActionLabel: string;
|
|
374
|
+
rerunReason: string;
|
|
375
|
+
evidenceOnly: boolean;
|
|
376
|
+
autoRunnable: boolean;
|
|
377
|
+
productRepairAllowed: boolean;
|
|
378
|
+
expensiveModelAllowed: boolean;
|
|
379
|
+
canRunProductRepair: boolean;
|
|
380
|
+
canRunExpensiveModel: boolean;
|
|
381
|
+
canResetLoopAfterEvidence: boolean;
|
|
382
|
+
requiresNewEvidence: boolean;
|
|
383
|
+
newEvidence: boolean;
|
|
384
|
+
maxAttemptsBeforePark: number;
|
|
385
|
+
requiredArtifacts: string[];
|
|
386
|
+
nextCommands: string[];
|
|
387
|
+
successCriteria: string[];
|
|
388
|
+
forbiddenActions: string[];
|
|
389
|
+
dispatchRecord?: ResolveIOAIManagerRecoveryActionDispatchRecord;
|
|
390
|
+
releasePolicy?: ResolveIOAIManagerHotfixFirstReleasePolicy;
|
|
391
|
+
createdAt: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface ResolveIOAIManagerRecoveryCheckpointInput {
|
|
395
|
+
plan: ResolveIOAIManagerRecoveryPlan;
|
|
396
|
+
current?: ResolveIOAIManagerFailureRecord;
|
|
397
|
+
previousCheckpoint?: ResolveIOAIManagerRecoveryCheckpoint;
|
|
398
|
+
now?: Date | string;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export type ResolveIOAIManagerRecoveryGateAction =
|
|
402
|
+
| 'allow'
|
|
403
|
+
| 'collect_new_evidence'
|
|
404
|
+
| 'reject_action'
|
|
405
|
+
| 'manual_handoff'
|
|
406
|
+
| 'complete';
|
|
407
|
+
|
|
408
|
+
export interface ResolveIOAIManagerRecoveryGateInput {
|
|
409
|
+
checkpoint: ResolveIOAIManagerRecoveryCheckpoint;
|
|
410
|
+
current?: ResolveIOAIManagerFailureRecord;
|
|
411
|
+
proposedAction?: string;
|
|
412
|
+
operatorApproved?: boolean;
|
|
413
|
+
now?: Date | string;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export interface ResolveIOAIManagerRecoveryGateDecision {
|
|
417
|
+
action: ResolveIOAIManagerRecoveryGateAction;
|
|
418
|
+
reason: string;
|
|
419
|
+
canRunProductRepair: boolean;
|
|
420
|
+
canRunExpensiveModel: boolean;
|
|
421
|
+
shouldResetLoopBudget: boolean;
|
|
422
|
+
shouldIncrementAttempt: boolean;
|
|
423
|
+
newEvidence: boolean;
|
|
424
|
+
materialEvidence: boolean;
|
|
425
|
+
evidenceStrength: ResolveIOAIManagerEvidenceStrength;
|
|
426
|
+
evidenceSignals: string[];
|
|
427
|
+
blockerFingerprint: string;
|
|
428
|
+
evidenceHash: string;
|
|
429
|
+
missingEvidence: string[];
|
|
430
|
+
checkpoint: ResolveIOAIManagerRecoveryCheckpoint;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export interface ResolveIOAIManagerRecoveryEvidenceProbeInput {
|
|
434
|
+
checkpoint: ResolveIOAIManagerRecoveryCheckpoint;
|
|
435
|
+
current?: ResolveIOAIManagerFailureRecord;
|
|
436
|
+
now?: Date | string;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export interface ResolveIOAIManagerRecoveryActionPacketInput {
|
|
440
|
+
plan?: ResolveIOAIManagerRecoveryPlan;
|
|
441
|
+
checkpoint: ResolveIOAIManagerRecoveryCheckpoint;
|
|
442
|
+
probe?: ResolveIOAIManagerRecoveryEvidenceProbe;
|
|
443
|
+
current?: ResolveIOAIManagerFailureRecord;
|
|
444
|
+
now?: Date | string;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export interface ResolveIOAIManagerRecoveryPlanInput {
|
|
448
|
+
action?: ResolveIOAIManagerAction | string;
|
|
449
|
+
reason?: string;
|
|
450
|
+
failureClass?: string;
|
|
451
|
+
lane?: string;
|
|
452
|
+
stepType?: string;
|
|
453
|
+
blocker?: string;
|
|
454
|
+
sameFailureCount?: number;
|
|
455
|
+
pingPongCount?: number;
|
|
456
|
+
newEvidence?: boolean;
|
|
457
|
+
productRepairFailure?: boolean;
|
|
458
|
+
changedFiles?: string[];
|
|
459
|
+
artifactPaths?: string[];
|
|
460
|
+
maxSameFailureRepeats?: number;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export interface ResolveIOAIManagerPolicyInput {
|
|
464
|
+
history?: ResolveIOAIManagerFailureRecord[];
|
|
465
|
+
current?: ResolveIOAIManagerFailureRecord;
|
|
466
|
+
maxSameFailureRepeats?: number;
|
|
467
|
+
maxPingPongTransitions?: number;
|
|
468
|
+
infraFailureClasses?: string[];
|
|
469
|
+
ignoredFailureClasses?: string[];
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export interface ResolveIOAIManagerPolicyDecision {
|
|
473
|
+
action: ResolveIOAIManagerAction;
|
|
474
|
+
reason: string;
|
|
475
|
+
failureClass: string;
|
|
476
|
+
blockerFingerprint: string;
|
|
477
|
+
evidenceHash: string;
|
|
478
|
+
sameFailureCount: number;
|
|
479
|
+
pingPongCount: number;
|
|
480
|
+
newEvidence: boolean;
|
|
481
|
+
materialEvidence: boolean;
|
|
482
|
+
evidenceStrength: ResolveIOAIManagerEvidenceStrength;
|
|
483
|
+
evidenceSignals: string[];
|
|
484
|
+
loopBudgetShouldReset: boolean;
|
|
485
|
+
productRepairFailure: boolean;
|
|
486
|
+
recoveryPlan: ResolveIOAIManagerRecoveryPlan;
|
|
487
|
+
recoveryCheckpoint: ResolveIOAIManagerRecoveryCheckpoint;
|
|
488
|
+
recoveryEvidenceProbe: ResolveIOAIManagerRecoveryEvidenceProbe;
|
|
489
|
+
recoveryAction: ResolveIOAIManagerRecoveryActionPacket;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export interface ResolveIOAIManagerRecoveryReplayMatrixInput {
|
|
493
|
+
surface?: string;
|
|
494
|
+
includeJourneyContractRepair?: boolean;
|
|
495
|
+
includeReleaseRepair?: boolean;
|
|
496
|
+
includeProductRepair?: boolean;
|
|
497
|
+
maxSameFailureRepeats?: number;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export interface ResolveIOAIManagerRecoveryReplayCase {
|
|
501
|
+
caseId: string;
|
|
502
|
+
surface: string;
|
|
503
|
+
pass: boolean;
|
|
504
|
+
action: string;
|
|
505
|
+
reason: string;
|
|
506
|
+
recoveryClass: string;
|
|
507
|
+
dispatchAction: string;
|
|
508
|
+
safeAutoDispatch: boolean;
|
|
509
|
+
expectedSafeAutoDispatch: boolean;
|
|
510
|
+
productRepairAllowed: boolean;
|
|
511
|
+
loopBudgetShouldReset: boolean;
|
|
512
|
+
materialEvidence: boolean;
|
|
513
|
+
evidenceStrength: ResolveIOAIManagerEvidenceStrength;
|
|
514
|
+
hotfixFirst?: boolean;
|
|
515
|
+
fullDeployAllowed?: boolean;
|
|
516
|
+
details?: Record<string, any>;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function cleanText(value: any, max = 2000): string {
|
|
520
|
+
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function cleanList(values: any, limit = 40, max = 500): string[] {
|
|
524
|
+
if (!Array.isArray(values)) {
|
|
525
|
+
return [];
|
|
526
|
+
}
|
|
527
|
+
const result: string[] = [];
|
|
528
|
+
for (const value of values) {
|
|
529
|
+
const normalized = cleanText(value, max);
|
|
530
|
+
if (normalized && !result.includes(normalized)) {
|
|
531
|
+
result.push(normalized);
|
|
532
|
+
}
|
|
533
|
+
if (result.length >= limit) {
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
return result;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function releaseStatusIsBlocked(value: string): boolean {
|
|
541
|
+
return /fail|error|blocked|missing|empty|not ready|not_ready|denied|invalid|timeout|stale/i.test(value);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function releaseStatusIsTerminalDeploy(value: string): boolean {
|
|
545
|
+
return /requested|queued|in.?progress|completed|complete|success|succeeded|pass|passed|published|deployed|failed|error|blocked/i.test(value);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function buildReleaseAllowedActions(action: ResolveIOAIManagerHotfixFirstReleaseAction): string[] {
|
|
549
|
+
if (action === 'wait_for_active_deploy') {
|
|
550
|
+
return ['wait_for_current_deploy_result', 'collect_current_deploy_log', 'refresh_release_snapshot'];
|
|
551
|
+
}
|
|
552
|
+
if (action === 'block_duplicate_deploy') {
|
|
553
|
+
return ['collect_existing_deploy_evidence', 'hotfix_release_artifact', 'request_force_deploy_with_reason'];
|
|
554
|
+
}
|
|
555
|
+
if (action === 'block_duplicate_publish') {
|
|
556
|
+
return ['collect_existing_publish_evidence', 'hotfix_release_artifact', 'request_force_publish_with_reason'];
|
|
557
|
+
}
|
|
558
|
+
if (action === 'review_force_deploy') {
|
|
559
|
+
return ['verify_force_deploy_reason', 'rerun_failed_release_gate_once', 'record_force_deploy_evidence'];
|
|
560
|
+
}
|
|
561
|
+
if (action === 'deploy_new_artifact_after_release_gate') {
|
|
562
|
+
return ['verify_new_artifact_fingerprint', 'run_release_gate_once', 'record_publish_deploy_evidence'];
|
|
563
|
+
}
|
|
564
|
+
if (action === 'build_artifact_first') {
|
|
565
|
+
return ['build_missing_release_artifact', 'record_artifact_fingerprint', 'run_release_gate_once'];
|
|
566
|
+
}
|
|
567
|
+
return ['hotfix_live_runner_or_release_artifact', 'rerun_failed_release_gate_only', 'record_release_evidence'];
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function hotfixStep(
|
|
571
|
+
id: string,
|
|
572
|
+
label: string,
|
|
573
|
+
channel: ResolveIOAIManagerHotfixChannel,
|
|
574
|
+
options: {
|
|
575
|
+
safeToAutoRun?: boolean;
|
|
576
|
+
requiresFullDeploy?: boolean;
|
|
577
|
+
requiredEvidence?: string[];
|
|
578
|
+
successEvidence?: string[];
|
|
579
|
+
blockedBy?: string[];
|
|
580
|
+
} = {}
|
|
581
|
+
): ResolveIOAIManagerHotfixPlanStep {
|
|
582
|
+
return {
|
|
583
|
+
id,
|
|
584
|
+
label,
|
|
585
|
+
channel,
|
|
586
|
+
safeToAutoRun: options.safeToAutoRun === true,
|
|
587
|
+
requiresFullDeploy: options.requiresFullDeploy === true,
|
|
588
|
+
requiredEvidence: options.requiredEvidence || [],
|
|
589
|
+
successEvidence: options.successEvidence || [],
|
|
590
|
+
blockedBy: options.blockedBy || []
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
function buildHotfixFirstReleasePlan(input: {
|
|
595
|
+
action: ResolveIOAIManagerHotfixFirstReleaseAction;
|
|
596
|
+
surface: string;
|
|
597
|
+
reason: string;
|
|
598
|
+
releaseBlocked: boolean;
|
|
599
|
+
}): ResolveIOAIManagerHotfixPlan {
|
|
600
|
+
const surface = cleanText(input.surface || 'runner', 80)
|
|
601
|
+
.toLowerCase()
|
|
602
|
+
.replace(/[^a-z0-9]+/g, '_')
|
|
603
|
+
.replace(/^_+|_+$/g, '') || 'runner';
|
|
604
|
+
const commonAcceptance = [
|
|
605
|
+
'failed release gate is rerun once and passes',
|
|
606
|
+
'artifact fingerprint or hotfix evidence is recorded',
|
|
607
|
+
'operator console shows no active duplicate deploy blocker'
|
|
608
|
+
];
|
|
609
|
+
if (input.action === 'wait_for_active_deploy') {
|
|
610
|
+
return {
|
|
611
|
+
planId: `${surface}:wait_for_active_deploy`,
|
|
612
|
+
label: 'Wait For Active Deploy',
|
|
613
|
+
recommendedChannel: 'release_artifact',
|
|
614
|
+
reason: input.reason,
|
|
615
|
+
fullDeployAvoided: true,
|
|
616
|
+
steps: [
|
|
617
|
+
hotfixStep('collect_active_deploy_log', 'Collect active deploy log', 'release_artifact', {
|
|
618
|
+
safeToAutoRun: true,
|
|
619
|
+
requiredEvidence: ['active deploy id or release operation id'],
|
|
620
|
+
successEvidence: ['terminal deploy status and release log captured']
|
|
621
|
+
})
|
|
622
|
+
],
|
|
623
|
+
acceptanceEvidence: commonAcceptance,
|
|
624
|
+
escalationTriggers: ['active deploy exceeds timeout', 'active deploy fails without a release log']
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
if (input.action === 'deploy_new_artifact_after_release_gate') {
|
|
628
|
+
return {
|
|
629
|
+
planId: `${surface}:deploy_new_artifact_after_release_gate`,
|
|
630
|
+
label: 'Deploy New Artifact After Release Gate',
|
|
631
|
+
recommendedChannel: 'new_artifact_deploy',
|
|
632
|
+
reason: input.reason,
|
|
633
|
+
fullDeployAvoided: false,
|
|
634
|
+
steps: [
|
|
635
|
+
hotfixStep('verify_new_artifact_fingerprint', 'Verify new artifact fingerprint', 'new_artifact_deploy', {
|
|
636
|
+
safeToAutoRun: true,
|
|
637
|
+
requiresFullDeploy: true,
|
|
638
|
+
requiredEvidence: ['current artifact fingerprint differs from last deployed fingerprint'],
|
|
639
|
+
successEvidence: ['release gate permits one full deploy']
|
|
640
|
+
})
|
|
641
|
+
],
|
|
642
|
+
acceptanceEvidence: [
|
|
643
|
+
'new artifact fingerprint recorded',
|
|
644
|
+
'release gate passed before full deploy',
|
|
645
|
+
'deploy/publish result recorded'
|
|
646
|
+
],
|
|
647
|
+
escalationTriggers: ['artifact fingerprint matches last deploy', 'release gate fails']
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
if (input.action === 'build_artifact_first') {
|
|
651
|
+
return {
|
|
652
|
+
planId: `${surface}:build_artifact_first`,
|
|
653
|
+
label: 'Build Artifact First',
|
|
654
|
+
recommendedChannel: 'artifact_build',
|
|
655
|
+
reason: input.reason,
|
|
656
|
+
fullDeployAvoided: true,
|
|
657
|
+
steps: [
|
|
658
|
+
hotfixStep('build_once_record_fingerprint', 'Build once and record fingerprint', 'artifact_build', {
|
|
659
|
+
safeToAutoRun: false,
|
|
660
|
+
requiredEvidence: ['missing artifact fingerprint', 'release gate reason for building'],
|
|
661
|
+
successEvidence: ['artifact fingerprint recorded before any deploy']
|
|
662
|
+
})
|
|
663
|
+
],
|
|
664
|
+
acceptanceEvidence: ['artifact fingerprint exists', 'no deploy queued before release gate'],
|
|
665
|
+
escalationTriggers: ['build repeats without a new fingerprint', 'build failure lacks compile log']
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
if (input.action === 'review_force_deploy') {
|
|
669
|
+
return {
|
|
670
|
+
planId: `${surface}:review_force_deploy`,
|
|
671
|
+
label: 'Review Force Deploy',
|
|
672
|
+
recommendedChannel: 'force_deploy_review',
|
|
673
|
+
reason: input.reason,
|
|
674
|
+
fullDeployAvoided: false,
|
|
675
|
+
steps: [
|
|
676
|
+
hotfixStep('verify_force_deploy_reason', 'Verify force deploy reason', 'force_deploy_review', {
|
|
677
|
+
requiredEvidence: ['explicit force_deploy reason', 'why hotfix cannot resolve the release blocker'],
|
|
678
|
+
successEvidence: ['one allowed deploy attempt is recorded with reason']
|
|
679
|
+
})
|
|
680
|
+
],
|
|
681
|
+
acceptanceEvidence: ['force deploy evidence recorded', 'duplicate fingerprint exception is auditable'],
|
|
682
|
+
escalationTriggers: ['force deploy reason is empty', 'same force deploy fails twice']
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
return {
|
|
686
|
+
planId: `${surface}:${input.action}`,
|
|
687
|
+
label: input.action === 'block_duplicate_deploy'
|
|
688
|
+
? 'Hotfix Or Force Deploy'
|
|
689
|
+
: input.action === 'block_duplicate_publish'
|
|
690
|
+
? 'Hotfix Or Force Publish'
|
|
691
|
+
: 'Hotfix Release Artifact',
|
|
692
|
+
recommendedChannel: input.action === 'block_duplicate_publish'
|
|
693
|
+
? 'release_artifact'
|
|
694
|
+
: input.releaseBlocked ? 'release_artifact' : 'static_ui',
|
|
695
|
+
reason: input.reason,
|
|
696
|
+
fullDeployAvoided: true,
|
|
697
|
+
steps: [
|
|
698
|
+
hotfixStep('static_ui_hotfix', 'Static UI hotfix', 'static_ui', {
|
|
699
|
+
safeToAutoRun: true,
|
|
700
|
+
requiredEvidence: ['built dist path', 'target S3 bucket and CloudFront distribution', 'changed frontend bundle or asset list'],
|
|
701
|
+
successEvidence: ['S3 upload result', 'CloudFront invalidation id', 'public bundle contains expected hotfix marker']
|
|
702
|
+
}),
|
|
703
|
+
hotfixStep('backend_js_hotfix', 'Backend JS hotfix', 'backend_js', {
|
|
704
|
+
requiredEvidence: ['compiled JS artifact path', 'target backend host', 'diff limited to runner/operator code'],
|
|
705
|
+
successEvidence: ['remote file checksum', 'service restart or process reload evidence', 'self-test passes']
|
|
706
|
+
}),
|
|
707
|
+
hotfixStep('config_seed_cache_restart', 'Config, seed, cache, or restart repair', 'config', {
|
|
708
|
+
safeToAutoRun: true,
|
|
709
|
+
requiredEvidence: ['exact config/seed/cache key or process name', 'why no product artifact changed'],
|
|
710
|
+
successEvidence: ['release gate rerun result', 'operator console release snapshot refreshed']
|
|
711
|
+
})
|
|
712
|
+
],
|
|
713
|
+
acceptanceEvidence: commonAcceptance,
|
|
714
|
+
escalationTriggers: [
|
|
715
|
+
'hotfix changes customer-facing product code outside the release artifact',
|
|
716
|
+
'same release gate fails twice after hotfix evidence',
|
|
717
|
+
'same publish fingerprint is retried without force_publish evidence',
|
|
718
|
+
'force deploy is requested without a reason'
|
|
719
|
+
]
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
export function buildResolveIOAIManagerHotfixFirstReleasePolicy(
|
|
724
|
+
input: ResolveIOAIManagerHotfixFirstReleasePolicyInput = {}
|
|
725
|
+
): ResolveIOAIManagerHotfixFirstReleasePolicy {
|
|
726
|
+
const surface = cleanText(input.surface || 'runner', 120);
|
|
727
|
+
const deployStatus = cleanText(input.deployStatus, 160);
|
|
728
|
+
const publishStatus = cleanText(input.publishStatus, 160);
|
|
729
|
+
const sampleDataStatus = cleanText(input.sampleDataStatus, 160);
|
|
730
|
+
const deployFingerprint = cleanText(input.deployFingerprint, 240);
|
|
731
|
+
const lastDeployFingerprint = cleanText(input.lastDeployFingerprint, 240);
|
|
732
|
+
const publishFingerprint = cleanText(input.publishFingerprint, 240);
|
|
733
|
+
const lastPublishFingerprint = cleanText(input.lastPublishFingerprint, 240);
|
|
734
|
+
const fingerprintMatchesLast = !!deployFingerprint && !!lastDeployFingerprint && deployFingerprint === lastDeployFingerprint;
|
|
735
|
+
const publishFingerprintMatchesLast = !!publishFingerprint && !!lastPublishFingerprint && publishFingerprint === lastPublishFingerprint;
|
|
736
|
+
const releaseBlocked = [deployStatus, publishStatus, sampleDataStatus].some(releaseStatusIsBlocked);
|
|
737
|
+
const duplicateDeployBlocked = fingerprintMatchesLast
|
|
738
|
+
&& input.forceDeploy !== true
|
|
739
|
+
&& releaseStatusIsTerminalDeploy([deployStatus, publishStatus].filter(Boolean).join(' '));
|
|
740
|
+
const duplicatePublishBlocked = publishFingerprintMatchesLast
|
|
741
|
+
&& input.forcePublish !== true
|
|
742
|
+
&& releaseStatusIsBlocked(publishStatus)
|
|
743
|
+
&& releaseStatusIsTerminalDeploy(publishStatus);
|
|
744
|
+
let recommendedAction: ResolveIOAIManagerHotfixFirstReleaseAction = 'hotfix_release_artifact';
|
|
745
|
+
let label = 'Hotfix Release Artifact';
|
|
746
|
+
let reason = 'Repair the live runner/operator code, release config, domain, seed-data, or release artifact and rerun only the failed release gate.';
|
|
747
|
+
let fullDeployAllowed = false;
|
|
748
|
+
if (input.activeDeploy === true) {
|
|
749
|
+
recommendedAction = 'wait_for_active_deploy';
|
|
750
|
+
label = 'Wait For Active Deploy';
|
|
751
|
+
reason = 'A deploy is already queued or running; collect that result before spending another deploy cycle.';
|
|
752
|
+
}
|
|
753
|
+
else if (duplicateDeployBlocked) {
|
|
754
|
+
recommendedAction = 'block_duplicate_deploy';
|
|
755
|
+
label = 'Block Duplicate Deploy';
|
|
756
|
+
reason = 'The same artifact fingerprint already has release status; hotfix or provide explicit force_deploy evidence before rerunning it.';
|
|
757
|
+
}
|
|
758
|
+
else if (duplicatePublishBlocked) {
|
|
759
|
+
recommendedAction = 'block_duplicate_publish';
|
|
760
|
+
label = 'Block Duplicate Publish';
|
|
761
|
+
reason = 'The same publish fingerprint already has release status; hotfix the release artifact or provide explicit force_publish evidence before rerunning publish.';
|
|
762
|
+
}
|
|
763
|
+
else if ((fingerprintMatchesLast && input.forceDeploy === true) || (publishFingerprintMatchesLast && input.forcePublish === true)) {
|
|
764
|
+
recommendedAction = 'review_force_deploy';
|
|
765
|
+
label = 'Review Force Deploy';
|
|
766
|
+
reason = input.forcePublish === true
|
|
767
|
+
? 'force_publish was explicitly requested for a repeated publish artifact; require a reason and rerun only the failed release gate.'
|
|
768
|
+
: 'force_deploy was explicitly requested for a repeated artifact; require a reason and rerun only the failed release gate.';
|
|
769
|
+
fullDeployAllowed = true;
|
|
770
|
+
}
|
|
771
|
+
else if (input.hasNewArtifact === false && !releaseBlocked) {
|
|
772
|
+
recommendedAction = 'build_artifact_first';
|
|
773
|
+
label = 'Build Artifact First';
|
|
774
|
+
reason = 'No release artifact fingerprint is available yet; build once, record the fingerprint, and avoid repeated deploys.';
|
|
775
|
+
}
|
|
776
|
+
else if (input.hasNewArtifact === true && !releaseBlocked) {
|
|
777
|
+
recommendedAction = 'deploy_new_artifact_after_release_gate';
|
|
778
|
+
label = 'Deploy New Artifact After Release Gate';
|
|
779
|
+
reason = 'A new artifact can be deployed after the release gate proves the artifact is new and ready.';
|
|
780
|
+
fullDeployAllowed = true;
|
|
781
|
+
}
|
|
782
|
+
const allowedActions = buildReleaseAllowedActions(recommendedAction);
|
|
783
|
+
const hotfixPlan = buildHotfixFirstReleasePlan({
|
|
784
|
+
action: recommendedAction,
|
|
785
|
+
surface,
|
|
786
|
+
reason,
|
|
787
|
+
releaseBlocked
|
|
788
|
+
});
|
|
789
|
+
return {
|
|
790
|
+
policy: 'hotfix_first',
|
|
791
|
+
surface,
|
|
792
|
+
recommendedAction,
|
|
793
|
+
label,
|
|
794
|
+
reason,
|
|
795
|
+
hotfixPreferred: recommendedAction !== 'deploy_new_artifact_after_release_gate' && recommendedAction !== 'review_force_deploy',
|
|
796
|
+
fullDeployAllowed,
|
|
797
|
+
duplicateDeployBlocked,
|
|
798
|
+
duplicatePublishBlocked,
|
|
799
|
+
forceDeployRequiredToRepeat: true,
|
|
800
|
+
forcePublishRequiredToRepeat: true,
|
|
801
|
+
statuses: {
|
|
802
|
+
deploy: deployStatus,
|
|
803
|
+
publish: publishStatus,
|
|
804
|
+
sampleData: sampleDataStatus
|
|
805
|
+
},
|
|
806
|
+
fingerprints: {
|
|
807
|
+
current: deployFingerprint,
|
|
808
|
+
last: lastDeployFingerprint,
|
|
809
|
+
matchesLast: fingerprintMatchesLast,
|
|
810
|
+
publishCurrent: publishFingerprint,
|
|
811
|
+
publishLast: lastPublishFingerprint,
|
|
812
|
+
publishMatchesLast: publishFingerprintMatchesLast
|
|
813
|
+
},
|
|
814
|
+
hotfixPlan,
|
|
815
|
+
allowedActions,
|
|
816
|
+
forbiddenActions: [
|
|
817
|
+
'rerun full builder loop for a release-only blocker',
|
|
818
|
+
'queue duplicate deploy without force_deploy evidence',
|
|
819
|
+
'queue duplicate publish without force_publish evidence',
|
|
820
|
+
'publish/deploy again before reading the failed release log',
|
|
821
|
+
'change core workflow after business proof passed unless release evidence proves it is required'
|
|
822
|
+
],
|
|
823
|
+
requiredEvidence: [
|
|
824
|
+
'failed release gate log or active deploy result',
|
|
825
|
+
'deploy artifact fingerprint comparison',
|
|
826
|
+
'publish artifact fingerprint comparison when publish is the failed gate',
|
|
827
|
+
'hotfix/config/seed/domain change evidence when no new product artifact is needed',
|
|
828
|
+
'force_deploy or force_publish reason when repeating the same fingerprint'
|
|
829
|
+
]
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export function isResolveIOAIManagerSafeAutoDispatch(
|
|
834
|
+
input: ResolveIOAIManagerAutoDispatchPolicyInput | ResolveIOAIManagerRecoveryActionDispatchAction | string | undefined
|
|
835
|
+
): boolean {
|
|
836
|
+
const normalizedInput = typeof input === 'string'
|
|
837
|
+
? { dispatchAction: input }
|
|
838
|
+
: (input || {});
|
|
839
|
+
const dispatchAction = cleanText(normalizedInput.dispatchAction || normalizedInput.directive?.dispatchAction, 120);
|
|
840
|
+
const directiveAllowed = normalizedInput.directive?.allowed;
|
|
841
|
+
const actionAutoRunnable = normalizedInput.action?.autoRunnable;
|
|
842
|
+
const productRepairAllowed = normalizedInput.directive?.canRunProductRepair === true
|
|
843
|
+
|| normalizedInput.directive?.productRepairAllowed === true
|
|
844
|
+
|| normalizedInput.action?.productRepairAllowed === true;
|
|
845
|
+
const expensiveModelAllowed = normalizedInput.directive?.canRunExpensiveModel === true
|
|
846
|
+
|| normalizedInput.directive?.expensiveModelAllowed === true
|
|
847
|
+
|| normalizedInput.action?.expensiveModelAllowed === true;
|
|
848
|
+
if (!dispatchAction || dispatchAction === 'park_manual') {
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
if (directiveAllowed === false || actionAutoRunnable === false) {
|
|
852
|
+
return false;
|
|
853
|
+
}
|
|
854
|
+
if ([
|
|
855
|
+
'run_evidence_probe',
|
|
856
|
+
'run_read_only_diagnosis',
|
|
857
|
+
'run_infra_repair',
|
|
858
|
+
'run_compile_repair'
|
|
859
|
+
].includes(dispatchAction)) {
|
|
860
|
+
return true;
|
|
861
|
+
}
|
|
862
|
+
if (dispatchAction === 'run_release_repair') {
|
|
863
|
+
return normalizedInput.includeReleaseRepair !== false;
|
|
864
|
+
}
|
|
865
|
+
if (dispatchAction === 'run_journey_contract_repair') {
|
|
866
|
+
return normalizedInput.includeJourneyContractRepair !== false && productRepairAllowed !== true;
|
|
867
|
+
}
|
|
868
|
+
if (dispatchAction === 'run_business_assertion_repair') {
|
|
869
|
+
return normalizedInput.includeBusinessProofRepair === true
|
|
870
|
+
&& productRepairAllowed !== true
|
|
871
|
+
&& expensiveModelAllowed !== true;
|
|
872
|
+
}
|
|
873
|
+
if (dispatchAction === 'run_targeted_product_repair') {
|
|
874
|
+
return normalizedInput.includeProductRepair === true
|
|
875
|
+
&& productRepairAllowed === true
|
|
876
|
+
&& expensiveModelAllowed !== true;
|
|
877
|
+
}
|
|
878
|
+
return dispatchAction === 'advance' || dispatchAction === 'continue_gate';
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
function isoNow(value?: Date | string): string {
|
|
882
|
+
if (value instanceof Date) {
|
|
883
|
+
return value.toISOString();
|
|
884
|
+
}
|
|
885
|
+
const parsed = value ? new Date(value) : new Date();
|
|
886
|
+
if (Number.isFinite(parsed.getTime())) {
|
|
887
|
+
return parsed.toISOString();
|
|
888
|
+
}
|
|
889
|
+
return new Date().toISOString();
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
function stableHash(prefix: string, value: any): string {
|
|
893
|
+
const normalized = typeof value === 'string'
|
|
894
|
+
? cleanText(value, 12000)
|
|
895
|
+
: JSON.stringify(value || {});
|
|
896
|
+
let hash = 0;
|
|
897
|
+
for (let index = 0; index < normalized.length; index += 1) {
|
|
898
|
+
hash = ((hash << 5) - hash + normalized.charCodeAt(index)) | 0;
|
|
899
|
+
}
|
|
900
|
+
return `${prefix}-${Math.abs(hash).toString(36) || '0'}`;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
export function normalizeResolveIOAIManagerFailureClass(value: any): string {
|
|
904
|
+
const normalized = cleanText(value, 80)
|
|
905
|
+
.toLowerCase()
|
|
906
|
+
.replace(/[\s-]+/g, '_');
|
|
907
|
+
if (!normalized) {
|
|
908
|
+
return 'unknown';
|
|
909
|
+
}
|
|
910
|
+
if (/^(qa_infra|infrastructure|harness|puppeteer|chrome|mongo|port|startup)$/.test(normalized)) {
|
|
911
|
+
return 'infra';
|
|
912
|
+
}
|
|
913
|
+
if (/^(build|compile|typescript|tsc|angular_build|ng_build)$/.test(normalized)) {
|
|
914
|
+
return 'compile';
|
|
915
|
+
}
|
|
916
|
+
if (/^(false_pass|route_only|missing_business_proof)$/.test(normalized)) {
|
|
917
|
+
return 'business';
|
|
918
|
+
}
|
|
919
|
+
return normalized.slice(0, 80);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export function fingerprintResolveIOAIManagerBlocker(value: any): string {
|
|
923
|
+
const normalized = cleanText(value, 4000)
|
|
924
|
+
.toLowerCase()
|
|
925
|
+
.replace(/[a-f0-9]{16,}/g, '<id>')
|
|
926
|
+
.replace(/\b\d{2,}\b/g, '<n>')
|
|
927
|
+
.replace(/\bline\s+<n>\b/g, 'line <n>')
|
|
928
|
+
.replace(/https?:\/\/\S+/g, '<url>')
|
|
929
|
+
.replace(/\s+/g, ' ')
|
|
930
|
+
.trim();
|
|
931
|
+
return stableHash('mgr-blocker', normalized);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
function resolveResolveIOAIManagerBlockerFingerprint(
|
|
935
|
+
record: ResolveIOAIManagerFailureRecord | undefined,
|
|
936
|
+
fallback?: any
|
|
937
|
+
): string {
|
|
938
|
+
const blockerText = cleanText(record?.blocker || record?.summary, 4000);
|
|
939
|
+
if (blockerText) {
|
|
940
|
+
return fingerprintResolveIOAIManagerBlocker(blockerText);
|
|
941
|
+
}
|
|
942
|
+
const explicit = cleanText(record?.blockerFingerprint, 120);
|
|
943
|
+
if (explicit) {
|
|
944
|
+
return explicit;
|
|
945
|
+
}
|
|
946
|
+
return fingerprintResolveIOAIManagerBlocker(fallback || '');
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
export function hashResolveIOAIManagerEvidence(record: ResolveIOAIManagerFailureRecord | undefined): string {
|
|
950
|
+
if (!record) {
|
|
951
|
+
return stableHash('mgr-evidence', '');
|
|
952
|
+
}
|
|
953
|
+
const explicit = cleanText(record.evidenceHash, 120);
|
|
954
|
+
if (explicit) {
|
|
955
|
+
return explicit;
|
|
956
|
+
}
|
|
957
|
+
return stableHash('mgr-evidence', {
|
|
958
|
+
failureClass: normalizeResolveIOAIManagerFailureClass(record.failureClass),
|
|
959
|
+
blocker: cleanText(record.blocker || record.summary, 2000),
|
|
960
|
+
changedFiles: cleanList(record.changedFiles, 80, 500).sort(),
|
|
961
|
+
artifactPaths: cleanList(record.artifactPaths, 80, 500).sort()
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
export function buildResolveIOAIManagerRecoveryCheckpoint(
|
|
966
|
+
input: ResolveIOAIManagerRecoveryCheckpointInput
|
|
967
|
+
): ResolveIOAIManagerRecoveryCheckpoint {
|
|
968
|
+
const plan = input.plan;
|
|
969
|
+
const current = input.current || {};
|
|
970
|
+
const blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current, plan.objective);
|
|
971
|
+
const evidenceHash = hashResolveIOAIManagerEvidence(current);
|
|
972
|
+
const changedFiles = cleanList(current.changedFiles, 80, 500);
|
|
973
|
+
const artifactPaths = cleanList(current.artifactPaths, 80, 500);
|
|
974
|
+
const previous = input.previousCheckpoint;
|
|
975
|
+
const sameCheckpointBase = previous
|
|
976
|
+
&& previous.recoveryClass === plan.recoveryClass
|
|
977
|
+
&& previous.lane === plan.lane
|
|
978
|
+
&& previous.stepType === plan.stepType
|
|
979
|
+
&& previous.blockerFingerprint === blockerFingerprint
|
|
980
|
+
&& previous.evidenceHash === evidenceHash;
|
|
981
|
+
const attempts = sameCheckpointBase ? Math.max(0, Number(previous.attempts || 0)) + 1 : 1;
|
|
982
|
+
const status: ResolveIOAIManagerRecoveryCheckpointStatus = plan.recoveryClass === 'manual_handoff'
|
|
983
|
+
? 'manual_handoff'
|
|
984
|
+
: plan.recoveryClass === 'blocked_until_new_evidence'
|
|
985
|
+
? 'parked'
|
|
986
|
+
: plan.recoveryClass === 'advance_after_proof'
|
|
987
|
+
? 'complete'
|
|
988
|
+
: 'active';
|
|
989
|
+
const now = isoNow(input.now);
|
|
990
|
+
const checkpointId = stableHash('mgr-recovery', {
|
|
991
|
+
recoveryClass: plan.recoveryClass,
|
|
992
|
+
lane: plan.lane,
|
|
993
|
+
stepType: plan.stepType,
|
|
994
|
+
allowedAction: plan.allowedAction,
|
|
995
|
+
blockerFingerprint,
|
|
996
|
+
evidenceHash
|
|
997
|
+
});
|
|
998
|
+
return {
|
|
999
|
+
checkpointId,
|
|
1000
|
+
recoveryClass: plan.recoveryClass,
|
|
1001
|
+
status,
|
|
1002
|
+
lane: plan.lane,
|
|
1003
|
+
stepType: plan.stepType,
|
|
1004
|
+
allowedAction: plan.allowedAction,
|
|
1005
|
+
productRepairAllowed: plan.productRepairAllowed,
|
|
1006
|
+
expensiveModelAllowed: plan.expensiveModelAllowed,
|
|
1007
|
+
attempts,
|
|
1008
|
+
maxAttemptsBeforePark: plan.maxAttemptsBeforePark,
|
|
1009
|
+
blockerFingerprint,
|
|
1010
|
+
evidenceHash,
|
|
1011
|
+
changedFiles,
|
|
1012
|
+
artifactPaths,
|
|
1013
|
+
requiredEvidence: cleanList(plan.requiredEvidence, 40, 500),
|
|
1014
|
+
loopResetEvidence: cleanList(plan.loopResetEvidence, 40, 500),
|
|
1015
|
+
forbiddenActions: cleanList(plan.forbiddenActions, 40, 500),
|
|
1016
|
+
objective: cleanText(plan.objective, 1000),
|
|
1017
|
+
nextActionLabel: cleanText(plan.nextActionLabel, 160),
|
|
1018
|
+
createdAt: sameCheckpointBase && previous?.createdAt ? previous.createdAt : now,
|
|
1019
|
+
updatedAt: now
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
function makeRecoveryEvidenceProbeStep(
|
|
1024
|
+
id: string,
|
|
1025
|
+
kind: ResolveIOAIManagerRecoveryEvidenceProbeStepKind,
|
|
1026
|
+
label: string,
|
|
1027
|
+
objective: string,
|
|
1028
|
+
artifactExpectation: string,
|
|
1029
|
+
successSignal: string,
|
|
1030
|
+
options: Partial<Pick<ResolveIOAIManagerRecoveryEvidenceProbeStep, 'required' | 'commandHint'>> = {}
|
|
1031
|
+
): ResolveIOAIManagerRecoveryEvidenceProbeStep {
|
|
1032
|
+
return {
|
|
1033
|
+
id,
|
|
1034
|
+
kind,
|
|
1035
|
+
label,
|
|
1036
|
+
objective: cleanText(objective, 1000),
|
|
1037
|
+
required: options.required !== false,
|
|
1038
|
+
...(options.commandHint ? { commandHint: cleanText(options.commandHint, 500) } : {}),
|
|
1039
|
+
artifactExpectation: cleanText(artifactExpectation, 500),
|
|
1040
|
+
successSignal: cleanText(successSignal, 500)
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
function recoveryEvidenceProbeStepsFor(
|
|
1045
|
+
checkpoint: ResolveIOAIManagerRecoveryCheckpoint
|
|
1046
|
+
): ResolveIOAIManagerRecoveryEvidenceProbeStep[] {
|
|
1047
|
+
const base = [
|
|
1048
|
+
makeRecoveryEvidenceProbeStep(
|
|
1049
|
+
'snapshot_current_blocker',
|
|
1050
|
+
'rerun_same_gate',
|
|
1051
|
+
'Snapshot Current Blocker',
|
|
1052
|
+
'Capture the current blocker, failure class, evidence hash, changed files, and artifact paths before any new repair.',
|
|
1053
|
+
'runner-evidence/current-blocker.json',
|
|
1054
|
+
'Snapshot includes the same checkpointId, blockerFingerprint, and evidenceHashBefore.'
|
|
1055
|
+
)
|
|
1056
|
+
];
|
|
1057
|
+
if (checkpoint.recoveryClass === 'diagnosis_only' || checkpoint.recoveryClass === 'diagnosis_revision') {
|
|
1058
|
+
return [
|
|
1059
|
+
...base,
|
|
1060
|
+
makeRecoveryEvidenceProbeStep(
|
|
1061
|
+
'collect_read_only_root_cause_evidence',
|
|
1062
|
+
'read_only_diagnosis',
|
|
1063
|
+
'Collect Read-Only Root-Cause Evidence',
|
|
1064
|
+
checkpoint.recoveryClass === 'diagnosis_revision'
|
|
1065
|
+
? 'Collect new evidence that proves the current owner_files or failing_path is wrong before broadening scope.'
|
|
1066
|
+
: 'Reproduce or classify the issue and record the exact customer complaint, expected result, observed result, route/module, and account context.',
|
|
1067
|
+
'runner-evidence/diagnosis-readonly.md',
|
|
1068
|
+
'Evidence supports one falsifiable accepted hypothesis and at least one rejected alternative.'
|
|
1069
|
+
),
|
|
1070
|
+
makeRecoveryEvidenceProbeStep(
|
|
1071
|
+
'validate_diagnosis_gate',
|
|
1072
|
+
'read_only_diagnosis',
|
|
1073
|
+
'Validate Diagnosis Gate',
|
|
1074
|
+
'Validate issue_case, accepted_hypothesis, rejected_alternatives, failing_path, owner_files, and before/action/after proof_plan.',
|
|
1075
|
+
'runner-evidence/diagnosis-gate.json',
|
|
1076
|
+
'Diagnosis gate validates before product-code repair is allowed.'
|
|
1077
|
+
)
|
|
1078
|
+
];
|
|
1079
|
+
}
|
|
1080
|
+
if (checkpoint.recoveryClass === 'infra_repair') {
|
|
1081
|
+
return [
|
|
1082
|
+
...base,
|
|
1083
|
+
makeRecoveryEvidenceProbeStep(
|
|
1084
|
+
'run_infra_preflight',
|
|
1085
|
+
'infra_preflight',
|
|
1086
|
+
'Run Infra Preflight',
|
|
1087
|
+
'Check Puppeteer/Chrome, ports, Mongo/settings, cache state, startup commands, and server/client process health.',
|
|
1088
|
+
'runner-evidence/infra-preflight.log',
|
|
1089
|
+
'The same infra gate either passes or returns a new infra blocker hash.',
|
|
1090
|
+
{ commandHint: 'runner preflight: puppeteer/chrome/mongo/ports/startup' }
|
|
1091
|
+
)
|
|
1092
|
+
];
|
|
1093
|
+
}
|
|
1094
|
+
if (checkpoint.recoveryClass === 'compile_repair') {
|
|
1095
|
+
return [
|
|
1096
|
+
...base,
|
|
1097
|
+
makeRecoveryEvidenceProbeStep(
|
|
1098
|
+
'rerun_compile_gate',
|
|
1099
|
+
'compile_check',
|
|
1100
|
+
'Rerun Compile Gate',
|
|
1101
|
+
'Rerun the same deterministic compile/build command and capture the first actionable error.',
|
|
1102
|
+
'runner-evidence/compile.log',
|
|
1103
|
+
'Compile passes or the first failing error changes.',
|
|
1104
|
+
{ commandHint: 'same finite build/compile command from the failed gate' }
|
|
1105
|
+
)
|
|
1106
|
+
];
|
|
1107
|
+
}
|
|
1108
|
+
if (checkpoint.recoveryClass === 'journey_contract_repair') {
|
|
1109
|
+
return [
|
|
1110
|
+
...base,
|
|
1111
|
+
makeRecoveryEvidenceProbeStep(
|
|
1112
|
+
'validate_journey_contract',
|
|
1113
|
+
'journey_validation',
|
|
1114
|
+
'Validate Journey Contract',
|
|
1115
|
+
'Validate docs/APP_JOURNEY_CONTRACT.md has first/next/last workflow, route/action/method mapping, seeded data story, completion states, and QA assertions.',
|
|
1116
|
+
'runner-evidence/journey-contract-validation.json',
|
|
1117
|
+
'Journey contract validates before build tasks continue.'
|
|
1118
|
+
),
|
|
1119
|
+
makeRecoveryEvidenceProbeStep(
|
|
1120
|
+
'verify_hub_workflow_mapping',
|
|
1121
|
+
'journey_validation',
|
|
1122
|
+
'Verify Hub Workflow Mapping',
|
|
1123
|
+
'Confirm the hub CTA and screen sequence implement the journey contract instead of link-only navigation.',
|
|
1124
|
+
'runner-evidence/hub-workflow-map.json',
|
|
1125
|
+
'Primary hub action maps to a real route/action/method/calculation and next state.'
|
|
1126
|
+
)
|
|
1127
|
+
];
|
|
1128
|
+
}
|
|
1129
|
+
if (checkpoint.recoveryClass === 'business_proof_repair' || checkpoint.recoveryClass === 'product_code_repair') {
|
|
1130
|
+
return [
|
|
1131
|
+
...base,
|
|
1132
|
+
makeRecoveryEvidenceProbeStep(
|
|
1133
|
+
'rerun_business_assertion',
|
|
1134
|
+
'business_assertion',
|
|
1135
|
+
'Rerun Business Assertion',
|
|
1136
|
+
'Run the exact issue/app promise proof and capture before/action/after DOM/data evidence.',
|
|
1137
|
+
'runner-evidence/business-assertion.json',
|
|
1138
|
+
'Business assertion passes, or the observed failure changes with a new artifact path.'
|
|
1139
|
+
),
|
|
1140
|
+
makeRecoveryEvidenceProbeStep(
|
|
1141
|
+
'check_diff_scope',
|
|
1142
|
+
'diff_scope_check',
|
|
1143
|
+
'Check Diff Scope',
|
|
1144
|
+
'Compare changed files against the current diagnosis/journey owner scope before another code repair.',
|
|
1145
|
+
'runner-evidence/diff-scope.json',
|
|
1146
|
+
'Changed files are in scope, or diagnosis/journey scope is revised with evidence.'
|
|
1147
|
+
)
|
|
1148
|
+
];
|
|
1149
|
+
}
|
|
1150
|
+
if (checkpoint.recoveryClass === 'release_repair') {
|
|
1151
|
+
return [
|
|
1152
|
+
...base,
|
|
1153
|
+
makeRecoveryEvidenceProbeStep(
|
|
1154
|
+
'collect_release_status',
|
|
1155
|
+
'release_status',
|
|
1156
|
+
'Collect Release Status',
|
|
1157
|
+
'Collect publish/deploy/build-instance/domain/CloudFront status and the last actionable deploy error.',
|
|
1158
|
+
'runner-evidence/release-status.json',
|
|
1159
|
+
'Release gate passes or returns a new release blocker hash without product-code repair.'
|
|
1160
|
+
)
|
|
1161
|
+
];
|
|
1162
|
+
}
|
|
1163
|
+
if (checkpoint.recoveryClass === 'manual_handoff') {
|
|
1164
|
+
return [
|
|
1165
|
+
...base,
|
|
1166
|
+
makeRecoveryEvidenceProbeStep(
|
|
1167
|
+
'operator_review_checkpoint',
|
|
1168
|
+
'operator_review',
|
|
1169
|
+
'Operator Review Checkpoint',
|
|
1170
|
+
'Expose budget, blocker, evidence hash, and the minimum policy/scope change needed before another expensive loop.',
|
|
1171
|
+
'runner-evidence/operator-review.json',
|
|
1172
|
+
'Operator approves a new scope/policy or provides new external evidence.'
|
|
1173
|
+
)
|
|
1174
|
+
];
|
|
1175
|
+
}
|
|
1176
|
+
return [
|
|
1177
|
+
...base,
|
|
1178
|
+
makeRecoveryEvidenceProbeStep(
|
|
1179
|
+
'rerun_same_deterministic_gate',
|
|
1180
|
+
'rerun_same_gate',
|
|
1181
|
+
'Rerun Same Deterministic Gate',
|
|
1182
|
+
'Rerun the exact failed check and capture new logs/artifacts without changing product code first.',
|
|
1183
|
+
'runner-evidence/retry-gate.log',
|
|
1184
|
+
'Gate passes, or evidenceHash/blockerFingerprint/artifactPaths change.'
|
|
1185
|
+
)
|
|
1186
|
+
];
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
export function buildResolveIOAIManagerRecoveryEvidenceProbe(
|
|
1190
|
+
input: ResolveIOAIManagerRecoveryEvidenceProbeInput
|
|
1191
|
+
): ResolveIOAIManagerRecoveryEvidenceProbe {
|
|
1192
|
+
const checkpoint = input.checkpoint;
|
|
1193
|
+
const now = isoNow(input.now);
|
|
1194
|
+
const steps = recoveryEvidenceProbeStepsFor(checkpoint);
|
|
1195
|
+
const requiredArtifacts = Array.from(new Set(steps
|
|
1196
|
+
.filter((step) => step.required)
|
|
1197
|
+
.map((step) => step.artifactExpectation)
|
|
1198
|
+
.filter(Boolean)));
|
|
1199
|
+
return {
|
|
1200
|
+
probeId: stableHash('mgr-probe', {
|
|
1201
|
+
checkpointId: checkpoint.checkpointId,
|
|
1202
|
+
recoveryClass: checkpoint.recoveryClass,
|
|
1203
|
+
evidenceHash: checkpoint.evidenceHash,
|
|
1204
|
+
blockerFingerprint: checkpoint.blockerFingerprint
|
|
1205
|
+
}),
|
|
1206
|
+
checkpointId: checkpoint.checkpointId,
|
|
1207
|
+
recoveryClass: checkpoint.recoveryClass,
|
|
1208
|
+
lane: checkpoint.lane,
|
|
1209
|
+
stepType: checkpoint.stepType,
|
|
1210
|
+
objective: checkpoint.status === 'parked'
|
|
1211
|
+
? 'Collect new evidence before any additional expensive model/code repair.'
|
|
1212
|
+
: cleanText(checkpoint.objective, 1000),
|
|
1213
|
+
evidenceOnly: checkpoint.status === 'parked'
|
|
1214
|
+
|| checkpoint.recoveryClass === 'diagnosis_only'
|
|
1215
|
+
|| checkpoint.recoveryClass === 'diagnosis_revision'
|
|
1216
|
+
|| checkpoint.recoveryClass === 'infra_repair'
|
|
1217
|
+
|| checkpoint.recoveryClass === 'compile_repair'
|
|
1218
|
+
|| checkpoint.recoveryClass === 'release_repair',
|
|
1219
|
+
productRepairAllowed: checkpoint.productRepairAllowed && checkpoint.status !== 'parked',
|
|
1220
|
+
expensiveModelAllowed: checkpoint.expensiveModelAllowed && checkpoint.status !== 'parked',
|
|
1221
|
+
evidenceHashBefore: checkpoint.evidenceHash,
|
|
1222
|
+
blockerFingerprint: checkpoint.blockerFingerprint,
|
|
1223
|
+
steps,
|
|
1224
|
+
requiredArtifacts,
|
|
1225
|
+
acceptanceEvidence: Array.from(new Set([
|
|
1226
|
+
...checkpoint.requiredEvidence,
|
|
1227
|
+
...checkpoint.loopResetEvidence,
|
|
1228
|
+
...steps.map((step) => step.successSignal)
|
|
1229
|
+
].map((entry) => cleanText(entry, 500)).filter(Boolean))).slice(0, 30),
|
|
1230
|
+
stopConditions: Array.from(new Set([
|
|
1231
|
+
...checkpoint.forbiddenActions,
|
|
1232
|
+
'no new evidence hash',
|
|
1233
|
+
'no new artifact path',
|
|
1234
|
+
'product-code repair requested while evidenceOnly is true'
|
|
1235
|
+
].map((entry) => cleanText(entry, 500)).filter(Boolean))).slice(0, 30),
|
|
1236
|
+
loopResetEvidence: checkpoint.loopResetEvidence,
|
|
1237
|
+
createdAt: now
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
function recoveryAutomationModeFor(
|
|
1242
|
+
checkpoint: ResolveIOAIManagerRecoveryCheckpoint
|
|
1243
|
+
): ResolveIOAIManagerRecoveryAutomationMode {
|
|
1244
|
+
if (checkpoint.status === 'manual_handoff' || checkpoint.recoveryClass === 'manual_handoff') {
|
|
1245
|
+
return 'manual_review';
|
|
1246
|
+
}
|
|
1247
|
+
if (checkpoint.status === 'complete' || checkpoint.recoveryClass === 'advance_after_proof') {
|
|
1248
|
+
return 'advance';
|
|
1249
|
+
}
|
|
1250
|
+
if (checkpoint.status === 'parked' || checkpoint.recoveryClass === 'blocked_until_new_evidence') {
|
|
1251
|
+
return 'collect_evidence';
|
|
1252
|
+
}
|
|
1253
|
+
if (checkpoint.recoveryClass === 'diagnosis_only' || checkpoint.recoveryClass === 'diagnosis_revision') {
|
|
1254
|
+
return 'read_only_diagnosis';
|
|
1255
|
+
}
|
|
1256
|
+
if (checkpoint.recoveryClass === 'infra_repair') {
|
|
1257
|
+
return 'repair_infra';
|
|
1258
|
+
}
|
|
1259
|
+
if (checkpoint.recoveryClass === 'compile_repair') {
|
|
1260
|
+
return 'repair_compile';
|
|
1261
|
+
}
|
|
1262
|
+
if (checkpoint.recoveryClass === 'journey_contract_repair') {
|
|
1263
|
+
return 'repair_journey_contract';
|
|
1264
|
+
}
|
|
1265
|
+
if (checkpoint.recoveryClass === 'business_proof_repair') {
|
|
1266
|
+
return 'repair_business_assertion';
|
|
1267
|
+
}
|
|
1268
|
+
if (checkpoint.recoveryClass === 'release_repair') {
|
|
1269
|
+
return 'repair_release';
|
|
1270
|
+
}
|
|
1271
|
+
if (checkpoint.recoveryClass === 'product_code_repair') {
|
|
1272
|
+
return 'targeted_product_repair';
|
|
1273
|
+
}
|
|
1274
|
+
return 'continue_gate';
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
function recoveryActionLabelFor(mode: ResolveIOAIManagerRecoveryAutomationMode, checkpoint: ResolveIOAIManagerRecoveryCheckpoint): string {
|
|
1278
|
+
const explicit = cleanText(checkpoint.nextActionLabel, 120);
|
|
1279
|
+
if (explicit && mode !== 'collect_evidence') {
|
|
1280
|
+
return explicit;
|
|
1281
|
+
}
|
|
1282
|
+
const labels: Record<ResolveIOAIManagerRecoveryAutomationMode, string> = {
|
|
1283
|
+
advance: 'Advance To Next Gate',
|
|
1284
|
+
collect_evidence: 'Collect New Evidence',
|
|
1285
|
+
read_only_diagnosis: 'Run Diagnosis Evidence Pass',
|
|
1286
|
+
repair_infra: 'Repair Infra Gate',
|
|
1287
|
+
repair_compile: 'Repair Compile Gate',
|
|
1288
|
+
repair_journey_contract: 'Repair Journey Contract',
|
|
1289
|
+
repair_business_assertion: 'Repair Business Proof',
|
|
1290
|
+
repair_release: 'Repair Release Gate',
|
|
1291
|
+
targeted_product_repair: 'Run Targeted Repair',
|
|
1292
|
+
manual_review: 'Manual Review',
|
|
1293
|
+
continue_gate: 'Continue Current Gate'
|
|
1294
|
+
};
|
|
1295
|
+
return labels[mode];
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
function recoveryActionAutoRunnable(
|
|
1299
|
+
mode: ResolveIOAIManagerRecoveryAutomationMode,
|
|
1300
|
+
probe: ResolveIOAIManagerRecoveryEvidenceProbe
|
|
1301
|
+
): boolean {
|
|
1302
|
+
if (mode === 'manual_review') {
|
|
1303
|
+
return false;
|
|
1304
|
+
}
|
|
1305
|
+
if (mode === 'advance' || mode === 'continue_gate') {
|
|
1306
|
+
return true;
|
|
1307
|
+
}
|
|
1308
|
+
if (mode === 'targeted_product_repair' || mode === 'read_only_diagnosis' || mode === 'repair_journey_contract' || mode === 'repair_business_assertion') {
|
|
1309
|
+
return true;
|
|
1310
|
+
}
|
|
1311
|
+
return probe.steps.some((step) => step.commandHint || step.kind === 'rerun_same_gate' || step.kind === 'release_status' || step.kind === 'diff_scope_check');
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
export function buildResolveIOAIManagerRecoveryActionPacket(
|
|
1315
|
+
input: ResolveIOAIManagerRecoveryActionPacketInput
|
|
1316
|
+
): ResolveIOAIManagerRecoveryActionPacket {
|
|
1317
|
+
const checkpoint = input.checkpoint;
|
|
1318
|
+
const probe = input.probe || buildResolveIOAIManagerRecoveryEvidenceProbe({
|
|
1319
|
+
checkpoint,
|
|
1320
|
+
current: input.current,
|
|
1321
|
+
now: input.now
|
|
1322
|
+
});
|
|
1323
|
+
const mode = recoveryAutomationModeFor(checkpoint);
|
|
1324
|
+
const primaryStep = probe.steps.find((step) => step.required && step.id !== 'snapshot_current_blocker')
|
|
1325
|
+
|| probe.steps.find((step) => step.required)
|
|
1326
|
+
|| probe.steps[0];
|
|
1327
|
+
const evidenceOnly = probe.evidenceOnly || mode === 'collect_evidence' || mode === 'repair_infra' || mode === 'repair_compile' || mode === 'repair_release';
|
|
1328
|
+
const requireNewEvidence = mode === 'collect_evidence'
|
|
1329
|
+
|| checkpoint.status === 'parked'
|
|
1330
|
+
|| checkpoint.attempts >= checkpoint.maxAttemptsBeforePark;
|
|
1331
|
+
const stopWhen = Array.from(new Set([
|
|
1332
|
+
...probe.stopConditions,
|
|
1333
|
+
...(requireNewEvidence ? ['same blocker fingerprint and same evidence hash after probe'] : [])
|
|
1334
|
+
].map((entry) => cleanText(entry, 500)).filter(Boolean))).slice(0, 30);
|
|
1335
|
+
const resetLoopWhen = Array.from(new Set([
|
|
1336
|
+
...checkpoint.loopResetEvidence,
|
|
1337
|
+
...probe.loopResetEvidence,
|
|
1338
|
+
...(requireNewEvidence ? [
|
|
1339
|
+
'new material evidence: changed blocker, validated diagnosis/journey, business proof, compile/infra/release proof, or new actionable trace',
|
|
1340
|
+
'weak hash-only evidence does not reset the loop'
|
|
1341
|
+
] : [])
|
|
1342
|
+
].map((entry) => cleanText(entry, 500)).filter(Boolean))).slice(0, 30);
|
|
1343
|
+
const nextCommands = probe.steps
|
|
1344
|
+
.map((step) => cleanText(step.commandHint || `${step.kind}:${step.id}`, 500))
|
|
1345
|
+
.filter(Boolean)
|
|
1346
|
+
.slice(0, 12);
|
|
1347
|
+
const releasePolicy = mode === 'repair_release'
|
|
1348
|
+
? buildResolveIOAIManagerHotfixFirstReleasePolicy({
|
|
1349
|
+
surface: 'manager_recovery',
|
|
1350
|
+
deployStatus: checkpoint.stepType,
|
|
1351
|
+
publishStatus: checkpoint.lane
|
|
1352
|
+
})
|
|
1353
|
+
: undefined;
|
|
1354
|
+
const now = isoNow(input.now);
|
|
1355
|
+
return {
|
|
1356
|
+
actionId: stableHash('mgr-action', {
|
|
1357
|
+
checkpointId: checkpoint.checkpointId,
|
|
1358
|
+
probeId: probe.probeId,
|
|
1359
|
+
mode,
|
|
1360
|
+
evidenceHash: checkpoint.evidenceHash,
|
|
1361
|
+
blockerFingerprint: checkpoint.blockerFingerprint
|
|
1362
|
+
}),
|
|
1363
|
+
checkpointId: checkpoint.checkpointId,
|
|
1364
|
+
probeId: probe.probeId,
|
|
1365
|
+
recoveryClass: checkpoint.recoveryClass,
|
|
1366
|
+
mode,
|
|
1367
|
+
label: recoveryActionLabelFor(mode, checkpoint),
|
|
1368
|
+
lane: checkpoint.lane,
|
|
1369
|
+
stepType: checkpoint.stepType,
|
|
1370
|
+
primaryStepKind: primaryStep?.kind || 'none',
|
|
1371
|
+
objective: mode === 'collect_evidence'
|
|
1372
|
+
? probe.objective
|
|
1373
|
+
: cleanText(checkpoint.objective || probe.objective, 1000),
|
|
1374
|
+
evidenceOnly,
|
|
1375
|
+
autoRunnable: recoveryActionAutoRunnable(mode, probe),
|
|
1376
|
+
productRepairAllowed: checkpoint.productRepairAllowed && !evidenceOnly && checkpoint.status !== 'parked',
|
|
1377
|
+
expensiveModelAllowed: checkpoint.expensiveModelAllowed && checkpoint.status !== 'parked',
|
|
1378
|
+
canResetLoopAfterEvidence: resetLoopWhen.length > 0,
|
|
1379
|
+
maxAttemptsBeforePark: checkpoint.maxAttemptsBeforePark,
|
|
1380
|
+
requiredArtifacts: probe.requiredArtifacts.slice(0, 20),
|
|
1381
|
+
nextCommands: releasePolicy
|
|
1382
|
+
? Array.from(new Set([...nextCommands, ...releasePolicy.allowedActions])).slice(0, 12)
|
|
1383
|
+
: nextCommands,
|
|
1384
|
+
successCriteria: releasePolicy
|
|
1385
|
+
? Array.from(new Set([...probe.acceptanceEvidence, ...releasePolicy.requiredEvidence])).slice(0, 20)
|
|
1386
|
+
: probe.acceptanceEvidence.slice(0, 20),
|
|
1387
|
+
retryPolicy: {
|
|
1388
|
+
allowImmediateRetry: checkpoint.status !== 'parked' && mode !== 'manual_review',
|
|
1389
|
+
requireNewEvidence,
|
|
1390
|
+
resetLoopWhen,
|
|
1391
|
+
stopWhen
|
|
1392
|
+
},
|
|
1393
|
+
...(releasePolicy ? { releasePolicy } : {}),
|
|
1394
|
+
...(mode === 'collect_evidence' ? { blockedReason: 'Manager parked this loop until the recovery action records new evidence.' } : {}),
|
|
1395
|
+
createdAt: now
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
function dispatchActionForMode(mode: ResolveIOAIManagerRecoveryAutomationMode): ResolveIOAIManagerRecoveryActionDispatchAction {
|
|
1400
|
+
const map: Record<ResolveIOAIManagerRecoveryAutomationMode, ResolveIOAIManagerRecoveryActionDispatchAction> = {
|
|
1401
|
+
advance: 'advance',
|
|
1402
|
+
collect_evidence: 'run_evidence_probe',
|
|
1403
|
+
read_only_diagnosis: 'run_read_only_diagnosis',
|
|
1404
|
+
repair_infra: 'run_infra_repair',
|
|
1405
|
+
repair_compile: 'run_compile_repair',
|
|
1406
|
+
repair_journey_contract: 'run_journey_contract_repair',
|
|
1407
|
+
repair_business_assertion: 'run_business_assertion_repair',
|
|
1408
|
+
repair_release: 'run_release_repair',
|
|
1409
|
+
targeted_product_repair: 'run_targeted_product_repair',
|
|
1410
|
+
manual_review: 'park_manual',
|
|
1411
|
+
continue_gate: 'continue_gate'
|
|
1412
|
+
};
|
|
1413
|
+
return map[mode] || 'park_manual';
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
function buildRecoveryDispatchRecord(
|
|
1417
|
+
action: ResolveIOAIManagerRecoveryActionPacket,
|
|
1418
|
+
dispatchAction: ResolveIOAIManagerRecoveryActionDispatchAction,
|
|
1419
|
+
status: ResolveIOAIManagerRecoveryActionDispatchStatus,
|
|
1420
|
+
reason: string,
|
|
1421
|
+
current?: ResolveIOAIManagerFailureRecord,
|
|
1422
|
+
now?: Date | string
|
|
1423
|
+
): ResolveIOAIManagerRecoveryActionDispatchRecord {
|
|
1424
|
+
const evidenceHash = current?.evidenceHash || action.checkpointId || action.actionId;
|
|
1425
|
+
const blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current, action.objective);
|
|
1426
|
+
const artifactPaths = cleanList(current?.artifactPaths, 20, 500);
|
|
1427
|
+
const createdAt = isoNow(now);
|
|
1428
|
+
return {
|
|
1429
|
+
dispatchId: stableHash('mgr-dispatch', {
|
|
1430
|
+
actionId: action.actionId,
|
|
1431
|
+
dispatchAction,
|
|
1432
|
+
evidenceHash,
|
|
1433
|
+
blockerFingerprint,
|
|
1434
|
+
status
|
|
1435
|
+
}),
|
|
1436
|
+
actionId: action.actionId,
|
|
1437
|
+
checkpointId: action.checkpointId,
|
|
1438
|
+
probeId: action.probeId,
|
|
1439
|
+
mode: action.mode,
|
|
1440
|
+
dispatchAction,
|
|
1441
|
+
status,
|
|
1442
|
+
evidenceHash,
|
|
1443
|
+
blockerFingerprint,
|
|
1444
|
+
productRepairAllowed: action.productRepairAllowed && dispatchAction === 'run_targeted_product_repair',
|
|
1445
|
+
expensiveModelAllowed: action.expensiveModelAllowed && dispatchAction !== 'run_evidence_probe',
|
|
1446
|
+
reason,
|
|
1447
|
+
artifactPaths,
|
|
1448
|
+
...(status === 'started' ? { startedAt: createdAt } : {}),
|
|
1449
|
+
...(status === 'completed' ? { completedAt: createdAt } : {}),
|
|
1450
|
+
createdAt
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
export function decideResolveIOAIManagerRecoveryActionDispatch(
|
|
1455
|
+
input: ResolveIOAIManagerRecoveryActionDispatchInput
|
|
1456
|
+
): ResolveIOAIManagerRecoveryActionDispatchDecision {
|
|
1457
|
+
const action = input.action;
|
|
1458
|
+
const history = Array.isArray(input.history) ? input.history.filter(Boolean).slice(-50) : [];
|
|
1459
|
+
const current = input.current || {};
|
|
1460
|
+
if (!action) {
|
|
1461
|
+
return {
|
|
1462
|
+
dispatchAction: 'park_manual',
|
|
1463
|
+
allowed: false,
|
|
1464
|
+
reason: 'recovery_dispatch_missing_action',
|
|
1465
|
+
status: 'parked',
|
|
1466
|
+
canRunProductRepair: false,
|
|
1467
|
+
canRunExpensiveModel: false,
|
|
1468
|
+
shouldRecordDispatch: false,
|
|
1469
|
+
requiresNewEvidence: true,
|
|
1470
|
+
newEvidence: false
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
const dispatchAction = dispatchActionForMode(action.mode);
|
|
1474
|
+
const evidenceHash = current.evidenceHash || action.checkpointId || action.actionId;
|
|
1475
|
+
const blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current, action.objective);
|
|
1476
|
+
const sameActionHistory = history.filter((entry) => entry.actionId === action.actionId);
|
|
1477
|
+
const sameEvidenceHistory = sameActionHistory.filter((entry) => entry.evidenceHash === evidenceHash
|
|
1478
|
+
&& entry.blockerFingerprint === blockerFingerprint);
|
|
1479
|
+
const activeDispatch = sameEvidenceHistory.find((entry) => entry.status === 'queued' || entry.status === 'started');
|
|
1480
|
+
const completedDispatch = sameEvidenceHistory.find((entry) => entry.status === 'completed' || entry.status === 'failed');
|
|
1481
|
+
const newEvidence = sameActionHistory.length > 0 && sameEvidenceHistory.length === 0;
|
|
1482
|
+
const requiresNewEvidence = action.retryPolicy.requireNewEvidence === true;
|
|
1483
|
+
const manualOnly = action.mode === 'manual_review' || !action.autoRunnable;
|
|
1484
|
+
const productDispatch = dispatchAction === 'run_targeted_product_repair';
|
|
1485
|
+
const expensiveDispatch = !['run_evidence_probe', 'advance', 'continue_gate', 'park_manual'].includes(dispatchAction);
|
|
1486
|
+
if (manualOnly && input.operatorApproved !== true) {
|
|
1487
|
+
const record = buildRecoveryDispatchRecord(action, 'park_manual', 'parked', 'recovery_dispatch_requires_manual_review', current, input.now);
|
|
1488
|
+
return {
|
|
1489
|
+
dispatchAction: 'park_manual',
|
|
1490
|
+
allowed: false,
|
|
1491
|
+
reason: record.reason,
|
|
1492
|
+
status: 'parked',
|
|
1493
|
+
canRunProductRepair: false,
|
|
1494
|
+
canRunExpensiveModel: false,
|
|
1495
|
+
shouldRecordDispatch: true,
|
|
1496
|
+
requiresNewEvidence,
|
|
1497
|
+
newEvidence,
|
|
1498
|
+
dispatchRecord: record
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
if (productDispatch && action.productRepairAllowed !== true) {
|
|
1502
|
+
const record = buildRecoveryDispatchRecord(action, 'park_manual', 'parked', 'recovery_dispatch_product_repair_not_allowed', current, input.now);
|
|
1503
|
+
return {
|
|
1504
|
+
dispatchAction: 'park_manual',
|
|
1505
|
+
allowed: false,
|
|
1506
|
+
reason: record.reason,
|
|
1507
|
+
status: 'parked',
|
|
1508
|
+
canRunProductRepair: false,
|
|
1509
|
+
canRunExpensiveModel: false,
|
|
1510
|
+
shouldRecordDispatch: true,
|
|
1511
|
+
requiresNewEvidence: true,
|
|
1512
|
+
newEvidence,
|
|
1513
|
+
dispatchRecord: record
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
if (activeDispatch) {
|
|
1517
|
+
return {
|
|
1518
|
+
dispatchAction: 'park_manual',
|
|
1519
|
+
allowed: false,
|
|
1520
|
+
reason: 'recovery_dispatch_already_running_for_same_evidence',
|
|
1521
|
+
status: 'parked',
|
|
1522
|
+
canRunProductRepair: false,
|
|
1523
|
+
canRunExpensiveModel: false,
|
|
1524
|
+
shouldRecordDispatch: false,
|
|
1525
|
+
requiresNewEvidence: true,
|
|
1526
|
+
newEvidence: false
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
if (completedDispatch && requiresNewEvidence && !newEvidence) {
|
|
1530
|
+
const record = buildRecoveryDispatchRecord(action, 'park_manual', 'parked', 'recovery_dispatch_same_evidence_already_attempted', current, input.now);
|
|
1531
|
+
return {
|
|
1532
|
+
dispatchAction: 'park_manual',
|
|
1533
|
+
allowed: false,
|
|
1534
|
+
reason: record.reason,
|
|
1535
|
+
status: 'parked',
|
|
1536
|
+
canRunProductRepair: false,
|
|
1537
|
+
canRunExpensiveModel: false,
|
|
1538
|
+
shouldRecordDispatch: true,
|
|
1539
|
+
requiresNewEvidence: true,
|
|
1540
|
+
newEvidence: false,
|
|
1541
|
+
dispatchRecord: record
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
const status: ResolveIOAIManagerRecoveryActionDispatchStatus = dispatchAction === 'advance' || dispatchAction === 'continue_gate'
|
|
1545
|
+
? 'completed'
|
|
1546
|
+
: 'started';
|
|
1547
|
+
const record = buildRecoveryDispatchRecord(action, dispatchAction, status, 'recovery_dispatch_allowed', current, input.now);
|
|
1548
|
+
return {
|
|
1549
|
+
dispatchAction,
|
|
1550
|
+
allowed: true,
|
|
1551
|
+
reason: 'recovery_dispatch_allowed',
|
|
1552
|
+
status,
|
|
1553
|
+
canRunProductRepair: productDispatch && action.productRepairAllowed === true,
|
|
1554
|
+
canRunExpensiveModel: expensiveDispatch && action.expensiveModelAllowed === true,
|
|
1555
|
+
shouldRecordDispatch: true,
|
|
1556
|
+
requiresNewEvidence,
|
|
1557
|
+
newEvidence,
|
|
1558
|
+
dispatchRecord: record
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
export function appendResolveIOAIManagerRecoveryActionDispatch(
|
|
1563
|
+
history: ResolveIOAIManagerRecoveryActionDispatchRecord[] | undefined,
|
|
1564
|
+
record: ResolveIOAIManagerRecoveryActionDispatchRecord | undefined,
|
|
1565
|
+
limit = 50
|
|
1566
|
+
): ResolveIOAIManagerRecoveryActionDispatchRecord[] {
|
|
1567
|
+
const existing = Array.isArray(history) ? history.filter(Boolean) : [];
|
|
1568
|
+
if (!record) {
|
|
1569
|
+
return existing.slice(-limit);
|
|
1570
|
+
}
|
|
1571
|
+
const deduped = existing.filter((entry) => entry.dispatchId !== record.dispatchId);
|
|
1572
|
+
return [...deduped, record].slice(-limit);
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
function recoveryExecutionPhaseForDispatch(
|
|
1576
|
+
dispatchAction: ResolveIOAIManagerRecoveryActionDispatchAction
|
|
1577
|
+
): ResolveIOAIManagerRecoveryExecutionPhase {
|
|
1578
|
+
const map: Record<ResolveIOAIManagerRecoveryActionDispatchAction, ResolveIOAIManagerRecoveryExecutionPhase> = {
|
|
1579
|
+
run_evidence_probe: 'evidence',
|
|
1580
|
+
run_read_only_diagnosis: 'diagnosis',
|
|
1581
|
+
run_infra_repair: 'infra',
|
|
1582
|
+
run_compile_repair: 'compile',
|
|
1583
|
+
run_journey_contract_repair: 'journey',
|
|
1584
|
+
run_business_assertion_repair: 'business_proof',
|
|
1585
|
+
run_release_repair: 'release',
|
|
1586
|
+
run_targeted_product_repair: 'product_repair',
|
|
1587
|
+
advance: 'advance',
|
|
1588
|
+
continue_gate: 'advance',
|
|
1589
|
+
park_manual: 'manual'
|
|
1590
|
+
};
|
|
1591
|
+
return map[dispatchAction] || 'manual';
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
function recoveryDirectiveReason(
|
|
1595
|
+
action: ResolveIOAIManagerRecoveryActionPacket | undefined,
|
|
1596
|
+
decision: ResolveIOAIManagerRecoveryActionDispatchDecision,
|
|
1597
|
+
current?: ResolveIOAIManagerFailureRecord
|
|
1598
|
+
): string {
|
|
1599
|
+
const blocker = cleanText(current?.blocker || current?.summary || '', 260);
|
|
1600
|
+
const label = cleanText(action?.label, 120) || decision.dispatchAction;
|
|
1601
|
+
const objective = cleanText(action?.objective, 260);
|
|
1602
|
+
return [
|
|
1603
|
+
`MANAGER_RECOVERY:${decision.dispatchAction}`,
|
|
1604
|
+
`label=${label}`,
|
|
1605
|
+
decision.reason ? `reason=${decision.reason}` : '',
|
|
1606
|
+
blocker ? `blocker=${blocker}` : '',
|
|
1607
|
+
objective ? `objective=${objective}` : ''
|
|
1608
|
+
].filter(Boolean).join(' | ');
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
export function buildResolveIOAIManagerRecoveryExecutionDirective(
|
|
1612
|
+
input: ResolveIOAIManagerRecoveryExecutionDirectiveInput
|
|
1613
|
+
): ResolveIOAIManagerRecoveryExecutionDirective {
|
|
1614
|
+
const action = input.action;
|
|
1615
|
+
const dispatchDecision = input.dispatchDecision || decideResolveIOAIManagerRecoveryActionDispatch({
|
|
1616
|
+
action,
|
|
1617
|
+
current: input.current,
|
|
1618
|
+
now: input.now
|
|
1619
|
+
});
|
|
1620
|
+
const dispatchAction = dispatchDecision.dispatchAction;
|
|
1621
|
+
const now = isoNow(input.now);
|
|
1622
|
+
const phase = recoveryExecutionPhaseForDispatch(dispatchAction);
|
|
1623
|
+
const lane = cleanText(action?.lane || input.current?.lane || '', 120);
|
|
1624
|
+
const stepType = cleanText(action?.stepType || input.current?.stepType || '', 120);
|
|
1625
|
+
const rerunReason = recoveryDirectiveReason(action, dispatchDecision, input.current);
|
|
1626
|
+
const surface = cleanText(input.surface || 'runner', 120);
|
|
1627
|
+
return {
|
|
1628
|
+
directiveId: stableHash('mgr-directive', {
|
|
1629
|
+
surface,
|
|
1630
|
+
actionId: action?.actionId || '',
|
|
1631
|
+
dispatchAction,
|
|
1632
|
+
reason: dispatchDecision.reason,
|
|
1633
|
+
evidenceHash: dispatchDecision.dispatchRecord?.evidenceHash || input.current?.evidenceHash || ''
|
|
1634
|
+
}),
|
|
1635
|
+
surface,
|
|
1636
|
+
dispatchAction,
|
|
1637
|
+
phase,
|
|
1638
|
+
allowed: dispatchDecision.allowed,
|
|
1639
|
+
status: dispatchDecision.status,
|
|
1640
|
+
reason: dispatchDecision.reason,
|
|
1641
|
+
lane,
|
|
1642
|
+
stepType,
|
|
1643
|
+
nextActionLabel: cleanText(action?.label, 160) || dispatchAction,
|
|
1644
|
+
rerunReason,
|
|
1645
|
+
evidenceOnly: action?.evidenceOnly !== false || dispatchAction === 'run_evidence_probe',
|
|
1646
|
+
autoRunnable: action?.autoRunnable === true,
|
|
1647
|
+
productRepairAllowed: action?.productRepairAllowed === true,
|
|
1648
|
+
expensiveModelAllowed: action?.expensiveModelAllowed === true,
|
|
1649
|
+
canRunProductRepair: dispatchDecision.canRunProductRepair,
|
|
1650
|
+
canRunExpensiveModel: dispatchDecision.canRunExpensiveModel,
|
|
1651
|
+
canResetLoopAfterEvidence: action?.canResetLoopAfterEvidence === true,
|
|
1652
|
+
requiresNewEvidence: dispatchDecision.requiresNewEvidence,
|
|
1653
|
+
newEvidence: dispatchDecision.newEvidence,
|
|
1654
|
+
maxAttemptsBeforePark: Math.max(1, Number(action?.maxAttemptsBeforePark || 1) || 1),
|
|
1655
|
+
requiredArtifacts: cleanList(action?.requiredArtifacts, 20, 500),
|
|
1656
|
+
nextCommands: cleanList(action?.nextCommands, 20, 500),
|
|
1657
|
+
successCriteria: cleanList(action?.successCriteria, 20, 500),
|
|
1658
|
+
forbiddenActions: action?.productRepairAllowed === true
|
|
1659
|
+
? []
|
|
1660
|
+
: Array.from(new Set([
|
|
1661
|
+
'Do not run product-code repair from this directive unless canRunProductRepair is true.',
|
|
1662
|
+
...(action?.releasePolicy?.forbiddenActions || [])
|
|
1663
|
+
])).slice(0, 20),
|
|
1664
|
+
...(dispatchDecision.dispatchRecord ? { dispatchRecord: dispatchDecision.dispatchRecord } : {}),
|
|
1665
|
+
...(action?.releasePolicy ? { releasePolicy: action.releasePolicy } : {}),
|
|
1666
|
+
createdAt: now
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
function newListEntries(current: string[], previous: string[]): string[] {
|
|
1671
|
+
const existing = new Set(previous.map((entry) => cleanText(entry, 500)).filter(Boolean));
|
|
1672
|
+
return current
|
|
1673
|
+
.map((entry) => cleanText(entry, 500))
|
|
1674
|
+
.filter((entry) => entry && !existing.has(entry));
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
function recordLane(value: any): string {
|
|
1678
|
+
return cleanText(value?.lane, 80);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
function recordStepType(value: any): string {
|
|
1682
|
+
return cleanText(value?.stepType, 80);
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
function recordFailureClass(value: any): string {
|
|
1686
|
+
const valueText = cleanText(value?.failureClass, 80);
|
|
1687
|
+
return valueText ? normalizeResolveIOAIManagerFailureClass(valueText) : '';
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
function materialEvidenceText(record: ResolveIOAIManagerFailureRecord | undefined, paths: string[] = []): string {
|
|
1691
|
+
return [
|
|
1692
|
+
cleanText(record?.blocker, 1200),
|
|
1693
|
+
cleanText(record?.summary, 1200),
|
|
1694
|
+
...paths.map((path) => cleanText(path, 500))
|
|
1695
|
+
].filter(Boolean).join(' ').toLowerCase();
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
function hasMaterialEvidenceLanguage(text: string): boolean {
|
|
1699
|
+
return /(business|assertion|proof|before|after|dom|trace|stack|network|mongo|query|diff|scope|diagnosis|journey|contract|workflow|compile|build|preflight|infra|chrome|puppeteer|release|publish|deploy|sample|seed|route|auth|hydration|performance|slow|owner|root.?cause|repro|pdf|export|upload|import|filter|invoice|saved|calculated|comparison|report)/i.test(text);
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
export function assessResolveIOAIManagerEvidenceChange(
|
|
1703
|
+
previous: (ResolveIOAIManagerFailureRecord | ResolveIOAIManagerRecoveryCheckpoint | undefined),
|
|
1704
|
+
current: ResolveIOAIManagerFailureRecord | undefined,
|
|
1705
|
+
fallbackObjective?: string
|
|
1706
|
+
): ResolveIOAIManagerEvidenceAssessment {
|
|
1707
|
+
const currentRecord = current || {};
|
|
1708
|
+
const previousRecord = previous as any;
|
|
1709
|
+
const previousEvidenceHash = previousRecord ? cleanText(previousRecord.evidenceHash, 160) || hashResolveIOAIManagerEvidence(previousRecord) : '';
|
|
1710
|
+
const currentEvidenceHash = hashResolveIOAIManagerEvidence(currentRecord);
|
|
1711
|
+
const previousBlockerFingerprint = previousRecord
|
|
1712
|
+
? cleanText(previousRecord.blockerFingerprint, 160) || resolveResolveIOAIManagerBlockerFingerprint(previousRecord, fallbackObjective)
|
|
1713
|
+
: '';
|
|
1714
|
+
const currentBlockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(currentRecord, fallbackObjective);
|
|
1715
|
+
const previousChangedFiles = cleanList(previousRecord?.changedFiles, 80, 500);
|
|
1716
|
+
const currentChangedFiles = cleanList(currentRecord.changedFiles, 80, 500);
|
|
1717
|
+
const previousArtifactPaths = cleanList(previousRecord?.artifactPaths, 80, 500);
|
|
1718
|
+
const currentArtifactPaths = cleanList(currentRecord.artifactPaths, 80, 500);
|
|
1719
|
+
const addedChangedFiles = newListEntries(currentChangedFiles, previousChangedFiles);
|
|
1720
|
+
const addedArtifactPaths = newListEntries(currentArtifactPaths, previousArtifactPaths);
|
|
1721
|
+
const signals: string[] = [];
|
|
1722
|
+
if (previousEvidenceHash && currentEvidenceHash !== previousEvidenceHash) {
|
|
1723
|
+
signals.push('evidence_hash_changed');
|
|
1724
|
+
}
|
|
1725
|
+
if (previousBlockerFingerprint && currentBlockerFingerprint !== previousBlockerFingerprint) {
|
|
1726
|
+
signals.push('blocker_fingerprint_changed');
|
|
1727
|
+
}
|
|
1728
|
+
if (recordLane(previousRecord) && recordLane(previousRecord) !== recordLane(currentRecord)) {
|
|
1729
|
+
signals.push('lane_changed');
|
|
1730
|
+
}
|
|
1731
|
+
if (recordStepType(previousRecord) && recordStepType(previousRecord) !== recordStepType(currentRecord)) {
|
|
1732
|
+
signals.push('step_type_changed');
|
|
1733
|
+
}
|
|
1734
|
+
if (recordFailureClass(previousRecord) && recordFailureClass(previousRecord) !== recordFailureClass(currentRecord)) {
|
|
1735
|
+
signals.push('failure_class_changed');
|
|
1736
|
+
}
|
|
1737
|
+
if (addedChangedFiles.length) {
|
|
1738
|
+
signals.push('changed_files_added');
|
|
1739
|
+
}
|
|
1740
|
+
if (addedArtifactPaths.length) {
|
|
1741
|
+
signals.push('artifact_paths_added');
|
|
1742
|
+
}
|
|
1743
|
+
if (isPassingOutcome(currentRecord)) {
|
|
1744
|
+
signals.push('passing_outcome');
|
|
1745
|
+
}
|
|
1746
|
+
const changed = signals.length > 0;
|
|
1747
|
+
const evidenceText = materialEvidenceText(currentRecord, addedArtifactPaths);
|
|
1748
|
+
const pathOrSummaryHasMaterialSignal = hasMaterialEvidenceLanguage(evidenceText);
|
|
1749
|
+
const proof = signals.includes('passing_outcome');
|
|
1750
|
+
const structuralChange = signals.some((signal) => /blocker_fingerprint_changed|lane_changed|step_type_changed|failure_class_changed/.test(signal));
|
|
1751
|
+
const materialArtifact = addedArtifactPaths.length > 0 && pathOrSummaryHasMaterialSignal;
|
|
1752
|
+
const materialChangedFiles = addedChangedFiles.length > 0
|
|
1753
|
+
&& /diagnosis|owner|scope|diff|root.?cause|failing path|stack|trace|business|proof|compile|release|deploy|workflow|journey/i.test(evidenceText);
|
|
1754
|
+
const material = proof || structuralChange || materialArtifact || materialChangedFiles;
|
|
1755
|
+
const strength: ResolveIOAIManagerEvidenceStrength = proof
|
|
1756
|
+
? 'proof'
|
|
1757
|
+
: material
|
|
1758
|
+
? 'material'
|
|
1759
|
+
: changed
|
|
1760
|
+
? 'weak'
|
|
1761
|
+
: 'none';
|
|
1762
|
+
return {
|
|
1763
|
+
changed,
|
|
1764
|
+
material,
|
|
1765
|
+
strength,
|
|
1766
|
+
signals,
|
|
1767
|
+
evidenceHash: currentEvidenceHash,
|
|
1768
|
+
blockerFingerprint: currentBlockerFingerprint
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
function proposedActionIsProductRepair(value: any): boolean {
|
|
1773
|
+
const normalized = cleanText(value, 120);
|
|
1774
|
+
return /product|code|repair|build|business|journey|workflow/i.test(normalized)
|
|
1775
|
+
&& !/infra|compile|diagnosis|manual|evidence|release|publish/i.test(normalized);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
export function decideResolveIOAIManagerRecoveryGate(
|
|
1779
|
+
input: ResolveIOAIManagerRecoveryGateInput
|
|
1780
|
+
): ResolveIOAIManagerRecoveryGateDecision {
|
|
1781
|
+
const checkpoint = input.checkpoint;
|
|
1782
|
+
const hasCurrent = !!input.current;
|
|
1783
|
+
const current = input.current || {};
|
|
1784
|
+
const assessment = hasCurrent
|
|
1785
|
+
? assessResolveIOAIManagerEvidenceChange(checkpoint, current, checkpoint.objective)
|
|
1786
|
+
: {
|
|
1787
|
+
changed: false,
|
|
1788
|
+
material: false,
|
|
1789
|
+
strength: 'none' as ResolveIOAIManagerEvidenceStrength,
|
|
1790
|
+
signals: [],
|
|
1791
|
+
evidenceHash: checkpoint.evidenceHash,
|
|
1792
|
+
blockerFingerprint: checkpoint.blockerFingerprint
|
|
1793
|
+
};
|
|
1794
|
+
const blockerFingerprint = assessment.blockerFingerprint;
|
|
1795
|
+
const evidenceHash = assessment.evidenceHash;
|
|
1796
|
+
const changedFiles = hasCurrent ? cleanList(current.changedFiles, 80, 500) : checkpoint.changedFiles;
|
|
1797
|
+
const artifactPaths = hasCurrent ? cleanList(current.artifactPaths, 80, 500) : checkpoint.artifactPaths;
|
|
1798
|
+
const evidenceChanged = assessment.changed;
|
|
1799
|
+
const proposedAction = cleanText(input.proposedAction || checkpoint.allowedAction, 120);
|
|
1800
|
+
const productRepairRequested = proposedActionIsProductRepair(proposedAction);
|
|
1801
|
+
const missingEvidence = checkpoint.requiredEvidence.filter((required) => {
|
|
1802
|
+
const normalized = cleanText(required, 120).toLowerCase();
|
|
1803
|
+
if (!normalized) {
|
|
1804
|
+
return false;
|
|
1805
|
+
}
|
|
1806
|
+
if (/artifact|log|proof|gate|evidence/.test(normalized)) {
|
|
1807
|
+
return !artifactPaths.length && !current.evidenceHash;
|
|
1808
|
+
}
|
|
1809
|
+
if (/diff|changed files|owner|scope|file/.test(normalized)) {
|
|
1810
|
+
return !changedFiles.length;
|
|
1811
|
+
}
|
|
1812
|
+
return false;
|
|
1813
|
+
});
|
|
1814
|
+
const makeDecision = (
|
|
1815
|
+
action: ResolveIOAIManagerRecoveryGateAction,
|
|
1816
|
+
reason: string,
|
|
1817
|
+
overrides: Partial<ResolveIOAIManagerRecoveryGateDecision> = {}
|
|
1818
|
+
): ResolveIOAIManagerRecoveryGateDecision => ({
|
|
1819
|
+
action,
|
|
1820
|
+
reason,
|
|
1821
|
+
canRunProductRepair: checkpoint.productRepairAllowed,
|
|
1822
|
+
canRunExpensiveModel: checkpoint.expensiveModelAllowed,
|
|
1823
|
+
shouldResetLoopBudget: false,
|
|
1824
|
+
shouldIncrementAttempt: action === 'allow',
|
|
1825
|
+
newEvidence: evidenceChanged,
|
|
1826
|
+
materialEvidence: assessment.material,
|
|
1827
|
+
evidenceStrength: assessment.strength,
|
|
1828
|
+
evidenceSignals: assessment.signals,
|
|
1829
|
+
blockerFingerprint,
|
|
1830
|
+
evidenceHash,
|
|
1831
|
+
missingEvidence,
|
|
1832
|
+
checkpoint: {
|
|
1833
|
+
...checkpoint,
|
|
1834
|
+
updatedAt: isoNow(input.now)
|
|
1835
|
+
},
|
|
1836
|
+
...overrides
|
|
1837
|
+
});
|
|
1838
|
+
|
|
1839
|
+
if (checkpoint.status === 'complete') {
|
|
1840
|
+
return makeDecision('complete', 'recovery_gate_checkpoint_already_complete', {
|
|
1841
|
+
canRunProductRepair: false,
|
|
1842
|
+
canRunExpensiveModel: false,
|
|
1843
|
+
shouldIncrementAttempt: false
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
if (checkpoint.status === 'manual_handoff' && input.operatorApproved !== true) {
|
|
1847
|
+
return makeDecision('manual_handoff', 'recovery_gate_manual_handoff_requires_operator_approval', {
|
|
1848
|
+
canRunProductRepair: false,
|
|
1849
|
+
canRunExpensiveModel: false,
|
|
1850
|
+
shouldIncrementAttempt: false
|
|
1851
|
+
});
|
|
1852
|
+
}
|
|
1853
|
+
if (productRepairRequested && !checkpoint.productRepairAllowed) {
|
|
1854
|
+
return makeDecision('reject_action', 'recovery_gate_product_repair_not_allowed_for_checkpoint', {
|
|
1855
|
+
canRunProductRepair: false,
|
|
1856
|
+
canRunExpensiveModel: false,
|
|
1857
|
+
shouldIncrementAttempt: false
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
if (checkpoint.status === 'parked' && !evidenceChanged) {
|
|
1861
|
+
return makeDecision('collect_new_evidence', 'recovery_gate_parked_until_new_evidence', {
|
|
1862
|
+
canRunProductRepair: false,
|
|
1863
|
+
canRunExpensiveModel: false,
|
|
1864
|
+
shouldIncrementAttempt: false
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
if (checkpoint.status === 'parked' && evidenceChanged && !assessment.material) {
|
|
1868
|
+
return makeDecision('collect_new_evidence', 'recovery_gate_weak_evidence_requires_material_signal', {
|
|
1869
|
+
canRunProductRepair: false,
|
|
1870
|
+
canRunExpensiveModel: false,
|
|
1871
|
+
shouldIncrementAttempt: false
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
if (checkpoint.attempts >= checkpoint.maxAttemptsBeforePark && !evidenceChanged) {
|
|
1875
|
+
return makeDecision('collect_new_evidence', 'recovery_gate_attempt_limit_requires_new_evidence', {
|
|
1876
|
+
canRunProductRepair: false,
|
|
1877
|
+
canRunExpensiveModel: false,
|
|
1878
|
+
shouldIncrementAttempt: false
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
if (checkpoint.attempts >= checkpoint.maxAttemptsBeforePark && evidenceChanged && !assessment.material) {
|
|
1882
|
+
return makeDecision('collect_new_evidence', 'recovery_gate_attempt_limit_requires_material_evidence', {
|
|
1883
|
+
canRunProductRepair: false,
|
|
1884
|
+
canRunExpensiveModel: false,
|
|
1885
|
+
shouldIncrementAttempt: false
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
if (evidenceChanged) {
|
|
1889
|
+
const currentFailureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);
|
|
1890
|
+
const currentCanRunProductRepair = checkpoint.productRepairAllowed
|
|
1891
|
+
|| !/^(infra|compile|diagnosis|release)$/i.test(currentFailureClass);
|
|
1892
|
+
return makeDecision('allow', 'recovery_gate_new_material_evidence_unblocks_retry', {
|
|
1893
|
+
canRunProductRepair: currentCanRunProductRepair,
|
|
1894
|
+
canRunExpensiveModel: checkpoint.expensiveModelAllowed || currentCanRunProductRepair,
|
|
1895
|
+
shouldResetLoopBudget: true
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
return makeDecision('allow', 'recovery_gate_action_allowed');
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
function failureKey(record: ResolveIOAIManagerFailureRecord | undefined): string {
|
|
1902
|
+
if (!record) {
|
|
1903
|
+
return '';
|
|
1904
|
+
}
|
|
1905
|
+
const failureClass = normalizeResolveIOAIManagerFailureClass(record.failureClass);
|
|
1906
|
+
const blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(record);
|
|
1907
|
+
return `${cleanText(record.lane, 80)}:${cleanText(record.stepType, 80)}:${failureClass}:${blockerFingerprint}`;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
function failureEvidenceKey(record: ResolveIOAIManagerFailureRecord | undefined): string {
|
|
1911
|
+
return `${failureKey(record)}:${hashResolveIOAIManagerEvidence(record)}`;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
function isPassingOutcome(record: ResolveIOAIManagerFailureRecord | undefined): boolean {
|
|
1915
|
+
return /^(pass|accepted|ready_to_publish|published|ready_for_merge|complete|completed)$/i.test(cleanText(record?.outcome, 80));
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
function isManualOutcome(record: ResolveIOAIManagerFailureRecord | undefined): boolean {
|
|
1919
|
+
return /^(manual_handoff|park_manual|stopped)$/i.test(cleanText(record?.outcome, 80));
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
export function buildResolveIOAIManagerRecoveryPlan(input: ResolveIOAIManagerRecoveryPlanInput = {}): ResolveIOAIManagerRecoveryPlan {
|
|
1923
|
+
const action = cleanText(input.action, 80) || 'continue';
|
|
1924
|
+
const reason = cleanText(input.reason, 240);
|
|
1925
|
+
const failureClass = normalizeResolveIOAIManagerFailureClass(input.failureClass);
|
|
1926
|
+
const lane = cleanText(input.lane, 80) || 'supervisor';
|
|
1927
|
+
const stepType = cleanText(input.stepType, 80) || 'unknown';
|
|
1928
|
+
const blocker = cleanText(input.blocker, 700);
|
|
1929
|
+
const changedFiles = cleanList(input.changedFiles, 12, 240);
|
|
1930
|
+
const artifactPaths = cleanList(input.artifactPaths, 12, 240);
|
|
1931
|
+
const maxAttemptsBeforePark = Math.max(1, Number(input.maxSameFailureRepeats || 3) || 3);
|
|
1932
|
+
const commonNotes = [
|
|
1933
|
+
reason ? `policy_reason=${reason}` : '',
|
|
1934
|
+
blocker ? `blocker=${blocker}` : '',
|
|
1935
|
+
changedFiles.length ? `changed_files=${changedFiles.join(', ')}` : '',
|
|
1936
|
+
artifactPaths.length ? `artifacts=${artifactPaths.join(', ')}` : ''
|
|
1937
|
+
].filter(Boolean);
|
|
1938
|
+
const base: Omit<ResolveIOAIManagerRecoveryPlan, 'recoveryClass' | 'nextActionLabel' | 'objective' | 'allowedAction' | 'productRepairAllowed' | 'expensiveModelAllowed' | 'finiteSteps' | 'requiredEvidence' | 'loopResetEvidence' | 'forbiddenActions'> = {
|
|
1939
|
+
lane,
|
|
1940
|
+
stepType,
|
|
1941
|
+
maxAttemptsBeforePark,
|
|
1942
|
+
notes: commonNotes
|
|
1943
|
+
};
|
|
1944
|
+
const makePlan = (
|
|
1945
|
+
recoveryClass: ResolveIOAIManagerRecoveryClass,
|
|
1946
|
+
nextActionLabel: string,
|
|
1947
|
+
objective: string,
|
|
1948
|
+
allowedAction: string,
|
|
1949
|
+
productRepairAllowed: boolean,
|
|
1950
|
+
expensiveModelAllowed: boolean,
|
|
1951
|
+
finiteSteps: string[],
|
|
1952
|
+
requiredEvidence: string[],
|
|
1953
|
+
loopResetEvidence: string[],
|
|
1954
|
+
forbiddenActions: string[]
|
|
1955
|
+
): ResolveIOAIManagerRecoveryPlan => ({
|
|
1956
|
+
...base,
|
|
1957
|
+
recoveryClass,
|
|
1958
|
+
nextActionLabel,
|
|
1959
|
+
objective,
|
|
1960
|
+
allowedAction,
|
|
1961
|
+
productRepairAllowed,
|
|
1962
|
+
expensiveModelAllowed,
|
|
1963
|
+
finiteSteps,
|
|
1964
|
+
requiredEvidence,
|
|
1965
|
+
loopResetEvidence,
|
|
1966
|
+
forbiddenActions
|
|
1967
|
+
});
|
|
1968
|
+
if (action === 'reset_loop_budget') {
|
|
1969
|
+
return makePlan(
|
|
1970
|
+
'advance_after_proof',
|
|
1971
|
+
'Advance After Proof',
|
|
1972
|
+
'Checkpoint the passing evidence and move to the next required gate.',
|
|
1973
|
+
'advance_to_next_gate',
|
|
1974
|
+
false,
|
|
1975
|
+
false,
|
|
1976
|
+
[
|
|
1977
|
+
'Record the passing artifact, changed files, and gate result.',
|
|
1978
|
+
'Reset the loop counter because a real gate passed.',
|
|
1979
|
+
'Select the next unmet deterministic gate instead of repeating the previous repair.'
|
|
1980
|
+
],
|
|
1981
|
+
['passing gate record', 'artifact or log proving the passed check'],
|
|
1982
|
+
['new passing gate result', 'new business proof artifact'],
|
|
1983
|
+
['rerun the same repair after a pass', 'mark accepted without the required downstream gate']
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
if (action === 'manual_handoff') {
|
|
1987
|
+
return makePlan(
|
|
1988
|
+
'manual_handoff',
|
|
1989
|
+
'Manual Review',
|
|
1990
|
+
'Stop autonomous repair and expose the blocker, evidence, and last safe state.',
|
|
1991
|
+
'manual_review_only',
|
|
1992
|
+
false,
|
|
1993
|
+
false,
|
|
1994
|
+
[
|
|
1995
|
+
'Freeze further product-code edits.',
|
|
1996
|
+
'Show the blocker fingerprint, evidence hash, and prior attempts.',
|
|
1997
|
+
'Require a human edit to classification, scope, or retry policy before another model/code loop.'
|
|
1998
|
+
],
|
|
1999
|
+
['blocker fingerprint', 'evidence hash', 'attempt history'],
|
|
2000
|
+
['manual policy change', 'new external evidence'],
|
|
2001
|
+
['start another automatic model repair', 'hide the failed evidence']
|
|
2002
|
+
);
|
|
2003
|
+
}
|
|
2004
|
+
if (action === 'budget_stop') {
|
|
2005
|
+
return makePlan(
|
|
2006
|
+
'manual_handoff',
|
|
2007
|
+
'Budget Stop Review',
|
|
2008
|
+
'Stop autonomous model/code loops until a cheaper scoped next action is selected.',
|
|
2009
|
+
'budget_review_only',
|
|
2010
|
+
false,
|
|
2011
|
+
false,
|
|
2012
|
+
[
|
|
2013
|
+
'Freeze further model repair loops.',
|
|
2014
|
+
'Show the prompt/token/runtime budget that tripped the guard.',
|
|
2015
|
+
'Select a cheaper deterministic gate, infra repair, diagnosis revision, or manual scope edit before resuming.'
|
|
2016
|
+
],
|
|
2017
|
+
['budget guard reason', 'latest prompt estimate', 'last blocker/evidence hash'],
|
|
2018
|
+
['manual scope reduction', 'new deterministic evidence', 'approved budget policy change'],
|
|
2019
|
+
['start another broad model prompt', 'reset budget without new evidence', 'hide cost context']
|
|
2020
|
+
);
|
|
2021
|
+
}
|
|
2022
|
+
if (failureClass === 'diagnosis' || stepType === 'diagnosis_gate') {
|
|
2023
|
+
return makePlan(
|
|
2024
|
+
'diagnosis_only',
|
|
2025
|
+
'Run Diagnosis Gate',
|
|
2026
|
+
'Produce a falsifiable root-cause diagnosis before any repair.',
|
|
2027
|
+
'read_only_diagnosis',
|
|
2028
|
+
false,
|
|
2029
|
+
true,
|
|
2030
|
+
[
|
|
2031
|
+
'Reproduce or explicitly classify the customer issue.',
|
|
2032
|
+
'Accept one falsifiable hypothesis and record rejected alternatives.',
|
|
2033
|
+
'Identify the frontend/backend/shared failing path.',
|
|
2034
|
+
'Select a small owner_files set.',
|
|
2035
|
+
'Define exact before/action/after business proof.'
|
|
2036
|
+
],
|
|
2037
|
+
['issue_case', 'accepted_hypothesis', 'rejected_alternatives', 'failing_path', 'owner_files', 'proof_plan'],
|
|
2038
|
+
['new reproduction artifact', 'new query/log/code evidence', 'validated diagnosis gate'],
|
|
2039
|
+
['edit product code', 'run broad repo repair', 'accept route-load evidence as success']
|
|
2040
|
+
);
|
|
2041
|
+
}
|
|
2042
|
+
if (failureClass === 'owner_scope' || failureClass === 'out_of_scope' || /out.?of.?scope|owner_files/i.test(reason)) {
|
|
2043
|
+
return makePlan(
|
|
2044
|
+
'diagnosis_revision',
|
|
2045
|
+
'Revise Diagnosis Scope',
|
|
2046
|
+
'Revise owner_files only when new evidence proves the current scope is wrong.',
|
|
2047
|
+
'diagnosis_revision_only',
|
|
2048
|
+
false,
|
|
2049
|
+
true,
|
|
2050
|
+
[
|
|
2051
|
+
'Compare changed files against the diagnosis owner_files.',
|
|
2052
|
+
'Collect evidence proving why the new file is in the failing path.',
|
|
2053
|
+
'Update accepted_hypothesis, failing_path, owner_files, and proof_plan together.',
|
|
2054
|
+
'Resume repair only after the revised gate validates.'
|
|
2055
|
+
],
|
|
2056
|
+
['out-of-scope file list', 'new failing-path evidence', 'revalidated diagnosis gate'],
|
|
2057
|
+
['revised owner_files with evidence', 'new business proof requirement'],
|
|
2058
|
+
['keep broad edits without diagnosis', 'add convenience refactors', 'continue repair outside owner_files']
|
|
2059
|
+
);
|
|
2060
|
+
}
|
|
2061
|
+
if (action === 'retry_infra') {
|
|
2062
|
+
const isCompile = failureClass === 'compile';
|
|
2063
|
+
return makePlan(
|
|
2064
|
+
isCompile ? 'compile_repair' : 'infra_repair',
|
|
2065
|
+
isCompile ? 'Repair Compile Gate' : 'Repair Infra Gate',
|
|
2066
|
+
isCompile
|
|
2067
|
+
? 'Fix the deterministic compile/build blocker before spending another product repair loop.'
|
|
2068
|
+
: 'Fix the deterministic harness/browser/server/Mongo blocker before product repair.',
|
|
2069
|
+
isCompile ? 'compile_repair_only' : 'infra_repair_only',
|
|
2070
|
+
false,
|
|
2071
|
+
false,
|
|
2072
|
+
isCompile
|
|
2073
|
+
? [
|
|
2074
|
+
'Read the exact compile/build log and identify the first actionable error.',
|
|
2075
|
+
'Fix missing dependency, stale artifact, command, cache, or type wiring required by the compile gate.',
|
|
2076
|
+
'Rerun the same finite compile command.',
|
|
2077
|
+
'Return the compile log artifact and status.'
|
|
2078
|
+
]
|
|
2079
|
+
: [
|
|
2080
|
+
'Run preflight for Puppeteer, Chrome executable, ports, Mongo/settings, and startup command.',
|
|
2081
|
+
'Repair only the failing harness/environment item.',
|
|
2082
|
+
'Rerun the same infra check.',
|
|
2083
|
+
'Return the infra log and pass/fail status.'
|
|
2084
|
+
],
|
|
2085
|
+
isCompile
|
|
2086
|
+
? ['compile command', 'compile log artifact', 'first failing error fixed or still failing']
|
|
2087
|
+
: ['preflight command', 'infra log artifact', 'specific repaired environment item'],
|
|
2088
|
+
['same check now passes', 'new infra/compile blocker hash'],
|
|
2089
|
+
['run product-code model repair', 'count this as product failure', 'accept route/business success without the compile/infra gate']
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
if (action === 'park_repeated_failure' || action === 'park_ping_pong') {
|
|
2093
|
+
return makePlan(
|
|
2094
|
+
'blocked_until_new_evidence',
|
|
2095
|
+
action === 'park_ping_pong' ? 'Park Ping-Pong Loop' : 'Park Repeated Failure',
|
|
2096
|
+
'Stop the current loop until new evidence changes the diagnosis, route, or repair target.',
|
|
2097
|
+
'collect_new_evidence_only',
|
|
2098
|
+
false,
|
|
2099
|
+
false,
|
|
2100
|
+
[
|
|
2101
|
+
'Do not rerun the same prompt or same repair.',
|
|
2102
|
+
'Show the repeated blocker and evidence hash.',
|
|
2103
|
+
'Collect a new artifact: failing DOM state, stack trace, network response, Mongo delta, compile log, or revised diagnosis.',
|
|
2104
|
+
'Reset the loop only after material evidence changes the blocker, proof, diagnosis, journey, or actionable trace.'
|
|
2105
|
+
],
|
|
2106
|
+
['same failure count', 'blocker fingerprint', 'evidence hash'],
|
|
2107
|
+
['changed blocker fingerprint', 'changed evidence hash', 'business/compile/infra/release proof artifact', 'revised diagnosis or journey contract', 'new actionable trace or data delta'],
|
|
2108
|
+
['alternate between two failed patches', 'increase loop budget without evidence', 'hide the park reason']
|
|
2109
|
+
);
|
|
2110
|
+
}
|
|
2111
|
+
if (failureClass === 'journey') {
|
|
2112
|
+
return makePlan(
|
|
2113
|
+
'journey_contract_repair',
|
|
2114
|
+
'Repair Journey Contract',
|
|
2115
|
+
'Fix the first/next/last workflow contract before app code work continues.',
|
|
2116
|
+
'journey_contract_repair',
|
|
2117
|
+
false,
|
|
2118
|
+
true,
|
|
2119
|
+
[
|
|
2120
|
+
'Open docs/APP_JOURNEY_CONTRACT.md.',
|
|
2121
|
+
'Define first_screen, north_star_workflow, screen_sequence, data_story, completion_states, and qa_assertions.',
|
|
2122
|
+
'Ensure each CTA maps to an action, route, method, calculation, or state transition.',
|
|
2123
|
+
'Validate that sample data can drive the promised workflow.'
|
|
2124
|
+
],
|
|
2125
|
+
['validated journey_contract JSON', 'CTA-to-action mapping', 'workflow QA assertions'],
|
|
2126
|
+
['journey validation passes', 'new workflow QA rows generated'],
|
|
2127
|
+
['build empty routes', 'add link-only dashboard actions', 'defer workflow design to wow pass']
|
|
2128
|
+
);
|
|
2129
|
+
}
|
|
2130
|
+
if (failureClass === 'release') {
|
|
2131
|
+
return makePlan(
|
|
2132
|
+
'release_repair',
|
|
2133
|
+
'Repair Release Gate',
|
|
2134
|
+
'Repair deploy/publish/sample-data release evidence with a hotfix-first path before any repeated full deploy.',
|
|
2135
|
+
'release_repair_only',
|
|
2136
|
+
false,
|
|
2137
|
+
false,
|
|
2138
|
+
[
|
|
2139
|
+
'Read the deploy/publish/sample-data log.',
|
|
2140
|
+
'Identify whether the blocker is domain, asset, seed data, route, permission, or CDN.',
|
|
2141
|
+
'Prefer backend hotfix, release config, domain, cache, or seed-data repair when the product artifact already has business proof.',
|
|
2142
|
+
'Rerun only the failed release gate.'
|
|
2143
|
+
],
|
|
2144
|
+
['deploy or publish log', 'sample-data status', 'failed release gate rerun'],
|
|
2145
|
+
['release gate passes', 'new release blocker hash'],
|
|
2146
|
+
['change core workflow after business QA passed', 'mark accepted from scorecard only', 'rerun full builder loop', 'repeat deploy of same artifact without force_deploy evidence']
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
if (failureClass === 'business' || failureClass === 'qa_evidence' || failureClass === 'route') {
|
|
2150
|
+
return makePlan(
|
|
2151
|
+
'business_proof_repair',
|
|
2152
|
+
'Repair Business Proof',
|
|
2153
|
+
'Fix the exact failing workflow assertion and prove before/action/after behavior.',
|
|
2154
|
+
'business_repair',
|
|
2155
|
+
true,
|
|
2156
|
+
true,
|
|
2157
|
+
[
|
|
2158
|
+
'Open the failing QA row or proof_plan.',
|
|
2159
|
+
'Trace the UI action to method/publication/query/calculation.',
|
|
2160
|
+
'Patch the smallest owner or workflow files.',
|
|
2161
|
+
'Rerun only the failed business assertion.',
|
|
2162
|
+
'Record DOM/data/Mongo/artifact proof.'
|
|
2163
|
+
],
|
|
2164
|
+
['failing assertion', 'action trace', 'business proof artifact'],
|
|
2165
|
+
['business assertion passes', 'new failed assertion with new evidence'],
|
|
2166
|
+
['treat route load as success', 'rerun unrelated QA rows first', 'accept scorecard-only evidence']
|
|
2167
|
+
);
|
|
2168
|
+
}
|
|
2169
|
+
if (input.productRepairFailure !== false || failureClass === 'product_code') {
|
|
2170
|
+
return makePlan(
|
|
2171
|
+
'product_code_repair',
|
|
2172
|
+
'Run Targeted Product Repair',
|
|
2173
|
+
'Repair the current product-code blocker with the smallest scoped edit and immediate proof.',
|
|
2174
|
+
'targeted_product_repair',
|
|
2175
|
+
true,
|
|
2176
|
+
true,
|
|
2177
|
+
[
|
|
2178
|
+
'Inspect the current blocker, artifacts, changed files, and owner/workflow scope.',
|
|
2179
|
+
'Form one small repair hypothesis.',
|
|
2180
|
+
'Patch only files justified by the active diagnosis or journey contract.',
|
|
2181
|
+
'Rerun the smallest failed gate.',
|
|
2182
|
+
'Record new evidence before any additional loop.'
|
|
2183
|
+
],
|
|
2184
|
+
['owner/workflow scope', 'repair diff', 'failed gate rerun artifact'],
|
|
2185
|
+
['new evidence hash', 'same gate passes'],
|
|
2186
|
+
['broad repo search-and-edit', 'rerun the same prompt without inspecting artifacts', 'change unrelated UI polish']
|
|
2187
|
+
);
|
|
2188
|
+
}
|
|
2189
|
+
return makePlan(
|
|
2190
|
+
'continue',
|
|
2191
|
+
'Continue Current Gate',
|
|
2192
|
+
'Continue the current lane because no blocking loop or infra condition was detected.',
|
|
2193
|
+
'continue',
|
|
2194
|
+
false,
|
|
2195
|
+
false,
|
|
2196
|
+
[
|
|
2197
|
+
'Use the active lane memory.',
|
|
2198
|
+
'Run the next finite gate.',
|
|
2199
|
+
'Record artifacts and evidence hash.'
|
|
2200
|
+
],
|
|
2201
|
+
['active lane memory', 'finite gate artifact'],
|
|
2202
|
+
['new gate result', 'new artifact path'],
|
|
2203
|
+
['spawn duplicate runners', 'advance without evidence']
|
|
2204
|
+
);
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
function collectOpenTail(records: ResolveIOAIManagerFailureRecord[]): ResolveIOAIManagerFailureRecord[] {
|
|
2208
|
+
const tail: ResolveIOAIManagerFailureRecord[] = [];
|
|
2209
|
+
for (let index = records.length - 1; index >= 0; index -= 1) {
|
|
2210
|
+
const record = records[index];
|
|
2211
|
+
if (isPassingOutcome(record)) {
|
|
2212
|
+
break;
|
|
2213
|
+
}
|
|
2214
|
+
tail.unshift(record);
|
|
2215
|
+
}
|
|
2216
|
+
return tail;
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
function countSameFailure(records: ResolveIOAIManagerFailureRecord[], current: ResolveIOAIManagerFailureRecord): number {
|
|
2220
|
+
const currentKey = failureKey(current);
|
|
2221
|
+
let count = 0;
|
|
2222
|
+
for (let index = records.length - 1; index >= 0; index -= 1) {
|
|
2223
|
+
const record = records[index];
|
|
2224
|
+
if (isPassingOutcome(record)) {
|
|
2225
|
+
break;
|
|
2226
|
+
}
|
|
2227
|
+
if (failureKey(record) !== currentKey) {
|
|
2228
|
+
break;
|
|
2229
|
+
}
|
|
2230
|
+
count += 1;
|
|
2231
|
+
}
|
|
2232
|
+
return count;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
function previousRecordForPolicy(
|
|
2236
|
+
history: ResolveIOAIManagerFailureRecord[],
|
|
2237
|
+
current: ResolveIOAIManagerFailureRecord,
|
|
2238
|
+
currentWasExplicit: boolean
|
|
2239
|
+
): ResolveIOAIManagerFailureRecord | undefined {
|
|
2240
|
+
if (!history.length) {
|
|
2241
|
+
return undefined;
|
|
2242
|
+
}
|
|
2243
|
+
if (!currentWasExplicit) {
|
|
2244
|
+
return history.length > 1 ? history[history.length - 2] : undefined;
|
|
2245
|
+
}
|
|
2246
|
+
const last = history[history.length - 1];
|
|
2247
|
+
if (failureEvidenceKey(last) === failureEvidenceKey(current)) {
|
|
2248
|
+
return history.length > 1 ? history[history.length - 2] : undefined;
|
|
2249
|
+
}
|
|
2250
|
+
return last;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
function countPingPong(records: ResolveIOAIManagerFailureRecord[], current: ResolveIOAIManagerFailureRecord): number {
|
|
2254
|
+
const tail = collectOpenTail(records).filter((record) => {
|
|
2255
|
+
return cleanText(record.lane, 80) === cleanText(current.lane, 80)
|
|
2256
|
+
&& cleanText(record.stepType, 80) === cleanText(current.stepType, 80);
|
|
2257
|
+
});
|
|
2258
|
+
if (tail.length < 4) {
|
|
2259
|
+
return 0;
|
|
2260
|
+
}
|
|
2261
|
+
const keys = tail.map(failureKey).filter(Boolean);
|
|
2262
|
+
const last = keys.slice(-6);
|
|
2263
|
+
if (last.length < 4) {
|
|
2264
|
+
return 0;
|
|
2265
|
+
}
|
|
2266
|
+
const distinct = Array.from(new Set(last));
|
|
2267
|
+
if (distinct.length !== 2) {
|
|
2268
|
+
return 0;
|
|
2269
|
+
}
|
|
2270
|
+
for (let index = 2; index < last.length; index += 1) {
|
|
2271
|
+
if (last[index] !== last[index - 2]) {
|
|
2272
|
+
return 0;
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
return last.length - 1;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
export function decideResolveIOAIManagerPolicy(input: ResolveIOAIManagerPolicyInput): ResolveIOAIManagerPolicyDecision {
|
|
2279
|
+
const history = Array.isArray(input.history) ? input.history : [];
|
|
2280
|
+
const currentWasExplicit = !!input.current;
|
|
2281
|
+
const current = input.current || history[history.length - 1] || {};
|
|
2282
|
+
const failureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);
|
|
2283
|
+
const blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current);
|
|
2284
|
+
const evidenceHash = hashResolveIOAIManagerEvidence(current);
|
|
2285
|
+
const previous = previousRecordForPolicy(history, current, currentWasExplicit);
|
|
2286
|
+
const previousSameFailure = previous && failureKey(previous) === failureKey(current);
|
|
2287
|
+
const evidenceAssessment = previousSameFailure
|
|
2288
|
+
? assessResolveIOAIManagerEvidenceChange(previous, current)
|
|
2289
|
+
: {
|
|
2290
|
+
changed: false,
|
|
2291
|
+
material: false,
|
|
2292
|
+
strength: 'none' as ResolveIOAIManagerEvidenceStrength,
|
|
2293
|
+
signals: [],
|
|
2294
|
+
evidenceHash,
|
|
2295
|
+
blockerFingerprint
|
|
2296
|
+
};
|
|
2297
|
+
const newEvidence = !!previousSameFailure && evidenceAssessment.changed;
|
|
2298
|
+
const sameFailureCount = countSameFailure(history, current);
|
|
2299
|
+
const pingPongCount = countPingPong(history, current);
|
|
2300
|
+
const maxSameFailureRepeats = Math.max(1, Number(input.maxSameFailureRepeats || 3) || 3);
|
|
2301
|
+
const maxPingPongTransitions = Math.max(3, Number(input.maxPingPongTransitions || 3) || 3);
|
|
2302
|
+
const infraClasses = new Set((input.infraFailureClasses || ['infra', 'compile']).map(normalizeResolveIOAIManagerFailureClass));
|
|
2303
|
+
const ignoredClasses = new Set((input.ignoredFailureClasses || []).map(normalizeResolveIOAIManagerFailureClass));
|
|
2304
|
+
const base = {
|
|
2305
|
+
failureClass,
|
|
2306
|
+
blockerFingerprint,
|
|
2307
|
+
evidenceHash,
|
|
2308
|
+
sameFailureCount,
|
|
2309
|
+
pingPongCount,
|
|
2310
|
+
newEvidence,
|
|
2311
|
+
materialEvidence: evidenceAssessment.material,
|
|
2312
|
+
evidenceStrength: evidenceAssessment.strength,
|
|
2313
|
+
evidenceSignals: evidenceAssessment.signals,
|
|
2314
|
+
loopBudgetShouldReset: false,
|
|
2315
|
+
productRepairFailure: !infraClasses.has(failureClass) && !ignoredClasses.has(failureClass)
|
|
2316
|
+
};
|
|
2317
|
+
const withPlan = (
|
|
2318
|
+
action: ResolveIOAIManagerAction,
|
|
2319
|
+
reason: string,
|
|
2320
|
+
overrides: Partial<Omit<ResolveIOAIManagerPolicyDecision, 'action' | 'reason' | 'recoveryPlan' | 'recoveryCheckpoint'>> = {}
|
|
2321
|
+
): ResolveIOAIManagerPolicyDecision => {
|
|
2322
|
+
const merged = {
|
|
2323
|
+
...base,
|
|
2324
|
+
...overrides
|
|
2325
|
+
};
|
|
2326
|
+
const recoveryPlan = buildResolveIOAIManagerRecoveryPlan({
|
|
2327
|
+
action,
|
|
2328
|
+
reason,
|
|
2329
|
+
failureClass: merged.failureClass,
|
|
2330
|
+
lane: current.lane,
|
|
2331
|
+
stepType: current.stepType,
|
|
2332
|
+
blocker: current.blocker || current.summary,
|
|
2333
|
+
sameFailureCount: merged.sameFailureCount,
|
|
2334
|
+
pingPongCount: merged.pingPongCount,
|
|
2335
|
+
newEvidence: merged.newEvidence,
|
|
2336
|
+
productRepairFailure: merged.productRepairFailure,
|
|
2337
|
+
changedFiles: current.changedFiles,
|
|
2338
|
+
artifactPaths: current.artifactPaths,
|
|
2339
|
+
maxSameFailureRepeats
|
|
2340
|
+
});
|
|
2341
|
+
const recoveryCheckpoint = buildResolveIOAIManagerRecoveryCheckpoint({
|
|
2342
|
+
plan: recoveryPlan,
|
|
2343
|
+
current
|
|
2344
|
+
});
|
|
2345
|
+
const recoveryEvidenceProbe = buildResolveIOAIManagerRecoveryEvidenceProbe({
|
|
2346
|
+
checkpoint: recoveryCheckpoint,
|
|
2347
|
+
current
|
|
2348
|
+
});
|
|
2349
|
+
return {
|
|
2350
|
+
...merged,
|
|
2351
|
+
action,
|
|
2352
|
+
reason,
|
|
2353
|
+
recoveryPlan,
|
|
2354
|
+
recoveryCheckpoint,
|
|
2355
|
+
recoveryEvidenceProbe,
|
|
2356
|
+
recoveryAction: buildResolveIOAIManagerRecoveryActionPacket({
|
|
2357
|
+
plan: recoveryPlan,
|
|
2358
|
+
checkpoint: recoveryCheckpoint,
|
|
2359
|
+
probe: recoveryEvidenceProbe,
|
|
2360
|
+
current
|
|
2361
|
+
})
|
|
2362
|
+
};
|
|
2363
|
+
};
|
|
2364
|
+
if (isPassingOutcome(current)) {
|
|
2365
|
+
return withPlan('reset_loop_budget', 'manager_policy_progress_passed', {
|
|
2366
|
+
loopBudgetShouldReset: true,
|
|
2367
|
+
productRepairFailure: false
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
if (isManualOutcome(current)) {
|
|
2371
|
+
return withPlan('manual_handoff', 'manager_policy_manual_or_stopped');
|
|
2372
|
+
}
|
|
2373
|
+
if (pingPongCount >= maxPingPongTransitions) {
|
|
2374
|
+
return withPlan('park_ping_pong', 'manager_policy_ping_pong_failure_loop');
|
|
2375
|
+
}
|
|
2376
|
+
if (sameFailureCount >= maxSameFailureRepeats && !evidenceAssessment.material) {
|
|
2377
|
+
return withPlan('park_repeated_failure', newEvidence
|
|
2378
|
+
? 'manager_policy_same_failure_with_weak_evidence'
|
|
2379
|
+
: 'manager_policy_same_failure_without_new_evidence');
|
|
2380
|
+
}
|
|
2381
|
+
if (infraClasses.has(failureClass)) {
|
|
2382
|
+
return withPlan('retry_infra', 'manager_policy_infra_failure_routes_to_infra_repair', {
|
|
2383
|
+
productRepairFailure: false
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
if (newEvidence || !previousSameFailure) {
|
|
2387
|
+
if (newEvidence && !evidenceAssessment.material) {
|
|
2388
|
+
return withPlan('continue', 'manager_policy_weak_evidence_does_not_reset_loop_budget');
|
|
2389
|
+
}
|
|
2390
|
+
return withPlan('continue', newEvidence
|
|
2391
|
+
? 'manager_policy_new_material_evidence_resets_loop_budget'
|
|
2392
|
+
: 'manager_policy_new_failure_or_lane', {
|
|
2393
|
+
loopBudgetShouldReset: true,
|
|
2394
|
+
materialEvidence: newEvidence ? true : base.materialEvidence,
|
|
2395
|
+
evidenceStrength: newEvidence ? evidenceAssessment.strength : base.evidenceStrength
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
return withPlan('continue', 'manager_policy_retry_below_repeat_limit');
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
function buildReplayDirectiveFromPlan(input: {
|
|
2402
|
+
surface: string;
|
|
2403
|
+
plan: ResolveIOAIManagerRecoveryPlan;
|
|
2404
|
+
current: ResolveIOAIManagerFailureRecord;
|
|
2405
|
+
now?: Date | string;
|
|
2406
|
+
}): ResolveIOAIManagerRecoveryExecutionDirective {
|
|
2407
|
+
const checkpoint = buildResolveIOAIManagerRecoveryCheckpoint({
|
|
2408
|
+
plan: input.plan,
|
|
2409
|
+
current: input.current,
|
|
2410
|
+
now: input.now
|
|
2411
|
+
});
|
|
2412
|
+
const probe = buildResolveIOAIManagerRecoveryEvidenceProbe({
|
|
2413
|
+
checkpoint,
|
|
2414
|
+
current: input.current,
|
|
2415
|
+
now: input.now
|
|
2416
|
+
});
|
|
2417
|
+
const action = buildResolveIOAIManagerRecoveryActionPacket({
|
|
2418
|
+
plan: input.plan,
|
|
2419
|
+
checkpoint,
|
|
2420
|
+
probe,
|
|
2421
|
+
current: input.current,
|
|
2422
|
+
now: input.now
|
|
2423
|
+
});
|
|
2424
|
+
const dispatch = decideResolveIOAIManagerRecoveryActionDispatch({
|
|
2425
|
+
action,
|
|
2426
|
+
current: input.current,
|
|
2427
|
+
now: input.now
|
|
2428
|
+
});
|
|
2429
|
+
return buildResolveIOAIManagerRecoveryExecutionDirective({
|
|
2430
|
+
action,
|
|
2431
|
+
dispatchDecision: dispatch,
|
|
2432
|
+
current: input.current,
|
|
2433
|
+
surface: input.surface,
|
|
2434
|
+
now: input.now
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
function replayCaseFromDirective(input: {
|
|
2439
|
+
caseId: string;
|
|
2440
|
+
surface: string;
|
|
2441
|
+
action: string;
|
|
2442
|
+
reason: string;
|
|
2443
|
+
directive: ResolveIOAIManagerRecoveryExecutionDirective;
|
|
2444
|
+
expectedSafeAutoDispatch: boolean;
|
|
2445
|
+
pass: boolean;
|
|
2446
|
+
loopBudgetShouldReset?: boolean;
|
|
2447
|
+
materialEvidence?: boolean;
|
|
2448
|
+
evidenceStrength?: ResolveIOAIManagerEvidenceStrength;
|
|
2449
|
+
details?: Record<string, any>;
|
|
2450
|
+
}): ResolveIOAIManagerRecoveryReplayCase {
|
|
2451
|
+
const directive = input.directive;
|
|
2452
|
+
const safeAutoDispatch = isResolveIOAIManagerSafeAutoDispatch({
|
|
2453
|
+
dispatchAction: directive.dispatchAction,
|
|
2454
|
+
directive,
|
|
2455
|
+
includeJourneyContractRepair: input.expectedSafeAutoDispatch && directive.dispatchAction === 'run_journey_contract_repair',
|
|
2456
|
+
includeReleaseRepair: input.expectedSafeAutoDispatch && directive.dispatchAction === 'run_release_repair',
|
|
2457
|
+
includeProductRepair: false
|
|
2458
|
+
});
|
|
2459
|
+
return {
|
|
2460
|
+
caseId: input.caseId,
|
|
2461
|
+
surface: input.surface,
|
|
2462
|
+
pass: input.pass && safeAutoDispatch === input.expectedSafeAutoDispatch,
|
|
2463
|
+
action: input.action,
|
|
2464
|
+
reason: input.reason,
|
|
2465
|
+
recoveryClass: cleanText(directive.dispatchRecord?.mode || directive.phase, 120),
|
|
2466
|
+
dispatchAction: directive.dispatchAction,
|
|
2467
|
+
safeAutoDispatch,
|
|
2468
|
+
expectedSafeAutoDispatch: input.expectedSafeAutoDispatch,
|
|
2469
|
+
productRepairAllowed: directive.canRunProductRepair === true,
|
|
2470
|
+
loopBudgetShouldReset: input.loopBudgetShouldReset === true,
|
|
2471
|
+
materialEvidence: input.materialEvidence === true,
|
|
2472
|
+
evidenceStrength: input.evidenceStrength || 'none',
|
|
2473
|
+
...(directive.releasePolicy ? {
|
|
2474
|
+
hotfixFirst: directive.releasePolicy.policy === 'hotfix_first',
|
|
2475
|
+
fullDeployAllowed: directive.releasePolicy.fullDeployAllowed
|
|
2476
|
+
} : {}),
|
|
2477
|
+
details: {
|
|
2478
|
+
phase: directive.phase,
|
|
2479
|
+
allowed: directive.allowed,
|
|
2480
|
+
reason: directive.reason,
|
|
2481
|
+
releasePolicy: directive.releasePolicy,
|
|
2482
|
+
...(input.details || {})
|
|
2483
|
+
}
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
export function buildResolveIOAIManagerRecoveryReplayMatrix(
|
|
2488
|
+
input: ResolveIOAIManagerRecoveryReplayMatrixInput = {}
|
|
2489
|
+
): ResolveIOAIManagerRecoveryReplayCase[] {
|
|
2490
|
+
const surface = cleanText(input.surface || 'runner', 120);
|
|
2491
|
+
const maxSameFailureRepeats = Math.max(1, Number(input.maxSameFailureRepeats || 2) || 2);
|
|
2492
|
+
const includeReleaseRepair = input.includeReleaseRepair !== false;
|
|
2493
|
+
const includeJourneyContractRepair = input.includeJourneyContractRepair !== false;
|
|
2494
|
+
const cases: ResolveIOAIManagerRecoveryReplayCase[] = [];
|
|
2495
|
+
const infraPolicy = decideResolveIOAIManagerPolicy({
|
|
2496
|
+
history: [
|
|
2497
|
+
{ lane: 'qa', stepType: 'workflow_qa', outcome: 'needs_repair', failureClass: 'infra', blocker: 'Chrome executable missing.', evidenceHash: 'chrome-missing' }
|
|
2498
|
+
],
|
|
2499
|
+
current: { lane: 'qa', stepType: 'workflow_qa', outcome: 'needs_repair', failureClass: 'infra', blocker: 'Chrome executable missing.', evidenceHash: 'chrome-missing' },
|
|
2500
|
+
maxSameFailureRepeats
|
|
2501
|
+
});
|
|
2502
|
+
const infraDirective = buildResolveIOAIManagerRecoveryExecutionDirective({
|
|
2503
|
+
action: infraPolicy.recoveryAction,
|
|
2504
|
+
current: { lane: 'qa', stepType: 'workflow_qa', outcome: 'needs_repair', failureClass: 'infra', blocker: 'Chrome executable missing.', evidenceHash: 'chrome-missing' },
|
|
2505
|
+
surface
|
|
2506
|
+
});
|
|
2507
|
+
cases.push(replayCaseFromDirective({
|
|
2508
|
+
caseId: 'infra_routes_to_infra_repair',
|
|
2509
|
+
surface,
|
|
2510
|
+
action: infraPolicy.action,
|
|
2511
|
+
reason: infraPolicy.reason,
|
|
2512
|
+
directive: infraDirective,
|
|
2513
|
+
expectedSafeAutoDispatch: true,
|
|
2514
|
+
pass: infraPolicy.action === 'retry_infra'
|
|
2515
|
+
&& infraPolicy.recoveryPlan.recoveryClass === 'infra_repair'
|
|
2516
|
+
&& infraDirective.dispatchAction === 'run_infra_repair'
|
|
2517
|
+
&& infraDirective.canRunProductRepair === false,
|
|
2518
|
+
details: { recoveryClass: infraPolicy.recoveryPlan.recoveryClass }
|
|
2519
|
+
}));
|
|
2520
|
+
const releasePlan = buildResolveIOAIManagerRecoveryPlan({
|
|
2521
|
+
action: 'continue',
|
|
2522
|
+
reason: 'publish failed after business proof',
|
|
2523
|
+
failureClass: 'release',
|
|
2524
|
+
lane: 'publish',
|
|
2525
|
+
stepType: 'test_deploy',
|
|
2526
|
+
blocker: 'Domain publish failed for the current artifact.'
|
|
2527
|
+
});
|
|
2528
|
+
const releaseCurrent = {
|
|
2529
|
+
lane: 'publish',
|
|
2530
|
+
stepType: 'test_deploy',
|
|
2531
|
+
outcome: 'needs_repair',
|
|
2532
|
+
failureClass: 'release',
|
|
2533
|
+
blocker: 'Domain publish failed for the current artifact.',
|
|
2534
|
+
evidenceHash: 'release-domain-publish-failed',
|
|
2535
|
+
artifactPaths: ['runner-evidence/release-status.json']
|
|
2536
|
+
};
|
|
2537
|
+
const releaseDirective = buildReplayDirectiveFromPlan({
|
|
2538
|
+
surface,
|
|
2539
|
+
plan: releasePlan,
|
|
2540
|
+
current: releaseCurrent
|
|
2541
|
+
});
|
|
2542
|
+
cases.push(replayCaseFromDirective({
|
|
2543
|
+
caseId: 'release_uses_hotfix_first_repair',
|
|
2544
|
+
surface,
|
|
2545
|
+
action: 'continue',
|
|
2546
|
+
reason: 'publish failed after business proof',
|
|
2547
|
+
directive: releaseDirective,
|
|
2548
|
+
expectedSafeAutoDispatch: includeReleaseRepair,
|
|
2549
|
+
pass: releasePlan.recoveryClass === 'release_repair'
|
|
2550
|
+
&& releaseDirective.dispatchAction === 'run_release_repair'
|
|
2551
|
+
&& releaseDirective.releasePolicy?.policy === 'hotfix_first'
|
|
2552
|
+
&& releaseDirective.releasePolicy?.fullDeployAllowed === false
|
|
2553
|
+
&& releaseDirective.canRunProductRepair === false,
|
|
2554
|
+
details: { recoveryClass: releasePlan.recoveryClass }
|
|
2555
|
+
}));
|
|
2556
|
+
const journeyPlan = buildResolveIOAIManagerRecoveryPlan({
|
|
2557
|
+
action: 'continue',
|
|
2558
|
+
reason: 'journey contract missing first next last',
|
|
2559
|
+
failureClass: 'journey',
|
|
2560
|
+
lane: 'plan',
|
|
2561
|
+
stepType: 'journey_contract',
|
|
2562
|
+
blocker: 'Journey contract does not map the hub CTA to an action.'
|
|
2563
|
+
});
|
|
2564
|
+
const journeyDirective = buildReplayDirectiveFromPlan({
|
|
2565
|
+
surface,
|
|
2566
|
+
plan: journeyPlan,
|
|
2567
|
+
current: {
|
|
2568
|
+
lane: 'plan',
|
|
2569
|
+
stepType: 'journey_contract',
|
|
2570
|
+
outcome: 'needs_repair',
|
|
2571
|
+
failureClass: 'journey',
|
|
2572
|
+
blocker: 'Journey contract does not map the hub CTA to an action.',
|
|
2573
|
+
evidenceHash: 'journey-contract-invalid'
|
|
2574
|
+
}
|
|
2575
|
+
});
|
|
2576
|
+
cases.push(replayCaseFromDirective({
|
|
2577
|
+
caseId: 'journey_repair_is_safe_only_for_aicoder_surfaces',
|
|
2578
|
+
surface,
|
|
2579
|
+
action: 'continue',
|
|
2580
|
+
reason: 'journey contract missing first next last',
|
|
2581
|
+
directive: journeyDirective,
|
|
2582
|
+
expectedSafeAutoDispatch: includeJourneyContractRepair,
|
|
2583
|
+
pass: journeyPlan.recoveryClass === 'journey_contract_repair'
|
|
2584
|
+
&& journeyDirective.dispatchAction === 'run_journey_contract_repair'
|
|
2585
|
+
&& journeyDirective.canRunProductRepair === false,
|
|
2586
|
+
details: { recoveryClass: journeyPlan.recoveryClass }
|
|
2587
|
+
}));
|
|
2588
|
+
const weakPolicy = decideResolveIOAIManagerPolicy({
|
|
2589
|
+
history: [
|
|
2590
|
+
{ lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'save-before' },
|
|
2591
|
+
{ lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'renamed-hash-only' }
|
|
2592
|
+
],
|
|
2593
|
+
current: { lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'renamed-hash-only' },
|
|
2594
|
+
maxSameFailureRepeats
|
|
2595
|
+
});
|
|
2596
|
+
const weakDirective = buildResolveIOAIManagerRecoveryExecutionDirective({
|
|
2597
|
+
action: weakPolicy.recoveryAction,
|
|
2598
|
+
current: { lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'renamed-hash-only' },
|
|
2599
|
+
surface
|
|
2600
|
+
});
|
|
2601
|
+
cases.push(replayCaseFromDirective({
|
|
2602
|
+
caseId: 'weak_hash_only_evidence_stays_parked',
|
|
2603
|
+
surface,
|
|
2604
|
+
action: weakPolicy.action,
|
|
2605
|
+
reason: weakPolicy.reason,
|
|
2606
|
+
directive: weakDirective,
|
|
2607
|
+
expectedSafeAutoDispatch: true,
|
|
2608
|
+
pass: weakPolicy.action === 'park_repeated_failure'
|
|
2609
|
+
&& weakPolicy.materialEvidence === false
|
|
2610
|
+
&& weakPolicy.loopBudgetShouldReset === false
|
|
2611
|
+
&& weakDirective.dispatchAction === 'run_evidence_probe',
|
|
2612
|
+
loopBudgetShouldReset: weakPolicy.loopBudgetShouldReset,
|
|
2613
|
+
materialEvidence: weakPolicy.materialEvidence,
|
|
2614
|
+
evidenceStrength: weakPolicy.evidenceStrength,
|
|
2615
|
+
details: { evidenceSignals: weakPolicy.evidenceSignals }
|
|
2616
|
+
}));
|
|
2617
|
+
const materialPolicy = decideResolveIOAIManagerPolicy({
|
|
2618
|
+
history: [
|
|
2619
|
+
{ lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'save-before', artifactPaths: ['qa/save-before.log'] },
|
|
2620
|
+
{
|
|
2621
|
+
lane: 'repair',
|
|
2622
|
+
stepType: 'repair',
|
|
2623
|
+
outcome: 'needs_repair',
|
|
2624
|
+
failureClass: 'product_code',
|
|
2625
|
+
blocker: 'Save action still throws TypeError.',
|
|
2626
|
+
summary: 'New DOM trace proves the click reaches the method with an undefined id.',
|
|
2627
|
+
evidenceHash: 'save-dom-trace',
|
|
2628
|
+
artifactPaths: ['qa/save-before.log', 'qa/save-dom-trace.json']
|
|
2629
|
+
}
|
|
2630
|
+
],
|
|
2631
|
+
current: {
|
|
2632
|
+
lane: 'repair',
|
|
2633
|
+
stepType: 'repair',
|
|
2634
|
+
outcome: 'needs_repair',
|
|
2635
|
+
failureClass: 'product_code',
|
|
2636
|
+
blocker: 'Save action still throws TypeError.',
|
|
2637
|
+
summary: 'New DOM trace proves the click reaches the method with an undefined id.',
|
|
2638
|
+
evidenceHash: 'save-dom-trace',
|
|
2639
|
+
artifactPaths: ['qa/save-before.log', 'qa/save-dom-trace.json']
|
|
2640
|
+
},
|
|
2641
|
+
maxSameFailureRepeats
|
|
2642
|
+
});
|
|
2643
|
+
cases.push({
|
|
2644
|
+
caseId: 'material_evidence_resets_loop_budget',
|
|
2645
|
+
surface,
|
|
2646
|
+
pass: materialPolicy.action === 'continue'
|
|
2647
|
+
&& materialPolicy.materialEvidence === true
|
|
2648
|
+
&& materialPolicy.loopBudgetShouldReset === true,
|
|
2649
|
+
action: materialPolicy.action,
|
|
2650
|
+
reason: materialPolicy.reason,
|
|
2651
|
+
recoveryClass: materialPolicy.recoveryPlan.recoveryClass,
|
|
2652
|
+
dispatchAction: materialPolicy.recoveryAction.mode,
|
|
2653
|
+
safeAutoDispatch: false,
|
|
2654
|
+
expectedSafeAutoDispatch: false,
|
|
2655
|
+
productRepairAllowed: materialPolicy.recoveryAction.productRepairAllowed,
|
|
2656
|
+
loopBudgetShouldReset: materialPolicy.loopBudgetShouldReset,
|
|
2657
|
+
materialEvidence: materialPolicy.materialEvidence,
|
|
2658
|
+
evidenceStrength: materialPolicy.evidenceStrength,
|
|
2659
|
+
details: { evidenceSignals: materialPolicy.evidenceSignals }
|
|
2660
|
+
});
|
|
2661
|
+
const productPlan = buildResolveIOAIManagerRecoveryPlan({
|
|
2662
|
+
action: 'continue',
|
|
2663
|
+
reason: 'business proof still failing',
|
|
2664
|
+
failureClass: 'product_code',
|
|
2665
|
+
lane: 'repair',
|
|
2666
|
+
stepType: 'repair',
|
|
2667
|
+
blocker: 'Save action still throws TypeError.',
|
|
2668
|
+
productRepairFailure: true
|
|
2669
|
+
});
|
|
2670
|
+
const productDirective = buildReplayDirectiveFromPlan({
|
|
2671
|
+
surface,
|
|
2672
|
+
plan: productPlan,
|
|
2673
|
+
current: {
|
|
2674
|
+
lane: 'repair',
|
|
2675
|
+
stepType: 'repair',
|
|
2676
|
+
outcome: 'needs_repair',
|
|
2677
|
+
failureClass: 'product_code',
|
|
2678
|
+
blocker: 'Save action still throws TypeError.',
|
|
2679
|
+
evidenceHash: 'save-product-repair'
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
const productSafe = isResolveIOAIManagerSafeAutoDispatch({
|
|
2683
|
+
dispatchAction: productDirective.dispatchAction,
|
|
2684
|
+
directive: productDirective,
|
|
2685
|
+
includeProductRepair: input.includeProductRepair === true
|
|
2686
|
+
});
|
|
2687
|
+
cases.push({
|
|
2688
|
+
caseId: 'product_repair_requires_explicit_operator_policy',
|
|
2689
|
+
surface,
|
|
2690
|
+
pass: productPlan.recoveryClass === 'product_code_repair'
|
|
2691
|
+
&& productDirective.dispatchAction === 'run_targeted_product_repair'
|
|
2692
|
+
&& productSafe === false,
|
|
2693
|
+
action: 'continue',
|
|
2694
|
+
reason: 'business proof still failing',
|
|
2695
|
+
recoveryClass: productPlan.recoveryClass,
|
|
2696
|
+
dispatchAction: productDirective.dispatchAction,
|
|
2697
|
+
safeAutoDispatch: productSafe,
|
|
2698
|
+
expectedSafeAutoDispatch: false,
|
|
2699
|
+
productRepairAllowed: productDirective.canRunProductRepair,
|
|
2700
|
+
loopBudgetShouldReset: false,
|
|
2701
|
+
materialEvidence: false,
|
|
2702
|
+
evidenceStrength: 'none',
|
|
2703
|
+
details: { phase: productDirective.phase, allowed: productDirective.allowed }
|
|
2704
|
+
});
|
|
2705
|
+
const duplicateReleasePolicy = buildResolveIOAIManagerHotfixFirstReleasePolicy({
|
|
2706
|
+
surface,
|
|
2707
|
+
deployFingerprint: `${surface}-artifact-sha`,
|
|
2708
|
+
lastDeployFingerprint: `${surface}-artifact-sha`,
|
|
2709
|
+
deployStatus: 'completed',
|
|
2710
|
+
publishStatus: 'published'
|
|
2711
|
+
});
|
|
2712
|
+
cases.push({
|
|
2713
|
+
caseId: 'duplicate_release_fingerprint_blocks_full_deploy',
|
|
2714
|
+
surface,
|
|
2715
|
+
pass: duplicateReleasePolicy.recommendedAction === 'block_duplicate_deploy'
|
|
2716
|
+
&& duplicateReleasePolicy.duplicateDeployBlocked === true
|
|
2717
|
+
&& duplicateReleasePolicy.fullDeployAllowed === false,
|
|
2718
|
+
action: duplicateReleasePolicy.recommendedAction,
|
|
2719
|
+
reason: duplicateReleasePolicy.reason,
|
|
2720
|
+
recoveryClass: 'release_repair',
|
|
2721
|
+
dispatchAction: 'run_release_repair',
|
|
2722
|
+
safeAutoDispatch: includeReleaseRepair,
|
|
2723
|
+
expectedSafeAutoDispatch: includeReleaseRepair,
|
|
2724
|
+
productRepairAllowed: false,
|
|
2725
|
+
loopBudgetShouldReset: false,
|
|
2726
|
+
materialEvidence: false,
|
|
2727
|
+
evidenceStrength: 'none',
|
|
2728
|
+
hotfixFirst: true,
|
|
2729
|
+
fullDeployAllowed: duplicateReleasePolicy.fullDeployAllowed,
|
|
2730
|
+
details: { releasePolicy: duplicateReleasePolicy }
|
|
2731
|
+
});
|
|
2732
|
+
return cases;
|
|
2733
|
+
}
|