@attalabs/vinaya 0.40.0 → 0.41.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.
Files changed (157) hide show
  1. package/aeg-root/contracts/developer-reviewer.md +2 -2
  2. package/aeg-root/contracts/planner-developer.md +4 -4
  3. package/aeg-root/process.md +3 -3
  4. package/aeg-root/roles/developer/reference.md +3 -0
  5. package/aeg-root/state-machine.md +2 -2
  6. package/aeg-root/templates/brief-template.md +1 -1
  7. package/dist/checks/bin/check-body-bare-digits.js +165 -65
  8. package/dist/checks/bin/check-branch-topology.js +169 -60
  9. package/dist/checks/bin/check-brief-shape.js +165 -65
  10. package/dist/checks/bin/check-changeset-coverage.js +342 -122
  11. package/dist/checks/bin/check-ci-shard-coverage.js +384 -130
  12. package/dist/checks/bin/check-closes-n.js +169 -60
  13. package/dist/checks/bin/check-coherence.js +165 -65
  14. package/dist/checks/bin/check-dead-branch-push.js +142 -59
  15. package/dist/checks/bin/check-dispatch-readiness.js +211 -81
  16. package/dist/checks/bin/check-doc-claims.js +165 -65
  17. package/dist/checks/bin/check-doc-coverage-push.js +342 -122
  18. package/dist/checks/bin/check-doc-coverage.js +344 -124
  19. package/dist/checks/bin/check-doctrine-no-procedures.js +165 -65
  20. package/dist/checks/bin/check-doctrine-portability.js +342 -122
  21. package/dist/checks/bin/check-evidence-fresh.js +376 -129
  22. package/dist/checks/bin/check-exec-bits.js +342 -122
  23. package/dist/checks/bin/check-first-push-dispatch.js +208 -78
  24. package/dist/checks/bin/check-issue-milestone-attach.js +142 -59
  25. package/dist/checks/bin/check-issue-objectives-numbering.js +165 -65
  26. package/dist/checks/bin/check-issue-parts-coverage.js +142 -59
  27. package/dist/checks/bin/check-issue-surface-globs.js +218 -88
  28. package/dist/checks/bin/check-issue-title-grammar.js +142 -59
  29. package/dist/checks/bin/check-main-branch-refusal.js +142 -59
  30. package/dist/checks/bin/check-no-disk-state.js +142 -59
  31. package/dist/checks/bin/check-pr-premise-reassert.js +165 -65
  32. package/dist/checks/bin/check-pr-report-density.js +142 -59
  33. package/dist/checks/bin/check-principal-test-plan-wait.js +165 -65
  34. package/dist/checks/bin/check-quoted-command.js +338 -118
  35. package/dist/checks/bin/check-reader-resolvable-prose.js +338 -118
  36. package/dist/checks/bin/check-registry-gates.js +206 -78
  37. package/dist/checks/bin/check-retired-vocabulary.js +338 -118
  38. package/dist/checks/bin/check-review-gate.js +203 -83
  39. package/dist/checks/bin/check-single-plan-pr.js +142 -59
  40. package/dist/checks/bin/check-surface-scope.js +169 -60
  41. package/dist/checks/bin/check-test-plan.js +165 -65
  42. package/dist/checks/bin/check-token-collection-wired.js +142 -59
  43. package/dist/checks/bin/check-workspace-escape.js +340 -120
  44. package/dist/checks/bin/verify-coherence.js +153 -60
  45. package/dist/checks/bin/verify-dispatch.js +169 -69
  46. package/dist/checks/bin/verify-docs.js +142 -57
  47. package/dist/index.js +16280 -11764
  48. package/dist/lib/pre-push-cache-test-run.js +791 -68
  49. package/dist/lib/pre-push-changed-files.js +65 -19
  50. package/dist/lib/pre-push-mode.js +466 -0
  51. package/dist/lib/pre-push-progress-dir.js +4205 -0
  52. package/dist/lib/pre-push-record-tests.js +446 -0
  53. package/dist/lib/pre-push-select-tests.js +1426 -454
  54. package/dist/lib/push-progress-observer.js +4213 -0
  55. package/package.json +11 -5
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -2
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +18 -4
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +3 -3
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +2 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +88 -5
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +34 -2
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +26 -4
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +7 -1
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +17 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +13 -17
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +1 -1
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +70 -45
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +1 -4
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +77 -7
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +24 -54
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +221 -56
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/live-record.ts +179 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +8 -2
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +1 -0
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +1 -0
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema-digest.ts +225 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +7 -1
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +23 -1
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/principals-config.ts +44 -0
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/prose-rules.ts +532 -0
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/protected-paths.ts +31 -0
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +157 -80
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +8 -12
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +52 -109
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +46 -17
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +85 -1
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +46 -0
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +2 -4
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +63 -8
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +24 -0
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +0 -1
  93. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  95. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  130. 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
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wzfiav._.js → [root-of-the-server]__1d4eth3._.js} +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +3 -3
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +2 -2
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +3 -3
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  146. 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
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  151. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{38kom-9c-oi65.js → 0x7u6si-ai179.js} +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1p3vr9qts86_b.js → 2fu7mfsj4oima.js} +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{21tunzmxjvm2a.js → 34b4ruddunn3q.js} +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  155. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_buildManifest.js +0 -0
  156. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_clientMiddlewareManifest.js +0 -0
  157. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{Y3oaZSTSP9PivUuJvxK1W → 2ZARxTwpuRew8-SvYsRdU}/_ssgManifest.js +0 -0
@@ -76,9 +76,9 @@ Every item the Developer produces in the open PR (left) has exactly one obligati
76
76
  - **Documentation-update list honored.** Every doc named in the list must be updated in the diff before opening the PR. A PR with list items outstanding is not ready for review; do not open it and expect the Reviewer to discover the gap.
77
77
  - **`.vinaya/doc-owners` coverage satisfied.** For every binding fired by the diff: update the bound doc in this PR; or, for URL bindings, add `Doc-ack: <pointer> — <note>`; or have a principal apply the actor-verified `vinaya/waiver:docs` label — you cannot self-serve it, and there is no body-field waiver grammar anymore. `verify-docs` C5 enforces this mechanically — if it fails CI, do not request review.
78
78
  - CI must be green before requesting review. Do not request review with a red CI and expect the Reviewer to begin.
79
- - The brief is already frozen, unmodified, on the task Issue's `aeg:brief:v1` comment before the Developer's worktree exists — the PR body carries only the Developer's report (optionally with a reference copy of the brief in a collapsed `<details>` block). The whole body is authored once, at open. After open the Developer changes nothing outside the `AEG:EVIDENCE` anchor. The body carries no token table for either role to read: a dispatched turn's token use is recorded as the Vinaya log's own `usage` event. The Principal's `[principal]` ticks are the Principal's writes and must survive every Developer edit. A review round's response and any re-run evidence are PR comments, not body edits.
79
+ - The brief is already frozen, unmodified, on the task Issue's `aeg:brief:v1` comment before the Developer's worktree exists — the PR body carries only the Developer's report (optionally with a reference copy of the brief in a collapsed `<details>` block). The whole body is authored once, at open. After open the Developer changes nothing outside the `AEG:EVIDENCE` anchor. The body carries no token table for either role to read: a dispatched turn's token use is recorded as the Vinaya log's own `usage` event. The Principal's `[principal]` ticks are the Principal's writes and must survive every Developer edit. Re-run evidence is recorded by the controller (`refresh_evidence` writes it into `AEG:EVIDENCE`); a review round's response is the turn result the loop posts, not a body edit.
80
80
  - The diff stays within the brief's Technical Surface Map. A file outside it is no stop: the driver records it in the pull request body's beyond-Surface block, and the Reviewer judges it like any change.
81
- - Every `[agent]` Test Plan item must have an evidence comment posted on the PR — the actual command output, not a paraphrase. A re-run after fixes posts a new comment; it never edits the one already there.
81
+ - Every `[agent]` Test Plan item must have its actual command output recorded as evidence — by the controller (`refresh_evidence`, or `vinaya pr report --write` working manually) into `AEG:EVIDENCE`, never a paraphrase. A re-run after fixes refreshes that block.
82
82
  - One row appended to the tranche's token ledger before opening the PR.
83
83
 
84
84
  ## Consumer obligations (the Reviewer)
@@ -67,8 +67,8 @@ Every field below has exactly one named obligation for the Developer (right colu
67
67
  | **A fenced command with its executed output pasted beneath it (the only other form a behavioural fact about code may take in a brief)** | Re-run before the Part that depends on it; output pasted in that round's PR comment | The Developer re-runs the command and compares its own output against what the brief pasted. A mismatch is a brief defect, not a fact to transcribe — the Developer stops, `severity: strategy`, and never writes the brief's sentence into doctrine or code. |
68
68
  | **Documentation-update list** (rendered from `Docs to keep coherent`, mechanically derived against `.vinaya/doc-owners`) | Self-check before opening PR + Reviewer doc check | The Developer updates every doc named in the list before claiming done. The list is a DoD obligation, not a recommendation — a named doc not updated is a BLOCKER at review. `verify-docs --pr` gates structural presence; the Reviewer gates content correctness. |
69
69
  | **Task Done checklist** (the Developer's own tier checklist, not a rendered section) | Self-check before opening PR | The Developer runs every item before opening the PR. An unchecked item means the PR is not ready. |
70
- | **`## Test plan`** tagged `[agent]` / `[principal]` | Runs `[agent]` items; leaves `[principal]` for Principal | The Developer runs every `[agent]` item and posts evidence. Does not tick `[principal]` boxes. |
71
- | **`## Stop conditions`** | Halt triggers | The Developer stops and posts a blocker comment on the Issue when any condition is met. Never improvises past a stop condition. |
70
+ | **`## Test plan`** tagged `[agent]` / `[principal]` | Runs `[agent]` items; leaves `[principal]` for Principal | The Developer runs every `[agent]` item; the controller records the output as evidence. Does not tick `[principal]` boxes. |
71
+ | **`## Stop conditions`** | Halt triggers | The Developer stops when any condition is met and reports the blocker in its turn result (the loop posts it). Never improvises past a stop condition. |
72
72
  | **Constraints** (rendered from `Traps to avoid` plus the standing autonomy clause) | Hard rules during execution | The Developer treats these as absolute — not "guidelines." A violated constraint is a PR that must not merge. |
73
73
 
74
74
  **Reading the table:** left is the producer obligation (the Issue's own gates refuse a task Issue missing a rationale field or judgment section at creation time; the dispatch act's render refuses a brief with a gap it cannot derive), right is the consumer obligation (Developer role doc and executor protocol enforce it). The role doc must not contradict this table.
@@ -126,8 +126,8 @@ The dispatch act's enforcement is the same forge-derived check the Developer run
126
126
  - Execute step 0 first, always. Never branch from `HEAD` of the current local checkout.
127
127
  - Verify all dependencies are merged before the first line of code.
128
128
  - Stay within the surface map. A file outside it is no stop: the driver records it in the pull request body's beyond-Surface block, and the reviewers judge it like any change.
129
- - Run every `[agent]` Test Plan item and post the actual command output as evidence. Do not paraphrase verification results.
130
- - Stop on any stop condition — post a blocker comment, do not improvise.
129
+ - Run every `[agent]` Test Plan item and let the controller record the actual command output as evidence. Do not paraphrase verification results.
130
+ - Stop on any stop condition — report the blocker in your turn result (the loop posts it), do not improvise.
131
131
  - Report tokens in the PR body at turn-end, per `aeg-root/roles/developer/reference.md` — never append your own row to a ledger file.
132
132
 
133
133
  ---
@@ -227,16 +227,16 @@ A PR that has passed code review and security review still has not been run. The
227
227
 
228
228
  The test plan is split by who can structurally execute each item:
229
229
 
230
- - **`[agent]` items** (non-auth, scriptable — SSRF rejections, parse checks, route responses, render smoke). The Developer-agent boots the relevant dev server(s) from the PR's branch, runs each `[agent]` item, and posts the actual output as evidence on the PR. Paraphrase is not evidence; the command + the response body is.
230
+ - **`[agent]` items** (non-auth, scriptable — SSRF rejections, parse checks, route responses, render smoke). The Developer-agent boots the relevant dev server(s) from the PR's branch, runs each `[agent]` item, and reports the actual output in its turn result; the controller records it as evidence on the PR. Paraphrase is not evidence; the command + the response body is.
231
231
  - **`[principal]` items** (auth-gated, key-dependent, visual — a signed-in BYOK audit, a ModelPicker render behind Clerk, a card landing in the right column). The Principal runs each item in a browser with the dev server up and ticks the box on the PR. The agent **cannot** tick `[principal]` boxes and the Principal does **not** tick `[agent]` boxes — the asymmetry is the whole shape of the gate (mirror of the chat-vs-terminal token capture).
232
232
 
233
233
  **`Test Plan: unit-tests-only`** is a first-class allowed value for pure-logic briefs (a parser, a sum function, a markdown normaliser — nothing the §4 Technical Surface Map lists as a runtime path). When the brief declares it, Phase 11 is satisfied by the CI unit-test gate alone; no runtime execution is required. Brief Validation rejects `unit-tests-only` on a brief whose §4 surface includes a runtime path.
234
234
 
235
- **The merge gate.** A PR is not mergeable while any Test Plan checkbox is unticked — `[agent]` items waiting for evidence, or `[principal]` items waiting for Principal confirmation. An `[agent]` item that fails returns the PR to the Developer on the same branch (same loop as a `CHANGES_REQUESTED` review); a `[principal]` failure does the same. Re-running an item appends a fresh evidence comment; it does not edit the previous one.
235
+ **The merge gate.** A PR is not mergeable while any Test Plan checkbox is unticked — `[agent]` items waiting for evidence, or `[principal]` items waiting for Principal confirmation. An `[agent]` item that fails returns the PR to the Developer on the same branch (same loop as a `CHANGES_REQUESTED` review); a `[principal]` failure does the same. Re-running an item makes the controller record fresh evidence; it does not edit the previous record.
236
236
 
237
237
  **Enforcement note:** the `test-plan` check (a checkbox-state parse over the PR body) is **live and mandatory** — it runs unconditionally in CI on every pull request — in this repo as the `test-plan` check inside the `vinaya check --all --diff-only` job (`.github/workflows/vinaya-checks.yml`); in the attalabs reference implementation, as a step of that repo's consolidated gate job. On this repo's toolchain the same check is also reachable standalone as `bun packages/aeg-core/bin/verify-test-plan.ts`. It is not opt-in and not decided per-tranche. What remains **trusted discipline** is the judgment the parse cannot make — whether a ticked box was genuinely run. The doctrine (Phase 11 exists; the brief carries a tagged Test Plan; an unticked box means not-yet-mergeable) holds whether the CI enforcer is on or off. Brief Validation rejects a brief that touches a runtime surface and has no tagged Test Plan.
238
238
 
239
- **Exit:** every `[agent]` Test Plan item has an evidence comment on the PR and is ticked; every `[principal]` item is ticked by the Principal. Or: the brief declared `Test Plan: unit-tests-only` and the §4 surface is pure-logic.
239
+ **Exit:** every `[agent]` Test Plan item has controller-recorded evidence on the PR and is ticked; every `[principal]` item is ticked by the Principal. Or: the brief declared `Test Plan: unit-tests-only` and the §4 surface is pure-logic.
240
240
 
241
241
  ---
242
242
 
@@ -108,6 +108,9 @@ The `AEG:EVIDENCE` block is populated by `vinaya pr report --write <body-file>`
108
108
 
109
109
  **After open, regenerating `AEG:EVIDENCE` is the driver's job.** Under the review loop the driver runs the same engine `vinaya pr report --push` calls, in-process, the moment your head's CI turns green, every round, and posts the round marker comment in your place. `refresh_evidence` is the tool for a regeneration you need mid-turn. Working manually, `vinaya pr report --push <n>` regenerates it on the open PR; its `--body-file <path>` mode also splices a section outside the two generated blocks — a Decisions bullet, most often — that only ever existed in a local draft.
110
110
 
111
+ <!-- AEG:CLAIM: processes/vinaya/loops/dev-review/v2/v2-actions.ts contains:const evidence = await writeEvidenceFor(fns, pr, head) -->
112
+ **Under the review-locally, push-once flow (version 2) only: no tests and no `refresh_evidence` in your turn.** In that flow the ready push runs the selected tests on the approved commit, and the driver writes the Evidence block once the pull request opens. Your turn runs the local checks (`run_checks`) and publishes; it runs no test suite and never calls `refresh_evidence`. Every other flow, and manual work, is unchanged: you run the tests and keep the Evidence block fresh as described above.
113
+
111
114
  ---
112
115
 
113
116
  ## Documentation is part of every task
@@ -136,7 +136,7 @@ Rows = artifact types. Columns = roles. "—" means no authority. The Reviewer i
136
136
  | **Task status** | — | — | — | — *(nobody writes it — derived from the forge)* |
137
137
  | **Provenance block** (on the merged PR) | Reads (audit) | Reads (audit) | — | Assembles + posts at close-out (append-only; from frozen facts) |
138
138
  | **Token ledger** (the archived per-tranche ledgers, `tranche-model.md` §12) | Fills a previously-`—` cell left by an operator-metered role, from whatever usage view its host shows a human (forward-reference exception, §13); approves PR | Reports tokens at turn-end, does not append — the plan act in the plan PR (or planning report if none), the dispatch act in its dispatch report | Reports no token figures anywhere: a dispatched turn's usage is collected from the agent host and written to the Vinaya log as its own `usage` event (`tranche-model.md` §12); does not append the ledger row either | **Sole writer** of the ledger — collects every role's token report for the task and appends all rows at close-out; flags missing-row drift |
139
- | **Test Plan execution** (Verification phase, on the open PR) | Runs the `[principal]` half (auth-gated/key-dependent/visual items) in a browser and ticks those checkboxes on the PR | — | Runs the `[agent]` half (scriptable items) against the booted app and posts evidence comments on the PR; reports `[agent]` failures back to itself via new commits on the same branch | Flags an unticked checkbox / missing evidence comment as a merge-gate failure at close-out time (won't happen if discipline holds — merge is gated on ticked boxes) |
139
+ | **Test Plan execution** (Verification phase, on the open PR) | Runs the `[principal]` half (auth-gated/key-dependent/visual items) in a browser and ticks those checkboxes on the PR | — | Runs the `[agent]` half (scriptable items) against the booted app and reports the output in its turn result, which the controller records as evidence on the PR; reports `[agent]` failures back to itself via new commits on the same branch | Flags an unticked checkbox / missing evidence comment as a merge-gate failure at close-out time (won't happen if discipline holds — merge is gated on ticked boxes) |
140
140
  | **Worktrees** | Removes after merge | — | Works in (created at dispatch) | Flags merged worktrees as cleanup candidates |
141
141
  | **Orchestration-tool runtime** (if used) | Edits config; reads (audit) | Reads | Appends events via the tool | — |
142
142
  | **CI/forge Actions** | Approves workflow changes via PR | Proposes workflow changes via PR | — | Runs as forge-CI automation |
@@ -319,7 +319,7 @@ The lowest-commitment way to run AEG: read-only over a team's existing process.
319
319
  ### Trusted (agent discipline — no CI enforcement in V0)
320
320
 
321
321
  - **Dispatching code-review and security-review passes** — Phase 10 requires them, including the spec-conformance check, but no CI bot dispatches the Reviewer subagents automatically yet; Principal + agent discipline decides when to invoke them. Automating dispatch is future work. **Once a review IS dispatched and posts a verdict, that verdict's existence and cleanliness is mechanically enforced pre-merge — see the Review gate row above.** This is the same shape as the Verification phase below: doctrine + one enforced half + one still-trusted half.
322
- - **Verification phase — runtime Test Plan execution**. Phase 11 requires the brief's §9 Test Plan to be executed before merge: the Developer-agent runs the `[agent]` items against the booted app and posts evidence on the PR; the Principal runs the `[principal]` items in a real signed-in browser and ticks the checkboxes. **Merge is gated on every checkbox being ticked AND the review verdicts being clean** — the runtime Test Plan executed-and-passing is a merge precondition alongside CI passing. The doctrine is mechanical (an unticked checkbox = not mergeable); the `[principal]`-checkbox-state half of that mechanism is now Enforced (see the Enforced list above — `verify-test-plan` fails CI on any unticked `[principal]` box). What remains trusted discipline: that the Developer-agent genuinely ran each `[agent]` command against a booted app rather than fabricating its output, and that the Principal genuinely exercised each `[principal]` item in a browser before ticking it — no CI can watch either happen. `Test Plan: unit-tests-only` (a first-class allowed value for pure-logic briefs whose §4 surface has no runtime path) satisfies the phase by the CI unit-test gate alone. **Parser hardening:** the section locator (`locateTestPlanSection`, `packages/aeg-core/src/test-plan-section.ts`) now recognizes both the inline `**Test Plan:**` marker and the `## N. Test Plan` heading form — the original inline-only regex is what let a heading-form body advisory-PASS with an unticked `[principal]` box, since "no section found" (a parser miss, not a genuinely missing section) read as PASS. A task-branch PR with no Test Plan section in either form now FAILs loud instead, naming what was searched for; non-task branches keep the advisory bypass. The runtime Test Plan check — now the `Runtime Test Plan checkbox state` step (4/9) of the AEG gate suite job in `.github/workflows/forge-lifecycle.yml` — now also passes `BRANCH` (previously only `PR_BODY`), without which the task-branch distinction could never fire in real CI.
322
+ - **Verification phase — runtime Test Plan execution**. Phase 11 requires the brief's §9 Test Plan to be executed before merge: the Developer-agent runs the `[agent]` items against the booted app and reports the output in its turn result, which the controller records as evidence on the PR; the Principal runs the `[principal]` items in a real signed-in browser and ticks the checkboxes. **Merge is gated on every checkbox being ticked AND the review verdicts being clean** — the runtime Test Plan executed-and-passing is a merge precondition alongside CI passing. The doctrine is mechanical (an unticked checkbox = not mergeable); the `[principal]`-checkbox-state half of that mechanism is now Enforced (see the Enforced list above — `verify-test-plan` fails CI on any unticked `[principal]` box). What remains trusted discipline: that the Developer-agent genuinely ran each `[agent]` command against a booted app rather than fabricating its output, and that the Principal genuinely exercised each `[principal]` item in a browser before ticking it — no CI can watch either happen. `Test Plan: unit-tests-only` (a first-class allowed value for pure-logic briefs whose §4 surface has no runtime path) satisfies the phase by the CI unit-test gate alone. **Parser hardening:** the section locator (`locateTestPlanSection`, `packages/aeg-core/src/test-plan-section.ts`) now recognizes both the inline `**Test Plan:**` marker and the `## N. Test Plan` heading form — the original inline-only regex is what let a heading-form body advisory-PASS with an unticked `[principal]` box, since "no section found" (a parser miss, not a genuinely missing section) read as PASS. A task-branch PR with no Test Plan section in either form now FAILs loud instead, naming what was searched for; non-task branches keep the advisory bypass. The runtime Test Plan check — now the `Runtime Test Plan checkbox state` step (4/9) of the AEG gate suite job in `.github/workflows/forge-lifecycle.yml` — now also passes `BRANCH` (previously only `PR_BODY`), without which the task-branch distinction could never fire in real CI.
323
323
  - **Dispatch gates** (depends-on merged / no conflicting PR open) — read from the forge and complied with; mechanical enforcement arrives when an automation tool runs dispatch (`tranche-model.md` §8).
324
324
  - **Label discipline** (Section 14) — `vinaya/tier:*` present on every task Issue and kept in sync with the PR-body `Tier:`; `vinaya/needs:*-input` / `vinaya/blocked` present-when-true *and removed when false*; no `status:*` labels; no `project:*` labels; no label outside the closed set. Trusted discipline; the Archivist drift cron asserts the tier label/field match and flags stale `vinaya/needs:*` labels.
325
325
  - **Contract conformance** (a role doc matches its `contracts/*.md` seam) — trusted discipline; the Archivist drift cron flags a role doc that contradicts its contract. The contract is the source of truth; a divergent role doc is the bug. (The Planner's own rationale grammar's *field-completeness* — every task Issue body carries all eight fields (`roles/planner/reference.md` § Rationale grammar) — moved to Enforced via R1 above; only the "role doc text matches contract prose" half remains trusted here.)
@@ -125,7 +125,7 @@ STOP and report if: pre-flight fails; [the Planner's stop-and-escalate condition
125
125
  - [forbidden patterns for this task — deferred features, off-limits paths]
126
126
  - Never write status anywhere; never add execution metadata to the tranche file.
127
127
 
128
- > **Autonomy:** Do not stop to ask clarifying questions. For any ambiguity not covered by a Section 10 stop condition, choose the most reasonable option consistent with this brief, record the choice in the PR body at open, or in a PR comment after open, and continue. Halt only for the explicit Section 10 stop conditions — and when you halt, record the blocker in a PR comment or an Issue comment rather than waiting interactively for input.
128
+ > **Autonomy:** Do not stop to ask clarifying questions. For any ambiguity not covered by a Section 10 stop condition, choose the most reasonable option consistent with this brief, record the choice in the PR body at open, and continue. Halt only for the explicit Section 10 stop conditions — and when you halt, report the blocker in your turn result (the loop posts it); post no PR or Issue comment yourself, and do not wait interactively for input.
129
129
 
130
130
  ## 12. Deliverable
131
131
 
@@ -780,10 +780,11 @@ function trancheSlugsFromLabels(labels) {
780
780
  }
781
781
  return slugs;
782
782
  }
783
- async function indexTrancheMilestonesAsync(owner, repo) {
783
+ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
784
+ const read = (fetch) => options.retryFailedReads ? retryOnce(fetch) : fetch();
784
785
  const [milestones, labels] = await Promise.all([
785
- ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
786
- ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)
786
+ read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
787
+ read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
787
788
  ]);
788
789
  const active = [];
789
790
  const archived = [];
@@ -794,9 +795,16 @@ async function indexTrancheMilestonesAsync(owner, repo) {
794
795
  const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
795
796
  const uniqueLegacySlugs = [...legacySlugs];
796
797
  const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
797
- Promise.all(uniqueLegacySlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))),
798
- Promise.all(uniqueNewPathSlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))
798
+ Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
799
+ Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
799
800
  ]);
801
+ const issuesBySlug = new Map;
802
+ uniqueLegacySlugs.forEach((slug, i) => {
803
+ issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
804
+ });
805
+ uniqueNewPathSlugs.forEach((slug, i) => {
806
+ issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
807
+ });
800
808
  uniqueLegacySlugs.forEach((slug, i) => {
801
809
  const m = legacyMilestoneBySlug.get(slug);
802
810
  if (!m)
@@ -820,7 +828,14 @@ async function indexTrancheMilestonesAsync(owner, repo) {
820
828
  else if (lifecycle === "complete")
821
829
  archived.push({ slug, goal });
822
830
  });
823
- return { active, archived, facts, legacySlugs };
831
+ return { active, archived, facts, legacySlugs, issuesBySlug };
832
+ }
833
+ async function retryOnce(fetch) {
834
+ try {
835
+ return await fetch();
836
+ } catch {
837
+ return fetch();
838
+ }
824
839
  }
825
840
  async function indexTrancheMilestonesForSlugAsync(owner, repo, slug) {
826
841
  const [milestones, labels, issues] = await Promise.all([
@@ -1865,15 +1880,16 @@ function describeError(err) {
1865
1880
  }
1866
1881
  // ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
1867
1882
  function defaultPriorTrancheArchivalDeps() {
1868
- let facts = new Map;
1869
1883
  return {
1870
- activeTrancheSlugs: async (excludeSlug, repo) => {
1871
- const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo);
1872
- facts = index.facts;
1873
- return index.active.map((m) => m.slug).filter((slug) => slug !== excludeSlug);
1874
- },
1875
- deriveTranche: (slug, repo) => deriveTrancheFromForge(repo.owner, repo.repo, slug, facts.get(slug)),
1876
- openIssues: async (slug, repo) => (await fetchTrancheIssuesAsync(repo.owner, repo.repo, slug)).filter((issue) => issue.state === "OPEN").map((issue) => ({ number: issue.number }))
1884
+ activeTranches: async (excludeSlug, repo) => {
1885
+ const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo, { retryFailedReads: true });
1886
+ return index.active.filter((m) => m.slug !== excludeSlug).map((m) => {
1887
+ const issues = index.issuesBySlug?.get(m.slug);
1888
+ if (!issues)
1889
+ throw new Error(`the Milestone index holds no Issue list for tranche \`${m.slug}\``);
1890
+ return { slug: m.slug, issues };
1891
+ });
1892
+ }
1877
1893
  };
1878
1894
  }
1879
1895
  function reason(err) {
@@ -1885,61 +1901,28 @@ async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = d
1885
1901
  return { facts: [], infraFailure: null };
1886
1902
  let candidates;
1887
1903
  try {
1888
- candidates = await deps.activeTrancheSlugs(excludeSlug, repo);
1904
+ candidates = await deps.activeTranches(excludeSlug, repo);
1889
1905
  } catch (err) {
1890
1906
  return {
1891
1907
  facts: [],
1892
1908
  infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
1893
1909
  };
1894
1910
  }
1911
+ const tasksBySlug = new Map(candidates.map((c) => [c.slug, tasksFromIssues(c.issues)]));
1895
1912
  const facts = [];
1896
- const unreadable = [];
1897
- const derived = new Map;
1898
- const derive = (slug) => {
1899
- let p = derived.get(slug);
1900
- if (!p) {
1901
- p = deps.deriveTranche(slug, repo);
1902
- derived.set(slug, p);
1903
- }
1904
- return p;
1905
- };
1906
1913
  for (const project of projects) {
1907
1914
  let found = null;
1908
- let unknown = false;
1909
- for (const slug of candidates) {
1910
- let candidateTranche;
1911
- try {
1912
- candidateTranche = await derive(slug);
1913
- } catch {
1914
- unknown = true;
1915
- unreadable.push(`the tasks of tranche \`${slug}\` (project \`${project}\`)`);
1916
- break;
1917
- }
1918
- if (!candidateTranche.tasks.some((t) => t.projects.includes(project)))
1915
+ for (const { slug, issues } of candidates) {
1916
+ if (!(tasksBySlug.get(slug) ?? []).some((t) => t.projects.includes(project)))
1919
1917
  continue;
1920
- let openIssues;
1921
- try {
1922
- openIssues = await deps.openIssues(slug, repo);
1923
- } catch {
1924
- openIssues = null;
1925
- }
1926
- if (openIssues === null) {
1927
- unknown = true;
1928
- unreadable.push(`the open Issues of tranche \`${slug}\` (project \`${project}\`)`);
1929
- break;
1930
- }
1931
- if (openIssues.length === 0) {
1918
+ if (!issues.some((issue) => issue.state === "OPEN")) {
1932
1919
  found = { project, priorTrancheSlug: slug, archived: false };
1933
1920
  break;
1934
1921
  }
1935
1922
  }
1936
- if (!unknown)
1937
- facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
1923
+ facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
1938
1924
  }
1939
- return {
1940
- facts,
1941
- infraFailure: unreadable.length === 0 ? null : `severity:infra — could not read ${unreadable.join(", ")}; whether a prior tranche is archived is unknown.`
1942
- };
1925
+ return { facts, infraFailure: null };
1943
1926
  }
1944
1927
  // ../../packages/aeg-forge-state/src/fetch-open-issues.ts
1945
1928
  async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
@@ -2765,11 +2748,13 @@ var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
2765
2748
  var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
2766
2749
  var DEFAULT_MAX_ROUNDS = 3;
2767
2750
  var DEFAULT_MAX_TASK_MINUTES = 180;
2751
+ var DEFAULT_READY_PUSH_TIMEOUT_MINUTES = 20;
2768
2752
  var DEFAULT_REVIEW_POLICY = {
2769
2753
  codeReviewThreshold: "BLOCKER",
2770
2754
  securityThreshold: "HIGH",
2771
2755
  maxRounds: DEFAULT_MAX_ROUNDS,
2772
- maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
2756
+ maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES,
2757
+ readyPushTimeoutMinutes: DEFAULT_READY_PUSH_TIMEOUT_MINUTES
2773
2758
  };
2774
2759
  var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
2775
2760
  var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
@@ -6958,7 +6943,17 @@ var HeaderMetaV3Schema = z3.object({
6958
6943
  runtime: z3.string().nullable(),
6959
6944
  source: z3.string().nullable()
6960
6945
  }).strict();
6961
- var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
6946
+ var HeaderMetaV4Schema = HeaderMetaV3Schema.extend({
6947
+ schema: z3.literal(4),
6948
+ process: z3.object({ id: z3.string(), version: z3.string().nullable(), digest: z3.string().nullable() }).strict(),
6949
+ runner: z3.object({ id: z3.string(), version: z3.string().nullable() }).strict()
6950
+ }).strict();
6951
+ var HeaderMetaSchema = z3.discriminatedUnion("schema", [
6952
+ HeaderMetaV1Schema,
6953
+ HeaderMetaV2Schema,
6954
+ HeaderMetaV3Schema,
6955
+ HeaderMetaV4Schema
6956
+ ]);
6962
6957
  var SubjectSchema = z3.object({
6963
6958
  issue: z3.number().int().nullable(),
6964
6959
  pr: z3.number().int().optional(),
@@ -7178,6 +7173,75 @@ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
7178
7173
  round: z3.number().int(),
7179
7174
  phase: z3.string()
7180
7175
  }).strict(),
7176
+ z3.object({
7177
+ ...loopShared,
7178
+ event: z3.literal("conflict_reentry"),
7179
+ task: z3.number().int(),
7180
+ pr: z3.number().int().positive(),
7181
+ attempt: z3.number().int().positive(),
7182
+ bound: z3.number().int().positive()
7183
+ }).strict(),
7184
+ z3.object({
7185
+ ...loopShared,
7186
+ event: z3.literal("storage_push"),
7187
+ round: z3.number().int(),
7188
+ branch: z3.string(),
7189
+ head: z3.string()
7190
+ }).strict(),
7191
+ z3.object({
7192
+ ...loopShared,
7193
+ event: z3.literal("local_checks_run"),
7194
+ round: z3.number().int(),
7195
+ head: z3.string().nullable(),
7196
+ passed: z3.boolean(),
7197
+ wall_ms: z3.number().nonnegative()
7198
+ }).strict(),
7199
+ z3.object({
7200
+ ...loopShared,
7201
+ event: z3.literal("ready_push"),
7202
+ round: z3.number().int(),
7203
+ head: z3.string(),
7204
+ outcome: z3.enum(["passed", "refused"]),
7205
+ selected: z3.number().int().nonnegative(),
7206
+ failed: z3.number().int().nonnegative(),
7207
+ rerun: z3.boolean(),
7208
+ wall_ms: z3.number().nonnegative()
7209
+ }).strict(),
7210
+ z3.object({
7211
+ ...loopShared,
7212
+ event: z3.literal("failed_tests_rerun"),
7213
+ round: z3.number().int(),
7214
+ head: z3.string(),
7215
+ rerun_of: z3.string(),
7216
+ failed_files: z3.number().int().nonnegative(),
7217
+ affected_files: z3.number().int().nonnegative(),
7218
+ full_count: z3.number().int().nonnegative()
7219
+ }).strict(),
7220
+ z3.object({
7221
+ ...loopShared,
7222
+ event: z3.literal("pr_opened"),
7223
+ round: z3.number().int(),
7224
+ pr: z3.number().int().positive(),
7225
+ head: z3.string()
7226
+ }).strict(),
7227
+ z3.object({
7228
+ ...loopShared,
7229
+ event: z3.literal("ci_result_read"),
7230
+ round: z3.number().int(),
7231
+ pr: z3.number().int().positive(),
7232
+ head: z3.string(),
7233
+ conclusion: z3.enum(["green", "red", "pending", "skipped"]),
7234
+ failing_checks: z3.array(z3.string()),
7235
+ wait_ms: z3.number().nonnegative()
7236
+ }).strict(),
7237
+ z3.object({
7238
+ ...loopShared,
7239
+ event: z3.literal("phase_time"),
7240
+ round: z3.number().int(),
7241
+ phase: z3.enum(["developer", "local_checks", "review", "push", "ci", "other"]),
7242
+ step: z3.string(),
7243
+ wall_ms: z3.number().nonnegative()
7244
+ }).strict(),
7181
7245
  z3.object({
7182
7246
  ...loopShared,
7183
7247
  event: z3.literal("driver_exited"),
@@ -7365,7 +7429,7 @@ var EffectEventSchema = z3.discriminatedUnion("event", [
7365
7429
  ]);
7366
7430
  var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
7367
7431
  var customShared = {
7368
- meta: HeaderMetaV3Schema,
7432
+ meta: HeaderMetaSchema,
7369
7433
  subject: SubjectSchema,
7370
7434
  kind: z3.literal("custom"),
7371
7435
  ...envelopeTail
@@ -7450,7 +7514,7 @@ function buildHeader(input) {
7450
7514
  const issue = subject.issue;
7451
7515
  return {
7452
7516
  meta: {
7453
- schema: 3,
7517
+ schema: 4,
7454
7518
  ts: input.now.toISOString(),
7455
7519
  run_id: input.runId,
7456
7520
  seq: input.seq,
@@ -7487,6 +7551,15 @@ function buildHeader(input) {
7487
7551
  version: lineageFieldFromEnv(input.env.flowVersion)
7488
7552
  },
7489
7553
  runtime: lineageFieldFromEnv(input.env.runtime),
7554
+ process: {
7555
+ id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
7556
+ version: lineageFieldFromEnv(input.env.processVersion),
7557
+ digest: lineageFieldFromEnv(input.env.processDigest)
7558
+ },
7559
+ runner: {
7560
+ id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
7561
+ version: lineageFieldFromEnv(input.env.runnerVersion)
7562
+ },
7490
7563
  source: lineageFieldFromEnv(input.env.source)
7491
7564
  },
7492
7565
  subject
@@ -7530,7 +7603,7 @@ function redact(value, home) {
7530
7603
  return value;
7531
7604
  }
7532
7605
  // ../../packages/aeg-core/src/log/store.ts
7533
- var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
7606
+ var KNOWN_SCHEMA_VERSIONS = [1, 2, 3, 4];
7534
7607
  function metaOf(obj) {
7535
7608
  if (obj === null || typeof obj !== "object")
7536
7609
  return null;
@@ -7754,14 +7827,24 @@ var ResolutionRecordSchema = z4.object({
7754
7827
  authenticatedFrom: z4.string().min(1),
7755
7828
  consumedAt: isoTimestamp
7756
7829
  }).strict();
7830
+ var ExecutionRoundMirrorRecordSchema = z4.object({
7831
+ version: z4.literal(1),
7832
+ kind: z4.literal("execution_round"),
7833
+ task: taskId,
7834
+ repository: z4.string().min(1),
7835
+ threadId: z4.string().min(1),
7836
+ checkpointId: z4.string().min(1),
7837
+ round: z4.number().int().positive(),
7838
+ recordedAt: isoTimestamp
7839
+ }).strict();
7757
7840
  // ../../packages/aeg-core/src/control-store/local.ts
7758
7841
  var CONTROL_AREA_DIRNAME = "control";
7759
7842
  // src/lib/config.ts
7760
7843
  import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
7761
7844
  import { promisify as promisify4 } from "node:util";
7762
- import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
7845
+ import { existsSync, lstatSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
7763
7846
  import { homedir } from "node:os";
7764
- import { dirname, isAbsolute, join, resolve } from "node:path";
7847
+ import { basename as basename3, dirname, isAbsolute, join, resolve } from "node:path";
7765
7848
  import { z as z6 } from "zod";
7766
7849
 
7767
7850
  // src/checks/contract.ts
@@ -8224,7 +8307,8 @@ var VinayaConfigObjectSchema = z6.object({
8224
8307
  codeReviewThreshold: z6.string().min(1).optional(),
8225
8308
  securityThreshold: z6.string().min(1).optional(),
8226
8309
  maxRounds: z6.number().optional(),
8227
- maxTaskMinutes: z6.number().optional()
8310
+ maxTaskMinutes: z6.number().optional(),
8311
+ readyPushTimeoutMinutes: z6.number().optional()
8228
8312
  }).optional(),
8229
8313
  securityScan: z6.object({
8230
8314
  command: z6.array(z6.string().min(1)).min(1)
@@ -8240,7 +8324,16 @@ var VinayaConfigObjectSchema = z6.object({
8240
8324
  collisionThreshold: z6.number().int().nonnegative().optional()
8241
8325
  }).optional(),
8242
8326
  prePush: z6.object({
8243
- alwaysRun: z6.array(z6.string()).optional()
8327
+ alwaysRun: z6.array(z6.string()).optional(),
8328
+ readyTests: z6.object({
8329
+ mode: z6.literal("ci"),
8330
+ workflow: z6.literal(".github/workflows/ci.yml"),
8331
+ check: z6.literal("Vinaya CI")
8332
+ }).strict().optional(),
8333
+ requiredCi: z6.object({
8334
+ workflow: z6.literal(".github/workflows/ci.yml"),
8335
+ check: z6.literal("Vinaya CI")
8336
+ }).strict().optional()
8244
8337
  }).optional(),
8245
8338
  report: z6.object({
8246
8339
  commandTimeoutMs: z6.number().int().positive().optional()
@@ -8258,6 +8351,7 @@ var VinayaConfigObjectSchema = z6.object({
8258
8351
  message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
8259
8352
  }),
8260
8353
  runtimeDir: z6.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
8354
+ runner: z6.enum(["standalone", "atta-engine"]).optional(),
8261
8355
  logs: z6.object({
8262
8356
  folder: z6.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
8263
8357
  url: z6.string().url().optional(),
@@ -8270,7 +8364,7 @@ var VinayaConfigObjectSchema = z6.object({
8270
8364
  message: "logs: headers requires url"
8271
8365
  }).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
8272
8366
  message: "logs: readHeaders requires url"
8273
- }).optional(),
8367
+ }).or(z6.literal(false)).optional(),
8274
8368
  decisionRecords: z6.object({
8275
8369
  path: RepoRelativePathSchema
8276
8370
  }).strict().optional()
@@ -8400,13 +8494,19 @@ function resolveReviewPolicy(config) {
8400
8494
  if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
8401
8495
  throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
8402
8496
  }
8497
+ const readyPushTimeoutMinutes = raw.readyPushTimeoutMinutes ?? DEFAULT_READY_PUSH_TIMEOUT_MINUTES;
8498
+ if (!Number.isInteger(readyPushTimeoutMinutes) || readyPushTimeoutMinutes < 1) {
8499
+ throw new Error(`vinaya.config.json: reviewPolicy.readyPushTimeoutMinutes "${readyPushTimeoutMinutes}" is not a positive integer — fix the config, this never falls back to a default.`);
8500
+ }
8403
8501
  return {
8404
8502
  codeReviewThreshold,
8405
8503
  securityThreshold,
8406
8504
  maxRounds,
8407
- maxTaskMinutes
8505
+ maxTaskMinutes,
8506
+ readyPushTimeoutMinutes
8408
8507
  };
8409
8508
  }
8509
+ var emittedLocalOverrideWarnings = new Set;
8410
8510
  function resolveGateCutovers(config) {
8411
8511
  const raw = config?.gateCutovers;
8412
8512
  if (!raw)