@attalabs/vinaya 0.36.0 → 0.38.0
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/README.md +6 -6
- package/aeg-root/contracts/developer-reviewer.md +1 -1
- package/aeg-root/contracts/planner-operator.md +1 -1
- package/aeg-root/contracts/principal-operator.md +6 -6
- package/aeg-root/contracts/security-archivist.md +1 -1
- package/aeg-root/enforcement.md +14 -14
- package/aeg-root/process.md +3 -1
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer/reference.md +36 -37
- package/aeg-root/roles/developer.md +9 -5
- package/aeg-root/roles/operator.md +18 -18
- package/aeg-root/roles/planner/reference.md +15 -4
- package/aeg-root/roles/principal.md +6 -1
- package/aeg-root/roles/reviewer.md +14 -6
- package/aeg-root/roles/security.md +22 -11
- package/aeg-root/roles/tranche-archivist.md +14 -2
- package/aeg-root/state-machine.md +12 -11
- package/aeg-root/templates/brief-template.md +8 -6
- package/aeg-root/templates/pr-report-template.md +1 -9
- package/aeg-root/tranche-model.md +10 -4
- package/dist/checks/bin/check-body-bare-digits.js +823 -595
- package/dist/checks/bin/check-branch-topology.js +796 -478
- package/dist/checks/bin/check-brief-shape.js +824 -596
- package/dist/checks/bin/check-changeset-coverage.js +1337 -747
- package/dist/checks/bin/check-closes-n.js +796 -478
- package/dist/checks/bin/check-coherence.js +914 -611
- package/dist/checks/bin/check-dead-branch-push.js +705 -462
- package/dist/checks/bin/check-dispatch-readiness.js +941 -624
- package/dist/checks/bin/check-doc-coverage-push.js +1332 -742
- package/dist/checks/bin/check-doc-coverage.js +1339 -742
- package/dist/checks/bin/check-doctrine-no-procedures.js +821 -593
- package/dist/checks/bin/check-doctrine-portability.js +1332 -742
- package/dist/checks/bin/check-evidence-fresh.js +1339 -918
- package/dist/checks/bin/check-exec-bits.js +1331 -741
- package/dist/checks/bin/check-first-push-dispatch.js +917 -614
- package/dist/checks/bin/check-issue-assignment.js +796 -478
- package/dist/checks/bin/check-issue-milestone-attach.js +705 -462
- package/dist/checks/bin/check-issue-objectives-numbering.js +821 -593
- package/dist/checks/bin/check-issue-parts-coverage.js +705 -462
- package/dist/checks/bin/check-issue-surface-globs.js +925 -613
- package/dist/checks/bin/check-issue-title-grammar.js +705 -462
- package/dist/checks/bin/check-issue-tranche-label.js +705 -462
- package/dist/checks/bin/check-main-branch-refusal.js +705 -462
- package/dist/checks/bin/check-no-disk-state.js +705 -462
- package/dist/checks/bin/check-pr-premise-reassert.js +821 -593
- package/dist/checks/bin/check-pr-report-density.js +705 -462
- package/dist/checks/bin/check-principal-test-plan-wait.js +705 -462
- package/dist/checks/bin/check-quoted-command.js +1816 -1228
- package/dist/checks/bin/check-reader-resolvable-prose.js +1835 -1235
- package/dist/checks/bin/check-registry-gates.js +993 -526
- package/dist/checks/bin/check-retired-vocabulary.js +1810 -1222
- package/dist/checks/bin/check-review-gate.js +832 -604
- package/dist/checks/bin/check-single-plan-pr.js +705 -462
- package/dist/checks/bin/check-surface-scope.js +796 -478
- package/dist/checks/bin/check-test-plan.js +705 -462
- package/dist/checks/bin/check-token-collection-wired.js +705 -462
- package/dist/checks/bin/check-workspace-escape.js +1332 -742
- package/dist/checks/bin/verify-dispatch.js +3849 -0
- package/dist/index.js +20876 -10091
- package/dist/lib/pre-push-cache-test-run.js +1045 -682
- package/dist/lib/pre-push-changed-files.js +16 -11
- package/dist/lib/pre-push-select-tests.js +785 -500
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +7 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +71 -15
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +51 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +50 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +443 -28
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +18 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +6 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +13 -13
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +46 -110
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +169 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +3 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +30 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +0 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +82 -8
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +754 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +24 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/custom.ts +157 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +44 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/executions.ts +493 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/fact-sheets.ts +111 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/generator.ts +155 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/index.ts +12 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +128 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/catches.ts +63 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/checks.ts +146 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/common.ts +137 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/completion.ts +137 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/convergence.ts +420 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/determinism.ts +65 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/index.ts +69 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/judgment.ts +132 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/labels.ts +21 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/time.ts +167 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/usage.ts +139 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +226 -15
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +7 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/cache-contract.ts +207 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/contracts.ts +105 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/engine.ts +308 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/index.ts +34 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/measured.ts +20 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/memory-cache.ts +78 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/normalize.ts +156 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/row.ts +103 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +34 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +70 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +19 -14
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +201 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +5 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +46 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +15 -28
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0h9yhwx._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__0jdjsxe._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1-acpmtfmrc35.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 2f2y8xxok8zph.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 2xevgia1h8g0y.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- package/dist/checks/bin/check-token-report.js +0 -6526
- package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
- package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00z3-ljjd1gj9.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_ssgManifest.js +0 -0
package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts
CHANGED
|
@@ -21,8 +21,10 @@
|
|
|
21
21
|
* - The three exits are decided here and nowhere else: an id previously
|
|
22
22
|
* `resolved` reported again (`stop_condition_met` `condition: 'reappearance'`),
|
|
23
23
|
* a confidence collapse per the rule above (`condition: 'confidence'`), and
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* a round that reaches the cap without going green (`condition: 'max_rounds'`;
|
|
25
|
+
* the default cap is 3, so rounds 1–3 run and the loop pauses after round
|
|
26
|
+
* 3's review, and a green round at the cap still publishes) — distinct
|
|
27
|
+
* `condition` values a 2026-09-06 amendment adds to `stop_condition_met.condition` so a reader
|
|
26
28
|
* tells a confidence collapse and a finding reappearance apart from each
|
|
27
29
|
* other and from the round cap. A fourth exit once lived here too — two
|
|
28
30
|
* consecutive rounds resolving no id (`condition: 'no_progress'`) — but it
|
|
@@ -31,6 +33,26 @@
|
|
|
31
33
|
* progress; it is removed. The `no_progress` condition and pause reason
|
|
32
34
|
* survive only for the driver's own attach-redelivery pause and for
|
|
33
35
|
* already-written journals, never as an assessment exit here.
|
|
36
|
+
* - Two further exits, each with its own `condition` value and pause reason,
|
|
37
|
+
* stop a loop that is repeating itself rather than converging: the same
|
|
38
|
+
* BLOCKING finding — same reviewer role, same finding id — still open in
|
|
39
|
+
* two consecutive reviewed rounds (`condition: 'repeat_finding'`), and two
|
|
40
|
+
* consecutive attempts ending on the same mechanical failure
|
|
41
|
+
* (`condition: 'repeat_failure'`). Neither revives `no_progress`: a round
|
|
42
|
+
* that resolves nothing but raises only new findings still continues, and
|
|
43
|
+
* a round whose repeated finding is non-blocking continues too. Both name
|
|
44
|
+
* what repeated in the pause's own `detail`.
|
|
45
|
+
* - One further exit bounds the task by TIME rather than by rounds or repeats:
|
|
46
|
+
* the task's ACTIVE working time — the sum of the phases a driver spent
|
|
47
|
+
* developing, reviewing and awaiting confidence, never the hours it sat
|
|
48
|
+
* paused, published or driverless — passing `ReviewPolicy.maxTaskMinutes`
|
|
49
|
+
* (`condition: 'time_budget'`). It is the one exit a loop cannot outrun by
|
|
50
|
+
* never advancing — the round cap bounds review rounds, and a loop stuck
|
|
51
|
+
* pushing, rebasing and retrying advances no round at all — and the one whose
|
|
52
|
+
* measurement this module cannot make itself: the caller reads the clock and
|
|
53
|
+
* hands it in (`TaskClock.elapsedMs`, already the active sum), since the
|
|
54
|
+
* per-phase times that survive a driver restart live in the durable control
|
|
55
|
+
* records, which nothing in this package may read.
|
|
34
56
|
*
|
|
35
57
|
* Reuse, not a second counter: the id-state map for each round is built by
|
|
36
58
|
* calling `groupRounds` (`../review-status`) with synthetic same-key
|
|
@@ -43,11 +65,14 @@
|
|
|
43
65
|
* there and nowhere else"), built on the reused map.
|
|
44
66
|
*/
|
|
45
67
|
|
|
68
|
+
import { CODE_TOKEN_PATTERN, ROLE_VALUES, type Role } from '../log/schema'
|
|
46
69
|
import { groupRounds, type Round, type VerdictComment } from '../review-status'
|
|
70
|
+
import { isActiveBudgetPhase, taskPhaseLabel } from '../task-phase-history'
|
|
47
71
|
import {
|
|
48
72
|
SEVERITY_COLUMNS,
|
|
49
73
|
type Confidence,
|
|
50
74
|
type Decision,
|
|
75
|
+
type DeferredFindingRow,
|
|
51
76
|
type DevReviewLoopEventInput,
|
|
52
77
|
type LoopState,
|
|
53
78
|
type NotReviewedReason,
|
|
@@ -56,6 +81,7 @@ import {
|
|
|
56
81
|
type RoundOutcome,
|
|
57
82
|
type RoundRecord,
|
|
58
83
|
type RoundStats,
|
|
84
|
+
type TaskClock,
|
|
59
85
|
type VerdictObservation
|
|
60
86
|
} from './types'
|
|
61
87
|
|
|
@@ -148,6 +174,39 @@ function toReviewFinding(f: VerdictObservation['findings'][number]): {
|
|
|
148
174
|
}
|
|
149
175
|
}
|
|
150
176
|
|
|
177
|
+
/** The doctrine role a verdict's own role names — `VerdictObservation.role` says `'reviewer'` where the log's role vocabulary says `'code-reviewer'`. */
|
|
178
|
+
function verdictLogRole(role: VerdictObservation['role']): Role {
|
|
179
|
+
return role === 'reviewer' ? 'code-reviewer' : role
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* One entry per reviewer role the loop held or expected a verdict from, taken
|
|
184
|
+
* from the verdicts themselves (never from the findings): a role that
|
|
185
|
+
* approved with no findings appears, and a configured role with no verdict
|
|
186
|
+
* reads `not_reviewed`. A blocking verdict contributes one blocker, so the
|
|
187
|
+
* entries add up to the event's own `blockers`; an `ESCALATE` verdict is not
|
|
188
|
+
* an approval and not a counted blocker, so it reads `changes_requested`
|
|
189
|
+
* with none.
|
|
190
|
+
*/
|
|
191
|
+
function reviewerEntries(
|
|
192
|
+
state: LoopState,
|
|
193
|
+
verdicts: VerdictObservation[]
|
|
194
|
+
): NonNullable<Extract<DevReviewLoopEventInput, { event: 'verdicts_read' }>['reviewers']> {
|
|
195
|
+
const held = new Map(verdicts.map((v) => [verdictLogRole(v.role), v]))
|
|
196
|
+
const isRole = (value: string): value is Role => (ROLE_VALUES as readonly string[]).includes(value)
|
|
197
|
+
const roles = [...new Set([...state.config.reviewers.filter(isRole), ...held.keys()])]
|
|
198
|
+
return roles.map((role) => {
|
|
199
|
+
const v = held.get(role)
|
|
200
|
+
const entry =
|
|
201
|
+
v === undefined
|
|
202
|
+
? { outcome: 'not_reviewed' as const, blockers: 0 }
|
|
203
|
+
: v.verdict === 'APPROVE' || v.verdict === 'PASS'
|
|
204
|
+
? { outcome: 'approve' as const, blockers: 0 }
|
|
205
|
+
: { outcome: 'changes_requested' as const, blockers: v.verdict === 'ESCALATE' ? 0 : 1 }
|
|
206
|
+
return { role, ...entry }
|
|
207
|
+
})
|
|
208
|
+
}
|
|
209
|
+
|
|
151
210
|
function verdictsReadEvent(state: LoopState, round: number, verdicts: VerdictObservation[]): DevReviewLoopEventInput {
|
|
152
211
|
const allApprove = verdicts.every((v) => v.verdict === 'APPROVE' || v.verdict === 'PASS')
|
|
153
212
|
const head = pendingHead(state, round)
|
|
@@ -160,7 +219,8 @@ function verdictsReadEvent(state: LoopState, round: number, verdicts: VerdictObs
|
|
|
160
219
|
head,
|
|
161
220
|
all_approve: allApprove,
|
|
162
221
|
blockers,
|
|
163
|
-
findings
|
|
222
|
+
findings,
|
|
223
|
+
reviewers: reviewerEntries(state, verdicts)
|
|
164
224
|
}
|
|
165
225
|
}
|
|
166
226
|
|
|
@@ -173,7 +233,16 @@ function findingsComparedEvent(state: LoopState, fc: FindingsCompared): DevRevie
|
|
|
173
233
|
function stopConditionMetEvent(
|
|
174
234
|
state: LoopState,
|
|
175
235
|
round: number,
|
|
176
|
-
condition:
|
|
236
|
+
condition:
|
|
237
|
+
| 'green'
|
|
238
|
+
| 'max_rounds'
|
|
239
|
+
| 'no_progress'
|
|
240
|
+
| 'escalated'
|
|
241
|
+
| 'confidence'
|
|
242
|
+
| 'reappearance'
|
|
243
|
+
| 'repeat_finding'
|
|
244
|
+
| 'repeat_failure'
|
|
245
|
+
| 'time_budget'
|
|
177
246
|
): DevReviewLoopEventInput {
|
|
178
247
|
return { ...loopEventEnvelope(state), event: 'stop_condition_met', round, condition }
|
|
179
248
|
}
|
|
@@ -181,9 +250,16 @@ function stopConditionMetEvent(
|
|
|
181
250
|
function pausedEvent(
|
|
182
251
|
state: LoopState,
|
|
183
252
|
round: number,
|
|
184
|
-
reason: 'escalation' | 'principal_item'
|
|
253
|
+
reason: 'escalation' | 'principal_item',
|
|
254
|
+
reasonCode: string
|
|
185
255
|
): DevReviewLoopEventInput {
|
|
186
|
-
return {
|
|
256
|
+
return {
|
|
257
|
+
...loopEventEnvelope(state),
|
|
258
|
+
event: 'paused',
|
|
259
|
+
round,
|
|
260
|
+
reason,
|
|
261
|
+
reason_code: CODE_TOKEN_PATTERN.test(reasonCode) ? reasonCode : 'unknown'
|
|
262
|
+
}
|
|
187
263
|
}
|
|
188
264
|
|
|
189
265
|
function roundEndedEvent(
|
|
@@ -236,20 +312,29 @@ function buildRoundRecord(
|
|
|
236
312
|
): RoundRecord {
|
|
237
313
|
// Every column this round MEASURED, seeded at zero before a single finding
|
|
238
314
|
// is counted — so a round the loop assessed and found nothing in is a
|
|
239
|
-
// recorded zero, not an absent count.
|
|
240
|
-
// apart
|
|
315
|
+
// recorded zero, not an absent count. A reader needs the two told
|
|
316
|
+
// apart: a round rebuilt from the pull
|
|
241
317
|
// request's markers after a restart has no counts at all, and must report
|
|
242
318
|
// nothing rather than a zero a reader would take for a clean round.
|
|
243
319
|
const countsBySeverity: Record<string, number> = {}
|
|
244
320
|
for (const key of SEVERITY_COLUMNS) countsBySeverity[key] = 0
|
|
321
|
+
// O4: the findings this round set aside rather than let them block, in the
|
|
322
|
+
// order the verdicts reported them, each with its original severity and
|
|
323
|
+
// location — never its reported severity mutated (that is the whole point
|
|
324
|
+
// of a deferral: the finding is real, this round just cannot act on it).
|
|
325
|
+
const deferred: DeferredFindingRow[] = []
|
|
245
326
|
for (const v of verdicts) {
|
|
246
327
|
for (const f of v.findings) {
|
|
247
328
|
const key = f.severity.toLowerCase()
|
|
248
|
-
if (
|
|
249
|
-
|
|
329
|
+
if ((SEVERITY_COLUMNS as readonly string[]).includes(key)) {
|
|
330
|
+
countsBySeverity[key] = (countsBySeverity[key] ?? 0) + 1
|
|
331
|
+
}
|
|
332
|
+
if (f.deferred !== undefined) {
|
|
333
|
+
deferred.push({ severity: f.severity, location: f.location ?? '', reason: f.deferred })
|
|
334
|
+
}
|
|
250
335
|
}
|
|
251
336
|
}
|
|
252
|
-
return { round, countsBySeverity, confidence, outcome }
|
|
337
|
+
return { round, countsBySeverity, confidence, outcome, ...(deferred.length > 0 ? { deferred } : {}) }
|
|
253
338
|
}
|
|
254
339
|
|
|
255
340
|
/**
|
|
@@ -257,9 +342,7 @@ function buildRoundRecord(
|
|
|
257
342
|
* below-threshold confidence sent the developer back — has no findings from any
|
|
258
343
|
* source. Unlike `buildRoundRecord`, it records NO counts (an empty
|
|
259
344
|
* `countsBySeverity`, the shape a marker-reconstructed round also carries), so
|
|
260
|
-
*
|
|
261
|
-
* renderer's existing "counts have no source" path, never a `0` a reader would
|
|
262
|
-
* take for a clean review (`countCells`, `render-summary.ts`). `outcome` is left
|
|
345
|
+
* no severity column reads as a `0` a reader would take for a clean review. `outcome` is left
|
|
263
346
|
* exactly as this round would otherwise carry — the `round_ended` log event is
|
|
264
347
|
* unchanged — and `notReviewed` names why no reviewer saw it for the table's
|
|
265
348
|
* outcome cell.
|
|
@@ -310,6 +393,87 @@ function computeFindingsCompared(
|
|
|
310
393
|
return { round, open, resolved, new: newIds, recurring }
|
|
311
394
|
}
|
|
312
395
|
|
|
396
|
+
/**
|
|
397
|
+
* A round's BLOCKING, still-open findings as `<role>:<id>` keys, sorted and
|
|
398
|
+
* de-duplicated — the identity the `'repeat_finding'` stop compares across
|
|
399
|
+
* rounds. Two deliberate narrowings: a finding counts as the same one only by
|
|
400
|
+
* reviewer role AND id (the same id from the two roles is two findings, since
|
|
401
|
+
* each role numbers its own report), and only a finding the effective policy
|
|
402
|
+
* treated as `blocking` counts at all — a `non_blocking` finding never sent
|
|
403
|
+
* the developer back, so its repeat is not a loop failing to converge. A
|
|
404
|
+
* finding whose treatment the observation does not state is not counted
|
|
405
|
+
* either: the stop pauses a task, and an unstated treatment is not evidence.
|
|
406
|
+
* A deferred finding is excluded by the same test, without naming deferral at
|
|
407
|
+
* all: `policyTreatment` reads `non_blocking` whenever `deferred` is set
|
|
408
|
+
* (`types.ts`), and a finding the round never asked the developer to act on
|
|
409
|
+
* cannot be one the developer failed to close.
|
|
410
|
+
*/
|
|
411
|
+
function blockingOpenKeys(verdicts: VerdictObservation[]): string[] {
|
|
412
|
+
const keys = new Set<string>()
|
|
413
|
+
for (const v of verdicts) {
|
|
414
|
+
for (const f of v.findings) {
|
|
415
|
+
if (f.policyTreatment !== 'blocking') continue
|
|
416
|
+
if (f.state === 'resolved') continue
|
|
417
|
+
keys.add(`${v.role}:${f.id}`)
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return [...keys].sort()
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* The fixed volatile-token list the `'repeat_failure'` stop matches on —
|
|
425
|
+
* everything that naturally differs between two runs of the SAME failure and
|
|
426
|
+
* nothing that distinguishes two DIFFERENT ones. Timestamps, temporary
|
|
427
|
+
* directories, process ids, durations and commit shas become a fixed
|
|
428
|
+
* placeholder; the message's own words — which check failed, which premise
|
|
429
|
+
* pin is absent — survive untouched, so `absent: maxRounds` and
|
|
430
|
+
* `absent: reviewers` never collapse into one signature.
|
|
431
|
+
*/
|
|
432
|
+
const VOLATILE_TOKENS: readonly { pattern: RegExp; replacement: string }[] = [
|
|
433
|
+
// ISO-8601 timestamps, with or without fractional seconds and zone.
|
|
434
|
+
{ pattern: /\d{4}-\d{2}-\d{2}[t ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:z|[+-]\d{2}:?\d{2})?/g, replacement: '<ts>' },
|
|
435
|
+
// A bare clock time — a log line's own prefix.
|
|
436
|
+
{ pattern: /\b\d{1,2}:\d{2}:\d{2}\b/g, replacement: '<ts>' },
|
|
437
|
+
// Temporary directories — the per-run scratch paths a retry never reuses.
|
|
438
|
+
{ pattern: /(?:\/private)?\/(?:tmp|var\/folders)\/[^\s,;)'"]*/g, replacement: '<tmp>' },
|
|
439
|
+
// Process ids, however the producer spells them.
|
|
440
|
+
{ pattern: /\b(?:pid|process)[ =:]+\d+/g, replacement: 'pid <pid>' },
|
|
441
|
+
// Durations: 1200ms, 1.2s, 90 seconds, 3m.
|
|
442
|
+
{ pattern: /\b\d+(?:\.\d+)?\s*(?:ms|s|m|h|milliseconds?|seconds?|minutes?|hours?)\b/g, replacement: '<dur>' },
|
|
443
|
+
// Commit shas and other long hex runs.
|
|
444
|
+
{ pattern: /\b[0-9a-f]{7,40}\b/g, replacement: '<sha>' }
|
|
445
|
+
]
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* What the `'repeat_failure'` rule makes of one reported failure: the
|
|
449
|
+
* `{signature, message}` pair to remember (`null` for a failure the driver
|
|
450
|
+
* could not name — nothing left after normalisation), and whether it matches
|
|
451
|
+
* the previous attempt's. Shared by both observation kinds that can carry a
|
|
452
|
+
* mechanical failure, so a repeat means the same thing whether or not the
|
|
453
|
+
* attempt produced a head.
|
|
454
|
+
*/
|
|
455
|
+
function matchFailure(
|
|
456
|
+
state: LoopState,
|
|
457
|
+
reported: string | undefined
|
|
458
|
+
): { failure: { signature: string; message: string } | null; repeat: boolean } {
|
|
459
|
+
const message = reported?.trim() ?? ''
|
|
460
|
+
const signature = message === '' ? '' : normalizeFailureSignature(message)
|
|
461
|
+
if (signature === '') return { failure: null, repeat: false }
|
|
462
|
+
return { failure: { signature, message }, repeat: state.lastFailure?.signature === signature }
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* One mechanical failure's matching signature (O3) — lower-cased, volatile
|
|
467
|
+
* tokens replaced per the fixed list above, whitespace collapsed. Pure and
|
|
468
|
+
* total: any string in, a signature out; the empty string for a message with
|
|
469
|
+
* nothing left, which the caller treats as no signature at all.
|
|
470
|
+
*/
|
|
471
|
+
export function normalizeFailureSignature(message: string): string {
|
|
472
|
+
let out = message.toLowerCase()
|
|
473
|
+
for (const { pattern, replacement } of VOLATILE_TOKENS) out = out.replace(pattern, replacement)
|
|
474
|
+
return out.replace(/\s+/g, ' ').trim()
|
|
475
|
+
}
|
|
476
|
+
|
|
313
477
|
function mergedIds(
|
|
314
478
|
priorIds: Map<string, string | null>,
|
|
315
479
|
currentIds: Map<string, string | null>
|
|
@@ -321,7 +485,7 @@ function mergedIds(
|
|
|
321
485
|
|
|
322
486
|
function assessGate(
|
|
323
487
|
state: LoopState,
|
|
324
|
-
obs: { round: number; green: boolean; confidence?: Confidence; stats: RoundStats }
|
|
488
|
+
obs: { round: number; green: boolean; confidence?: Confidence; stats: RoundStats; failure?: string }
|
|
325
489
|
): { decision: Decision; state: LoopState; events: DevReviewLoopEventInput[] } {
|
|
326
490
|
const events: DevReviewLoopEventInput[] = []
|
|
327
491
|
const isNewRound = state.pending === null || state.pending.round !== obs.round
|
|
@@ -338,17 +502,52 @@ function assessGate(
|
|
|
338
502
|
events.push(gateResultReadEvent(state, obs.round, obs.stats.head, obs.green, obs.confidence))
|
|
339
503
|
|
|
340
504
|
if (!obs.green) {
|
|
505
|
+
// The mechanical failure that ended this attempt, matched against the
|
|
506
|
+
// previous attempt's by normalised signature — never by raw equality,
|
|
507
|
+
// which two runs of the same failure never satisfy (different
|
|
508
|
+
// timestamps, scratch paths, process ids, durations). A failure the
|
|
509
|
+
// driver could not name at all (`undefined`, or nothing left after
|
|
510
|
+
// normalisation) is no signature: it breaks the chain rather than
|
|
511
|
+
// matching one unknown to another.
|
|
512
|
+
const { failure, repeat } = matchFailure(state, obs.failure)
|
|
513
|
+
if (repeat && failure !== null) {
|
|
514
|
+
events.push(stopConditionMetEvent(state, obs.round, 'repeat_failure'))
|
|
515
|
+
events.push(pausedEvent(state, obs.round, 'principal_item', 'repeat_failure'))
|
|
516
|
+
events.push(roundEndedEvent(state, obs.round, obs.stats, 'changes_requested'))
|
|
517
|
+
const record = buildUnreviewedRecord(obs.round, null, 'stopped', 'checks_red')
|
|
518
|
+
const preFinalize: LoopState = {
|
|
519
|
+
...state,
|
|
520
|
+
rounds: [...state.rounds, record],
|
|
521
|
+
pending: null,
|
|
522
|
+
lastFailure: failure,
|
|
523
|
+
...withRoundStats(state, obs.stats)
|
|
524
|
+
}
|
|
525
|
+
events.push(journalFinalizedEvent(preFinalize, obs.stats.head, 'stopped'))
|
|
526
|
+
// The pause carries the failure as reported, not the signature: the
|
|
527
|
+
// normalised form exists only to match two attempts, never to be read.
|
|
528
|
+
return {
|
|
529
|
+
decision: { type: 'pause', reason: 'repeat_failure', detail: failure.message },
|
|
530
|
+
state: preFinalize,
|
|
531
|
+
events
|
|
532
|
+
}
|
|
533
|
+
}
|
|
341
534
|
events.push(roundEndedEvent(state, obs.round, obs.stats, 'changes_requested'))
|
|
342
535
|
const record = buildUnreviewedRecord(obs.round, null, 'changes_requested', 'checks_red')
|
|
343
536
|
const newState: LoopState = {
|
|
344
537
|
...state,
|
|
345
538
|
rounds: [...state.rounds, record],
|
|
346
539
|
pending: null,
|
|
540
|
+
lastFailure: failure,
|
|
347
541
|
...withRoundStats(state, obs.stats)
|
|
348
542
|
}
|
|
349
543
|
return { decision: { type: 'dispatch_developer' }, state: newState, events }
|
|
350
544
|
}
|
|
351
545
|
|
|
546
|
+
// Past the red branch the gate is green: whatever mechanical failure the
|
|
547
|
+
// previous attempt hit is over, so the repeat chain starts again from
|
|
548
|
+
// nothing. Every state this function returns below carries that.
|
|
549
|
+
const clearedFailure = { lastFailure: null } as const
|
|
550
|
+
|
|
352
551
|
if (obs.round === 1) {
|
|
353
552
|
const pending: PendingRound = {
|
|
354
553
|
round: obs.round,
|
|
@@ -357,7 +556,7 @@ function assessGate(
|
|
|
357
556
|
confidence: obs.confidence ?? null,
|
|
358
557
|
priorIds: state.lastIds
|
|
359
558
|
}
|
|
360
|
-
return { decision: { type: 'dispatch_reviewers' }, state: { ...state, pending }, events }
|
|
559
|
+
return { decision: { type: 'dispatch_reviewers' }, state: { ...state, ...clearedFailure, pending }, events }
|
|
361
560
|
}
|
|
362
561
|
|
|
363
562
|
// Round ≥ 2: the confidence gate.
|
|
@@ -367,11 +566,12 @@ function assessGate(
|
|
|
367
566
|
if (confidence === 'absent') {
|
|
368
567
|
if (priorAskCount >= 1) {
|
|
369
568
|
events.push(stopConditionMetEvent(state, obs.round, 'confidence'))
|
|
370
|
-
events.push(pausedEvent(state, obs.round, 'principal_item'))
|
|
569
|
+
events.push(pausedEvent(state, obs.round, 'principal_item', 'confidence'))
|
|
371
570
|
events.push(roundEndedEvent(state, obs.round, obs.stats, 'changes_requested'))
|
|
372
571
|
const record = buildRoundRecord(obs.round, [], null, 'stopped')
|
|
373
572
|
const preFinalize: LoopState = {
|
|
374
573
|
...state,
|
|
574
|
+
...clearedFailure,
|
|
375
575
|
rounds: [...state.rounds, record],
|
|
376
576
|
pending: null,
|
|
377
577
|
...withRoundStats(state, obs.stats)
|
|
@@ -386,17 +586,18 @@ function assessGate(
|
|
|
386
586
|
confidence: null,
|
|
387
587
|
priorIds: state.lastIds
|
|
388
588
|
}
|
|
389
|
-
return { decision: { type: 'ask_confidence' }, state: { ...state, pending }, events }
|
|
589
|
+
return { decision: { type: 'ask_confidence' }, state: { ...state, ...clearedFailure, pending }, events }
|
|
390
590
|
}
|
|
391
591
|
|
|
392
592
|
if (confidence.value < 50) {
|
|
393
593
|
if (state.extraTurnUsed) {
|
|
394
594
|
events.push(stopConditionMetEvent(state, obs.round, 'confidence'))
|
|
395
|
-
events.push(pausedEvent(state, obs.round, 'principal_item'))
|
|
595
|
+
events.push(pausedEvent(state, obs.round, 'principal_item', 'confidence'))
|
|
396
596
|
events.push(roundEndedEvent(state, obs.round, obs.stats, 'changes_requested'))
|
|
397
597
|
const record = buildRoundRecord(obs.round, [], confidence, 'stopped')
|
|
398
598
|
const preFinalize: LoopState = {
|
|
399
599
|
...state,
|
|
600
|
+
...clearedFailure,
|
|
400
601
|
rounds: [...state.rounds, record],
|
|
401
602
|
pending: null,
|
|
402
603
|
...withRoundStats(state, obs.stats)
|
|
@@ -408,6 +609,7 @@ function assessGate(
|
|
|
408
609
|
const record = buildUnreviewedRecord(obs.round, confidence, 'changes_requested', 'low_confidence')
|
|
409
610
|
const newState: LoopState = {
|
|
410
611
|
...state,
|
|
612
|
+
...clearedFailure,
|
|
411
613
|
rounds: [...state.rounds, record],
|
|
412
614
|
pending: null,
|
|
413
615
|
extraTurnUsed: true,
|
|
@@ -423,7 +625,7 @@ function assessGate(
|
|
|
423
625
|
confidence,
|
|
424
626
|
priorIds: state.lastIds
|
|
425
627
|
}
|
|
426
|
-
return { decision: { type: 'dispatch_reviewers' }, state: { ...state, pending }, events }
|
|
628
|
+
return { decision: { type: 'dispatch_reviewers' }, state: { ...state, ...clearedFailure, pending }, events }
|
|
427
629
|
}
|
|
428
630
|
|
|
429
631
|
function assessVerdicts(
|
|
@@ -441,12 +643,18 @@ function assessVerdicts(
|
|
|
441
643
|
events.push(findingsComparedEvent(state, fc))
|
|
442
644
|
|
|
443
645
|
const carriedIds = mergedIds(pending.priorIds, currentIds)
|
|
646
|
+
// This round's blocking-and-open finding keys, compared against the
|
|
647
|
+
// PREVIOUS reviewed round's before any exit below can consume them, and
|
|
648
|
+
// carried into every state this function returns — a round the loop pauses
|
|
649
|
+
// on still records what it saw, exactly as `lastIds` does.
|
|
650
|
+
const currentBlocking = blockingOpenKeys(obs.verdicts)
|
|
651
|
+
const repeatedBlocking = currentBlocking.filter((key) => state.lastBlockingFindings.includes(key))
|
|
444
652
|
const confidence = pending.confidence
|
|
445
653
|
|
|
446
654
|
const hasEscalate = obs.verdicts.some((v) => v.verdict === 'ESCALATE')
|
|
447
655
|
if (hasEscalate) {
|
|
448
656
|
events.push(stopConditionMetEvent(state, obs.round, 'escalated'))
|
|
449
|
-
events.push(pausedEvent(state, obs.round, 'escalation'))
|
|
657
|
+
events.push(pausedEvent(state, obs.round, 'escalation', 'escalation'))
|
|
450
658
|
events.push(roundEndedEvent(state, obs.round, pending.stats, 'escalated'))
|
|
451
659
|
const record = buildRoundRecord(obs.round, obs.verdicts, confidence, 'escalated')
|
|
452
660
|
const preFinalize: LoopState = {
|
|
@@ -454,6 +662,7 @@ function assessVerdicts(
|
|
|
454
662
|
rounds: [...state.rounds, record],
|
|
455
663
|
pending: null,
|
|
456
664
|
lastIds: carriedIds,
|
|
665
|
+
lastBlockingFindings: currentBlocking,
|
|
457
666
|
...withRoundStats(state, pending.stats)
|
|
458
667
|
}
|
|
459
668
|
events.push(journalFinalizedEvent(preFinalize, pending.stats.head, 'stopped'))
|
|
@@ -473,6 +682,7 @@ function assessVerdicts(
|
|
|
473
682
|
rounds: [...state.rounds, record],
|
|
474
683
|
pending: null,
|
|
475
684
|
lastIds: carriedIds,
|
|
685
|
+
lastBlockingFindings: currentBlocking,
|
|
476
686
|
...withRoundStats(state, pending.stats)
|
|
477
687
|
}
|
|
478
688
|
events.push(journalFinalizedEvent(preFinalize, pending.stats.head, 'merged_ready'))
|
|
@@ -481,7 +691,7 @@ function assessVerdicts(
|
|
|
481
691
|
|
|
482
692
|
if (fc.recurring.length > 0) {
|
|
483
693
|
events.push(stopConditionMetEvent(state, obs.round, 'reappearance'))
|
|
484
|
-
events.push(pausedEvent(state, obs.round, 'principal_item'))
|
|
694
|
+
events.push(pausedEvent(state, obs.round, 'principal_item', 'reappearance'))
|
|
485
695
|
events.push(roundEndedEvent(state, obs.round, pending.stats, 'changes_requested'))
|
|
486
696
|
const record = buildRoundRecord(obs.round, obs.verdicts, confidence, 'stopped')
|
|
487
697
|
const preFinalize: LoopState = {
|
|
@@ -489,15 +699,43 @@ function assessVerdicts(
|
|
|
489
699
|
rounds: [...state.rounds, record],
|
|
490
700
|
pending: null,
|
|
491
701
|
lastIds: carriedIds,
|
|
702
|
+
lastBlockingFindings: currentBlocking,
|
|
492
703
|
...withRoundStats(state, pending.stats)
|
|
493
704
|
}
|
|
494
705
|
events.push(journalFinalizedEvent(preFinalize, pending.stats.head, 'stopped'))
|
|
495
706
|
return { decision: { type: 'pause', reason: 'reappearance' }, state: preFinalize, events }
|
|
496
707
|
}
|
|
497
708
|
|
|
498
|
-
if (
|
|
709
|
+
if (repeatedBlocking.length > 0) {
|
|
710
|
+
events.push(stopConditionMetEvent(state, obs.round, 'repeat_finding'))
|
|
711
|
+
events.push(pausedEvent(state, obs.round, 'principal_item', 'repeat_finding'))
|
|
712
|
+
events.push(roundEndedEvent(state, obs.round, pending.stats, 'changes_requested'))
|
|
713
|
+
const record = buildRoundRecord(obs.round, obs.verdicts, confidence, 'stopped')
|
|
714
|
+
const preFinalize: LoopState = {
|
|
715
|
+
...state,
|
|
716
|
+
rounds: [...state.rounds, record],
|
|
717
|
+
pending: null,
|
|
718
|
+
lastIds: carriedIds,
|
|
719
|
+
lastBlockingFindings: currentBlocking,
|
|
720
|
+
...withRoundStats(state, pending.stats)
|
|
721
|
+
}
|
|
722
|
+
events.push(journalFinalizedEvent(preFinalize, pending.stats.head, 'stopped'))
|
|
723
|
+
// The pause names the finding(s), so a Principal reading it never has to
|
|
724
|
+
// diff two rounds' reports to learn what the developer could not close.
|
|
725
|
+
return {
|
|
726
|
+
decision: {
|
|
727
|
+
type: 'pause',
|
|
728
|
+
reason: 'repeat_finding',
|
|
729
|
+
detail: `open after two consecutive rounds: ${repeatedBlocking.join(', ')}`
|
|
730
|
+
},
|
|
731
|
+
state: preFinalize,
|
|
732
|
+
events
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
if (obs.round >= state.config.maxRounds) {
|
|
499
737
|
events.push(stopConditionMetEvent(state, obs.round, 'max_rounds'))
|
|
500
|
-
events.push(pausedEvent(state, obs.round, 'principal_item'))
|
|
738
|
+
events.push(pausedEvent(state, obs.round, 'principal_item', 'max_rounds'))
|
|
501
739
|
events.push(roundEndedEvent(state, obs.round, pending.stats, 'changes_requested'))
|
|
502
740
|
const record = buildRoundRecord(obs.round, obs.verdicts, confidence, 'stopped')
|
|
503
741
|
const preFinalize: LoopState = {
|
|
@@ -505,6 +743,7 @@ function assessVerdicts(
|
|
|
505
743
|
rounds: [...state.rounds, record],
|
|
506
744
|
pending: null,
|
|
507
745
|
lastIds: carriedIds,
|
|
746
|
+
lastBlockingFindings: currentBlocking,
|
|
508
747
|
...withRoundStats(state, pending.stats)
|
|
509
748
|
}
|
|
510
749
|
events.push(journalFinalizedEvent(preFinalize, pending.stats.head, 'stopped'))
|
|
@@ -523,21 +762,197 @@ function assessVerdicts(
|
|
|
523
762
|
rounds: [...state.rounds, record],
|
|
524
763
|
pending: null,
|
|
525
764
|
lastIds: carriedIds,
|
|
765
|
+
lastBlockingFindings: currentBlocking,
|
|
526
766
|
...withRoundStats(state, pending.stats)
|
|
527
767
|
}
|
|
528
768
|
return { decision: { type: 'dispatch_developer' }, state: newState, events }
|
|
529
769
|
}
|
|
530
770
|
|
|
531
771
|
/**
|
|
532
|
-
*
|
|
533
|
-
*
|
|
772
|
+
* An attempt that ended on a mechanical failure without producing a head.
|
|
773
|
+
* The SAME `'repeat_failure'` rule the gate path applies, on an observation
|
|
774
|
+
* that has no gate result to carry: a second consecutive attempt whose
|
|
775
|
+
* failure normalises to the previous one's signature pauses, naming the
|
|
776
|
+
* failure exactly as the driver reported it. A first occurrence — or an
|
|
777
|
+
* attempt whose failure differs from the previous one's — records the
|
|
778
|
+
* signature and nothing else: no round record, no events, no diff-stat
|
|
779
|
+
* accounting, since no head was produced and the driver's own first-occurrence
|
|
780
|
+
* bounds still govern what happens next.
|
|
781
|
+
*/
|
|
782
|
+
function assessMechanicalFailure(
|
|
783
|
+
state: LoopState,
|
|
784
|
+
obs: { round: number; failure: string; stats: RoundStats }
|
|
785
|
+
): { decision: Decision; state: LoopState; events: DevReviewLoopEventInput[] } {
|
|
786
|
+
const { failure, repeat } = matchFailure(state, obs.failure)
|
|
787
|
+
if (repeat && failure !== null) {
|
|
788
|
+
const events: DevReviewLoopEventInput[] = [
|
|
789
|
+
stopConditionMetEvent(state, obs.round, 'repeat_failure'),
|
|
790
|
+
pausedEvent(state, obs.round, 'principal_item', 'repeat_failure'),
|
|
791
|
+
roundEndedEvent(state, obs.round, obs.stats, 'changes_requested')
|
|
792
|
+
]
|
|
793
|
+
const record = buildUnreviewedRecord(obs.round, null, 'stopped', 'mechanical_failure')
|
|
794
|
+
const preFinalize: LoopState = {
|
|
795
|
+
...state,
|
|
796
|
+
rounds: [...state.rounds, record],
|
|
797
|
+
pending: null,
|
|
798
|
+
lastFailure: failure,
|
|
799
|
+
...withRoundStats(state, obs.stats)
|
|
800
|
+
}
|
|
801
|
+
events.push(journalFinalizedEvent(preFinalize, obs.stats.head, 'stopped'))
|
|
802
|
+
return {
|
|
803
|
+
decision: { type: 'pause', reason: 'repeat_failure', detail: failure.message },
|
|
804
|
+
state: preFinalize,
|
|
805
|
+
events
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
return { decision: { type: 'dispatch_developer' }, state: { ...state, lastFailure: failure }, events: [] }
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// --- the task's own wall-clock budget --------------------------------------
|
|
812
|
+
|
|
813
|
+
/** Whole minutes, rounded to the nearest — every figure the time stop names a reader in. */
|
|
814
|
+
function minutesOf(ms: number): number {
|
|
815
|
+
return Math.round(ms / 60_000)
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* `true` when the task has spent longer than `maxTaskMinutes` in ACTIVE work —
|
|
820
|
+
* `clock.elapsedMs`, which the caller has already summed from the active phases
|
|
821
|
+
* alone (`activeBudgetMs`), so paused, publishing and driverless time can never
|
|
822
|
+
* blow the budget. `0` — and any value below it, which `resolveReviewPolicy`
|
|
823
|
+
* refuses at config load and this predicate still treats as off rather than as
|
|
824
|
+
* a budget already blown — turns the budget off: the loop then bounds rounds
|
|
825
|
+
* only, exactly as it did before this budget existed.
|
|
826
|
+
*
|
|
827
|
+
* The comparison is strictly greater, so a task sitting exactly on its budget
|
|
828
|
+
* has not passed it. The round cap reads the other way: a round that REACHES
|
|
829
|
+
* `state.config.maxRounds` without going green pauses, since the cap is the
|
|
830
|
+
* number of rounds that run.
|
|
831
|
+
*/
|
|
832
|
+
export function taskBudgetExceeded(maxTaskMinutes: number, clock: TaskClock): boolean {
|
|
833
|
+
if (maxTaskMinutes <= 0) return false
|
|
834
|
+
return clock.elapsedMs > maxTaskMinutes * 60_000
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Where the time went, longest phase first — `developing 190 min, reviewing
|
|
839
|
+
* 22 min`. Phases are named with `taskPhaseLabel`, the SAME vocabulary
|
|
840
|
+
* `task status` renders a live run's phase in, so the pause and the status
|
|
841
|
+
* table call one phase by one name; a phase that vocabulary does not know
|
|
842
|
+
* reads back as the loop's own recorded word rather than as a guess.
|
|
843
|
+
*
|
|
844
|
+
* A phase that accrued under a minute is still listed, at `0 min`: the loop
|
|
845
|
+
* recorded time there, and a reader is better served by a short row than by a
|
|
846
|
+
* phase silently missing. An empty breakdown renders `no phase times
|
|
847
|
+
* recorded` — the honest answer for a run whose earlier phases were recorded
|
|
848
|
+
* by a driver that has since died, never a fabricated single row covering the
|
|
849
|
+
* whole elapsed time.
|
|
850
|
+
*/
|
|
851
|
+
export function renderPhaseBreakdown(byPhaseMs: Record<string, number>): string {
|
|
852
|
+
const entries = Object.entries(byPhaseMs).filter(([, ms]) => ms >= 0)
|
|
853
|
+
if (entries.length === 0) return 'no phase times recorded'
|
|
854
|
+
return entries
|
|
855
|
+
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
|
|
856
|
+
.map(([phase, ms]) => `${taskPhaseLabel(phase)} ${minutesOf(ms)} min`)
|
|
857
|
+
.join(', ')
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* The `'time_budget'` pause's own `detail` — the budget, the ACTIVE time
|
|
862
|
+
* actually spent, and the breakdown of the active phases that time was summed
|
|
863
|
+
* from, in that order, so a Principal reading it learns whether the budget is
|
|
864
|
+
* too tight or one working phase ran away without opening the run's log.
|
|
865
|
+
*
|
|
866
|
+
* `spent` is `clock.elapsedMs` — the very figure `taskBudgetExceeded` compared
|
|
867
|
+
* against the budget — and the breakdown names ONLY the active phases
|
|
868
|
+
* (`isActiveBudgetPhase`), so the numbers in the breakdown sum to the number
|
|
869
|
+
* reported as spent. Time the task sat `paused` or `publishing` is in
|
|
870
|
+
* `byPhaseMs` (the full record) but is deliberately absent here: it never
|
|
871
|
+
* counted toward the budget, so the pause never names it as time the budget
|
|
872
|
+
* spent.
|
|
873
|
+
*/
|
|
874
|
+
export function renderTaskBudgetDetail(maxTaskMinutes: number, clock: TaskClock): string {
|
|
875
|
+
const activePhaseMs: Record<string, number> = {}
|
|
876
|
+
for (const [phase, ms] of Object.entries(clock.byPhaseMs)) {
|
|
877
|
+
if (isActiveBudgetPhase(phase)) activePhaseMs[phase] = ms
|
|
878
|
+
}
|
|
879
|
+
return `task time budget: ${maxTaskMinutes} min, spent ${minutesOf(clock.elapsedMs)} min — ${renderPhaseBreakdown(activePhaseMs)}`
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* The time stop, built in the same four-event shape every other bounded pause
|
|
884
|
+
* here emits (`stop_condition_met`, `paused`, `round_ended`,
|
|
885
|
+
* `journal_finalized`) so a reader — or a machine parsing the outbox — sees a
|
|
886
|
+
* complete pause record, not a special case.
|
|
887
|
+
*
|
|
888
|
+
* The round it lands on is a round no reviewer saw, and records as one
|
|
889
|
+
* (`notReviewed: 'time_budget'`, no counts): this
|
|
890
|
+
* stop is only ever checked at a round boundary or a mechanical retry, never
|
|
891
|
+
* on a `verdicts` observation, so verdicts already back from reviewers are
|
|
892
|
+
* never thrown away by it. `lastFailure` is left exactly as it stands — the
|
|
893
|
+
* budget running out says nothing about whether the previous attempt's
|
|
894
|
+
* mechanical failure has cleared.
|
|
895
|
+
*/
|
|
896
|
+
function timeBudgetPause(
|
|
897
|
+
state: LoopState,
|
|
898
|
+
obs: { round: number; stats: RoundStats },
|
|
899
|
+
clock: TaskClock
|
|
900
|
+
): { decision: Decision; state: LoopState; events: DevReviewLoopEventInput[] } {
|
|
901
|
+
const events: DevReviewLoopEventInput[] = [
|
|
902
|
+
stopConditionMetEvent(state, obs.round, 'time_budget'),
|
|
903
|
+
pausedEvent(state, obs.round, 'principal_item', 'time_budget'),
|
|
904
|
+
roundEndedEvent(state, obs.round, obs.stats, 'changes_requested')
|
|
905
|
+
]
|
|
906
|
+
const record = buildUnreviewedRecord(obs.round, null, 'stopped', 'time_budget')
|
|
907
|
+
const preFinalize: LoopState = {
|
|
908
|
+
...state,
|
|
909
|
+
rounds: [...state.rounds, record],
|
|
910
|
+
pending: null,
|
|
911
|
+
...withRoundStats(state, obs.stats)
|
|
912
|
+
}
|
|
913
|
+
events.push(journalFinalizedEvent(preFinalize, obs.stats.head, 'stopped'))
|
|
914
|
+
return {
|
|
915
|
+
decision: {
|
|
916
|
+
type: 'pause',
|
|
917
|
+
reason: 'time_budget',
|
|
918
|
+
detail: renderTaskBudgetDetail(state.config.maxTaskMinutes, clock)
|
|
919
|
+
},
|
|
920
|
+
state: preFinalize,
|
|
921
|
+
events
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* `assessRound(state, observations, clock?) → { decision, state, events }` —
|
|
927
|
+
* pure, no I/O. `events` is the `DevReviewLoopEventInput[]` the caller passes,
|
|
534
928
|
* unchanged, to the injected `log()`; `assessRound` itself never calls
|
|
535
929
|
* it.
|
|
930
|
+
*
|
|
931
|
+
* `clock` is the task's own wall clock, read by the caller (this module has
|
|
932
|
+
* none). Supplied, it arms the `'time_budget'` stop below; omitted, the
|
|
933
|
+
* assessment is exactly the round-and-repeat-bounded one it was — so a caller
|
|
934
|
+
* that cannot measure the task's first start honestly passes nothing rather
|
|
935
|
+
* than a clock starting at its own process's start, which would mean a loop
|
|
936
|
+
* restarted often enough never approaches its budget.
|
|
937
|
+
*
|
|
938
|
+
* The budget is checked on a `gate` observation and on a `mechanical_failure`
|
|
939
|
+
* observation, and on neither of those does a round's review exist yet: those
|
|
940
|
+
* two kinds are exactly the round boundaries and the mechanical retries, so a
|
|
941
|
+
* phase stuck short of review cannot outrun the budget by more than the one
|
|
942
|
+
* attempt in flight when it ran out. A `verdicts` observation is deliberately
|
|
943
|
+
* NOT checked — reviewers have already done the round's work by then, and
|
|
944
|
+
* discarding their verdicts to save minutes the round has already spent would
|
|
945
|
+
* buy nothing.
|
|
536
946
|
*/
|
|
537
947
|
export function assessRound(
|
|
538
948
|
state: LoopState,
|
|
539
|
-
observations: Observations
|
|
949
|
+
observations: Observations,
|
|
950
|
+
clock?: TaskClock
|
|
540
951
|
): { decision: Decision; state: LoopState; events: DevReviewLoopEventInput[] } {
|
|
952
|
+
if (observations.kind === 'verdicts') return assessVerdicts(state, observations)
|
|
953
|
+
if (clock !== undefined && taskBudgetExceeded(state.config.maxTaskMinutes, clock)) {
|
|
954
|
+
return timeBudgetPause(state, observations, clock)
|
|
955
|
+
}
|
|
541
956
|
if (observations.kind === 'gate') return assessGate(state, observations)
|
|
542
|
-
return
|
|
957
|
+
return assessMechanicalFailure(state, observations)
|
|
543
958
|
}
|