codex-workflow-v2 2.0.0-alpha.7 → 2.0.0-alpha.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/alpha6/plan-risk.d.ts +1 -0
- package/dist/src/alpha6/plan-risk.js +2 -2
- package/dist/src/alpha6/plan-risk.js.map +1 -1
- package/dist/src/alpha6/remediation.d.ts +4 -1
- package/dist/src/alpha6/remediation.js +84 -19
- package/dist/src/alpha6/remediation.js.map +1 -1
- package/dist/src/alpha7/corrective-recovery.d.ts +26 -0
- package/dist/src/alpha7/corrective-recovery.js +593 -0
- package/dist/src/alpha7/corrective-recovery.js.map +1 -0
- package/dist/src/cli.js +4 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/contracts.d.ts +27 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/src/workflow.d.ts +2 -0
- package/dist/src/workflow.js +302 -56
- package/dist/src/workflow.js.map +1 -1
- package/docs/alpha7.1-implementation-brief.md +268 -0
- package/docs/alpha7.2-corrective-context-refresh-brief.md +484 -0
- package/docs/autonomy-guardrails.md +29 -14
- package/package.json +1 -1
- package/plugins/codex-workflow-gateway/references/protocol.md +13 -4
- package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +16 -4
- package/references/state-machine.md +17 -6
- package/schemas/corrective-decision-recovery-event.schema.json +71 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# codex-workflow-v2 2.0.0-alpha.7.1 implementation brief
|
|
2
|
+
|
|
3
|
+
## Status and authority
|
|
4
|
+
|
|
5
|
+
This document is the single source of truth for the local `2.0.0-alpha.7.1`
|
|
6
|
+
release candidate. It was authorized in the current Codex task on 2026-08-14.
|
|
7
|
+
Workflow V2 must not be used to organize or authorize this development work.
|
|
8
|
+
|
|
9
|
+
The candidate is based on the published tag `v2.0.0-alpha.7` at commit
|
|
10
|
+
`b7ce0b5e14791e8177c104a2344dfb46f459696f` and is developed in the standalone
|
|
11
|
+
repository `/Users/home-pc/htdocs/codex-workflow-v2` on the isolated branch
|
|
12
|
+
`codex/workflow-v2-alpha7-1`.
|
|
13
|
+
|
|
14
|
+
No tag, push, or npm publication is authorized. The `signal_v4` repository,
|
|
15
|
+
its external Workflow state, and its Milestone 3 state are read-only evidence
|
|
16
|
+
and must not be changed.
|
|
17
|
+
|
|
18
|
+
## Problem statement
|
|
19
|
+
|
|
20
|
+
Alpha.7 adds a bounded Milestone autonomy contract, but its guarded remediation
|
|
21
|
+
state machine is not internally consistent after a strict Step review failure
|
|
22
|
+
causes Project Knowledge refresh, Task Knowledge rebind, and delegated
|
|
23
|
+
reauthorization.
|
|
24
|
+
|
|
25
|
+
The production-shaped failure is:
|
|
26
|
+
|
|
27
|
+
1. A guarded Step fails two strict reviews and records two ordinary remediation
|
|
28
|
+
events.
|
|
29
|
+
2. The Step's commits make Project Knowledge stale.
|
|
30
|
+
3. Project Knowledge is reconciled and approved, then the Task Plan is rebound
|
|
31
|
+
and reauthorized under a new Plan hash.
|
|
32
|
+
4. The Task remains runnable and the failed Step remains the remediation target,
|
|
33
|
+
but `next` no longer advertises `task corrective-decision` because the gate is
|
|
34
|
+
derived only for `needs_fix`.
|
|
35
|
+
5. `recordStepCorrectiveDecision` also accepts only `needs_fix` or a narrowly
|
|
36
|
+
defined `blocked` unverified-review posture, so the advertised and executable
|
|
37
|
+
transitions can diverge.
|
|
38
|
+
|
|
39
|
+
This creates a lifecycle deadlock and previously encouraged signal-specific
|
|
40
|
+
rescue patches. Alpha.7.1 must fix the generic transition semantics. It must not
|
|
41
|
+
hard-code repository names, Task IDs, Step IDs, revisions, commits, Plan hashes,
|
|
42
|
+
or package-upgrade rescue identities.
|
|
43
|
+
|
|
44
|
+
The real-agent E2E exposed a second autonomy deadlock. A normal Task that adds a
|
|
45
|
+
new test can cause the repository scanner to add that file as a supporting
|
|
46
|
+
Knowledge source. The Milestone autonomy contract currently permits only
|
|
47
|
+
content-hash-only atomic refresh, so the new source forces another human approval
|
|
48
|
+
even when its exact path, category, authority, and reason were declared in the
|
|
49
|
+
authorized Task Plan. Alpha.7.1 must distinguish such Plan-bounded supporting
|
|
50
|
+
source additions from unplanned source-set or authority changes.
|
|
51
|
+
|
|
52
|
+
## User outcomes
|
|
53
|
+
|
|
54
|
+
1. A Milestone coordinator can execute a bounded Milestone autonomously without
|
|
55
|
+
asking for repeated human approvals covered by the Milestone autonomy
|
|
56
|
+
contract.
|
|
57
|
+
2. A guarded Step gets at most two ordinary remediation attempts, then exactly
|
|
58
|
+
one independently audited corrective attempt when `continue-fix` is chosen.
|
|
59
|
+
3. Project Knowledge refresh, Task Knowledge rebind, and delegated
|
|
60
|
+
reauthorization preserve the remediation posture rather than losing or
|
|
61
|
+
bypassing it.
|
|
62
|
+
4. `next` always recommends a transition that the corresponding command can
|
|
63
|
+
execute from the same immutable state, subject only to the evidence explicitly
|
|
64
|
+
named by that recommendation.
|
|
65
|
+
5. A third failed guarded remediation reaches a hard stop. Only split or stop
|
|
66
|
+
escalation is permitted; a fourth run is impossible.
|
|
67
|
+
6. Discovery quality is checked, but ordinary human incompleteness and
|
|
68
|
+
non-blocking unknowns do not require the user to pre-plan agent behavior.
|
|
69
|
+
7. A Task may add a supporting Knowledge source declared by its already
|
|
70
|
+
authorized Plan without creating another human gate; undeclared additions,
|
|
71
|
+
canonical-source additions, removals, authority/category changes, gaps, and
|
|
72
|
+
conflicts still fail closed.
|
|
73
|
+
|
|
74
|
+
## Required state-machine semantics
|
|
75
|
+
|
|
76
|
+
### R1 — generic corrective posture
|
|
77
|
+
|
|
78
|
+
Derive the corrective posture from the current guarded Step, current Plan Risk
|
|
79
|
+
Audit, remediation history, and corrective-decision history. Do not infer it
|
|
80
|
+
solely from `Task.status`.
|
|
81
|
+
|
|
82
|
+
The derivation must work when the same failed guarded Step is represented in any
|
|
83
|
+
legitimate post-failure/post-refresh status produced by the Workflow, including
|
|
84
|
+
`needs_fix`, post-rebind `ready`, post-authorization `ready`, and the existing
|
|
85
|
+
blocked/unverified strict-review retry posture.
|
|
86
|
+
|
|
87
|
+
### R2 — `next`/command consistency
|
|
88
|
+
|
|
89
|
+
If a guarded Step has two failed remediation events and no decision for attempt
|
|
90
|
+
3, `next` must advertise `task corrective-decision` before `task run` regardless
|
|
91
|
+
of a content-only Knowledge refresh, Plan rebind, or delegated reauthorization.
|
|
92
|
+
|
|
93
|
+
When `next` advertises `task corrective-decision`,
|
|
94
|
+
`recordStepCorrectiveDecision` must accept the same Task/Step state with the
|
|
95
|
+
recommended revision, Plan Risk Audit, actor/lease posture, and independent
|
|
96
|
+
auditor evidence.
|
|
97
|
+
|
|
98
|
+
### R3 — Plan rebind continuity
|
|
99
|
+
|
|
100
|
+
Knowledge rebind may create a new Plan hash. Historical remediation events remain
|
|
101
|
+
immutable. A corrective decision is bound to the current Plan hash and the exact
|
|
102
|
+
covered remediation event IDs. Rebind must not reset attempt counts or permit a
|
|
103
|
+
third ordinary attempt.
|
|
104
|
+
|
|
105
|
+
### R4 — bounded recovery
|
|
106
|
+
|
|
107
|
+
- Attempts 1 and 2 are ordinary.
|
|
108
|
+
- Attempt 3 requires an independent corrective decision.
|
|
109
|
+
- `continue-fix` enables exactly the third corrective attempt.
|
|
110
|
+
- `replan-required` requires an actual new Plan posture before execution.
|
|
111
|
+
- `split-required` and `stop-escalate` block execution.
|
|
112
|
+
- After a third failed remediation event, `next` must expose a stable hard-stop
|
|
113
|
+
action and must not throw while merely reporting status.
|
|
114
|
+
- A fourth `task run` and a fourth `continue-fix` decision are prohibited.
|
|
115
|
+
|
|
116
|
+
### R5 — priority ordering
|
|
117
|
+
|
|
118
|
+
Pending strict review for an already recorded completion commit outranks
|
|
119
|
+
Knowledge refresh. After that review is terminal, required Project Knowledge
|
|
120
|
+
refresh and Task Knowledge rebind remain mandatory. Once current knowledge and
|
|
121
|
+
authorization are restored, an outstanding corrective decision outranks another
|
|
122
|
+
run. C1 claim/handoff constraints remain authoritative and must not be bypassed.
|
|
123
|
+
|
|
124
|
+
### R6 — Milestone autonomy
|
|
125
|
+
|
|
126
|
+
The alpha.7 Milestone autonomy contract remains bounded by its immutable semantic
|
|
127
|
+
scope, delegate, expiry, policy hash, and allowed transitions. It may cover
|
|
128
|
+
Milestone execution/final acceptance, Task execution/final acceptance, and
|
|
129
|
+
content-only Project Knowledge approval. Semantic scope changes still require
|
|
130
|
+
new human authority. Alpha.7.1 must not broaden these permissions.
|
|
131
|
+
|
|
132
|
+
### R7 — Plan-bounded supporting-source refresh
|
|
133
|
+
|
|
134
|
+
The user explicitly authorized this bounded delegated-approval expansion in the
|
|
135
|
+
current Codex task after the real-agent E2E exposed the supporting-source
|
|
136
|
+
deadlock. The authorization is limited to the complete fail-closed predicate
|
|
137
|
+
below.
|
|
138
|
+
|
|
139
|
+
The atomic delegated `task context-refresh` transition may accept a newly
|
|
140
|
+
discovered Knowledge source only when all of the following are true:
|
|
141
|
+
|
|
142
|
+
- the active Task belongs to the Milestone named by the autonomy grant;
|
|
143
|
+
- the current authorized Task Plan declares `knowledgeImpact: create` and an
|
|
144
|
+
exact `knowledgeTargets` entry for the new path and category;
|
|
145
|
+
- the scanner classifies that exact path and category as `supporting`;
|
|
146
|
+
- no previously approved source is removed;
|
|
147
|
+
- no existing source changes category or authority;
|
|
148
|
+
- no unplanned source is added;
|
|
149
|
+
- gaps and conflicts are unchanged and no new conflict exists.
|
|
150
|
+
|
|
151
|
+
The transition remains atomic: reconcile, approve the exact safe candidate,
|
|
152
|
+
rebind Task Knowledge, and supersede execution authorization together. It must
|
|
153
|
+
not permit standalone Project Memory approval, canonical-source creation,
|
|
154
|
+
wildcard/directory targets, or mutation beyond the Task's current Plan and the
|
|
155
|
+
existing Milestone autonomy policy. `next` must expose this delegated refresh
|
|
156
|
+
only when the complete predicate is satisfied and otherwise report the concrete
|
|
157
|
+
unsafe differences.
|
|
158
|
+
|
|
159
|
+
## Required tests
|
|
160
|
+
|
|
161
|
+
### Deterministic replay (release-blocking)
|
|
162
|
+
|
|
163
|
+
Add a production-shaped regression using opaque, non-hard-coded Step IDs. It must
|
|
164
|
+
replay the complete sequence:
|
|
165
|
+
|
|
166
|
+
1. Milestone autonomy and delegated Task authorization.
|
|
167
|
+
2. Guarded Step completion and strict-review failure 1.
|
|
168
|
+
3. Ordinary remediation, completion, and strict-review failure 2.
|
|
169
|
+
4. Project Knowledge staleness, content-only reconcile/approval, Task Knowledge
|
|
170
|
+
rebind, refreshed Plan Risk Audit, and delegated reauthorization.
|
|
171
|
+
5. `next -> task corrective-decision` and successful recording by an auditor
|
|
172
|
+
distinct from the latest strict reviewer.
|
|
173
|
+
6. Corrective attempt 3 and successful strict review, followed by Task completion.
|
|
174
|
+
7. A sibling replay where attempt 3 fails and proves stable hard-stop reporting,
|
|
175
|
+
rejection of a fourth run, and rejection of `continue-fix` for attempt 4.
|
|
176
|
+
|
|
177
|
+
The replay must assert state, sidecar bindings, attempt ordinals, Plan hashes,
|
|
178
|
+
returned actions, and absence of repository-specific rescue logic.
|
|
179
|
+
|
|
180
|
+
Add a sibling deterministic replay for R7. It must prove that one exact
|
|
181
|
+
Plan-declared supporting test source can be accepted through atomic delegated
|
|
182
|
+
context refresh, while an undeclared source, a canonical addition, a removal,
|
|
183
|
+
and an authority/category change remain ineligible and cannot mutate state.
|
|
184
|
+
|
|
185
|
+
### Existing suites (release-blocking)
|
|
186
|
+
|
|
187
|
+
`npm run validate`, `npm run release:check`, `npm run pack:check`,
|
|
188
|
+
`npm run smoke:downstream`, and `npm run plugin:check` must pass sequentially
|
|
189
|
+
under the repository's supported Node version. Parallel build/clean scripts are
|
|
190
|
+
not valid evidence because they race on shared output directories.
|
|
191
|
+
|
|
192
|
+
### Real-agent isolated E2E (release-blocking)
|
|
193
|
+
|
|
194
|
+
Create `test-runs/2.0.0-alpha.7.1/project` as a disposable repository inside the
|
|
195
|
+
standalone project. Use the sibling `codex-home`, `workflow-state`, `plugin-root`,
|
|
196
|
+
`npm-cache`, and `evidence` directories for complete isolation. Install the
|
|
197
|
+
candidate from a local `npm pack` tarball, not the public registry. The globally
|
|
198
|
+
installed Codex Workflow plugin remains disabled; the real agent loads only the
|
|
199
|
+
candidate gateway from the isolated plugin root.
|
|
200
|
+
|
|
201
|
+
Run a real Delegate agent through:
|
|
202
|
+
|
|
203
|
+
`initial Discovery -> Milestone -> bounded Milestone autonomy -> Tasks -> strict
|
|
204
|
+
review/remediation and Knowledge refresh -> merge/handback -> Milestone validate
|
|
205
|
+
-> delegated final accept`.
|
|
206
|
+
|
|
207
|
+
The Milestone must be small enough to finish but contain at least three Tasks:
|
|
208
|
+
|
|
209
|
+
1. A bounded safe-contract implementation Task that adds a Plan-declared
|
|
210
|
+
supporting test source and exercises the R7 atomic refresh path.
|
|
211
|
+
2. A guarded persistence/documentation Task that causes content drift and two
|
|
212
|
+
deterministic strict-review failures before a bounded corrective success,
|
|
213
|
+
exercising reconcile, rebind, and reauthorization.
|
|
214
|
+
3. A composition/acceptance Task that closes the Milestone.
|
|
215
|
+
|
|
216
|
+
The initial Discovery prompt should imitate a real product-owner request: desired
|
|
217
|
+
outcome, examples and constraints are present, while implementation details,
|
|
218
|
+
exact Step decomposition, retry mechanics, and some non-blocking design choices
|
|
219
|
+
are deliberately omitted. The agent must discover and resolve what it can,
|
|
220
|
+
record non-blocking unknowns honestly, and proceed without asking the user to
|
|
221
|
+
predict its implementation behavior. The signal_v4 M3 Discovery may be used as
|
|
222
|
+
read-only style evidence, but its domain and identifiers must not be copied into
|
|
223
|
+
the candidate logic.
|
|
224
|
+
|
|
225
|
+
E2E acceptance requires the Milestone to reach final acceptance, all Tasks to be
|
|
226
|
+
terminal, repository state clean, no active or stale writer leases, no action
|
|
227
|
+
requiring human approval inside the granted semantic scope, and an evidence log
|
|
228
|
+
that identifies every command/action and final entity status without secrets.
|
|
229
|
+
The run must include at least one new supporting test source admitted through the
|
|
230
|
+
R7 atomic delegated context-refresh path; manually approving that source is not
|
|
231
|
+
acceptable passing evidence.
|
|
232
|
+
|
|
233
|
+
## Ownership and integration
|
|
234
|
+
|
|
235
|
+
- Main coordinator: owns this Brief, integration, local tarball, isolated E2E,
|
|
236
|
+
final evidence, and all decisions that cross file ownership.
|
|
237
|
+
- State-machine implementer: owns production changes in `src/` and directly
|
|
238
|
+
related contracts/reference documentation. Must not edit E2E evidence.
|
|
239
|
+
- E2E/test owner: owns deterministic regression tests, fixtures, and isolated E2E
|
|
240
|
+
harness documentation/scripts. Must not change production semantics without a
|
|
241
|
+
written finding to the coordinator.
|
|
242
|
+
- Independent auditor: starts only after implementation and E2E evidence are
|
|
243
|
+
complete; reviews Brief-to-diff traceability, test validity, release artifacts,
|
|
244
|
+
and residual risks without editing implementation files.
|
|
245
|
+
|
|
246
|
+
All contributors share the worktree, must preserve concurrent edits, and must not
|
|
247
|
+
revert changes they did not create.
|
|
248
|
+
|
|
249
|
+
## Stop-loss and release gate
|
|
250
|
+
|
|
251
|
+
All local iterations retain version `2.0.0-alpha.7.1`; individual failures do not
|
|
252
|
+
create alpha.7.2/alpha.7.3 versions. No publication occurs until deterministic
|
|
253
|
+
replay, the real-agent Milestone, and independent audit all pass.
|
|
254
|
+
|
|
255
|
+
If real-agent execution cannot be completed because Codex cannot be launched with
|
|
256
|
+
the required isolation or cannot exercise a deterministic failure seam, that is
|
|
257
|
+
a release blocker, not permission to substitute a mocked test.
|
|
258
|
+
|
|
259
|
+
## Deliverables
|
|
260
|
+
|
|
261
|
+
1. This Brief.
|
|
262
|
+
2. Generic source diff and reference documentation.
|
|
263
|
+
3. Deterministic replay and all package validation evidence.
|
|
264
|
+
4. Local alpha.7.1 tarball identity and downstream installation evidence.
|
|
265
|
+
5. Real-agent E2E evidence through Milestone final acceptance.
|
|
266
|
+
6. Independent audit with every finding resolved or explicitly accepted by the
|
|
267
|
+
user.
|
|
268
|
+
7. Remaining risks and a release recommendation. No tag, push, or publish.
|