codex-workflow-v2 2.0.0-beta.12 → 2.0.0-beta.12.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 (62) hide show
  1. package/README.md +65 -5
  2. package/dist/src/alpha6/downstream-proof.d.ts +68 -0
  3. package/dist/src/alpha6/downstream-proof.js +604 -0
  4. package/dist/src/alpha6/downstream-proof.js.map +1 -0
  5. package/dist/src/alpha6/milestone.d.ts +6 -2
  6. package/dist/src/alpha6/milestone.js +164 -10
  7. package/dist/src/alpha6/milestone.js.map +1 -1
  8. package/dist/src/alpha6/plan-risk.js +2 -2
  9. package/dist/src/alpha6/plan-risk.js.map +1 -1
  10. package/dist/src/alpha6/remediation.d.ts +8 -3
  11. package/dist/src/alpha6/remediation.js +374 -9
  12. package/dist/src/alpha6/remediation.js.map +1 -1
  13. package/dist/src/alpha6/review.d.ts +6 -0
  14. package/dist/src/alpha6/review.js +12 -0
  15. package/dist/src/alpha6/review.js.map +1 -1
  16. package/dist/src/alpha7/corrective-recovery.d.ts +8 -1
  17. package/dist/src/alpha7/corrective-recovery.js +406 -26
  18. package/dist/src/alpha7/corrective-recovery.js.map +1 -1
  19. package/dist/src/cli.js +135 -5
  20. package/dist/src/cli.js.map +1 -1
  21. package/dist/src/contracts.d.ts +154 -3
  22. package/dist/src/dependency-provenance.d.ts +9 -2
  23. package/dist/src/dependency-provenance.js +70 -8
  24. package/dist/src/dependency-provenance.js.map +1 -1
  25. package/dist/src/git.d.ts +1 -1
  26. package/dist/src/git.js +6 -2
  27. package/dist/src/git.js.map +1 -1
  28. package/dist/src/historical-step-provenance.d.ts +20 -0
  29. package/dist/src/historical-step-provenance.js +111 -0
  30. package/dist/src/historical-step-provenance.js.map +1 -0
  31. package/dist/src/state/corrective-replan-executor.js +5 -0
  32. package/dist/src/state/corrective-replan-executor.js.map +1 -1
  33. package/dist/src/version.d.ts +1 -1
  34. package/dist/src/version.js +1 -1
  35. package/dist/src/version.js.map +1 -1
  36. package/dist/src/workflow.d.ts +40 -2
  37. package/dist/src/workflow.js +1440 -65
  38. package/dist/src/workflow.js.map +1 -1
  39. package/docs/autonomy-guardrails.md +91 -1
  40. package/docs/decisions.md +14 -0
  41. package/docs/delegated-approval.md +6 -1
  42. package/docs/development-flow.md +60 -5
  43. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  44. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  45. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  46. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +97 -7
  47. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +68 -9
  48. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +150 -33
  49. package/docs/release.md +51 -8
  50. package/docs/updating-existing-project.md +155 -2
  51. package/docs/validation-report.md +101 -94
  52. package/package.json +7 -2
  53. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +1 -1
  54. package/plugins/codex-workflow-gateway/references/protocol.md +69 -1
  55. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +156 -1
  56. package/schemas/authorization-event.schema.json +8 -1
  57. package/schemas/downstream-proof-invalidation-event.schema.json +71 -0
  58. package/schemas/downstream-proof-replan-recovery-event.schema.json +61 -0
  59. package/schemas/milestone-scope-change-event.schema.json +25 -1
  60. package/schemas/stop-escalate-override-event.schema.json +45 -0
  61. package/schemas/task.schema.json +104 -0
  62. package/scripts/generate-pdf-docs.py +13 -2
package/README.md CHANGED
@@ -19,11 +19,17 @@ automation do not import anything from the parent V1 project.
19
19
  - one writer lease and one atomic Git commit per completed Step;
20
20
  - execution authorization with a bounded, versioned mechanical Plan-feasibility payload, independent
21
21
  review, and a state-bound human final-acceptance gate;
22
+ - automatic release of the active Task writer lease when `result-set` enters human final acceptance,
23
+ followed by fresh credential acquisition for merge;
22
24
  - high-risk Plan guidance plus evidence-bound `fix`/`replan` review routing without an attempt-count stop;
23
25
  - executable proof obligations with hostile counterexamples for every guarded failure mode;
24
26
  - read-only update preflight for clean checkout, running-Step, and writer-lease blockers;
25
27
  - beta.10 bounded recovery for one exact dependency-only HEAD, including retained product commits
26
28
  proven by intact passed strict-review and reviewer-attestation chains;
29
+ - beta.12.6 active-downstream-proof update bridge: one exact dependency-only Task HEAD can be
30
+ registered while the already-classified proof work remains dirty and its Step remains active;
31
+ - beta.12.7 stranded-replan recovery: an accidental post-recovery Knowledge rebind cannot resurrect
32
+ the rejected Plan, and exact dirty bytes can be adopted by one newly authorized owning Step;
27
33
  - bounded first-failure Plan-integrity recovery for legacy/in-flight contradictions that could not
28
34
  be rejected by the current pre-authorization feasibility gate;
29
35
  - read-only Milestone progress projection with stable membership ordinals and replacement links;
@@ -32,6 +38,12 @@ automation do not import anything from the parent V1 project.
32
38
  - optional time-bound delegated approval with project/Milestone/Task scope and an explicit audit trail;
33
39
  - one bounded Milestone Autonomy Contract for approvals, guarded content-only context refresh,
34
40
  and membership-only Task-graph evolution;
41
+ - audited remediation topology for an unstarted Task whose current Plan Risk Audit records
42
+ `stop-escalate`: Core may append exactly one upstream Task, inherit the blocked Task's exact
43
+ merged dependency frontier, and derive replacement Milestone/Task authority without a new
44
+ human approval while preserving outcome, success signal, acceptance, and checks;
45
+ - bounded recovery of one previously passed and accepted Step commit omitted by a corrective Plan,
46
+ without rewriting Git history or adopting the old Step into the replacement Plan;
35
47
  - Milestones aggregate already merged Tasks on the base branch, without an integration branch;
36
48
  - V1 transition is snapshot-only and never performs semantic import.
37
49
 
@@ -43,7 +55,7 @@ cross-machine synchronization are not part of its contract.
43
55
  Node.js 22 or newer is required. Consumers pin the exact package version:
44
56
 
45
57
  ```bash
46
- npm install --save-dev --save-exact codex-workflow-v2@2.0.0-beta.12
58
+ npm install --save-dev --save-exact codex-workflow-v2@2.0.0-beta.12.10
47
59
  npx codex-workflow gateway handshake --repo .
48
60
  npx codex-workflow doctor --repo .
49
61
  ```
@@ -98,6 +110,10 @@ codex-workflow task step-complete --repo . --id TASK-... --step STEP-001 \
98
110
  `task step-complete` runs configured checks, creates the workflow-owned atomic commit, and
99
111
  either records completion immediately or leaves the Step non-terminal for `task step-review`
100
112
  when the current Plan Risk Audit marks it for strict review.
113
+ After a passing final Task review, fresh `next` makes `task result-set` lease-bound. Pass the active
114
+ writer token (and the exact claimant as `--actor` for C1). Success releases that lease before the
115
+ unbounded human final-acceptance pause. After acceptance, do not reuse the consumed token; follow
116
+ fresh `next` through `task writer-credential-replace` before merge or merge confirmation.
101
117
  When `next` includes `gitMutationPolicy`, obtain bounded permission to write Git metadata
102
118
  before the first call of that exact transition. For `task start`, the policy applies only when
103
119
  you invoke `--workspace-owner local`; for `task step-complete`, `task merge`, and
@@ -187,7 +203,7 @@ sidecars:
187
203
  `corrective-replan-executions.jsonl`, `step-review-events.jsonl`,
188
204
  `reviewer-attestations.jsonl`, `remediation-events.jsonl`,
189
205
  `corrective-decisions.jsonl`, `corrective-decision-recoveries.jsonl`,
190
- `remediation-mode-recoveries.jsonl`, `handoffs.jsonl`
206
+ `remediation-mode-recoveries.jsonl`, `downstream-proof-invalidations.jsonl`, `handoffs.jsonl`
191
207
  - milestone: `scope-change-events.jsonl`, `autonomy-contract-events.jsonl`
192
208
 
193
209
  Milestone scope-change recovery also uses Milestone-local `.transactions/` journal files.
@@ -214,6 +230,40 @@ definition, Git HEAD, manifest hash, and complete dirty-file set. The recovery r
214
230
  journaled corrective-replan path. It does not edit the Plan, run a second failing attempt, widen
215
231
  `allowedWrites`, or modify the worktree.
216
232
 
233
+ When an active downstream proof exposes a required change in files owned by a completed transitive
234
+ predecessor Step, fresh `next` advertises `task downstream-proof-recover` instead of the impossible
235
+ `task step-complete`. The lease-bound transaction preserves worktree and HEAD, invalidates only the
236
+ affected predecessor completion evidence, retains its commits as historical `invalidatedStepCommits`, yields
237
+ C1, and returns the same Task to ordinary planning. A fresh replacement Plan, Plan Risk Audit, and
238
+ execution authorization are required. Unrelated dirty files, non-predecessor ownership, unregistered
239
+ history, or damaged invalidation evidence fail closed.
240
+
241
+ If that exact condition is already present on an older package and therefore blocks the ordinary
242
+ clean-checkout update, beta.12.6 provides a bounded compatibility bridge. Update the active
243
+ Milestone base and Task branch with separate commits that each change only `package.json` and
244
+ `package-lock.json`, install the exact package, and continue only when fresh `next` advertises
245
+ `update downstream-proof-dependency-recover`. Its read-only preflight validates the candidate at
246
+ `HEAD`, the previously recorded Task history at `HEAD^`, aligned runtime/declared/locked/installed/
247
+ base versions, absence of leases and transactions, the exact active Step, predecessor ownership,
248
+ and a SHA-256 binding of every dirty product file. Recovery registers only that dependency commit,
249
+ does not touch product bytes or end the Step, and makes the existing `task downstream-proof-recover`
250
+ route reachable. Unknown history, an unrelated dirty path, a non-dependency candidate, stale base,
251
+ or changed authority remains a hard stop.
252
+
253
+ If beta.12.6 already invalidated the predecessor but a later Project Knowledge approval rebound the
254
+ rejected Plan, beta.12.7 exposes a separate exact compatibility route. Run the new package's read-only
255
+ `update downstream-proof-replan-update-preflight` before changing dependencies. After the two
256
+ dependency-only commits, follow fresh `next` through replan dependency registration and
257
+ `task downstream-proof-replan-recover`. Knowledge refresh may follow, but it cannot replace the
258
+ required `task plan-set`. Preserved dirty bytes are executable only when one replacement Step owns the
259
+ entire path set and `next` reports `downstreamProofCarryover.state=validated`; normal checks, Core commit,
260
+ and strict review remain mandatory.
261
+
262
+ Docker socket `EPERM`/permission errors observed inside a sandbox are access-boundary evidence, not
263
+ daemon-failure evidence. The gateway repeats the exact read-only probe or Plan check once with
264
+ sandbox escalation without consuming a remediation/infra retry. Docker Desktop restart or image
265
+ mutation requires separate authority and an escalated probe that actually proves daemon failure.
266
+
217
267
  For a terminal split, follow the [canonical replacement stop procedure](docs/split-required-recovery.md).
218
268
  P04-A intentionally disables structural replacement; P04-B/P05 must define the topology-preserving
219
269
  transaction before the route can be used.
@@ -243,7 +293,12 @@ success signal, acceptance, checks, discovery, and base branch remain cryptograp
243
293
  Pass `--delegation-grant` only when the same `next` response exposes an exact eligible
244
294
  `delegatedApprovalOptions` entry for that transition. Ordinary C1 handoff, claim, run,
245
295
  step-complete, step-review, merge, and sync-base do not inherit a Milestone approval grant.
246
- Adoption apply and semantic scope changes stay human-only. Revocation is immediate for future
296
+ Adoption apply and arbitrary semantic scope changes stay human-only. The bounded
297
+ `milestone remediation-materialize` route is not a generic delegated scope change: it is admitted
298
+ only by a current `stop-escalate` audit, keeps Milestone semantics byte-for-byte unchanged, appends
299
+ one required remediation Task, and adds only the blocked Task dependency edge. Its
300
+ `corrective-derived` authority covers execution authorization and final acceptance of current
301
+ required Tasks; final Milestone acceptance remains unchanged. Revocation is immediate for future
247
302
  uses. The original human path remains available and unchanged.
248
303
 
249
304
  ## Milestone autonomy and alpha.6 rescue
@@ -302,9 +357,14 @@ alpha regressions that must not recur are tracked in the
302
357
  - [Chat-only development guide](docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf)
303
358
  - [Deep technical reference](docs/pdf/codex-workflow-v2-technical-reference-ru.pdf)
304
359
 
305
- These beta.12 documents cover delegated Discovery, Milestone Autonomy Contract issuance,
360
+ These beta.12.10 documents cover delegated Discovery, Milestone Autonomy Contract issuance,
306
361
  dependency-aware Task routing, C1 credential handling, external-sealed reviews, bounded
307
- Plan-integrity recovery, and the P04-A structural-replacement stop boundary. Their reviewable
362
+ Plan-integrity recovery, Task-local dependency provenance recovery, the human-confirmed legacy
363
+ attempt-four stop override (including append-only multi-rebind, dependency-only HEAD continuation,
364
+ evidence-accounted post-audit recovery revisions), both downstream-proof update bridges, exact
365
+ dirty-worktree carryover into a replacement Step, audited additive remediation topology with
366
+ corrective-derived Task authority, and the P04-A
367
+ structural-replacement stop boundary. Their reviewable
308
368
  sources live in [`docs/pdf/sources`](docs/pdf/sources), and `npm run docs:pdf:check` proves the
309
369
  tracked binaries were generated from the current source and package version. The PDFs remain
310
370
  human-facing artifacts; the Markdown documents above, bundled gateway, schemas, and runtime code
@@ -0,0 +1,68 @@
1
+ import type { DownstreamProofInvalidationEvent, DownstreamProofReplanCompatibility, DownstreamProofReplanRecoveryEvent, TaskState } from '../contracts.js';
2
+ import type { FileStateStore } from '../state/store.js';
3
+ export interface DownstreamProofInvalidatedStep {
4
+ stepId: string;
5
+ evidenceCommit: string;
6
+ triggerFiles: string[];
7
+ }
8
+ export interface DownstreamProofRecoveryAssessment {
9
+ applicable: boolean;
10
+ eligible: boolean;
11
+ activeStepId: string | null;
12
+ dirtyFiles: string[];
13
+ outsideActiveStepFiles: string[];
14
+ invalidatedSteps: DownstreamProofInvalidatedStep[];
15
+ preservedHeadCommit: string | null;
16
+ dirtyWorktreeHash: string | null;
17
+ blockers: string[];
18
+ }
19
+ export interface PreparedDownstreamProofInvalidation {
20
+ event: DownstreamProofInvalidationEvent;
21
+ postimage: string;
22
+ }
23
+ export interface DownstreamProofReplanRecoveryAssessment {
24
+ applicable: boolean;
25
+ eligible: boolean;
26
+ invalidation: DownstreamProofInvalidationEvent | null;
27
+ rebind: TaskState['knowledgeRebinds'][number] | null;
28
+ compatibility: DownstreamProofReplanCompatibility | null;
29
+ dependencyRecoveryCommit: string | null;
30
+ blockers: string[];
31
+ }
32
+ export interface PreparedDownstreamProofReplanRecovery {
33
+ event: DownstreamProofReplanRecoveryEvent;
34
+ postimage: string;
35
+ }
36
+ export interface DownstreamProofCarryoverAssessment {
37
+ applicable: boolean;
38
+ eligible: boolean;
39
+ dirtyFiles: string[];
40
+ dirtyWorktreeHash: string | null;
41
+ invalidationEventId: string | null;
42
+ blockers: string[];
43
+ }
44
+ export declare function assessDownstreamProofRecovery(store: FileStateStore, repositoryRoot: string, task: TaskState, options?: {
45
+ historyBoundary?: string;
46
+ preservedHeadCommit?: string;
47
+ }): DownstreamProofRecoveryAssessment;
48
+ export declare function prepareDownstreamProofInvalidation(store: FileStateStore, resultTask: TaskState, assessment: DownstreamProofRecoveryAssessment, input: {
49
+ previousTaskRevision: number;
50
+ actor: string;
51
+ reason: string;
52
+ }, now: Date): PreparedDownstreamProofInvalidation;
53
+ export declare function readDownstreamProofInvalidations(store: FileStateStore, task: TaskState): DownstreamProofInvalidationEvent[];
54
+ export declare function downstreamProofInvalidationSidecar(): string;
55
+ export declare function assessDownstreamProofReplanRecovery(store: FileStateStore, repositoryRoot: string, task: TaskState, options?: {
56
+ historyBoundary?: string;
57
+ preservedHeadCommit?: string;
58
+ currentPlanRiskAuditExists?: boolean;
59
+ }): DownstreamProofReplanRecoveryAssessment;
60
+ export declare function prepareDownstreamProofReplanRecovery(store: FileStateStore, resultTask: TaskState, assessment: DownstreamProofReplanRecoveryAssessment, input: {
61
+ previousTaskRevision: number;
62
+ actor: string;
63
+ reason: string;
64
+ }, now: Date): PreparedDownstreamProofReplanRecovery;
65
+ export declare function readDownstreamProofReplanRecoveries(store: FileStateStore, task: TaskState): DownstreamProofReplanRecoveryEvent[];
66
+ export declare function downstreamProofReplanRecoverySidecar(): string;
67
+ export declare function assessDownstreamProofCarryover(store: FileStateStore, repositoryRoot: string, task: TaskState, stepId: string): DownstreamProofCarryoverAssessment;
68
+ export declare function hashDirtyWorktree(repositoryRoot: string, dirtyFiles: readonly string[]): string;