codex-workflow-v2 2.0.0-beta.13.9 → 2.0.0-beta.14

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 (271) hide show
  1. package/README.md +27 -388
  2. package/dist/reviewer-runtime-build.json +89 -29
  3. package/dist/src/alpha6/adoption.d.ts +2 -0
  4. package/dist/src/alpha6/adoption.js +22 -0
  5. package/dist/src/alpha6/adoption.js.map +1 -1
  6. package/dist/src/alpha6/captured-check-evidence.d.ts +51 -0
  7. package/dist/src/alpha6/captured-check-evidence.js +152 -0
  8. package/dist/src/alpha6/captured-check-evidence.js.map +1 -0
  9. package/dist/src/alpha6/component-owner.d.ts +15 -1
  10. package/dist/src/alpha6/component-owner.js +44 -2
  11. package/dist/src/alpha6/component-owner.js.map +1 -1
  12. package/dist/src/alpha6/corrective-decision-boundary.d.ts +4 -0
  13. package/dist/src/alpha6/corrective-decision-boundary.js +47 -0
  14. package/dist/src/alpha6/corrective-decision-boundary.js.map +1 -0
  15. package/dist/src/alpha6/downstream-proof.d.ts +1 -25
  16. package/dist/src/alpha6/downstream-proof.js +0 -171
  17. package/dist/src/alpha6/downstream-proof.js.map +1 -1
  18. package/dist/src/alpha6/literal-test-invocation.d.ts +2 -0
  19. package/dist/src/alpha6/literal-test-invocation.js +106 -0
  20. package/dist/src/alpha6/literal-test-invocation.js.map +1 -0
  21. package/dist/src/alpha6/milestone.d.ts +2 -0
  22. package/dist/src/alpha6/milestone.js +10 -1
  23. package/dist/src/alpha6/milestone.js.map +1 -1
  24. package/dist/src/alpha6/navigation-dirty-carryover.d.ts +11 -0
  25. package/dist/src/alpha6/navigation-dirty-carryover.js +130 -0
  26. package/dist/src/alpha6/navigation-dirty-carryover.js.map +1 -0
  27. package/dist/src/alpha6/plan-integrity.js +7 -5
  28. package/dist/src/alpha6/plan-integrity.js.map +1 -1
  29. package/dist/src/alpha6/remediation.d.ts +6 -21
  30. package/dist/src/alpha6/remediation.js +161 -476
  31. package/dist/src/alpha6/remediation.js.map +1 -1
  32. package/dist/src/alpha6/root-cause-replan-carryover.d.ts +4 -1
  33. package/dist/src/alpha6/root-cause-replan-carryover.js +29 -5
  34. package/dist/src/alpha6/root-cause-replan-carryover.js.map +1 -1
  35. package/dist/src/beta1/project-transaction.d.ts +3 -1
  36. package/dist/src/beta1/project-transaction.js +6 -2
  37. package/dist/src/beta1/project-transaction.js.map +1 -1
  38. package/dist/src/checks/runner.d.ts +26 -0
  39. package/dist/src/checks/runner.js +223 -0
  40. package/dist/src/checks/runner.js.map +1 -0
  41. package/dist/src/checks/task-sync.d.ts +10 -0
  42. package/dist/src/checks/task-sync.js +41 -0
  43. package/dist/src/checks/task-sync.js.map +1 -0
  44. package/dist/src/checks/worker.d.ts +1 -0
  45. package/dist/src/checks/worker.js +154 -0
  46. package/dist/src/checks/worker.js.map +1 -0
  47. package/dist/src/cli-actions.d.ts +2 -2
  48. package/dist/src/cli-actions.js +3 -15
  49. package/dist/src/cli-actions.js.map +1 -1
  50. package/dist/src/cli.js +14 -98
  51. package/dist/src/cli.js.map +1 -1
  52. package/dist/src/contracts.d.ts +35 -32
  53. package/dist/src/dependency-provenance.d.ts +2 -2
  54. package/dist/src/dependency-provenance.js +12 -69
  55. package/dist/src/dependency-provenance.js.map +1 -1
  56. package/dist/src/domain/base-sync-conflict.d.ts +13 -0
  57. package/dist/src/domain/base-sync-conflict.js +32 -0
  58. package/dist/src/domain/base-sync-conflict.js.map +1 -0
  59. package/dist/src/domain/step-start-admission.d.ts +4 -0
  60. package/dist/src/domain/step-start-admission.js +9 -0
  61. package/dist/src/domain/step-start-admission.js.map +1 -0
  62. package/dist/src/domain/virgin-registration.d.ts +3 -0
  63. package/dist/src/domain/virgin-registration.js +65 -0
  64. package/dist/src/domain/virgin-registration.js.map +1 -0
  65. package/dist/src/errors.d.ts +1 -1
  66. package/dist/src/errors.js.map +1 -1
  67. package/dist/src/gateway-handshake.js +0 -8
  68. package/dist/src/gateway-handshake.js.map +1 -1
  69. package/dist/src/git.d.ts +3 -1
  70. package/dist/src/git.js +41 -14
  71. package/dist/src/git.js.map +1 -1
  72. package/dist/src/graph.js +25 -3
  73. package/dist/src/graph.js.map +1 -1
  74. package/dist/src/index.d.ts +1 -0
  75. package/dist/src/navigation-actions.d.ts +9 -0
  76. package/dist/src/navigation-actions.js +72 -0
  77. package/dist/src/navigation-actions.js.map +1 -0
  78. package/dist/src/navigation-update-artifact.d.ts +5 -0
  79. package/dist/src/navigation-update-artifact.js +227 -0
  80. package/dist/src/navigation-update-artifact.js.map +1 -0
  81. package/dist/src/navigation-update.d.ts +39 -0
  82. package/dist/src/navigation-update.js +82 -0
  83. package/dist/src/navigation-update.js.map +1 -0
  84. package/dist/src/observation.js +52 -29
  85. package/dist/src/observation.js.map +1 -1
  86. package/dist/src/observed-routes.js +5 -6
  87. package/dist/src/observed-routes.js.map +1 -1
  88. package/dist/src/pending-review-update.d.ts +0 -13
  89. package/dist/src/pending-review-update.js +1 -6
  90. package/dist/src/pending-review-update.js.map +1 -1
  91. package/dist/src/reviewer.d.ts +1 -1
  92. package/dist/src/reviewer.js +20 -17
  93. package/dist/src/reviewer.js.map +1 -1
  94. package/dist/src/runtime.d.ts +3 -0
  95. package/dist/src/runtime.js +6 -0
  96. package/dist/src/runtime.js.map +1 -0
  97. package/dist/src/state/corrective-replan-executor.d.ts +10 -0
  98. package/dist/src/state/corrective-replan-executor.js +37 -1
  99. package/dist/src/state/corrective-replan-executor.js.map +1 -1
  100. package/dist/src/state/corrective-replan-public-schema.js +15 -2
  101. package/dist/src/state/corrective-replan-public-schema.js.map +1 -1
  102. package/dist/src/state/corrective-replan-public.js +1 -1
  103. package/dist/src/state/corrective-replan-public.js.map +1 -1
  104. package/dist/src/state/corrective-replan-transaction.d.ts +1 -0
  105. package/dist/src/state/corrective-replan-transaction.js +12 -11
  106. package/dist/src/state/corrective-replan-transaction.js.map +1 -1
  107. package/dist/src/state/corrective-yield-transaction.d.ts +1 -0
  108. package/dist/src/state/corrective-yield-transaction.js +11 -10
  109. package/dist/src/state/corrective-yield-transaction.js.map +1 -1
  110. package/dist/src/state/lock.d.ts +4 -0
  111. package/dist/src/state/lock.js +21 -0
  112. package/dist/src/state/lock.js.map +1 -1
  113. package/dist/src/version.d.ts +1 -1
  114. package/dist/src/version.js +1 -1
  115. package/dist/src/version.js.map +1 -1
  116. package/dist/src/workflow-blocker-route.d.ts +8 -0
  117. package/dist/src/workflow-blocker-route.js +106 -0
  118. package/dist/src/workflow-blocker-route.js.map +1 -0
  119. package/dist/src/workflow.d.ts +48 -63
  120. package/dist/src/workflow.js +666 -1460
  121. package/dist/src/workflow.js.map +1 -1
  122. package/docs/autonomy-guardrails.md +26 -304
  123. package/docs/decisions.md +14 -112
  124. package/docs/development-flow.md +35 -238
  125. package/docs/project-memory.md +31 -50
  126. package/docs/release-app-evidence.md +190 -0
  127. package/docs/release.md +95 -388
  128. package/docs/updating-existing-project.md +19 -717
  129. package/package.json +11 -13
  130. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +2 -2
  131. package/plugins/codex-workflow-gateway/references/chat-dispatch.md +73 -197
  132. package/plugins/codex-workflow-gateway/references/codebase-memory-routing.md +57 -0
  133. package/plugins/codex-workflow-gateway/references/protocol.md +42 -445
  134. package/plugins/codex-workflow-gateway/scripts/chat-dispatch.mjs +7 -1
  135. package/plugins/codex-workflow-gateway/scripts/chat-model-policy.mjs +10 -8
  136. package/plugins/codex-workflow-gateway/scripts/chat-registry.mjs +23 -5
  137. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +66 -757
  138. package/references/state-machine.md +4 -4
  139. package/roles/technical-planner.md +1 -1
  140. package/schemas/corrective-decision-event.schema.json +3 -1
  141. package/schemas/project-knowledge-map.schema.json +3 -1
  142. package/schemas/remediation-event.schema.json +10 -1
  143. package/schemas/task.schema.json +46 -2
  144. package/schemas/transition-payloads.schema.json +16 -1
  145. package/src/alpha6/adoption.ts +1123 -0
  146. package/src/alpha6/captured-check-evidence.ts +132 -0
  147. package/src/alpha6/check-support-anchor.ts +128 -0
  148. package/src/alpha6/component-owner.ts +168 -0
  149. package/src/alpha6/corrective-decision-boundary.ts +39 -0
  150. package/src/alpha6/downstream-proof.ts +520 -0
  151. package/src/alpha6/failed-step-planning-recovery.ts +88 -0
  152. package/src/alpha6/handoff.ts +1443 -0
  153. package/src/alpha6/journal.ts +473 -0
  154. package/src/alpha6/literal-test-invocation.ts +84 -0
  155. package/src/alpha6/mechanical-feasibility.ts +488 -0
  156. package/src/alpha6/milestone.ts +2192 -0
  157. package/src/alpha6/navigation-dirty-carryover.ts +154 -0
  158. package/src/alpha6/npm-check-contract.ts +47 -0
  159. package/src/alpha6/plan-integrity.ts +298 -0
  160. package/src/alpha6/plan-risk.ts +1480 -0
  161. package/src/alpha6/preexecution-replan.ts +187 -0
  162. package/src/alpha6/remediation-cause.ts +98 -0
  163. package/src/alpha6/remediation.ts +2438 -0
  164. package/src/alpha6/review.ts +1198 -0
  165. package/src/alpha6/root-cause-replan-carryover.ts +491 -0
  166. package/src/alpha6/store-sidecars.ts +335 -0
  167. package/src/alpha7/autonomy.ts +411 -0
  168. package/src/alpha7/corrective-recovery.ts +1332 -0
  169. package/src/artifacts.ts +130 -0
  170. package/src/beta1/project-transaction.ts +355 -0
  171. package/src/change-explanation.ts +153 -0
  172. package/src/checks/runner.ts +245 -0
  173. package/src/checks/task-sync.ts +41 -0
  174. package/src/checks/worker.ts +149 -0
  175. package/src/cli-actions.ts +107 -0
  176. package/src/cli.ts +1457 -0
  177. package/src/contracts.ts +1494 -0
  178. package/src/credential-output.ts +89 -0
  179. package/src/credential-transport.ts +215 -0
  180. package/src/delegation.ts +190 -0
  181. package/src/dependency-provenance.ts +472 -0
  182. package/src/diagnostics.ts +93 -0
  183. package/src/domain/base-sync-conflict.ts +35 -0
  184. package/src/domain/completed-step-carryover.ts +76 -0
  185. package/src/domain/discovery.ts +27 -0
  186. package/src/domain/plan-semantics.ts +58 -0
  187. package/src/domain/step-start-admission.ts +10 -0
  188. package/src/domain/validation.ts +177 -0
  189. package/src/domain/virgin-registration.ts +46 -0
  190. package/src/errors.ts +24 -0
  191. package/src/fs-utils.ts +61 -0
  192. package/src/gateway-handshake.ts +95 -0
  193. package/src/git.ts +183 -0
  194. package/src/graph.ts +342 -0
  195. package/src/historical-step-provenance.ts +136 -0
  196. package/src/index.ts +23 -0
  197. package/src/lifecycle/canonical-hash.ts +28 -0
  198. package/src/lifecycle/catalog.ts +202 -0
  199. package/src/lifecycle/compiler-inspection.ts +29 -0
  200. package/src/lifecycle/core-static-readiness.ts +132 -0
  201. package/src/lifecycle/corrective-replan-authority.ts +136 -0
  202. package/src/lifecycle/corrective-replan-binding-manifest.ts +51 -0
  203. package/src/lifecycle/corrective-replan-credential-core.ts +408 -0
  204. package/src/lifecycle/corrective-replan-credential-schema.ts +54 -0
  205. package/src/lifecycle/corrective-replan-credentials.ts +48 -0
  206. package/src/lifecycle/corrective-replan.ts +843 -0
  207. package/src/lifecycle/evaluator.ts +48 -0
  208. package/src/lifecycle/fingerprint.ts +488 -0
  209. package/src/lifecycle/immutable.ts +8 -0
  210. package/src/lifecycle/implementation-table.ts +118 -0
  211. package/src/lifecycle/index.ts +8 -0
  212. package/src/lifecycle/schema-artifact.ts +263 -0
  213. package/src/lifecycle/semantic-registry.ts +572 -0
  214. package/src/lifecycle/types.ts +838 -0
  215. package/src/memory.ts +273 -0
  216. package/src/migration.ts +161 -0
  217. package/src/navigation-actions.ts +70 -0
  218. package/src/navigation-update-artifact.ts +198 -0
  219. package/src/navigation-update.ts +121 -0
  220. package/src/observation.ts +225 -0
  221. package/src/observed-routes.ts +660 -0
  222. package/src/operational-contract.ts +125 -0
  223. package/src/pending-review-update.ts +175 -0
  224. package/src/repository.ts +99 -0
  225. package/src/reviewer.ts +1879 -0
  226. package/src/runtime.ts +6 -0
  227. package/src/state/corrective-replan-executor.ts +818 -0
  228. package/src/state/corrective-replan-public-schema.ts +83 -0
  229. package/src/state/corrective-replan-public.ts +908 -0
  230. package/src/state/corrective-replan-transaction.ts +949 -0
  231. package/src/state/corrective-yield-executor.ts +327 -0
  232. package/src/state/corrective-yield-transaction.ts +730 -0
  233. package/src/state/lock.ts +902 -0
  234. package/src/state/store.ts +567 -0
  235. package/src/transition-core.ts +330 -0
  236. package/src/ulid.ts +24 -0
  237. package/src/version.ts +2 -0
  238. package/src/workflow-blocker-route.ts +109 -0
  239. package/src/workflow.ts +10172 -0
  240. package/docs/alpha7.1-implementation-brief.md +0 -268
  241. package/docs/alpha7.2-corrective-context-refresh-brief.md +0 -484
  242. package/docs/alpha7.2.1-remediation-recovery-brief.md +0 -86
  243. package/docs/beta1-stabilization-brief.md +0 -165
  244. package/docs/beta11-plan-integrity-recovery-brief.md +0 -38
  245. package/docs/beta13.2-signal-review-recovery.md +0 -38
  246. package/docs/beta2-initial-assembly-navigation-brief.md +0 -616
  247. package/docs/change-model.md +0 -118
  248. package/docs/delegated-approval.md +0 -254
  249. package/docs/lifecycle/state-machine-stabilization.md +0 -641
  250. package/docs/pdf/README.md +0 -24
  251. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  252. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  253. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  254. package/docs/pdf/requirements.txt +0 -1
  255. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +0 -478
  256. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +0 -506
  257. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +0 -778
  258. package/docs/pending-review-update.md +0 -15
  259. package/docs/problem-briefs/01-pre-implementation-integrity.md +0 -482
  260. package/docs/problem-briefs/02-minimal-step-integrity.md +0 -411
  261. package/docs/problem-briefs/03-minimal-agent-context-integrity.md +0 -358
  262. package/docs/problem-briefs/04-task-dependency-and-structural-replacement-integrity.md +0 -573
  263. package/docs/problem-briefs/BRIEF-TEMPLATE.md +0 -56
  264. package/docs/problem-briefs/README.md +0 -120
  265. package/docs/problem-briefs/evidence/p01-mechanical-feasibility-corpus.md +0 -90
  266. package/docs/problem-briefs/evidence/signal-v4-pre-m3-replay.md +0 -246
  267. package/docs/split-required-recovery.md +0 -47
  268. package/docs/stable-release-defect-register.md +0 -730
  269. package/docs/validation-report.md +0 -182
  270. package/scripts/generate-pdf-docs.py +0 -524
  271. package/scripts/run-pdf-docs.mjs +0 -62
@@ -1,458 +1,55 @@
1
- # Gateway Protocol V2
1
+ # Current action inputs
2
2
 
3
- ## beta.12.6 compatibility transitions and continuable remediation
3
+ Read this reference when preparing a Plan, a context refresh or a sealed review. Fresh Core
4
+ navigation is the eligibility authority; command help and current schemas define serialization.
5
+ This reference does not enumerate transitions or provide another compatibility contract.
4
6
 
5
- - When fresh `next` advertises `task plan-integrity-recover`, consume its exact Task revision,
6
- Step, actor, and writer-token contract. This route is valid only for the Core-derived
7
- first-failure missing-root-npm-script evidence and must be followed by fresh `status -> next`.
8
- It records a replan posture without changing Plan or product files; corrective yield and the
9
- existing state-bound corrective-replan Human gate remain mandatory.
7
+ ## Planning and Knowledge
10
8
 
11
- - When fresh `next` advertises `task downstream-proof-recover`, Core has proved that every dirty
12
- file outside the active Step belongs to a completed transitive predecessor and that recorded Git
13
- history is intact. Invoke the exact lease-bound transition once. It preserves product files and
14
- HEAD, invalidates stale predecessor completion authority with an append-only event, yields C1,
15
- and routes the same Task to ordinary `task plan-set`. The replacement Plan, risk audit, and
16
- execution authorization are fresh authority; no Task or Milestone recreation is involved.
9
+ When `next` advertises `task plan-set`, consume its `taskPlanContract`. Preserve every
10
+ `requiredRequirementIds` and `requiredAcceptanceIds` member in the corresponding Plan arrays;
11
+ prose does not replace IDs. Bind the returned Brief hash and Knowledge Map revision/hash.
12
+ Preserve completed Step evidence and the current semantic/safety boundaries when replanning.
13
+ Missing or contradictory bindings stop Plan submission.
17
14
 
18
- - When an older installed package cannot reach that recovery because its normal update preflight
19
- requires a clean checkout, beta.12.6 permits one bounded dependency transport. The active
20
- Milestone base and Task branch must first receive separate exact commits changing only
21
- `package.json` and `package-lock.json`; product work remains dirty and uncommitted. Fresh beta.12.6
22
- `next` must then advertise `update downstream-proof-dependency-recover`. Its preflight proves the
23
- Task history at `HEAD^`, the dependency candidate at `HEAD`, aligned version surfaces, no lease or
24
- transaction, exact predecessor ownership, and a content hash of the dirty set. Recovery registers
25
- only the dependency commit. It does not mutate product files or Step state; fresh `next` must
26
- proceed to `task downstream-proof-recover`, which outranks manifest-induced Knowledge staleness.
15
+ Compare planned exact `allowedWrites` and output paths with scanner classifications. A planned
16
+ new Knowledge source requires `knowledgeImpact: create` and an exact normalized path/category
17
+ in `knowledgeTargets`. A wildcard or directory is not an exact declaration. Source authority
18
+ comes from approved repository evidence; the planner cannot infer delegated approval eligibility.
27
19
 
28
- - `update dependency-provenance-preflight --id <TASK-ID>` is read-only. The matching
29
- `update dependency-provenance-recover --id <TASK-ID> --expected-revision <N> --actor <ACTOR>
30
- --reason <TEXT>` is valid only when preflight and fresh `next` both advertise it. Historical
31
- product commits absent from the current corrective Step are recognized only through intact passed
32
- strict-review plus verified reviewer-attestation chains and remain separately auditable as
33
- `retainedHistoricalCommits`.
34
- Task-local manifest/lock fields from recorded history may differ from the base, but the candidate
35
- commit must preserve them exactly while changing only the Workflow dependency entries.
36
- - `task historical-step-provenance-preflight --id <TASK-ID>` is read-only. The matching
37
- `task historical-step-provenance-recover` is available only for one unexpected product commit
38
- with an intact passed strict-review chain, matching prior final acceptance, no lease or pending
39
- operation, and dirty files confined to the current active Step. It retains historical authority
40
- without changing Git, worktree bytes, or the current Plan.
41
- - `update historical-step-dependency-preflight/recover` handles the same proof when the beta.12.9
42
- dependency-only commit is the unregistered HEAD. It binds the exact dependency candidate and the
43
- reviewed historical Step commit in one recovery record, preserves active product bytes, and then
44
- requires fresh `status` and `next`.
45
- - `task stop-override-prepare` is a read-only Human gate for the exact beta.11 attempt-four stop
46
- shape. `task stop-override-apply` requires the same Task revision, Step, actor, reason, Plan, HEAD,
47
- evidence binding, and returned `SOO-*` code in a later user turn. It appends evidence without
48
- deleting `stop-escalate`; it never applies to `split-required`.
49
- - After an applied stop override, one or more ordinary delegated `task context-refresh` transitions
50
- may rebind the Plan before attempt four. Fresh `next` returns `task run` only when Core validates
51
- the complete contiguous Plan/rebind/audit chain, mechanical equivalence at every hop, shared
52
- delegated authority, and append-only chronology. HEAD may differ from the override only when every
53
- intervening commit is an exact registered dependency-provenance recovery changing only
54
- `package.json` and `package-lock.json`. If C1 remains claimed but the lease was lost at the Human
55
- boundary, use only the simultaneously advertised `task writer-credential-replace` action.
56
- A provenance recovery recorded after the final context-refresh audit may explain exactly one
57
- additional Task revision only when it belongs to that verified Git chain. Any unexplained
58
- revision remains a `doctor` boundary.
59
- - Before a credential-consuming mutation, check the public `writerCredentialReference.expiresAt`
60
- against the current time and its actor/action binding. Lease heartbeat or renewal does not
61
- extend that reference's expiry. An expired, missing, consumed or unverifiable reference requires
62
- the simultaneously advertised `next.writerCredentialRecovery` action with its exact Task,
63
- revision and `requiredActor`, followed by fresh `status` and `next`; use the new reference.
64
- If no recovery is advertised, stop before mutation. Never read or patch the vault, extend expiry
65
- manually, or reuse the old reference. This check also applies after independent reviews and pauses.
66
- - `milestone progress --id <MS-ID>` is a read-only projection and the sole source for Coordinator
67
- progress tables. It preserves cancelled/replacement Tasks as distinct membership rows.
68
- - `scripts/chat-registry.mjs` atomically allocates project-monotonic `#NNN`, builds all six title
69
- families, verifies exact readback, supplies deterministic fallbacks, and binds the verified chat.
70
- It also journals a single creation permit, pending/actual IDs, evidence-based resolution and
71
- supervision cursors. Missing App listings never permit a retry. See `chat-dispatch.md` for
72
- dispatch commands and the explicit role/phase model + thinking policy. These are App routing
73
- helpers; they do not change Workflow protocol/state schema or grant approval authority.
20
+ If top-level `next` advertises `task context-refresh`, execute that atomic action with the returned
21
+ Task/map revisions, named delegate and grant. Do not approve/reconcile Knowledge separately first.
22
+ Unsafe differences use the visible Knowledge approval route returned by Core. For additional
23
+ implementation scope, `change explain` consumes a closed proposal; its diagnostic is not approval.
74
24
 
75
- ## Handshake
25
+ ## Sealed review
76
26
 
77
- Run:
27
+ For `external-sealed`, request the advertised Step or Task review packet and dispatch an independent
28
+ reviewer with only the immutable evidence and its read-only role. A separate thread identity alone
29
+ does not establish that a review occurred. Obtain the actual result and verify unchanged bindings.
30
+ Do not launch a nested local reviewer in an App sandbox when external-sealed is recommended.
78
31
 
79
- ```text
80
- codex-workflow gateway handshake --repo <git-root>
81
- ```
32
+ The record input is the full envelope, not a flattened review:
82
33
 
83
- Require:
34
+ - `protocol`: the current Step/Task envelope protocol;
35
+ - `packetHash`, `repositorySealHash`, `reviewerThreadId`, `reviewMode`: exact packet/result bindings;
36
+ - `review`: the closed object containing `status`, `reviewer`, `summary`, and `findings`.
84
37
 
85
- - package name `codex-workflow-v2`
86
- - protocol version `2`
87
- - state schema version `2`
88
- - the capabilities needed for the requested operation
38
+ Consult `task step-review-record --help` or `task review-sealed-record --help` for the applicable
39
+ schema/example. Mode belongs in the envelope; do not invent an extra record-command option.
40
+ Use the lifecycle actor from `next`, separately from the independent reviewer identity, and the
41
+ advertised credential reference. Discard a review whose packet, commit or seal changed.
42
+ An unverified launch or permission denial is not evidence of a semantic implementation failure.
89
43
 
90
- Current capability set:
44
+ ## Context and authority changes
91
45
 
92
- - `project-memory-v1`
93
- - `graph-binding-v1`
94
- - `local-state-v1`
95
- - `milestone-lifecycle-v1`
96
- - `milestone-human-final-gate-v1`
97
- - `delegated-approval-v1`
98
- - `task-knowledge-rebind-v1`
99
- - `task-context-refresh-v1`
100
- - `structural-task-replacement-disabled-v1`
101
- - `project-composite-transaction-journal-v1`
102
- - `corrective-plan-audit-v1`
103
- - `safe-update-preflight-v1`
104
- - `bounded-dependency-provenance-recovery-v1`
105
- - `task-local-dependency-provenance-recovery-v1`
106
- - `legacy-stop-escalate-override-v1`
107
- - `stop-override-context-rebind-v1`
108
- - `stop-override-context-rebind-chain-v1`
109
- - `stop-override-post-audit-dependency-revision-v1`
110
- - `retained-reviewed-history-recovery-v1`
111
- - `milestone-progress-projection-v1`
112
- - `strict-reviewer-v1`
113
- - `legacy-snapshot-v1`
114
- - `plan-risk-audit-sidecar-v1`
115
- - `step-strict-review-sidecar-v1`
116
- - `step-remediation-circuit-breaker-sidecar-v1`
117
- - `milestone-scope-change-sidecar-v1`
118
- - `milestone-membership-integrity-v1`
119
- - `milestone-task-dependency-dag-v1`
120
- - `milestone-initial-plan-transaction-v1`
121
- - `task-c1-handoff-sidecar-v1`
122
- - `task-mechanical-feasibility-v1`
123
- - `semantic-plan-risk-audit-v2`
124
- - `guarded-remediation-continuation-v1`
125
- - `milestone-reverse-membership-integrity-v1`
126
- - `task-c1-handoff-bundle-v2`
127
- - `alpha6-adoption-posture-v1`
128
- - `alpha6-strict-review-rescue-v1`
129
- - `milestone-initial-assembly-v1`
130
- - `milestone-initial-assembly-navigation-v2`
131
- - `milestone-autonomy-contract-v1`
132
- - `milestone-autonomy-content-refresh-v1`
133
- - `milestone-autonomous-membership-evolution-v1`
134
- - `task-c1-derived-worker-actor-v1`
135
- - `guarded-corrective-auditor-routing-v1`
136
- - `corrective-decision-context-recovery-v1`
137
- - `remediation-mode-recovery-v1`
138
- - `plan-proof-obligations-v1`
139
- - `bounded-plan-integrity-recovery-v1`
140
- - `downstream-proof-predecessor-recovery-v1`
141
- - `active-downstream-proof-dependency-recovery-v1`
142
- - `corrective-yield-journal-v1`
143
- - `corrective-replan-journal-v1`
144
- - `corrective-replan-human-gate-v1`
145
- - `corrective-replan-protocol-v2`
46
+ Help cannot waive any current claim, lease, independent audit or human gate. An actor derived by
47
+ Core removes a naming question, not its authority checks. A new review finding does not by itself
48
+ permit scope expansion or a new Task. Follow its current fix/replan/stop route and preserve history.
49
+ When the response offers several alternatives, choose only one consistent with the user's intent;
50
+ cancellation, publication and delegation issuance do not acquire authorization by appearing there.
146
51
 
147
- Protocol `1` and schema `2` remain valid only because alpha.7 is additive. The gateway must
148
- not claim compatibility if canonical entity shapes or non-additive command semantics change.
149
-
150
- ## Alpha.6 adoption posture
151
-
152
- For an existing schema 2 project without alpha.6 posture, repository-level `next` blocks
153
- execution behind adoption:
154
-
155
- - `action: "state adoption-apply"` when the repository is already at a safe boundary
156
- - `action: "restore safe boundary, then state adoption-prepare"` otherwise
157
-
158
- Use:
159
-
160
- ```text
161
- codex-workflow state adoption-prepare --repo <git-root>
162
- codex-workflow state adoption-apply --repo <git-root> \
163
- --actor <HUMAN-ACTOR> --confirmation-code <ADA-CODE>
164
- ```
165
-
166
- The confirmation is bound to project identity, package version, protocol version, schema
167
- version, canonical entity summaries, and the current sidecar baseline hash. Adoption is not
168
- `state migrate`.
169
-
170
- ## Worker Step completion and strict Step Review
171
-
172
- `task run` dispatches one Step and returns a first-field `writerLeaseReceipt`, followed by the
173
- credential-free lease metadata, Task state, and Worker envelope. Consume the receipt before the
174
- remaining payload and retain its token only in working memory. The Worker
175
- must leave all changes uncommitted and must not stage, commit, amend, reset, rebase, or
176
- modify Git history.
177
-
178
- While that Step is `in_progress`, repository-level `next` normally returns
179
- `action: "task step-complete"`, the exact `stepId`, and a `commitPolicy` declaring
180
- `workflow-core` ownership. The coordinator invokes that transition with the current revision
181
- and writer token. Core then runs configured checks, validates `allowedWrites`, stages the
182
- changes, creates the atomic commit, and records evidence.
183
- When `next` also includes `gitMutationPolicy`, obtain bounded permission for that exact
184
- Git-writing transition before the first call; do not probe and retry after a
185
- `.git/index.lock` failure. For `task start`, the policy applies only when the coordinator
186
- chooses `--workspace-owner local`.
187
-
188
- When `next` also includes `writerTokenContract`, the coordinator must retain the active writer
189
- lease from `writerLeaseReceipt` and pass it with the advertised option on the first transition call.
190
- The contract never contains the token value. Do not print, persist, reconstruct, or replace the
191
- token with a redacted fingerprint; stop before mutation when the active lease is unavailable.
192
- Satisfy this contract separately from any `gitMutationPolicy` on the same response.
193
-
194
- `codex-workflow <noun> [action] --help` is a read-only command-discovery route. It exits without
195
- constructing workflow state or validating lifecycle inputs. Use exact option lists only when the
196
- response says `exactOptionContractAvailable=true`; otherwise consult this packaged protocol. After
197
- help, obtain a fresh `next` before invoking the lifecycle transition.
198
-
199
- If the current Plan Risk Audit marks that Step for strict review, the commit is still
200
- workflow-owned, but `next` then returns `action: "task step-review"` with the same `stepId`
201
- and the exact `completionCommit`. Canonical Step completion remains blocked until the strict
202
- review and reviewer attestation sidecars verify against that exact commit.
203
- Invoke `task step-review` with the same lifecycle actor advertised by `next`
204
- (`c1Handoff.claimant` or `requiredActor` when present). The isolated reviewer is launched
205
- inside Core; do not substitute the reviewer identity into `--actor`. In claimed C1 posture,
206
- `next.writerTokenContract` is mandatory for both `task step-review` and the later
207
- `task review-launch`; pass the retained active lease on the first call of each exact action.
208
-
209
- After submission, a pending Task review is advertised as `action: "task review-launch"`, not
210
- `task review-record`. That compound route launches the read-only reviewer and atomically
211
- records the returned review. If claimant-bound mutation is active, pass the same lifecycle
212
- actor through `--actor`; reviewer identity remains internal to the route.
213
-
214
- An unrecorded commit is Git history drift. Stop instead of adding another commit or editing
215
- workflow state manually; recovery remains coordinator-controlled.
216
-
217
- If a Docker proof fails with `EPERM`, `operation not permitted`, or `permission denied` at the
218
- Docker socket/CLI boundary, classify it as sandbox access, not daemon failure. Re-run the exact
219
- read-only health probe or Plan command once with sandbox escalation; do not charge an infrastructure
220
- retry. Restarting Docker Desktop or pulling another image is forbidden on this evidence alone. A
221
- Docker infrastructure failure exists only when an escalated call reaches Docker and independently
222
- proves the daemon unavailable.
223
-
224
- ## Plan Risk Audit and remediation breaker
225
-
226
- Before `task authorize`, every new alpha.7 Task requires:
227
-
228
- ```text
229
- codex-workflow task plan-risk-audit --repo <git-root> \
230
- --id <TASK-ID> --expected-revision <REVISION> --file <audit.json>
231
- ```
232
-
233
- The audit must classify every current Step exactly once, name distinct planner/auditor
234
- actors, bind guarded failure modes to exact Step checks, and map each guarded failure mode to
235
- one hostile counterexample, expected safe result, and exact executable evidence command. Use `decision=approved` for an
236
- unguarded Plan. Missing, stale, `split-required`, or `stop-escalate` evidence blocks
237
- authorization.
238
-
239
- For guarded remediation, the first two failed cycles are recorded as `ordinary` and later cycles as
240
- `corrective`. This mode is diagnostic: a third or later retry remains executable and still requires
241
- a fresh strict review. A finding defaults to `route=fix`; `route=replan` is accepted only with exact
242
- Plan-conflict evidence and routes to ordinary `task plan-set` for implementation-Step changes.
243
-
244
- An explicit corrective disposition can still be recorded when the actor deliberately chooses a
245
- stop, split, or compatible historical recovery route:
246
-
247
- ```text
248
- codex-workflow task corrective-decision --repo <git-root> \
249
- --id <TASK-ID> --step <STEP-ID> --expected-revision <REVISION> --file <decision.json>
250
- ```
251
-
252
- `continue-fix` permits continuation; `replan-required`, `split-required`, and `stop-escalate` are
253
- explicit stop or redirection decisions. They are never inferred from attempt count. Without such an
254
- explicit decision, another failed strict review continues the same Task through its evidence-bound
255
- `fix`/`replan` route.
256
-
257
- One append-only compatibility exception exists for a beta.11 policy-created attempt-four stop.
258
- Fresh `next` must advertise `task stop-override-prepare`; run it with exact human inputs, present the
259
- complete binding, and stop. A later explicit user turn may run `task stop-override-apply` with the
260
- same inputs and confirmation code. Any split decision, Plan/revision/HEAD drift, missing attempt-3
261
- continue authority, lease, transaction, or journal damage blocks the route.
262
-
263
- ## Context refresh
264
-
265
- Before `task plan-set`, compare exact Step `allowedWrites` and expected output paths with scanner
266
- classifications. A planned new scanner-visible Knowledge file must be declared with
267
- `knowledgeImpact: create` and an exact path/category `knowledgeTargets` entry. Wildcards,
268
- directories, and inferred authority are not declarations; only Core may decide whether the final
269
- diff is eligible for delegated refresh.
270
-
271
- For every `task plan-set` navigation, consume `next.taskPlanContract` before building the Plan.
272
- Its `requiredRequirementIds` and `requiredAcceptanceIds` are exact-membership preconditions, not
273
- descriptive hints. Preserve each ID verbatim in the corresponding Plan array and use the returned
274
- Brief hash plus Knowledge Map revision/hash as the planning binding. Missing or stale contract data
275
- is a stop condition.
276
-
277
- Use `task context-refresh` only when the same `next` response returns it as the top-level action and
278
- exposes `contextRefresh` for the exact grant. Pass Task revision, map revision, delegate actor, and
279
- grant ID. Never run standalone `project-memory reconcile` first; Core blocks that non-atomic route
280
- when the exact delegated composite is available. The composite
281
- operation accepts content-hash-only drift and, under a Milestone Autonomy Grant, an exact
282
- supporting-source addition predeclared by the current execution-authorized Task Plan. Core checks
283
- the full fail-closed predicate; do not reconstruct it in the gateway. When `next` instead returns
284
- `contextRefreshBlocked.unsafeDifferences`, keep the change on the normal visible Knowledge path.
285
-
286
- Before updating the installed package, run `update preflight`. Continue only for `safe=true`.
287
- For an alpha.6 project trapped between a pending strict review and forbidden Knowledge rebind,
288
- an exact external alpha.7 runner may run `update rescue-preflight`. Continue only for
289
- `eligible=true` and only with the returned lock-repair and strict-review actions.
290
-
291
- ## C1 handoff
292
-
293
- `C1` coordination is machine-bound and local. Use:
294
-
295
- ```text
296
- codex-workflow task handoff-prepare --repo <git-root> --id <TASK-ID> \
297
- --expected-revision <REVISION> --actor <CURRENT-ACTOR> \
298
- [--target-actor <TARGET-ACTOR>] --reason <TEXT> [--writer-token <TOKEN>] \
299
- [--delegation-grant <GRANT>] [--expires-at <ISO-TIMESTAMP>]
300
- codex-workflow task handoff-show --repo <git-root> --id <TASK-ID>
301
- codex-workflow task claim --repo <git-root> --id <TASK-ID> \
302
- --expected-revision <REVISION> --actor <TARGET-ACTOR> --claim-token <TOKEN> \
303
- [--writer-token <WRITER-TOKEN>]
304
- codex-workflow task handback-create --repo <git-root> --id <TASK-ID> \
305
- --expected-revision <REVISION> --actor <CLAIMANT> --reason <TEXT> \
306
- --recommended-next <TEXT> [--limitation <TEXT>] [--writer-token <TOKEN>]
307
- ```
308
-
309
- While a handoff is pending, `next` blocks the previous action behind `task claim`. While
310
- claimed, only the claimant may mutate the Task, and lease-bound mutations must present the
311
- bound writer token. Milestone-linked Tasks must be claimed before start, and handback is
312
- terminal and evidence-bound. When target actor is omitted, Core derives
313
- `agent:worker:<task-id>`. No thread id is required or accepted as authority.
314
- The successful prepare response begins with `credentialHandoff`. Consume that receipt before the
315
- Task/event/bundle payload, retain its token only in working memory, and pass it exactly once to the
316
- declared `task claim --claim-token` action for the declared target actor. The later bundle remains
317
- contextual and intentionally contains no second copy of the claim token.
318
- The successful claim response then begins with `writerLeaseReceipt`. Retain that token only in
319
- working memory. In claimed C1 posture, fresh `next` exposes `writerTokenContract` on `task run`;
320
- pass the receipt token through its declared `--writer-token` option on the first run call. The
321
- successful run returns the refreshed writer receipt for later lease-bound transitions.
322
-
323
- `task result-set` is also lease-bound. It requires the active `--writer-token` and the exact C1
324
- claimant in `--actor` when the Task is claimed. Success releases the lease before the Task enters
325
- `awaiting_final_acceptance`; the token is no longer valid. The Human gate must therefore remain
326
- lease-free for an arbitrary amount of time. After acceptance, obtain the new merge credential only
327
- through the `writerCredentialRecovery` action advertised by fresh `next`.
328
-
329
- ## Milestone assembly, autonomy, and human gate
330
-
331
- During initial planning, materialize every linked Task and then call `milestone plan-set` once
332
- with the complete membership. Execution is blocked while reverse membership is incomplete.
333
- Before Task 1 and between linked Tasks, follow top-level `next.action = "milestone initial-assembly"`.
334
- Its `linked-task-assembly.commands` permit `discovery start` and `discovery materialize`; after the
335
- first linked Task exists, the separate closing option permits `milestone plan-set`. If `status` or `next` fails, stop: never label
336
- the gap expected and invoke `milestone plan-set` directly.
337
-
338
- Every required navigation checkpoint is strictly sequential: start `status`, wait until its
339
- terminal result is recorded, then start `next` and wait for its terminal result. Never issue the
340
- pair concurrently or through a parallel tool call. The trusted transcript validator treats a
341
- second invocation before the first terminal result as indeterminate release evidence.
342
-
343
- After that Plan, one human may prepare and grant a maximum-72-hour Milestone Autonomy Contract:
344
-
345
- ```text
346
- codex-workflow milestone autonomy-prepare --repo <git-root> --id <MS-ID> \
347
- --expected-revision <REVISION> --principal <HUMAN> --delegate <AGENT> --expires-at <ISO>
348
- codex-workflow milestone autonomy-grant --repo <git-root> --id <MS-ID> \
349
- --expected-revision <REVISION> --principal <HUMAN> --delegate <AGENT> --expires-at <ISO> \
350
- --confirmation-code <MAC-CODE>
351
- ```
352
-
353
- The contract issues a milestone-scoped grant for the existing Task/Milestone approval transitions
354
- and Project Memory approval only inside an atomic Task context refresh for the same Milestone.
355
- That composite path covers content-only drift plus exact Plan-bounded supporting-source additions;
356
- it cannot approve Project Memory independently. `milestone autonomy-evolve --file
357
- <plan.json>` is permitted only when outcome, success signal, acceptance, checks, discovery, and
358
- base branch still match the contract. It journals agent actor plus contract evidence and requires
359
- reauthorization afterward.
360
-
361
- After the initial empty planning posture, Milestone scope updates use:
362
-
363
- ```text
364
- codex-workflow milestone scope-change-prepare --repo <git-root> \
365
- --id <MS-ID> --expected-revision <REVISION> --actor <HUMAN-ACTOR> --file <plan.json>
366
- codex-workflow milestone scope-change-apply --repo <git-root> \
367
- --id <MS-ID> --expected-revision <REVISION> --actor <HUMAN-ACTOR> \
368
- --confirmation-code <MSC-CODE> --file <plan.json>
369
- ```
370
-
371
- This ordinary semantic-change path is human-only. Generic delegated approval never authorizes it.
372
-
373
- At `awaiting_final_acceptance`, `next` returns `requiredHumanGate` with kind
374
- `milestone_final_acceptance`, Milestone ID, revision, Plan/Result/evidence hashes, validated
375
- HEAD, and a confirmation code. Display the complete object and end the turn. Only a later
376
- explicit user message that approves the same code authorizes:
377
-
378
- ```text
379
- codex-workflow milestone accept --repo <git-root> --id <MS-ID> \
380
- --expected-revision <REVISION> --actor <USER-ACTOR> \
381
- --confirmation-code <MSA-CODE>
382
- ```
383
-
384
- Do not infer approval from the request that initiated validation. A changed revision, hash,
385
- or HEAD requires a new gate.
386
-
387
- ## Delegated Approval
388
-
389
- `delegation prepare --file <policy.json>` returns a `delegation_grant_issuance` gate with a
390
- project-bound policy hash and `DGA-*` confirmation code. Display it and end the turn. A later
391
- explicit user message containing the exact code permits `delegation grant`.
392
-
393
- Active eligible grants appear in `next.delegatedApprovalOptions`. Use only the option whose
394
- transition matches the requested command, with the named delegate as actor and the grant ID
395
- as `--delegation-grant`. The resulting authorization event records the grant and both actors.
396
- For `milestone.final_accept`, also pass the current `MSA-*` code; the existing grant replaces
397
- the later-message requirement, not the state binding.
398
- Do not pass `--delegation-grant` to ordinary C1 handoff, claim, run, step-complete,
399
- step-review, merge, or sync-base calls. Those transitions are not authorized by a Milestone
400
- approval grant unless the same `next` response explicitly advertises an eligible grant for the
401
- exact transition.
402
-
403
- Delegated approval does not cover adoption apply or the ordinary semantic Milestone scope-change
404
- path. Membership-only evolution requires the separate Milestone Autonomy Contract.
405
-
406
- ## Graph Refresh Request
407
-
408
- The package returns:
409
-
410
- ```json
411
- {
412
- "protocolVersion": 1,
413
- "requestId": "uuid",
414
- "projectId": "local-project-id",
415
- "graphKind": "product",
416
- "sourceRoot": "/absolute/local/path",
417
- "rootFingerprint": "sha256",
418
- "indexedHead": "git-sha-or-null",
419
- "packageVersion": null,
420
- "manifestHash": null,
421
- "mode": "moderate",
422
- "persistence": false,
423
- "issuedAt": "ISO-8601"
424
- }
425
- ```
426
-
427
- `workflow` requests set packageVersion and manifestHash and point sourceRoot to
428
- the prepared versioned workflow view.
429
-
430
- ## Evidence
431
-
432
- Return the request unchanged with:
433
-
434
- ```json
435
- {
436
- "requestId": "same-uuid",
437
- "provider": "codebase-memory-mcp",
438
- "projectKey": "provider-project-key",
439
- "rootFingerprint": "same-sha256",
440
- "indexedHead": "same-git-sha-or-null",
441
- "packageVersion": null,
442
- "manifestHash": null,
443
- "mode": "moderate",
444
- "status": "ready",
445
- "nodeCount": 100,
446
- "edgeCount": 200,
447
- "observedAt": "ISO-8601"
448
- }
449
- ```
450
-
451
- The package rejects mismatched or stale requests. Absolute source paths remain
452
- local workflow data and are not project knowledge.
453
-
454
- ## Retention
455
-
456
- Product binding stores only the current evidence. Workflow binding stores the
457
- current package evidence plus one previous package snapshot. A new snapshot is
458
- retained only after the new binding is ready.
52
+ A successful result submission can release the execution lease before final acceptance. After a
53
+ human pause, use fresh navigation and its credential recovery; do not reuse the earlier reference.
54
+ Before a package update, require the installed package's `update preflight` to report `safe=true`.
55
+ An unsafe boundary is a diagnostic, not permission to edit state or clean away retained work.
@@ -64,7 +64,13 @@ export function dispatchAction(action, entry, input = {}) {
64
64
  const selection = selectChatModel(entry.type, input.modelRequest);
65
65
  const id = randomUUID();
66
66
  const marker = `[workflow-dispatch:${id}:${hash(prompt)}]`;
67
- const dispatchedPrompt = `${marker}\n${prompt}\nExecution boundary: use the actual child checkout returned by App readback. Before any write, reconcile it with the exact Task branch and run dispatch-context-check. A repository path in this packet is identity context, not authorization to write outside that checkout.`;
67
+ // Only the registry's explicit review/audit roles receive a read-only boundary.
68
+ // A model phase or packet prose cannot turn a product Worker into a reviewer.
69
+ const reviewRole = ['step-review', 'final-review', 'corrective-audit', 'plan-audit'].includes(entry.type);
70
+ const boundary = reviewRole
71
+ ? 'Review boundary: use the exact canonical repository and immutable commit, packet/seal or audit-request bindings supplied for this independent review. Verify those bindings before reading evidence and before returning the result; stop if they change. The App checkout may be detached or on another branch: do not switch it or require Task-branch dispatch-context-check for read-only inspection. Do not modify product files, Git history, or Workflow state, and do not invoke lifecycle mutations. Save the review result only to an explicitly requested artifact path outside all repository checkouts, under actual filesystem permissions; this instruction grants no filesystem access. A repository path identifies read evidence, never write authority.'
72
+ : 'Execution boundary: use the actual child checkout returned by App readback. Before any product or repository write, reconcile it with the exact Task branch and run dispatch-context-check. A repository path in this packet is identity context, not authorization to write outside that checkout.';
73
+ const dispatchedPrompt = `${marker}\n${prompt}\n${boundary}`;
68
74
  entry.dispatch = {
69
75
  version: 1, id, state: 'creating', appProjectId, hostId, repositoryRoot, gitDir, executionMode,
70
76
  promptPath, promptHash: hash(prompt), dispatchedPromptHash: hash(dispatchedPrompt), marker,
@@ -1,15 +1,17 @@
1
1
  // Relative cost/latency policy, not a price list or an availability oracle.
2
- export const MODEL_POLICY_VERSION = 'chat-model-policy-v1';
2
+ export const MODEL_POLICY_VERSION = 'chat-model-policy-v2';
3
3
  const PROFILES = {
4
4
  mechanical: [['gpt-5.4-mini', 'low'], ['gpt-5.6-luna', 'low']],
5
- scoped: [['gpt-5.6-luna', 'medium'], ['gpt-5.6-terra', 'medium']],
6
- implementation: [['gpt-5.6-terra', 'medium'], ['gpt-5.6-sol', 'medium']],
7
- planning: [['gpt-5.6-sol', 'medium'], ['gpt-6-astra', 'medium']],
8
- review: [['gpt-5.6-sol', 'high'], ['gpt-6-astra', 'high']],
9
- 'scoped-review': [['gpt-5.6-terra', 'medium'], ['gpt-5.6-sol', 'medium']],
10
- complex: [['gpt-6-astra', 'high'], ['gpt-5.6-sol', 'high']],
5
+ scoped: [['gpt-5.6-luna', 'low'], ['gpt-5.4-mini', 'medium']],
6
+ implementation: [['gpt-5.6-terra', 'low'], ['gpt-5.6-luna', 'medium']],
7
+ planning: [['gpt-5.6-terra', 'low'], ['gpt-5.6-luna', 'medium']],
8
+ review: [['gpt-5.6-terra', 'low'], ['gpt-5.6-luna', 'medium']],
9
+ 'scoped-review': [['gpt-5.6-luna', 'low'], ['gpt-5.4-mini', 'medium']],
10
+ complex: [['gpt-5.6-terra', 'medium'], ['gpt-5.6-luna', 'medium']],
11
11
  };
12
- const TYPES = ['coordinator', 'task', 'step-review', 'final-review', 'corrective-audit', 'plan-audit'];
12
+ const TYPES = [
13
+ 'coordinator', 'task', 'step-review', 'final-review', 'corrective-audit', 'plan-audit', 'workflow-blocker',
14
+ ];
13
15
  export function selectChatModel(type, request) {
14
16
  if (!TYPES.includes(type)) throw new Error('Unknown chat type.');
15
17
  if (!request || !['routine', 'standard', 'complex'].includes(request.complexity)
@@ -14,7 +14,9 @@ import process from 'node:process';
14
14
  import { randomUUID } from 'node:crypto';
15
15
  import { dispatchAction, dispatchInput } from './chat-dispatch.mjs';
16
16
 
17
- const TYPES = new Set(['coordinator', 'task', 'step-review', 'final-review', 'corrective-audit', 'plan-audit']);
17
+ const TYPES = new Set([
18
+ 'coordinator', 'task', 'step-review', 'final-review', 'corrective-audit', 'plan-audit', 'workflow-blocker',
19
+ ]);
18
20
  const LOCK_STALE_MS = 30_000;
19
21
  const LOCK_WAIT_MS = 2_000;
20
22
 
@@ -26,9 +28,12 @@ export function allocateChat(options) {
26
28
  const sequence = registry.nextSequence;
27
29
  const reservationId = randomUUID();
28
30
  const candidates = buildTitleCandidates({ ...options, sequence });
31
+ const milestoneOrdinal = options.type === 'workflow-blocker'
32
+ ? null
33
+ : requiredOrdinal(options.milestoneOrdinal, 'M');
29
34
  const existing = registry.entries.find(entry => entry.status !== 'abandoned'
30
35
  && entry.type === options.type && entry.entityId === options.entityId
31
- && entry.milestoneOrdinal === requiredOrdinal(options.milestoneOrdinal, 'M')
36
+ && entry.milestoneOrdinal === milestoneOrdinal
32
37
  && entry.taskOrdinal === optionalOrdinal(options.taskOrdinal, 'T')
33
38
  && entry.stepOrdinal === optionalOrdinal(options.stepOrdinal, 'S')
34
39
  && (['task', 'coordinator'].includes(options.type)
@@ -38,7 +43,7 @@ export function allocateChat(options) {
38
43
  sequence,
39
44
  reservationId,
40
45
  type: options.type,
41
- milestoneOrdinal: requiredOrdinal(options.milestoneOrdinal, 'M'),
46
+ milestoneOrdinal,
42
47
  taskOrdinal: optionalOrdinal(options.taskOrdinal, 'T'),
43
48
  stepOrdinal: optionalOrdinal(options.stepOrdinal, 'S'),
44
49
  entityId: requiredText(options.entityId, 'entityId'),
@@ -191,6 +196,15 @@ export function showRegistry(options) {
191
196
  }
192
197
 
193
198
  export function buildTitleCandidates(options) {
199
+ if (options.type === 'workflow-blocker') {
200
+ const entityId = requiredText(options.entityId, 'entityId');
201
+ const semantic = compactWhitespace(requiredText(options.semanticTitle, 'semanticTitle'));
202
+ validateTypeBindings(options.type, null, null, entityId);
203
+ if (!/^\d+\.\d+\.\d+-beta(?:\.\d+)+$/u.test(semantic)) {
204
+ throw new Error('workflow-blocker title must be the exact target beta patch version.');
205
+ }
206
+ return [semantic];
207
+ }
194
208
  const prefix = `#${String(positiveInteger(options.sequence, 'sequence')).padStart(3, '0')}`;
195
209
  const milestone = requiredOrdinal(options.milestoneOrdinal, 'M');
196
210
  const task = optionalOrdinal(options.taskOrdinal, 'T');
@@ -331,11 +345,15 @@ function validateProjectId(projectId) {
331
345
 
332
346
  function validateTypeBindings(type, taskOrdinal, stepOrdinal, entityId) {
333
347
  if (!TYPES.has(type)) throw new Error(`Unsupported chat type: ${type}`);
334
- if (type !== 'coordinator' && !taskOrdinal) throw new Error(`${type} requires a Task membership ordinal.`);
348
+ if (!['coordinator', 'workflow-blocker'].includes(type) && !taskOrdinal) {
349
+ throw new Error(`${type} requires a Task membership ordinal.`);
350
+ }
335
351
  if ((type === 'step-review' || type === 'corrective-audit') && !stepOrdinal) {
336
352
  throw new Error(`${type} requires a Step membership ordinal.`);
337
353
  }
338
- const validEntity = type === 'coordinator'
354
+ const validEntity = type === 'workflow-blocker'
355
+ ? /^[a-f0-9]{64}$/u.test(entityId)
356
+ : type === 'coordinator'
339
357
  ? entityId === 'DISCOVERY' || /^MS-[0-9A-HJKMNP-TV-Z]{26}$/.test(entityId)
340
358
  : /^TASK-[0-9A-HJKMNP-TV-Z]{26}$/.test(entityId);
341
359
  if (!validEntity) throw new Error(`${type} requires its full authoritative entity ID.`);