codex-workflow-v2 2.0.0-beta.13 → 2.0.0-beta.13.10

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 (86) hide show
  1. package/README.md +6 -1
  2. package/dist/reviewer-runtime-build.json +44 -20
  3. package/dist/src/alpha6/failed-step-planning-recovery.d.ts +10 -0
  4. package/dist/src/alpha6/failed-step-planning-recovery.js +93 -0
  5. package/dist/src/alpha6/failed-step-planning-recovery.js.map +1 -0
  6. package/dist/src/alpha6/plan-risk.d.ts +4 -0
  7. package/dist/src/alpha6/plan-risk.js +50 -13
  8. package/dist/src/alpha6/plan-risk.js.map +1 -1
  9. package/dist/src/alpha6/preexecution-replan.d.ts +38 -0
  10. package/dist/src/alpha6/preexecution-replan.js +130 -0
  11. package/dist/src/alpha6/preexecution-replan.js.map +1 -0
  12. package/dist/src/alpha6/remediation.d.ts +4 -2
  13. package/dist/src/alpha6/remediation.js +155 -20
  14. package/dist/src/alpha6/remediation.js.map +1 -1
  15. package/dist/src/alpha6/root-cause-replan-carryover.d.ts +18 -0
  16. package/dist/src/alpha6/root-cause-replan-carryover.js +396 -0
  17. package/dist/src/alpha6/root-cause-replan-carryover.js.map +1 -0
  18. package/dist/src/alpha7/autonomy.d.ts +3 -0
  19. package/dist/src/alpha7/autonomy.js +89 -42
  20. package/dist/src/alpha7/autonomy.js.map +1 -1
  21. package/dist/src/change-explanation.d.ts +64 -0
  22. package/dist/src/change-explanation.js +150 -0
  23. package/dist/src/change-explanation.js.map +1 -0
  24. package/dist/src/cli-actions.d.ts +3 -2
  25. package/dist/src/cli-actions.js +6 -0
  26. package/dist/src/cli-actions.js.map +1 -1
  27. package/dist/src/cli.js +73 -1
  28. package/dist/src/cli.js.map +1 -1
  29. package/dist/src/contracts.d.ts +38 -0
  30. package/dist/src/dependency-provenance.d.ts +3 -2
  31. package/dist/src/dependency-provenance.js +33 -2
  32. package/dist/src/dependency-provenance.js.map +1 -1
  33. package/dist/src/domain/plan-semantics.d.ts +11 -0
  34. package/dist/src/domain/plan-semantics.js +49 -0
  35. package/dist/src/domain/plan-semantics.js.map +1 -0
  36. package/dist/src/gateway-handshake.js +2 -0
  37. package/dist/src/gateway-handshake.js.map +1 -1
  38. package/dist/src/lifecycle/corrective-replan.js +3 -3
  39. package/dist/src/lifecycle/corrective-replan.js.map +1 -1
  40. package/dist/src/observed-routes.js +1 -0
  41. package/dist/src/observed-routes.js.map +1 -1
  42. package/dist/src/pending-review-update.d.ts +49 -0
  43. package/dist/src/pending-review-update.js +132 -0
  44. package/dist/src/pending-review-update.js.map +1 -0
  45. package/dist/src/repository.js +16 -4
  46. package/dist/src/repository.js.map +1 -1
  47. package/dist/src/reviewer.js +4 -1
  48. package/dist/src/reviewer.js.map +1 -1
  49. package/dist/src/state/corrective-replan-executor.js +3 -1
  50. package/dist/src/state/corrective-replan-executor.js.map +1 -1
  51. package/dist/src/state/corrective-replan-public.js +5 -4
  52. package/dist/src/state/corrective-replan-public.js.map +1 -1
  53. package/dist/src/state/corrective-yield-executor.js +12 -3
  54. package/dist/src/state/corrective-yield-executor.js.map +1 -1
  55. package/dist/src/state/store.d.ts +1 -1
  56. package/dist/src/state/store.js +17 -3
  57. package/dist/src/state/store.js.map +1 -1
  58. package/dist/src/version.d.ts +1 -1
  59. package/dist/src/version.js +1 -1
  60. package/dist/src/version.js.map +1 -1
  61. package/dist/src/workflow.d.ts +84 -1
  62. package/dist/src/workflow.js +1616 -355
  63. package/dist/src/workflow.js.map +1 -1
  64. package/docs/beta13.2-signal-review-recovery.md +38 -0
  65. package/docs/change-model.md +118 -0
  66. package/docs/delegated-approval.md +26 -0
  67. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  68. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  69. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  70. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +9 -1
  71. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +9 -5
  72. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +18 -3
  73. package/docs/pending-review-update.md +15 -0
  74. package/docs/release.md +267 -2
  75. package/docs/updating-existing-project.md +36 -6
  76. package/docs/validation-report.md +30 -9
  77. package/package.json +2 -1
  78. package/plugins/codex-workflow-gateway/references/chat-dispatch.md +204 -0
  79. package/plugins/codex-workflow-gateway/references/protocol.md +11 -0
  80. package/plugins/codex-workflow-gateway/scripts/chat-dispatch.mjs +298 -0
  81. package/plugins/codex-workflow-gateway/scripts/chat-model-policy.mjs +43 -0
  82. package/plugins/codex-workflow-gateway/scripts/chat-registry.mjs +55 -3
  83. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +218 -21
  84. package/schemas/plan-risk-audit-event.schema.json +1 -0
  85. package/schemas/preexecution-replan-event.schema.json +45 -0
  86. package/schemas/task.schema.json +55 -0
@@ -92,6 +92,109 @@ active writer token when the C1 contract requires it. The recovery records only
92
92
  `task run` merely to manufacture the second failure, and never invoke this recovery for a generic
93
93
  test failure, a writable manifest, or unconfined changes.
94
94
 
95
+ When fresh `next` includes `preExecutionReplanOption.state=eligible`, an independent Plan auditor
96
+ may stop a `ready` Task before its next Step because the current implementation Plan is obstructed.
97
+ Use only `task preexecution-replan` with the exact advertised Task revision, Brief hash, Plan hash,
98
+ current Plan Risk Audit event hash, and HEAD. The audit file must be a genuine independent
99
+ `stop-escalate` replacement audit: its planner remains the original planner, its auditor is the
100
+ transition actor, and it retains current guarded categories, review requirements, failure modes,
101
+ evidence commands, and proof bindings while recording the obstruction. This transition requires a
102
+ clean checkout with no Step in progress, C1 posture, or writer lease. It appends immutable audit and
103
+ provenance records, supersedes only current execution authorization, preserves completed Step
104
+ authority and existing delegation scope, and does not require a new approval. After success, run
105
+ sequential `status` then `next`; Core must advertise ordinary `task plan-set`, not audited-remediation
106
+ topology. Submit a semantically changed Plan with the exact Task objective, requirements, and
107
+ acceptance, preserve completed Steps and prior safety boundaries, attach a fresh Plan Risk Audit,
108
+ then obtain fresh execution authorization. Never append an approved audit to the unchanged Plan,
109
+ rebind context around the marker, invent a failure/corrective cause, or invoke the command when the
110
+ option is absent or blocked.
111
+
112
+ For this route, Core treats each `(Step ID, failureMode, evidence)` tuple as the immutable proof
113
+ binding. It does not claim to understand whether revised `counterexample` or `expectedResult` prose
114
+ is semantically stronger. Changing that prose therefore requires an independent
115
+ `approved-with-rationale` audit, a changed substantive summary, and an explicit rationale; the
116
+ earlier audit remains immutable history for human review.
117
+
118
+ When the exact beta.13.6 package reports validated root-cause corrective-replan dirty
119
+ carryover, the retained work belongs to a previously failed execution of the same Task.
120
+ Use the fresh advertised `task run` only with the current writer credential and exact
121
+ Task/Step bindings. Core must verify the repeated mechanical cause, historical Plan,
122
+ replacement Plan and independent PRA, authorization, completed evidence, HEAD, dirty
123
+ paths and content hash. Every retained path must already be allowed by the new Step
124
+ and remain outside forbidden scope. A changed binding or blocked assessment is a hard
125
+ stop; never clean, stash, reset, manually commit, or edit state to make it eligible.
126
+
127
+ The beta.13.8 consumed-carryover compatibility profile also permits the exact
128
+ published external beta.13.8 runner to execute only the read-only
129
+ `update corrective-carryover-preflight --id <TASK-ID>` against a coherent beta.13.6
130
+ repository. A completed, verified Step's carryover remains historical evidence;
131
+ it must not override a later Step's repeated-cause recovery route.
132
+
133
+ When `sourceRecovery.eligible=true`, execute only its exact `action` with the
134
+ repository-installed beta.13.6 CLI. This narrow compatibility response, not the
135
+ old source `next`, authorizes the source navigation repair. It may expose only
136
+ `task plan-set`, `task handoff-prepare`, or `task claim`, bound to the current
137
+ Task revision, Plan, completed history, terminal failure HEAD/dirty hash and
138
+ corrective-yield actor. For Plan replacement, prepare the exact candidate Plan
139
+ and independent PRA files, then pass them as `--file` and `--risk-audit-file`
140
+ to this read-only preflight. Without both inputs no source mutation is authorized.
141
+ Require the returned candidate Plan and input hashes; execute source `task plan-set`
142
+ with those same unchanged files and verify its resulting Plan hash. Core rejects
143
+ candidate inputs that omit or alter any completed Step before source mutation.
144
+ Source execution
145
+ authorization retains its ordinary human or exact eligible delegation gate.
146
+ Use only the returned original Worker for handoff and claim. After every source
147
+ mutation run source `status` then `next`, and repeat the target preflight before
148
+ another compatibility action. `sourceRecovery` never authorizes transport or
149
+ `task run`; top-level `eligible` remains false until transport itself is proved.
150
+
151
+ Once the replacement Plan is authorized and that same Worker has claimed it,
152
+ the preflight may expose the exact expired-lease repair described below. Never
153
+ force-release a live lease. Require a fresh top-level `eligible=true` before
154
+ dependency transport. beta.13.8 accepts one dependency-only commit on each of
155
+ the Task and Milestone base, with the same exact source beta.13.6 and target
156
+ beta.13.8. After installing the target, use its ordinary advertised
157
+ dependency provenance recovery, atomic context refresh and original-Worker
158
+ credential recovery. This profile permits no external state mutation, installed
159
+ code patch, wider product commit, changed dirty bytes, or approval substitution.
160
+
161
+ The exact beta.13.9 runner supports the same bounded consumed-carryover profile
162
+ with beta.13.6 as its source and beta.13.9 as its pinned target. Require the
163
+ returned version bindings and all the same source-recovery and transport proofs.
164
+ Historical beta.13.8 evidence is not proof for a beta.13.9 invocation.
165
+
166
+ The historical beta.13.7 runner retains its own exact beta.13.6-to-beta.13.7 profile.
167
+ The current beta.13.8 profile does not admit a beta.13.7 source or an in-progress
168
+ Step and cannot be used to bypass the ordinary safe update boundary.
169
+
170
+ The historical beta.13.6 corrective-carryover update compatibility profile permits its exact
171
+ external runner to execute only the read-only
172
+ `update corrective-carryover-preflight --id <TASK-ID>` against a repository coherently
173
+ pinned to beta.13.5. This is an explicit compatibility inspection, not permission to
174
+ run ordinary transitions with an external or unpublished package. An active writer
175
+ lease blocks transport. Wait for natural expiry. The target compatibility preflight
176
+ may then return only an exact source-package stale-lease repair, after validating the
177
+ sole expired Task lease, its original claimant, Task/Plan/PRA/authorization/HEAD and
178
+ dirty-work bindings. This narrowly scoped preflight action is the authority for that
179
+ source-package repair; do not describe it as an action advertised by the old source
180
+ `next`. An active lease, another lease or any other blocker forbids the repair and
181
+ transport. Never force-release a live lease. Preserve the original C1 claimant and
182
+ hash-bound ownership event, log the preflight and exact repair, then run sequential
183
+ source `status` and `next` and repeat the target preflight.
184
+
185
+ After repair, require a fresh preflight with `eligible=true`, no blockers, and exact
186
+ Task revision, source HEAD, replacement Plan/PRA/authorization, dirty paths/hash and
187
+ original C1 ownership. Transport only the exact target dependency in `package.json`
188
+ and `package-lock.json`: one commit on the Milestone base in a separate worktree and
189
+ one at Task HEAD, leaving every product byte unchanged. Install the repository-local
190
+ target, then follow fresh navigation through the existing
191
+ `update dependency-provenance-recover` only when it advertises the matching carryover
192
+ binding. Use current bounded credential recovery for the original Worker, and obtain
193
+ fresh validated carryover before `task run`. Unknown history, wider commits, version
194
+ misalignment, changed product bytes, different ownership, pending operations or missing
195
+ bindings stop the update. This profile creates no scope or approval authority and does
196
+ not authorize editing the installed package or Workflow state files.
197
+
95
198
  When fresh `next` advertises `task downstream-proof-recover`, the active proof Step has produced
96
199
  uncommitted files inside its own `allowedWrites` and has also exposed required changes owned by one
97
200
  or more completed transitive predecessor Steps. Do not invoke `task step-complete`: its scope is
@@ -278,22 +381,32 @@ because the sandboxed call returned a permission error; those actions require th
278
381
  authorization and evidence.
279
382
 
280
383
  When `next` includes `writerTokenContract`, treat it as an exact first-call precondition. Retain
281
- the active writer lease from the first-field `writerLeaseReceipt` returned by `task run` and pass it using the advertised `option` for that
282
- transition. The token is sensitive: never print, summarize, persist, or substitute a redacted
283
- fingerprint. Stop before mutation if the active lease is unavailable. This input contract is
284
- independent from `gitMutationPolicy`; satisfy both when both are present.
285
-
286
- On successful `task handoff-prepare`, consume the first-field `credentialHandoff` before reading
287
- the Task/event/bundle payload. Retain its one-time token only in working memory and use it exactly
288
- once with the declared `action` and `option` for the declared `targetActor`. Successful `task claim`
289
- returns a first-field `writerLeaseReceipt`; retain that lease and pass it to claimed `task run` when
290
- the fresh `next.writerTokenContract` requires it. Successful `task run` returns the refreshed
291
- `writerLeaseReceipt`; retain it only until Core releases that lease.
292
- Never search later payload fields for either credential and never copy credentials into evidence.
384
+ the `writerCredentialReference` returned by `task run`, `task claim`, or
385
+ `task writer-credential-replace`, including its public `credentialRef`, actor, allowed actions and
386
+ `expiresAt`. Pass the reference using the advertised `--writer-credential-ref` option. The secret
387
+ stays in the local vault: never read, print, copy, or edit vault records or substitute a redacted
388
+ token. This input contract is independent from `gitMutationPolicy`; satisfy both when present.
389
+
390
+ Before every credential-consuming mutation, especially after an independent review or a pause,
391
+ compare the held reference's `expiresAt` with the current time and verify its actor/action binding.
392
+ A live or renewed lease does not extend an existing reference's expiry; `reuse-reference` is not
393
+ permission to reuse an expired reference. If the reference is expired, missing, consumed, or its
394
+ validity cannot be established, use only the simultaneously advertised
395
+ `next.writerCredentialRecovery` action with its exact Task, revision and `requiredActor` before
396
+ attempting the blocked mutation. Follow successful replacement with `status` then `next`, retain
397
+ the newly returned reference and expiry, and discard the prior reference. If recovery is not
398
+ advertised, stop before mutation. Never extend expiry manually or retry with the old reference.
399
+
400
+ Successful `task handoff-prepare` returns a one-time `claimCredentialReference`; use its
401
+ `credentialRef` with the declared `--claim-credential-ref` option for `task claim` and the bound
402
+ actor. Successful claim consumes that reference. A renewed claim/run may return
403
+ `writerCredential.disposition=renewed` without a new reference; the held reference must still
404
+ satisfy its own expiry and binding checks. Never search later payload fields for raw tokens and
405
+ never copy credentials into evidence.
293
406
 
294
407
  When a passed final Task review routes to `task result-set`, pass the active writer credential and,
295
408
  for claimed C1 posture, the exact claimant as `--actor`. A successful `result-set` consumes that
296
- execution lease before entering `awaiting_final_acceptance`; never reuse the old token and never
409
+ execution lease before entering `awaiting_final_acceptance`; never reuse the old reference and never
297
410
  leave or manufacture a lease while waiting for the Human decision. After `task accept`, follow fresh
298
411
  `next`: local merge or external merge confirmation normally advertises
299
412
  `task writer-credential-replace`, which acquires a new bounded lease for the exact recovery actor.
@@ -319,9 +432,11 @@ A Milestone chat and its Task chats are separate user-visible execution contexts
319
432
  conversation. Create every Task chat as a brand-new Codex task with `create_thread`, an explicit
320
433
  Task-only prompt, and an explicit title. Never use `fork_thread`, thread handoff, or a continuation
321
434
  of the Milestone chat to create a Task chat: those paths carry parent history into the child. A
322
- failure to create a new task is a routing blocker. Check the thread list for an already-created
323
- exact Task ID, retry `create_thread` once sequentially when none exists, and then stop; never fall
324
- back to a fork.
435
+ confirmed failure to create a new task is a routing blocker. A pending `clientThreadId`, timeout,
436
+ lost response, or absence from `list_threads` does not establish failure and never permits a
437
+ second creation. Persist the attempt before calling the App, resolve its actual ID and confirm
438
+ it with `read_thread`; never fall back to a fork. Read and follow
439
+ `../../references/chat-dispatch.md` for the executable dispatch/recovery and model-selection contract.
325
440
 
326
441
  Codex App may wrap the supplied prompt in a host-generated `codex_delegation` envelope containing
327
442
  only routing provenance such as `source_thread_id`. That envelope is permitted and is not parent
@@ -366,6 +481,22 @@ chat type, Milestone/Task/Step membership ordinals, semantic title, authoritativ
366
481
  review attempt. Use returned `requestedTitle` verbatim. Never derive its prefix from
367
482
  `list_threads`, sidebar order, a count, or `count + 1`: allocation atomically reserves the
368
483
  project-wide monotonically increasing `#NNN`, and an abandoned number is never reused.
484
+ Allocation reuses an existing matching reservation. For a new dispatch, call `dispatch-begin`
485
+ with the closed packet and explicit model request, then call the App exactly once only when
486
+ `createAllowed=true`, using returned `createArgs` unchanged. Record the full result via
487
+ `dispatch-result`, resolve/read back via `dispatch-discover` and `dispatch-observe`, and bind.
488
+ After restart use `dispatch-status`; an unresolved creation cannot be abandoned to create another.
489
+ For legacy reservations without a dispatch marker, first reconcile existing App/source evidence;
490
+ absence of the new marker does not prove no earlier creation occurred.
491
+
492
+ When the user authorizes model selection, use the versioned role/phase/complexity matrix rather
493
+ than coordinator inheritance. Both `model` and App `thinking` must be explicit in create arguments.
494
+ Use the destination host's current supported model/effort catalog; no guessed aliases or silent
495
+ fallback. Before a materially different phase, `model-select` returns explicit follow-up settings
496
+ for the same bound thread. Routine lifecycle work should not retain planning/review reasoning by
497
+ accident; security-sensitive and complex work must not be classified as routine to save tokens.
498
+ Without user authorization for model selection, do not manufacture it from a registry field;
499
+ resolve that policy choice before starting a new dispatch.
369
500
 
370
501
  The builder owns these compact title families; callers must not hand-compose variants:
371
502
 
@@ -387,7 +518,7 @@ Put `#NNN` and membership ordinals first so clipped sidebar titles remain distin
387
518
  inherit the parent title, use a generic title such as `Milestone recovery` / `Task execution`, or
388
519
  reuse one title for different entity IDs. Maintain the registry-backed
389
520
  `Task ID -> thread ID -> title` mapping in
390
- the Milestone chat. Before dispatch, verify from the thread list that the title contains the exact
521
+ the Milestone chat. Before supervision, verify from actual `read_thread` evidence that the title contains the exact
391
522
  ordinal and entity ID, is unique, and the new chat input contains only its TaskContextPacket plus
392
523
  the permitted host routing envelope. Never trust the `create_thread` title argument without a
393
524
  readback: pass the observed title to registry `readback`. If it returns `renameRequired=true`,
@@ -396,6 +527,12 @@ compact the role while preserving `#NNN`, membership ordinals, attempt, and the
396
527
  Never invent another fallback or abbreviate the ID. Bind the verified entry to `threadId` and
397
528
  `hostId`; if all candidates fail, mark it blocked and stop routing. Visual sidebar clipping is
398
529
  harmless only when exact API readback still matches. Do not dispatch while title/context is wrong.
530
+ Persist the single supervisor, cursor and next action using `supervision-record`. Large tool/CLI
531
+ JSON must be saved completely to a private local file and parsed there, with only bounded non-secret
532
+ summaries printed. For an uncertain mutation outcome, run fresh `status -> next` before recovery;
533
+ never replay a mutation merely because displayed output was truncated. Review the exact serialized
534
+ external-review envelope passed to Core, not a separately reconstructed object. Public CREF expiry
535
+ is independent of lease expiry and must be checked before every credential-consuming transition.
399
536
 
400
537
  After every significant Task Step boundary—completion, failure, block, skip, sealed-review result,
401
538
  or corrective decision—the Task chat prints a compact Task progress Markdown table from fresh
@@ -525,10 +662,20 @@ delegable only through an explicit project-scoped `project_memory.approve` permi
525
662
  changes, grant issuance, and grant expansion are never delegated by `delegated-approval-v1`.
526
663
 
527
664
  For an entire Milestone, prefer one bounded `milestone autonomy-prepare` gate after the complete
528
- initial membership Plan exists. Show principal, delegate, expiry, semantic-scope hash, policy
665
+ initial membership Plan exists. An explicitly human-requested full contract may also be prepared
666
+ for an `active` Milestone, including after a previous contract expired or was revoked. This is
667
+ new issuance, never automatic renewal. Fresh Task-first or repository `next` may expose
668
+ `activeMilestoneAutonomyOptions`; these are optional preparation routes and do not replace the
669
+ current Task action. Preparation still requires coherent state and active Project Knowledge.
670
+ A generic grant does not become a full contract and is not automatically revoked. A still-valid
671
+ full contract must first be explicitly revoked by its principal before a different one is issued.
672
+ The new confirmation binds the current Milestone status, revision, Plan, semantic scope, policy,
673
+ and previous contract/grant state; any change requires preparation and confirmation again.
674
+ An exact successful retry returns the same grant; an old code cannot revive a revoked grant. Show principal, delegate, expiry, semantic-scope hash, policy
529
675
  hash, and `MAC-*` code, then stop. A later exact approval permits `milestone autonomy-grant`.
530
676
  Use the delegated path only when the same `next` response exposes
531
- `milestoneAuthorizationOptions[].action = "milestone autonomy-prepare"` and the user explicitly
677
+ `milestoneAuthorizationOptions[].action = "milestone autonomy-prepare"` or an
678
+ `activeMilestoneAutonomyOptions` entry for that exact Milestone, and the user explicitly
532
679
  requested delegated Milestone operation; otherwise follow the ordinary `milestone authorize`
533
680
  human gate.
534
681
  The resulting grant covers the existing Task/Milestone approval transitions and the Project
@@ -540,6 +687,18 @@ only for membership changes; any change to outcome, success signal, acceptance,
540
687
  discovery, or base branch requires the ordinary human scope-change gate. Never self-renew or
541
688
  replace the contract.
542
689
 
690
+ When fresh `next` advertises `task corrective-decision` with
691
+ `planningRecovery.authority = "planning-only"`, a started failed Step has a current
692
+ blocking audit after a Knowledge-only Plan rebind. Core proves the historical approved
693
+ safety baseline; the stopped audit does not authorize execution. Obtain the independent
694
+ corrective decision against the returned bindings and preserve the exact original Worker
695
+ credential/yield prerequisites. Follow the existing human-confirmed corrective-replan
696
+ route, then fresh replacement Plan authorization. Never approve the obstructed Plan merely
697
+ to unlock navigation, use ordinary `plan-set` to bypass the corrective gate, or create an
698
+ upstream remediation Task for this already-started posture. `continue-fix` is unavailable
699
+ for this planning-only route. A package update can require another Knowledge rebind and
700
+ fresh blocking audit; do not rewrite or silently reuse a stale audit.
701
+
543
702
  Repeated failed Task reviews remain on the same Task and do not require a separate corrective
544
703
  Plan audit based only on count. Follow fresh `next`: ordinary findings default to `route=fix`;
545
704
  `route=replan` is valid only with the exact Plan clause, obstruction, and minimal Plan change
@@ -552,7 +711,13 @@ When `next.strictStepReview.recommendedMode` is `external-sealed`, do not launch
552
711
  reviewer from inside a Codex App sandbox. Run the advertised read-only `task step-review-packet`,
553
712
  create a separate user-visible reviewer chat for that exact packet, and require one closed
554
713
  `ReviewInput` JSON result bound to its reviewed commit. The reviewer must not modify repository or
555
- Workflow state. Then run only the advertised `task step-review-record` with the unchanged packet
714
+ Workflow state. The `--file` passed to `task step-review-record` must be the full
715
+ `ExternalStrictStepReviewInput` envelope: top-level `protocol`, `packetHash`,
716
+ `repositorySealHash`, `reviewerThreadId`, and `reviewMode` (`ordinary` or `security`), plus the
717
+ nested `review` object containing `status`, `reviewer`, `summary`, and `findings`. Copy both hashes
718
+ and the mode from the packet; do not flatten `review`, and do not pass `--review-mode` to the record
719
+ command because it reads the mode from the JSON file. Run `task step-review-record --help` for a
720
+ complete minimal example. Then run only the advertised `task step-review-record` with the unchanged packet
556
721
  and repository-seal hashes, the separate reviewer thread ID, the lifecycle actor from `next`, and
557
722
  the active writer token when required. Never author the independent review in the Worker or
558
723
  Delivery Coordinator chat, never alter the packet, and never treat an unverified local reviewer
@@ -563,7 +728,11 @@ When `next.strictTaskReview.recommendedMode` is `external-sealed`, apply the sam
563
728
  the final submitted-Task review. Run the advertised read-only `task review-packet`, send the exact
564
729
  packet to a separate user-visible Independent Reviewer chat, and accept only a closed `ReviewInput`
565
730
  bound to the unchanged packet and repository-seal hashes. Record it only through the advertised
566
- `task review-sealed-record`, using the lifecycle actor from `next` and the active writer token when
731
+ `task review-sealed-record`. Its `--file` must be the analogous full
732
+ `ExternalStrictTaskReviewInput` envelope using protocol
733
+ `codex-workflow-external-strict-task-review-v1`, the packet and repository-seal hashes,
734
+ `reviewerThreadId`, top-level `reviewMode`, and nested `review`; its `--help` contains a minimal
735
+ example. Use the lifecycle actor from `next` and the active writer token when
567
736
  required. Do not call `task review-launch` from inside a Codex App sandbox, do not use the Worker or
568
737
  Delivery Coordinator as reviewer, and discard the result if a fresh packet changes either hash.
569
738
 
@@ -571,6 +740,19 @@ When `next` returns a derived C1 Worker or corrective Auditor actor, use that ex
571
740
  asking the user to name one. Derivation removes a routing pause; handoff claim, writer lease,
572
741
  strict review, and auditor-independence checks remain mandatory.
573
742
 
743
+ The beta.13.2 pending strict-review update exception is documented in
744
+ `docs/pending-review-update.md` in the exact package. An exact external target runner may run
745
+ only `update pending-review-source-preflight` against the known beta.13.1 source. Require its
746
+ verified runtime build, exact Task/revision/Plan/HEAD/pending binding and no blockers. If it
747
+ returns an exact stale Task lease repair, run that `locks repair` with the installed source and
748
+ repeat preflight. Preserve the eligible receipt outside the checkout; transport only the two
749
+ bound dependency commits on base and Task, then install the target locally. Fresh local `next`
750
+ must advertise `update pending-review-dependency-recover`; run its matching read-only preflight
751
+ with `--file <source-receipt>` before recovery. Recovery does not approve Knowledge or review.
752
+ Use the original pending product SHA through the newly sealed external packet and record,
753
+ then follow fresh credential/context-refresh/ordinary lifecycle actions. Never treat this as
754
+ permission for other external-runner mutations, product transport, or manual state repair.
755
+
574
756
  Before an npm package update, run the project-local `update preflight` and stop unless it
575
757
  returns `safe=true` with a clean checkout, no running Step, and no active writer lease.
576
758
 
@@ -585,3 +767,18 @@ returns `safe=true` with a clean checkout, no running Step, and no active writer
585
767
  - A lifecycle `status` or `next` failed; do not continue with a different lifecycle mutation.
586
768
  - A human gate was emitted but the user has not approved its exact confirmation code in a
587
769
  later message and no exact eligible delegated approval option exists.
770
+
771
+ ## Explain an implementation change before escalating
772
+
773
+ Before a product write by a tracked Worker, run the packaged registry `dispatch-context-check`
774
+ using fresh App readback, the actual write root and the branch from the current Task. Resolve
775
+ checkout mismatch without duplicate dispatch or silent canonical-checkout writes. A matching
776
+ context is not a filesystem permission or writer credential.
777
+
778
+ When a fix needs additional files, the route is unclear, or an external operation was denied,
779
+ use read-only `change explain --task <exact Task ID> --file <closed proposal JSON>` as documented
780
+ in `docs/change-model.md`. Present all known blocking layers together. Never relabel an external
781
+ permission refusal as a missing grant. `requiresUser: null` is unknown, not blanket approval.
782
+ For an exact Core-derived check-support amendment, follow the existing advertised recovery and
783
+ fresh next; do not manually widen allowedWrites or issue new authority. Membership, semantic
784
+ scope and Knowledge refresh retain their separate existing routes and evidence requirements.
@@ -35,6 +35,7 @@
35
35
  "summary": { "type": "string", "minLength": 1 },
36
36
  "decision": { "enum": ["approved", "approved-with-rationale", "split-required", "stop-escalate"] },
37
37
  "splitRationale": { "type": ["string", "null"], "minLength": 1 },
38
+ "structuralProductionEdgeAuthority": { "const": "required-v1" },
38
39
  "stepClassifications": {
39
40
  "type": "array",
40
41
  "minItems": 1,
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/preexecution-replan-event.schema.json",
4
+ "title": "Codex Workflow V2 Pre-execution Replan Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId", "taskId", "sourceTaskRevision", "resultTaskRevision", "briefHash",
9
+ "sourcePlanHash", "knowledgeMapRevision", "knowledgeMapHash",
10
+ "sourcePlanRiskAuditEventId", "sourcePlanRiskAuditEventHash",
11
+ "obstructionPlanRiskAuditEventId", "obstructionPlanRiskAuditEventHash",
12
+ "sourceExecutionAuthorizationHash", "sourceHeadCommit", "completedStepIds",
13
+ "completedStepsHash", "actor", "reason", "recordedAt", "previousEventHash", "eventHash"
14
+ ],
15
+ "properties": {
16
+ "eventId": { "type": "string", "pattern": "^PER-[0-9A-HJKMNP-TV-Z]{26}$" },
17
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
18
+ "sourceTaskRevision": { "type": "integer", "minimum": 1 },
19
+ "resultTaskRevision": { "type": "integer", "minimum": 2 },
20
+ "briefHash": { "$ref": "#/$defs/hash64" },
21
+ "sourcePlanHash": { "$ref": "#/$defs/hash64" },
22
+ "knowledgeMapRevision": { "type": "integer", "minimum": 1 },
23
+ "knowledgeMapHash": { "$ref": "#/$defs/hash64" },
24
+ "sourcePlanRiskAuditEventId": { "type": "string", "pattern": "^PRA-[0-9A-HJKMNP-TV-Z]{26}$" },
25
+ "sourcePlanRiskAuditEventHash": { "$ref": "#/$defs/hash64" },
26
+ "obstructionPlanRiskAuditEventId": { "type": "string", "pattern": "^PRA-[0-9A-HJKMNP-TV-Z]{26}$" },
27
+ "obstructionPlanRiskAuditEventHash": { "$ref": "#/$defs/hash64" },
28
+ "sourceExecutionAuthorizationHash": { "$ref": "#/$defs/hash64" },
29
+ "sourceHeadCommit": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
30
+ "completedStepIds": {
31
+ "type": "array",
32
+ "uniqueItems": true,
33
+ "items": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" }
34
+ },
35
+ "completedStepsHash": { "$ref": "#/$defs/hash64" },
36
+ "actor": { "type": "string", "minLength": 1 },
37
+ "reason": { "type": "string", "minLength": 1, "maxLength": 2048 },
38
+ "recordedAt": { "type": "string", "format": "date-time" },
39
+ "previousEventHash": { "anyOf": [{ "$ref": "#/$defs/hash64" }, { "type": "null" }] },
40
+ "eventHash": { "$ref": "#/$defs/hash64" }
41
+ },
42
+ "$defs": {
43
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
44
+ }
45
+ }
@@ -215,6 +215,61 @@
215
215
  }
216
216
  },
217
217
  "additionalProperties": false
218
+ },
219
+ "rootCauseReplan": {
220
+ "type": "object",
221
+ "required": [
222
+ "kind", "taskId", "sourceTaskRevision", "stepId", "sourcePlanHash",
223
+ "sourcePlanSemanticHash", "replacementPlanHash", "replacementPlanSemanticHash",
224
+ "sourceHeadCommit", "remediationEvents", "terminalRemediationEventId",
225
+ "terminalRemediationEventHash", "terminalExecutionTaskRevision",
226
+ "repeatedCauseFingerprint", "correctiveYieldEventId", "correctiveYieldEventHash",
227
+ "dirtyFiles", "dirtyWorktreeHash", "replacementPlanRiskAuditEventId",
228
+ "replacementPlanRiskAuditEventHash", "executionAuthorizationHash",
229
+ "executionAuthorizationHead", "completedStepsHash", "c1ClaimEventId",
230
+ "c1ClaimEventHash", "claimant", "compatibilityHash"
231
+ ],
232
+ "properties": {
233
+ "kind": { "const": "root-cause-corrective-replan-dirty-carryover" },
234
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
235
+ "sourceTaskRevision": { "type": "integer", "minimum": 1 },
236
+ "stepId": { "type": "string", "pattern": "^STEP-[A-Z0-9][A-Z0-9-]{2,63}$" },
237
+ "sourcePlanHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
238
+ "sourcePlanSemanticHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
239
+ "replacementPlanHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
240
+ "replacementPlanSemanticHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
241
+ "sourceHeadCommit": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
242
+ "remediationEvents": {
243
+ "type": "array", "minItems": 1,
244
+ "items": {
245
+ "type": "object", "required": ["eventId", "eventHash", "attemptOrdinal"],
246
+ "properties": {
247
+ "eventId": { "type": "string", "pattern": "^RME-[0-9A-HJKMNP-TV-Z]{26}$" },
248
+ "eventHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
249
+ "attemptOrdinal": { "type": "integer", "minimum": 1 }
250
+ },
251
+ "additionalProperties": false
252
+ }
253
+ },
254
+ "terminalRemediationEventId": { "type": "string", "pattern": "^RME-[0-9A-HJKMNP-TV-Z]{26}$" },
255
+ "terminalRemediationEventHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
256
+ "terminalExecutionTaskRevision": { "type": "integer", "minimum": 1 },
257
+ "repeatedCauseFingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
258
+ "correctiveYieldEventId": { "type": "string", "pattern": "^HOF-[a-f0-9]{64}$" },
259
+ "correctiveYieldEventHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
260
+ "dirtyFiles": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
261
+ "dirtyWorktreeHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
262
+ "replacementPlanRiskAuditEventId": { "type": "string", "pattern": "^PRA-[0-9A-HJKMNP-TV-Z]{26}$" },
263
+ "replacementPlanRiskAuditEventHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
264
+ "executionAuthorizationHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
265
+ "executionAuthorizationHead": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
266
+ "completedStepsHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
267
+ "c1ClaimEventId": { "type": "string", "pattern": "^HOF-[0-9A-HJKMNP-TV-Z]{26}$" },
268
+ "c1ClaimEventHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
269
+ "claimant": { "type": "string", "minLength": 1 },
270
+ "compatibilityHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
271
+ },
272
+ "additionalProperties": false
218
273
  }
219
274
  },
220
275
  "additionalProperties": false