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,484 @@
|
|
|
1
|
+
# codex-workflow-v2 2.0.0-alpha.7.2 corrective context-refresh brief
|
|
2
|
+
|
|
3
|
+
## Status and authority
|
|
4
|
+
|
|
5
|
+
This document is the single source of truth for the narrow
|
|
6
|
+
`codex-workflow-v2@2.0.0-alpha.7.2` lifecycle patch. The candidate is based on
|
|
7
|
+
published tag `v2.0.0-alpha.7.1` at commit
|
|
8
|
+
`90e40108a593e0b908862c9326ceae8bfe8f6d67` and is developed only in the
|
|
9
|
+
detached worktree
|
|
10
|
+
`/Users/home-pc/Documents/Codex/2026-08-15/codex-workflow-v2-alpha7-2/work/codex-workflow-v2-alpha7-2`.
|
|
11
|
+
|
|
12
|
+
Workflow V2 is not used to plan, authorize, implement, test, or audit this
|
|
13
|
+
patch. The source repository's main checkout is read-only. No tag, push, or npm
|
|
14
|
+
publication is authorized.
|
|
15
|
+
|
|
16
|
+
The `signal_v4` repository and its external Workflow state are read-only
|
|
17
|
+
evidence. Exact replay must use a disposable byte copy of state and must never
|
|
18
|
+
point a mutating command at the original state root.
|
|
19
|
+
|
|
20
|
+
## Scoped feasibility decision
|
|
21
|
+
|
|
22
|
+
Alpha.7.2 guarantees command-local complete prevalidation before the first
|
|
23
|
+
durable recovery write, recovery-local serialization against duplicate recovery
|
|
24
|
+
callers, immediate under-lock evidence revalidation, and run-time revalidation
|
|
25
|
+
before a recovery is consumed. It does not claim global serializability against
|
|
26
|
+
unrelated Task, Knowledge Map, delegation, sidecar, or lease writers and does
|
|
27
|
+
not add a cross-file journal or global mutation protocol.
|
|
28
|
+
|
|
29
|
+
The inherited cross-store TOCTOU/crash window between final revalidation and
|
|
30
|
+
append is the same architectural risk class already present in alpha.7.1
|
|
31
|
+
multi-file transitions. A later evidence change makes the recovery event stale
|
|
32
|
+
and `task run` must fail closed. This residual risk is documented rather than
|
|
33
|
+
silently promoted into a new alpha.7.2 guarantee.
|
|
34
|
+
|
|
35
|
+
## Exact defect and baseline evidence
|
|
36
|
+
|
|
37
|
+
The production-shaped state is:
|
|
38
|
+
|
|
39
|
+
- Task `TASK-01M00W190K3V3HM68Q3QVSH1AY`, revision `25`, status `ready`;
|
|
40
|
+
- guarded Step `STEP-002-FORMALIZATION-CONTRACTS`, status `planned`;
|
|
41
|
+
- two failed ordinary remediation attempts, making ordinal `3` the next
|
|
42
|
+
attempt;
|
|
43
|
+
- corrective event `CRD-01M011B4MM5R1FZG2DSDRHVXJ4`, decision
|
|
44
|
+
`continue-fix`, triggering ordinal `3`;
|
|
45
|
+
- decision Plan hash
|
|
46
|
+
`21a17679b219f33822beaf519903c1adf497c318facf1a954550a54cef840e19`;
|
|
47
|
+
- current Plan hash
|
|
48
|
+
`9cb6b0c9f9400335877316c8163f35f5cf25c5fa3a4cd4775cf591e5293f3264`;
|
|
49
|
+
- one recorded Knowledge rebind from revision `163` to `165`, linking those
|
|
50
|
+
exact Plan hashes, followed by an approved delegated execution authorization
|
|
51
|
+
whose reason is the canonical content-only context-refresh reason.
|
|
52
|
+
|
|
53
|
+
The historical and current Plan artifacts differ in exactly one line: Knowledge
|
|
54
|
+
Map revision/hash. Objective, requirements, acceptance, risks, knowledge
|
|
55
|
+
impact, knowledge targets, graph use, Steps, allowed writes, expected outputs,
|
|
56
|
+
checks, and forbidden scope are byte-identical after normalizing that one
|
|
57
|
+
binding line.
|
|
58
|
+
|
|
59
|
+
An alpha.7.1 replay against a disposable copy of the untouched state produced:
|
|
60
|
+
|
|
61
|
+
1. `next -> action: task run`, Task revision `25`, Step
|
|
62
|
+
`STEP-002-FORMALIZATION-CONTRACTS`;
|
|
63
|
+
2. the exact advertised `task run` failed with `TRANSITION_BLOCKED` because the
|
|
64
|
+
corrective decision Plan hash differs from the current Plan hash;
|
|
65
|
+
3. the disposable state content digest remained unchanged;
|
|
66
|
+
4. the copied writer lease was stale before both calls and its heartbeat and
|
|
67
|
+
expiry remained unchanged, proving that the mismatch guard runs before lease
|
|
68
|
+
heartbeat and that lease staleness is not this navigation defect.
|
|
69
|
+
|
|
70
|
+
The primary defect is therefore `next`/transition disagreement. Because a
|
|
71
|
+
post-refresh Step may be `planned`, alpha.7.1 omits it from corrective-posture
|
|
72
|
+
discovery and advertises a run that the exact transition will reject. A sibling
|
|
73
|
+
constructed `failed` Step can instead advertise another corrective decision,
|
|
74
|
+
but that decision is also impossible because the existing Step/ordinal binding
|
|
75
|
+
must remain unique. That sibling is a separate regression variant, not a
|
|
76
|
+
replacement for the exact production replay.
|
|
77
|
+
|
|
78
|
+
## Required outcome
|
|
79
|
+
|
|
80
|
+
An existing `continue-fix` remains usable after an authorized context refresh
|
|
81
|
+
that changes only the Plan's Knowledge Map binding. Any other Plan difference
|
|
82
|
+
continues to block. Alpha.7.1 state gains a normal, verifiable, append-only
|
|
83
|
+
recovery transition; historical state and the original corrective event are
|
|
84
|
+
never edited.
|
|
85
|
+
|
|
86
|
+
## Design
|
|
87
|
+
|
|
88
|
+
### D1 — explicit recovery event, not decision rewriting
|
|
89
|
+
|
|
90
|
+
Add an append-only Task sidecar,
|
|
91
|
+
`corrective-decision-recoveries.jsonl`. A recovery event binds:
|
|
92
|
+
|
|
93
|
+
- the original corrective event ID/hash and its exact Step/ordinal;
|
|
94
|
+
- the decision Plan hash and current rebound Plan hash;
|
|
95
|
+
- a semantic Plan digest computed after replacing the one Knowledge Map
|
|
96
|
+
binding line with a fixed sentinel;
|
|
97
|
+
- the one exact direct Knowledge-rebind record from the decision Plan to the
|
|
98
|
+
current Plan;
|
|
99
|
+
- the matching current delegated Knowledge Map approval, current delegated
|
|
100
|
+
Task execution authorization, and mechanically rebound Plan Risk Audit;
|
|
101
|
+
- the historically valid grant identity shared by those delegated approvals;
|
|
102
|
+
- the recovering actor and timestamp.
|
|
103
|
+
|
|
104
|
+
The event does not create a new corrective decision and does not change the
|
|
105
|
+
original event. Sidecar hash chaining makes ordering and tampering explicit.
|
|
106
|
+
At most one recovery may exist for the same corrective event and target Plan.
|
|
107
|
+
An identical retry returns the existing event without writing; a conflicting
|
|
108
|
+
duplicate is rejected as corrupt or conflicting state.
|
|
109
|
+
|
|
110
|
+
### D2 — strict semantic equivalence
|
|
111
|
+
|
|
112
|
+
Recovery reads the current `plan.md` and the immutable historical
|
|
113
|
+
`.versions/plan.md.<decision-plan-hash>` artifact. Both hashes must match their
|
|
114
|
+
bindings. Each artifact must contain exactly one canonical Knowledge Map line:
|
|
115
|
+
|
|
116
|
+
`- Knowledge map: revision <positive integer>, hash <sha256>`
|
|
117
|
+
|
|
118
|
+
After replacing only that complete line with the same fixed sentinel, the full
|
|
119
|
+
UTF-8 artifacts must be byte-identical and their semantic digest must match.
|
|
120
|
+
This intentionally rejects formatting drift outside the binding as well as
|
|
121
|
+
semantic drift. In particular, any change to Objective, requirements,
|
|
122
|
+
acceptance, risks, knowledge impact/reason/targets, graph use, Step identity,
|
|
123
|
+
Step objective, dependencies, expected outputs, allowed writes, forbidden
|
|
124
|
+
scope, or checks blocks recovery.
|
|
125
|
+
|
|
126
|
+
### D3 — confirmed authorized context-refresh evidence
|
|
127
|
+
|
|
128
|
+
Alpha.7.2 accepts exactly one unique direct `TaskState.knowledgeRebinds` record
|
|
129
|
+
whose `previousPlanHash` is the decision Plan and whose `reboundPlanHash` is the
|
|
130
|
+
current Plan. Multi-hop recovery is forbidden: alpha.7.1 does not retain enough
|
|
131
|
+
historical Knowledge Map approval evidence to prove every intermediate hop, and
|
|
132
|
+
endpoint comparison could conceal an intermediate semantic Plan change that was
|
|
133
|
+
later reverted.
|
|
134
|
+
|
|
135
|
+
Ordering must be proved from persisted array order and timestamps, not endpoint
|
|
136
|
+
uniqueness alone. Rebind timestamps must be strictly increasing. The selected
|
|
137
|
+
record must be the first rebind after both the corrective decision and source
|
|
138
|
+
Plan Risk Audit and also the final rebind in the array. No other rebind may have
|
|
139
|
+
a timestamp between the decision/source-audit binding and selected record, or
|
|
140
|
+
between the selected record and current Task binding. An intermediate rebind is
|
|
141
|
+
fatal even if a later record returns to the same endpoint Plan semantics.
|
|
142
|
+
|
|
143
|
+
The direct rebind's from/to Knowledge Map revision and hash must match the
|
|
144
|
+
bindings extracted from the two verified Plan artifacts. The current Project
|
|
145
|
+
Knowledge Map must be active, its revision/hash and approval map hash must match
|
|
146
|
+
the direct rebind target, and its approval must contain delegated evidence for
|
|
147
|
+
`project_memory.approve`.
|
|
148
|
+
|
|
149
|
+
The current Task Plan must have exactly one corresponding approved execution
|
|
150
|
+
authorization with:
|
|
151
|
+
|
|
152
|
+
- the same rebound Plan hash and unchanged Brief hash;
|
|
153
|
+
- `authorizationMode: delegated` and non-null delegation evidence;
|
|
154
|
+
- delegation transition `task.execution_authorize`;
|
|
155
|
+
- one of the two exact canonical reasons emitted only by alpha.7.1
|
|
156
|
+
`task context-refresh`: delegated content-only or delegated Plan-bounded
|
|
157
|
+
supporting-source context refresh;
|
|
158
|
+
- decision `approved`.
|
|
159
|
+
|
|
160
|
+
The current Knowledge Map approval and Task execution authorization must have
|
|
161
|
+
the same actor, authorization mode, grant ID, policy hash, principal, and
|
|
162
|
+
delegate; only their delegated transition names may differ. The persisted grant
|
|
163
|
+
record must match that shared immutable delegation identity and contain both
|
|
164
|
+
transitions. Its scope must be project-wide or the exact Task Milestone backed
|
|
165
|
+
by one valid alpha.7 milestone-autonomy contract whose grant ID, policy hash,
|
|
166
|
+
principal, delegate, and expiry all match; that contract is part of the recovery
|
|
167
|
+
evidence fingerprint. Task-scoped or unproven Milestone-scoped grants fail
|
|
168
|
+
closed. Both approval
|
|
169
|
+
timestamps must fall between grant creation and expiry and, if the grant was
|
|
170
|
+
later revoked, before `revokedAt`. Recovery recognizes historical authorization;
|
|
171
|
+
it does not require an unexpired grant at recovery time and does not create a
|
|
172
|
+
new delegated approval.
|
|
173
|
+
|
|
174
|
+
Recovery must also find exactly one source Plan Risk Audit for the decision Plan
|
|
175
|
+
and the unique current Plan Risk Audit for the rebound Plan. Both sidecar events
|
|
176
|
+
must have valid chain/hash integrity and the same Brief hash, planner, auditor,
|
|
177
|
+
decision, split rationale, and Step classifications. The current audit summary
|
|
178
|
+
must equal the source summary plus exactly one canonical
|
|
179
|
+
` Rebound automatically after content-only Task context refresh.` suffix; its
|
|
180
|
+
Knowledge binding must match the direct rebind target. The current audit must be
|
|
181
|
+
the immediate next Plan Risk Audit event
|
|
182
|
+
(`current.previousEventHash === source.eventHash`), so no intermediate audit may
|
|
183
|
+
exist, and the direct rebind must be the Task's last Knowledge rebind. The
|
|
184
|
+
rebound audit records the post-rebind Task revision, and the current Task must be
|
|
185
|
+
exactly one revision later because the final composite action is execution
|
|
186
|
+
authorization (`currentAudit.taskRevision + 1 === task.revision`). Chronology
|
|
187
|
+
must be map approval <= direct rebind <= rebound audit <= Task authorization.
|
|
188
|
+
Together these are the exact mechanical relationships emitted by
|
|
189
|
+
`appendReboundPlanRiskAudit` and `refreshTaskContext`, not a newly supplied
|
|
190
|
+
audit. In the exact legacy state this invariant is explicit: rebound audit Task
|
|
191
|
+
revision `24`, current authorized Task revision `25`.
|
|
192
|
+
|
|
193
|
+
For alpha.7.1 this is the strongest recoverable evidence already persisted by
|
|
194
|
+
the composite transition. It cannot prove atomic call provenance
|
|
195
|
+
cryptographically because alpha.7.1 did not persist a dedicated context-refresh
|
|
196
|
+
event; this limitation is recorded under Remaining risks. The conjunction of
|
|
197
|
+
immutable Plan versions, one direct rebind, current delegated Knowledge Map
|
|
198
|
+
approval, matching current delegated Task authorization, the same historically
|
|
199
|
+
valid grant,
|
|
200
|
+
Brief continuity, and mechanical Plan Risk Audit rebound is required. A
|
|
201
|
+
standalone rebind, arbitrary `task authorize --reason`, human authorization,
|
|
202
|
+
missing or mismatched map approval, independently replaced risk audit, wrong
|
|
203
|
+
delegation transition, or broken chain fails closed.
|
|
204
|
+
|
|
205
|
+
### D4 — recovery transition and validation order
|
|
206
|
+
|
|
207
|
+
Expose `task corrective-decision-recover` with Task ID, Step ID, expected Task
|
|
208
|
+
revision, actor, and optional writer token.
|
|
209
|
+
The transition performs all read-only validation before its first write:
|
|
210
|
+
|
|
211
|
+
1. adoption/state/event-chain integrity and expected Task revision;
|
|
212
|
+
2. exact Step, two-failure/ordinal-3 posture, and no hard stop;
|
|
213
|
+
3. unique original corrective event and `decision=continue-fix`;
|
|
214
|
+
4. explicit revalidation of corrective-auditor independence against the exact
|
|
215
|
+
covered remediation/review/attestation history (a `checks-failed` event may
|
|
216
|
+
legitimately have no reviewer attestation);
|
|
217
|
+
5. current Plan/Brief/execution authorization freshness;
|
|
218
|
+
6. historical/current Plan artifact hashes and strict semantic equivalence;
|
|
219
|
+
7. one unique direct Knowledge rebind, current delegated Knowledge Map approval,
|
|
220
|
+
the same historically valid delegation identity, and current delegated Task
|
|
221
|
+
authorization;
|
|
222
|
+
8. unique mechanically rebound source/current Plan Risk Audit pair;
|
|
223
|
+
9. existing recovery uniqueness/idempotence;
|
|
224
|
+
10. current recovery authority as defined in D4a, including C1 actor and exact
|
|
225
|
+
writer-token ownership when a claimed handoff exists.
|
|
226
|
+
|
|
227
|
+
After the complete read-only preflight, recovery acquires a Task-local atomic
|
|
228
|
+
recovery lock created with exclusive-create semantics. This lock is deliberately
|
|
229
|
+
shared only by recovery callers; it is not represented as a store-wide
|
|
230
|
+
transaction. Under the lock the command re-reads and re-fingerprints every
|
|
231
|
+
evidence item used by preflight, rechecks Task revision and recovery head, and
|
|
232
|
+
then either returns an already identical recovery idempotently, rejects drift or
|
|
233
|
+
a conflicting recovery without an append, or appends one hash-chained recovery
|
|
234
|
+
event. Parallel recovery commands therefore cannot append two events.
|
|
235
|
+
|
|
236
|
+
Expected validation failures before append must leave Task JSON, all durable
|
|
237
|
+
sidecars, `.versions`, writer lease, repository files, and Git history unchanged.
|
|
238
|
+
Creating and removing the transient recovery lock is coordination, not a domain
|
|
239
|
+
write. Recovery does not change Task revision, Step state, authorization,
|
|
240
|
+
Knowledge Map, writer lease, repository files, or Git history. Because unrelated
|
|
241
|
+
alpha.7.1 writers do not share this lock, `task run` must re-read the recovery
|
|
242
|
+
and its complete evidence before consuming it and fail closed on any later
|
|
243
|
+
drift.
|
|
244
|
+
|
|
245
|
+
### D4a — historical refresh proof versus current recovery authority
|
|
246
|
+
|
|
247
|
+
Two time questions are deliberately separate:
|
|
248
|
+
|
|
249
|
+
1. Historical context-refresh authorization is proved by the original shared
|
|
250
|
+
grant being unexpired and unrevoked at the recorded delegated Knowledge Map
|
|
251
|
+
approval and Task authorization timestamps, plus the direct mechanical
|
|
252
|
+
rebound evidence in D3. Later wall-clock expiry does not rewrite history.
|
|
253
|
+
2. Current authority to append recovery and then run requires the exact
|
|
254
|
+
Task execution authorization for the current Brief/Plan, no remediation hard
|
|
255
|
+
stop, valid C1 claimant/actor/lease-token identity, and no revocation that
|
|
256
|
+
invalidates the authority being exercised. Lease expiry alone does not
|
|
257
|
+
invalidate token identity. Natural expiry without revocation does not
|
|
258
|
+
invalidate an already-recorded exact Task execution authorization, matching
|
|
259
|
+
alpha.7.1 runtime semantics. A later grant revocation, changed authorization,
|
|
260
|
+
actor mismatch, changed C1 claim, or lease-owner/token mismatch blocks both
|
|
261
|
+
recovery and run. Alpha.7.2 does not add a renewed-grant bridge or rewrite
|
|
262
|
+
historical delegated evidence.
|
|
263
|
+
|
|
264
|
+
If legacy fields cannot prove the historical timestamps/policy or current
|
|
265
|
+
authority under these rules, recovery is `NO-GO`; it must not infer authority
|
|
266
|
+
from a reason string, renew a grant implicitly, or weaken an existing gate.
|
|
267
|
+
|
|
268
|
+
### D5 — runtime resolution and navigation
|
|
269
|
+
|
|
270
|
+
The guarded remediation gate may treat a stale-Plan `continue-fix` as applying
|
|
271
|
+
to the current Plan only when one unique, fully validated recovery event targets
|
|
272
|
+
that Plan. Without it, `task run` remains blocked.
|
|
273
|
+
|
|
274
|
+
Corrective-posture discovery must include a guarded `planned` Step when it has
|
|
275
|
+
at least two remediation events. Therefore exact alpha.7.1 state must no longer
|
|
276
|
+
advertise `task run`. If strict recovery assessment succeeds, `next` advertises
|
|
277
|
+
`task corrective-decision-recover` with the exact decision event, Step,
|
|
278
|
+
ordinal, from/to Plan hashes, required actor/lease posture, and then-run intent.
|
|
279
|
+
For claimed C1 posture, `next` must additionally verify that the lease file
|
|
280
|
+
exists, lease owner equals the claimant, and hash(lease token) equals the claim's
|
|
281
|
+
writer-token binding. Lease expiry alone is reported but is not a recovery
|
|
282
|
+
blocker because exact token proof can renew it at the later run. If assessment
|
|
283
|
+
fails, `next` returns a non-running blocked/doctor action with the concrete
|
|
284
|
+
failed predicates. It must never advertise another independent corrective
|
|
285
|
+
decision for the occupied Step/ordinal.
|
|
286
|
+
|
|
287
|
+
After recovery, `next` may advertise `task run`, and the exact run must pass the
|
|
288
|
+
corrective Plan-binding gate. The alpha.7.2 `next`/run consistency claim is
|
|
289
|
+
strictly scoped to that corrective recovery/binding gate. Existing branch,
|
|
290
|
+
cleanliness, allowedWrites, dependencies, active Knowledge Map, authorization,
|
|
291
|
+
C1, and writer-lease guards still execute normally and may independently block;
|
|
292
|
+
expanding navigation into a complete run preflight is outside this narrow patch.
|
|
293
|
+
|
|
294
|
+
### D6 — preserved safety properties
|
|
295
|
+
|
|
296
|
+
- `STATE_SCHEMA_VERSION` remains `2`; canonical Task/Milestone schemas are not
|
|
297
|
+
broadened.
|
|
298
|
+
- Attempt 3 remains corrective and a third failure remains a hard stop. Recovery
|
|
299
|
+
is prohibited at or beyond hard stop.
|
|
300
|
+
- Non-`continue-fix` decisions are never recoverable.
|
|
301
|
+
- Reviewer/corrective-auditor independence remains attached to the original
|
|
302
|
+
decision and is explicitly revalidated through the exact covered
|
|
303
|
+
decision/remediation/review/attestation history before recovery.
|
|
304
|
+
- Recovery requires current exact execution authorization and does not grant a
|
|
305
|
+
new authorization.
|
|
306
|
+
- C1 actor and writer-token ownership are checked without refreshing the lease
|
|
307
|
+
before semantic validation. The later run retains the existing heartbeat
|
|
308
|
+
behavior.
|
|
309
|
+
- Existing corrective decision uniqueness by Task/Step/ordinal remains intact.
|
|
310
|
+
- Broken corrective, remediation, review, authorization, rebind, or recovery
|
|
311
|
+
evidence fails closed.
|
|
312
|
+
- Recovery serialization is not authorization: it only prevents duplicate
|
|
313
|
+
append races after all safety predicates pass.
|
|
314
|
+
|
|
315
|
+
## Inherited residual risk and broader follow-up
|
|
316
|
+
|
|
317
|
+
There remains a pre-existing cross-store TOCTOU/crash window after final
|
|
318
|
+
under-lock revalidation because ordinary alpha.7.1 Task, Knowledge Map,
|
|
319
|
+
delegation, sidecar, and lease writers do not participate in the recovery lock.
|
|
320
|
+
This patch neither widens that window nor claims to eliminate it. A later drift
|
|
321
|
+
is detected by mandatory run-time evidence revalidation and blocks execution.
|
|
322
|
+
|
|
323
|
+
The smallest broader follow-up is a separately authorized shared mutation or
|
|
324
|
+
transaction protocol for all normal `FileStateStore` entity/artifact/sidecar
|
|
325
|
+
writers and `WriterLockManager` lease writers, with crash recovery, stale-lock,
|
|
326
|
+
reentrant composition, and schema-2 compatibility tests. That architectural
|
|
327
|
+
change is explicitly outside alpha.7.2.
|
|
328
|
+
|
|
329
|
+
## Regression and negative test matrix
|
|
330
|
+
|
|
331
|
+
The release-blocking deterministic regression is:
|
|
332
|
+
|
|
333
|
+
`two failures -> continue-fix -> authorized content-only context refresh ->`
|
|
334
|
+
`Plan binding hash changes while normalized Plan is identical -> next offers`
|
|
335
|
+
`recovery -> recovery append succeeds -> next/run reaches the ordinary branch,`
|
|
336
|
+
`authorization, Knowledge, C1 and lease guards with corrective mode permitted`.
|
|
337
|
+
|
|
338
|
+
It must assert exact attempt ordinal, event IDs/hashes, old/new Plan hashes,
|
|
339
|
+
semantic digest, rebind/authorization evidence, sidecar chain, Task revision,
|
|
340
|
+
and single append. A production-state replay must use the exact `signal_v4`
|
|
341
|
+
Task/Step/decision/hashes in a disposable copy and prove the before/after
|
|
342
|
+
alpha.7.1 and alpha.7.2 navigation results.
|
|
343
|
+
|
|
344
|
+
Negative tests must separately reject, without writes:
|
|
345
|
+
|
|
346
|
+
- Step definition, Objective, checks, or allowedWrites changes (with at least
|
|
347
|
+
requirements/acceptance/risks/expectedOutputs/forbiddenScope covered by the
|
|
348
|
+
exact normalized-artifact comparator or table-driven siblings);
|
|
349
|
+
- a decision other than `continue-fix`;
|
|
350
|
+
- absent confirmed context-refresh evidence;
|
|
351
|
+
- human, malformed, stale, wrong-transition, or otherwise unauthorized refresh
|
|
352
|
+
evidence;
|
|
353
|
+
- missing/mismatched/human current Knowledge Map approval, a different grant
|
|
354
|
+
identity between map and Task authorization, or a non-mechanical Plan Risk
|
|
355
|
+
Audit rebound;
|
|
356
|
+
- Step or triggering ordinal mismatch;
|
|
357
|
+
- a third failure/hard-stop posture;
|
|
358
|
+
- corrective auditor equal to the latest strict reviewer for a covered
|
|
359
|
+
review-backed failure;
|
|
360
|
+
- damaged corrective/remediation/recovery event chain or event hash;
|
|
361
|
+
- missing, hash-mismatched, ambiguous, multi-hop, or non-direct historical
|
|
362
|
+
Plan/rebind evidence;
|
|
363
|
+
- a second independent corrective decision for the occupied Step/ordinal;
|
|
364
|
+
- repeated recovery, which must return the original recovery event byte-for-byte
|
|
365
|
+
or deterministically reject without any write.
|
|
366
|
+
|
|
367
|
+
A concurrency regression must launch two recovery attempts from the same Task
|
|
368
|
+
revision and assert that the durable recovery log contains exactly one valid
|
|
369
|
+
event, its chain is intact, one caller succeeds, and the other either receives
|
|
370
|
+
that exact event idempotently or a deterministic serialization/CAS rejection
|
|
371
|
+
without a second append.
|
|
372
|
+
|
|
373
|
+
A targeted command-local TOCTOU regression must pause after semantic preflight, mutate one
|
|
374
|
+
fingerprinted input before serialization/CAS (at minimum the grant/revocation
|
|
375
|
+
record and one remediation/PRA evidence sidecar in separate cases), then prove
|
|
376
|
+
deterministic `STATE_CONFLICT`, zero recovery events, unchanged Task/lease, and
|
|
377
|
+
no durable sidecar or `.versions` mutation from the rejected recovery.
|
|
378
|
+
|
|
379
|
+
The sibling constructed state where alpha.7.1 returned
|
|
380
|
+
`task corrective-decision` after refresh must prove that alpha.7.2 routes to
|
|
381
|
+
explicit recovery instead of suggesting an impossible second decision.
|
|
382
|
+
|
|
383
|
+
## Verification disposition and evidence
|
|
384
|
+
|
|
385
|
+
Focused deterministic recovery/navigation tests and the exact disposable
|
|
386
|
+
`signal_v4` replay are release-blocking. The full package checks run on Node
|
|
387
|
+
`24.17.0`: validation, release check, pack check, downstream smoke, plugin check,
|
|
388
|
+
and diff hygiene. A final independent audit must review requirements, full diff,
|
|
389
|
+
test/replay evidence, and the inherited residual risk.
|
|
390
|
+
|
|
391
|
+
Read-only before/after snapshots record `signal_v4` HEAD/branch/index, worktree
|
|
392
|
+
and cached diff digests, stash identities, plus external project-state
|
|
393
|
+
content/metadata digests. Any unexplained difference is a release blocker.
|
|
394
|
+
|
|
395
|
+
## Executed verification evidence
|
|
396
|
+
|
|
397
|
+
All commands below ran on Node `24.17.0` in the detached candidate worktree:
|
|
398
|
+
|
|
399
|
+
- focused recovery suite: `14/14` passed, covering deterministic recovery,
|
|
400
|
+
exact semantic comparator negatives, non-continue/missing/unauthorized/wrong
|
|
401
|
+
Step/wrong ordinal/intermediate rebind/hard-stop/reviewer-independence/
|
|
402
|
+
broken-chain failures, forged actor/scope rejection, idempotence,
|
|
403
|
+
revocation/C1/autonomy-contract revalidation, injected grant and PRA drift,
|
|
404
|
+
and two concurrent recovery writers producing one event;
|
|
405
|
+
- `npm run validate`: `106/106` tests passed with typecheck;
|
|
406
|
+
- `npm run release:check`, `npm run pack:check`, `npm run smoke:downstream`,
|
|
407
|
+
and `npm run plugin:check`: passed;
|
|
408
|
+
- gateway handshake: package `2.0.0-alpha.7.2`, protocol `1`, state schema `2`,
|
|
409
|
+
capability `corrective-decision-context-recovery-v1`;
|
|
410
|
+
- `git diff --check`: passed, and dry-run/smoke left no tarball in the worktree.
|
|
411
|
+
|
|
412
|
+
A fresh byte-copy of the original Workflow state produced the exact replay:
|
|
413
|
+
|
|
414
|
+
1. `next -> task corrective-decision-recover`, Task revision `25`, guarded
|
|
415
|
+
`STEP-002-FORMALIZATION-CONTRACTS`, CRD
|
|
416
|
+
`CRD-01M011B4MM5R1FZG2DSDRHVXJ4`, ordinal `3`, exact `21a176... -> 9cb6b0...`
|
|
417
|
+
Plan hashes;
|
|
418
|
+
2. recovery appended `CDR-01M01C354BRJBDZ0BXZX7A3ARJ`, event hash
|
|
419
|
+
`18a17a4d9f2b6f7fafb13eb38e2c12122a4e93265c2e96edeb62852fa9dfae68`,
|
|
420
|
+
evidence fingerprint
|
|
421
|
+
`6d41590ea49b16183eda20645660f43a383c9cc17210edda2de96d790f5b32ec`,
|
|
422
|
+
semantic Plan hash
|
|
423
|
+
`be92aa797218cda1767bb92ced023dd5d7d38f024593b063357f46557f3164ff`;
|
|
424
|
+
3. an identical retry returned that same event and the log remained one event;
|
|
425
|
+
4. `next -> task run`; the exact run passed the corrective gate and changed only
|
|
426
|
+
disposable state to Task revision `26`, Task/Step `in_progress`, Worker role.
|
|
427
|
+
|
|
428
|
+
Final read-only snapshots still show `signal_v4` at commit
|
|
429
|
+
`5e26f6c9b4dd0caf57c6a66812121a5b658d4363`, the same branch, clean index and
|
|
430
|
+
worktree digests `e3b0...`, tracked-index digest `a7164020...`, and stash object
|
|
431
|
+
`69c2e5828fa5e31360afe1dbf89154396cc73300`. Two comparable before/after
|
|
432
|
+
snapshot scopes remain unchanged: the signal_v4 project subtree, using
|
|
433
|
+
path-qualified per-file SHA-256 plus mode/size/mtime/ctime metadata, is
|
|
434
|
+
`a24caf122745ae9ed84f64c2484bf7f7750816996559eba9c996ead7a626aa12` /
|
|
435
|
+
`fb77439261056342b6e4b81cad83c4f4ebf7a3807619ba43621783818ab348b4`;
|
|
436
|
+
the entire external schema-v2 root, using relative-path per-file SHA-256 plus
|
|
437
|
+
type/mode/size/mtime metadata, matched its fresh-copy pre-replay composites
|
|
438
|
+
`17f28588d92f9d4386438c5a182618466920a8602361252faaace73727d94a70` and
|
|
439
|
+
`625afd9d281cc5a00af23d4c1ac17efaf7c050d0ebd1a199dee89f090f212bf9`.
|
|
440
|
+
The source main checkout remains clean at `90e4010`; no new tag, push, or publish
|
|
441
|
+
was performed.
|
|
442
|
+
|
|
443
|
+
## Safe `signal_v4` update/resume path
|
|
444
|
+
|
|
445
|
+
The release recommendation must preserve:
|
|
446
|
+
|
|
447
|
+
- Step 1 commit `5e26f6c9b4dd0caf57c6a66812121a5b658d4363` on the existing Task branch;
|
|
448
|
+
- stash `stash@{0}` / object
|
|
449
|
+
`69c2e5828fa5e31360afe1dbf89154396cc73300`, containing the Step 2 recovery
|
|
450
|
+
work;
|
|
451
|
+
- Task state revision `25` and all historical sidecars;
|
|
452
|
+
- the current C1 claim and its exact writer-token binding.
|
|
453
|
+
|
|
454
|
+
After alpha.7.2 is published through a separately authorized release process,
|
|
455
|
+
the safe sequence is: snapshot branch/HEAD/stash/state; update only the
|
|
456
|
+
project-local workflow package with a no-save/no-lock mechanism; verify exact
|
|
457
|
+
package/protocol/schema/project identity; run read-only diagnostics; execute the
|
|
458
|
+
advertised recovery with the existing C1 actor and exact token; verify
|
|
459
|
+
`next -> task run`; launch Step 2 and receive an active Worker envelope; only
|
|
460
|
+
then restore `stash@{0}` while that Worker is ready to continue Step 2 within
|
|
461
|
+
its `allowedWrites`, before Step completion. Never edit external state manually,
|
|
462
|
+
repair/remove the stale lease to bypass evidence checks, restore the stash after
|
|
463
|
+
completion, or pop/drop it before the Worker boundary. Natural historical grant
|
|
464
|
+
expiry follows existing alpha.7.1 authorization semantics; revocation or any
|
|
465
|
+
changed evidence blocks recovery/run. Any missing commit/stash, changed project
|
|
466
|
+
ID, failed evidence predicate, or schema change is `NO-GO`.
|
|
467
|
+
|
|
468
|
+
## Remaining risks and release gate
|
|
469
|
+
|
|
470
|
+
Alpha.7.1 did not persist an explicit atomic context-refresh event. Legacy
|
|
471
|
+
recovery therefore proves the strongest available direct conjunction of
|
|
472
|
+
Plan-version, rebind, current map approval, matching historically valid
|
|
473
|
+
delegation, Task authorization, mechanical Plan Risk Audit rebound, reason, and
|
|
474
|
+
Brief evidence,
|
|
475
|
+
but cannot prove the originating method call cryptographically. Confidence is
|
|
476
|
+
high for genuine alpha.7.1 state and deliberately low for manually forged state;
|
|
477
|
+
forged, multi-hop, or ambiguous evidence must fail closed wherever detectable.
|
|
478
|
+
|
|
479
|
+
Release recommendation is conditional: alpha.7.2 may be released only if the
|
|
480
|
+
narrow implementation satisfies every regression and package check, the exact
|
|
481
|
+
disposable replay proves truthful navigation and permitted run, final audit
|
|
482
|
+
finds no safety regression, and read-only after-snapshots match the signal_v4
|
|
483
|
+
baselines. The inherited global transaction/crash limitation remains an
|
|
484
|
+
explicit residual risk and candidate for a separate architectural release.
|
|
@@ -75,14 +75,18 @@ start another implementation loop.
|
|
|
75
75
|
For guarded Steps, remediation attempts are also tracked in
|
|
76
76
|
`remediation-events.jsonl`. Two ordinary remediation attempts are allowed. A third ordinary
|
|
77
77
|
retry is blocked until `task corrective-decision` records a current corrective decision in
|
|
78
|
-
`corrective-decisions.jsonl`.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
`corrective-decisions.jsonl`. The corrective gate is derived from the guarded Step, current
|
|
79
|
+
Plan Risk Audit, remediation history, and corrective-decision history, so it remains visible
|
|
80
|
+
after content-only context refresh, Task Knowledge rebind, and reauthorization. `continue-fix`
|
|
81
|
+
allows bounded continuation; `replan-required` requires an actual new Plan posture before
|
|
82
|
+
execution; the other decisions stop or redirect ordinary execution. If that third, corrective
|
|
83
|
+
remediation review also fails, Core enters a hard stop: `next` must report the stop without
|
|
84
|
+
throwing, a fourth run and another `continue-fix`/`replan-required` decision are rejected,
|
|
85
|
+
and only `split-required` or `stop-escalate` may be recorded. At the corrective boundary,
|
|
86
|
+
`next` derives a distinct `agent:corrective-auditor:<task-id>` actor; selecting that actor is
|
|
87
|
+
not a human approval, while auditor independence remains mandatory.
|
|
88
|
+
|
|
89
|
+
## Atomic context refresh
|
|
86
90
|
|
|
87
91
|
When `next.contextRefresh` offers an exact option, a project-scoped delegate may run one
|
|
88
92
|
composite transition:
|
|
@@ -96,10 +100,20 @@ task context-refresh
|
|
|
96
100
|
```
|
|
97
101
|
|
|
98
102
|
The command requires the exact Task and Knowledge Map revisions, delegate actor, and grant.
|
|
99
|
-
Core validates both grant transitions
|
|
100
|
-
|
|
101
|
-
and conflicts are unchanged.
|
|
102
|
-
|
|
103
|
+
Core validates both grant transitions and the complete Knowledge diff before the first write.
|
|
104
|
+
The existing content-only path remains limited to an already approved source set whose category,
|
|
105
|
+
scope, authority, gaps, and conflicts are unchanged.
|
|
106
|
+
|
|
107
|
+
A Milestone Autonomy Grant may additionally admit a new supporting source when the current,
|
|
108
|
+
already execution-authorized Task Plan declares `knowledgeImpact: create` and the source's exact
|
|
109
|
+
normalized file path and scanner category in `knowledgeTargets`. Every added source must match;
|
|
110
|
+
wildcards and directory-like targets are not authority. The Task must belong to that exact
|
|
111
|
+
Milestone and the delegate and grant must still satisfy the immutable autonomy contract. Removed
|
|
112
|
+
sources, canonical additions, unplanned additions, changes to existing category/scope/authority
|
|
113
|
+
or classification identity, changed gaps, and changed or non-empty conflicts fail closed before
|
|
114
|
+
state is written. `next.contextRefresh.addedSources` exposes the exact eligible additions, while
|
|
115
|
+
`next.contextRefreshBlocked.unsafeDifferences` reports the concrete mismatches.
|
|
116
|
+
Standalone Project Memory approval is never enabled by this path.
|
|
103
117
|
|
|
104
118
|
## Chat ownership
|
|
105
119
|
|
|
@@ -142,8 +156,9 @@ scope change remains explicit and human-only through `milestone scope-change-pre
|
|
|
142
156
|
|
|
143
157
|
After the initial Plan, one human may approve a time-bound (maximum 72 hours) Milestone
|
|
144
158
|
Autonomy Contract. It creates a milestone-scoped grant for Task/Milestone execution and final
|
|
145
|
-
acceptance plus Project Memory approval only inside an atomic
|
|
146
|
-
|
|
159
|
+
acceptance plus Project Memory approval only inside an atomic Task context refresh for the same
|
|
160
|
+
Milestone. That refresh covers content-only drift and the exact Plan-bounded supporting-source
|
|
161
|
+
addition described above. Standalone Project Memory approval remains forbidden. The contract binds
|
|
147
162
|
the immutable outcome, success signal, acceptance, checks, discovery, and base branch.
|
|
148
163
|
`milestone autonomy-evolve` may only alter Task memberships; it records the
|
|
149
164
|
agent actor plus the autonomy-contract event hash in the journaled scope-change sidecar and
|
package/package.json
CHANGED
|
@@ -121,10 +121,18 @@ fourth run is prohibited; only split or stop may be recorded.
|
|
|
121
121
|
|
|
122
122
|
## Context refresh
|
|
123
123
|
|
|
124
|
+
Before `task plan-set`, compare exact Step `allowedWrites` and expected output paths with scanner
|
|
125
|
+
classifications. A planned new scanner-visible Knowledge file must be declared with
|
|
126
|
+
`knowledgeImpact: create` and an exact path/category `knowledgeTargets` entry. Wildcards,
|
|
127
|
+
directories, and inferred authority are not declarations; only Core may decide whether the final
|
|
128
|
+
diff is eligible for delegated refresh.
|
|
129
|
+
|
|
124
130
|
Use `task context-refresh` only when the same `next` response exposes `contextRefresh` for the
|
|
125
131
|
exact grant. Pass Task revision, map revision, delegate actor, and grant ID. The composite
|
|
126
|
-
operation
|
|
127
|
-
|
|
132
|
+
operation accepts content-hash-only drift and, under a Milestone Autonomy Grant, an exact
|
|
133
|
+
supporting-source addition predeclared by the current execution-authorized Task Plan. Core checks
|
|
134
|
+
the full fail-closed predicate; do not reconstruct it in the gateway. When `next` instead returns
|
|
135
|
+
`contextRefreshBlocked.unsafeDifferences`, keep the change on the normal visible Knowledge path.
|
|
128
136
|
|
|
129
137
|
Before updating the installed package, run `update preflight`. Continue only for `safe=true`.
|
|
130
138
|
For an alpha.6 project trapped between a pending strict review and forbidden Knowledge rebind,
|
|
@@ -171,8 +179,9 @@ codex-workflow milestone autonomy-grant --repo <git-root> --id <MS-ID> \
|
|
|
171
179
|
```
|
|
172
180
|
|
|
173
181
|
The contract issues a milestone-scoped grant for the existing Task/Milestone approval transitions
|
|
174
|
-
and Project Memory approval only inside an atomic
|
|
175
|
-
|
|
182
|
+
and Project Memory approval only inside an atomic Task context refresh for the same Milestone.
|
|
183
|
+
That composite path covers content-only drift plus exact Plan-bounded supporting-source additions;
|
|
184
|
+
it cannot approve Project Memory independently. `milestone autonomy-evolve --file
|
|
176
185
|
<plan.json>` is permitted only when outcome, success signal, acceptance, checks, discovery, and
|
|
177
186
|
base branch still match the contract. It journals agent actor plus contract evidence and requires
|
|
178
187
|
reauthorization afterward.
|
|
@@ -43,9 +43,19 @@ classifications, hashes, gaps, conflicts, and approval evidence.
|
|
|
43
43
|
|
|
44
44
|
Do not create a memory directory or write project files during scan.
|
|
45
45
|
|
|
46
|
+
Before `task plan-set`, the Technical Planner compares every exact `allowedWrites` and expected
|
|
47
|
+
output path with the package scanner classifications. If the Plan will create a file that the
|
|
48
|
+
scanner will treat as Project Knowledge (for example a test or documentation source), declare
|
|
49
|
+
`knowledgeImpact: create` and one `knowledgeTargets` entry with that exact normalized path and
|
|
50
|
+
scanner category. Do not replace the path with a wildcard or directory, do not infer or assign
|
|
51
|
+
authority, and do not claim delegated-refresh eligibility; Core decides eligibility from the
|
|
52
|
+
resulting repository diff and current authorization state.
|
|
53
|
+
|
|
46
54
|
When `next` exposes an exact delegated `contextRefresh`, use `task context-refresh` only for
|
|
47
|
-
the returned Task/map revisions, actor, and grant.
|
|
48
|
-
|
|
55
|
+
the returned Task/map revisions, actor, and grant. A source-set change is eligible only when
|
|
56
|
+
Core identifies it as a Plan-bounded supporting-source addition under the same Milestone
|
|
57
|
+
Autonomy Grant. Never infer eligibility from the Plan yourself; if Core returns
|
|
58
|
+
`contextRefreshBlocked.unsafeDifferences`, use the ordinary visible Knowledge Map flow.
|
|
49
59
|
|
|
50
60
|
## Product Or Workflow Graph Refresh
|
|
51
61
|
|
|
@@ -112,8 +122,10 @@ For an entire Milestone, prefer one bounded `milestone autonomy-prepare` gate af
|
|
|
112
122
|
initial membership Plan exists. Show principal, delegate, expiry, semantic-scope hash, policy
|
|
113
123
|
hash, and `MAC-*` code, then stop. A later exact approval permits `milestone autonomy-grant`.
|
|
114
124
|
The resulting grant covers the existing Task/Milestone approval transitions and the Project
|
|
115
|
-
Memory approval portion of an atomic
|
|
116
|
-
|
|
125
|
+
Memory approval portion of an atomic Task context refresh for the same Milestone. Besides
|
|
126
|
+
content-only drift, Core may accept exact supporting-source additions predeclared by the current
|
|
127
|
+
execution-authorized Task Plan; unsafe differences remain blocked. The contract never permits
|
|
128
|
+
standalone Project Memory approval. It also permits `milestone autonomy-evolve`
|
|
117
129
|
only for membership changes; any change to outcome, success signal, acceptance, checks,
|
|
118
130
|
discovery, or base branch requires the ordinary human scope-change gate. Never self-renew or
|
|
119
131
|
replace the contract.
|