codex-workflow-v2 2.0.0-alpha.2 → 2.0.0-alpha.4
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 +24 -3
- package/dist/src/cli.js +25 -6
- package/dist/src/cli.js.map +1 -1
- package/dist/src/contracts.d.ts +70 -1
- package/dist/src/delegation.d.ts +8 -0
- package/dist/src/delegation.js +155 -0
- package/dist/src/delegation.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/state/store.d.ts +5 -1
- package/dist/src/state/store.js +13 -0
- package/dist/src/state/store.js.map +1 -1
- package/dist/src/ulid.d.ts +1 -1
- package/dist/src/ulid.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/workflow.d.ts +14 -6
- package/dist/src/workflow.js +242 -14
- package/dist/src/workflow.js.map +1 -1
- package/docs/decisions.md +15 -0
- package/docs/delegated-approval.md +164 -0
- package/docs/development-flow.md +27 -1
- package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +336 -339
- package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +761 -650
- package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +502 -447
- package/docs/updating-existing-project.md +243 -0
- package/docs/validation-report.md +22 -6
- package/package.json +1 -1
- package/plugins/codex-workflow-gateway/references/protocol.md +30 -0
- package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +36 -1
- package/references/state-machine.md +23 -1
- package/references/validation-and-review.md +5 -0
- package/roles/delivery-coordinator.md +5 -0
- package/schemas/authorization-event.schema.json +55 -0
- package/schemas/delegation-grant.schema.json +69 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Обновление Workflow V2 в начатом проекте через Codex
|
|
2
|
+
|
|
3
|
+
Эта инструкция предназначена для проекта, где Workflow V2 уже создал Discovery, Tasks или
|
|
4
|
+
Milestones. Пользователь не выполняет команды самостоятельно: все проверки, установка и
|
|
5
|
+
Git-операции поручаются Codex.
|
|
6
|
+
|
|
7
|
+
## Что обновляется, а что сохраняется
|
|
8
|
+
|
|
9
|
+
Версия `codex-workflow-v2` закреплена точным значением в `package.json` и lock-файле каждого
|
|
10
|
+
проекта. Поэтому разные проекты могут использовать разные версии. Обновление одного проекта
|
|
11
|
+
не переключает остальные.
|
|
12
|
+
|
|
13
|
+
Состояние Workflow хранится отдельно от репозитория в
|
|
14
|
+
`$CODEX_HOME/workflow-state/v2/projects/<project-id>`. Оно определяется идентичностью Git
|
|
15
|
+
репозитория, а не версией npm-пакета. Обычное совместимое обновление заменяет зависимость и
|
|
16
|
+
gateway, но не удаляет и не пересоздаёт это состояние. Уже принятые Milestones, ревизии,
|
|
17
|
+
авторизации, evidence и Results сохраняются.
|
|
18
|
+
|
|
19
|
+
Никогда не разрешайте агенту вручную редактировать, переносить или удалять внешний state.
|
|
20
|
+
Команда миграции нужна только тогда, когда документация новой версии прямо сообщает о новой
|
|
21
|
+
state schema. Совпадение `stateSchemaVersion` до и после обновления означает, что миграция не
|
|
22
|
+
нужна.
|
|
23
|
+
|
|
24
|
+
## 1. Подготовьте отдельный чат обновления
|
|
25
|
+
|
|
26
|
+
Не обновляйте пакет во время выполняющегося Worker Step. Дождитесь завершения текущего ответа
|
|
27
|
+
Codex и откройте в нужном проекте отдельный чат `Workflow update`.
|
|
28
|
+
|
|
29
|
+
Передайте агенту этот промпт, заменив `<НОВАЯ_ВЕРСИЯ>` точной опубликованной версией:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
Обнови Codex Workflow V2 в этом проекте до точной версии <НОВАЯ_ВЕРСИЯ>
|
|
33
|
+
из npm: https://www.npmjs.com/package/codex-workflow-v2.
|
|
34
|
+
|
|
35
|
+
Все команды выполняешь ты. Сначала прочитай AGENTS.md и определи Git root.
|
|
36
|
+
До изменений запусти project-local gateway handshake, doctor, status и next;
|
|
37
|
+
зафиксируй текущую версию, protocolVersion, stateSchemaVersion, projectId,
|
|
38
|
+
активные сущности и наличие writer lease. Если Worker сейчас выполняется,
|
|
39
|
+
остановись без обновления.
|
|
40
|
+
|
|
41
|
+
Обнови только точную npm-зависимость и lock-файл, без диапазона версий.
|
|
42
|
+
Не удаляй и не редактируй вручную $CODEX_HOME/workflow-state/v2.
|
|
43
|
+
Не запускай state migration, если stateSchemaVersion не изменилась.
|
|
44
|
+
После установки проверь совпадение declared и installed версии, выполни
|
|
45
|
+
handshake, doctor, status и next новой версией. Затем установи или обнови
|
|
46
|
+
персональный codex-workflow-gateway из установленного npm-пакета штатным
|
|
47
|
+
installer скриптом. Покажи diff файлов репозитория и результаты проверок.
|
|
48
|
+
Не начинай продуктовую реализацию в этом чате.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Агенту может потребоваться ваше разрешение на установку npm-зависимости и запись персонального
|
|
52
|
+
plugin за пределами workspace. Это ожидаемая граница безопасности Codex, а не миграция state.
|
|
53
|
+
|
|
54
|
+
## 2. Проверьте отчёт чата обновления
|
|
55
|
+
|
|
56
|
+
До завершения чат должен подтвердить:
|
|
57
|
+
|
|
58
|
+
1. В `package.json` указана точная версия без `^`, `~`, `latest` или `next`.
|
|
59
|
+
2. Lock-файл и фактически установленный пакет содержат ту же версию.
|
|
60
|
+
3. Handshake возвращает ожидаемые package/protocol/state-schema версии.
|
|
61
|
+
4. `doctor` не сообщает о несовместимой зависимости или повреждённом state.
|
|
62
|
+
5. `projectId` совпадает со значением до обновления.
|
|
63
|
+
6. Существующие Task/Milestone ID, revisions и terminal statuses сохранились.
|
|
64
|
+
7. Персональный gateway обновлён из установленного пакета.
|
|
65
|
+
|
|
66
|
+
Изменение `projectId`, исчезновение сущностей или ошибка unsupported state schema — причина
|
|
67
|
+
остановиться. Не соглашайтесь на «починку» удалением state. Агент должен вернуть dependency к
|
|
68
|
+
предыдущей точной версии либо ждать официального мигратора.
|
|
69
|
+
|
|
70
|
+
## 3. Откройте новый чат после установки gateway
|
|
71
|
+
|
|
72
|
+
Codex загружает набор skills/plugin при старте чата. Уже открытый чат может продолжать видеть
|
|
73
|
+
старую gateway-инструкцию, даже если файлы plugin обновлены. Поэтому дальнейшую работу всегда
|
|
74
|
+
начинайте в новом чате проекта.
|
|
75
|
+
|
|
76
|
+
Промпт для контрольного чата:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
Возобнови проект через установленный Codex Workflow V2.
|
|
80
|
+
Все команды выполняешь ты. Начни с AGENTS.md, project-local gateway
|
|
81
|
+
handshake, doctor, status и next. Подтверди точную declared/installed
|
|
82
|
+
версию, protocolVersion, stateSchemaVersion и прежний projectId.
|
|
83
|
+
|
|
84
|
+
Проверь Knowledge Map штатно. Если изменение package.json или lock-файла
|
|
85
|
+
сделало карту stale, выполни scan/reconcile и покажи мне классификацию и
|
|
86
|
+
изменения до approve. Не редактируй внешний workflow-state вручную.
|
|
87
|
+
Следуй только текущему ответу next и остановись перед любой human gate.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Обновление dependency меняет `package.json` и обычно lock-файл. Если один из этих файлов входит
|
|
91
|
+
в Knowledge Map, изменение его content hash штатно делает карту `stale`. Это не потеря state:
|
|
92
|
+
нужно выполнить `scan/reconcile`, показать пользователю изменения классификации и получить
|
|
93
|
+
approval, если он требуется.
|
|
94
|
+
|
|
95
|
+
## 3.1. При необходимости включите delegated approval
|
|
96
|
+
|
|
97
|
+
Delegated approval не включается автоматически после обновления. Существующие авторизации и
|
|
98
|
+
terminal-сущности не меняются, а `stateSchemaVersion` остаётся `2`. Пользователь один раз
|
|
99
|
+
подтверждает точную policy; после этого named delegate может выполнять только перечисленные
|
|
100
|
+
переходы до истечения срока или revocation.
|
|
101
|
+
|
|
102
|
+
Для заместителя, который должен планировать ещё не созданные Milestones и Tasks, нужен
|
|
103
|
+
ограниченный по времени project scope. Более узкий Milestone/Task scope безопаснее, когда ID
|
|
104
|
+
уже известен. Пример policy:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"principal": "user:owner",
|
|
109
|
+
"delegate": "agent:deputy",
|
|
110
|
+
"scope": { "kind": "project" },
|
|
111
|
+
"transitions": [
|
|
112
|
+
"project_memory.approve",
|
|
113
|
+
"milestone.execution_authorize",
|
|
114
|
+
"milestone.final_accept",
|
|
115
|
+
"task.execution_authorize",
|
|
116
|
+
"task.final_accept"
|
|
117
|
+
],
|
|
118
|
+
"expiresAt": "<ISO-8601 UTC>"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Промпт для выпуска grant:
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
Подготовь delegated approval policy для этого проекта: principal user:owner,
|
|
126
|
+
delegate agent:deputy, project scope, переходы project_memory.approve,
|
|
127
|
+
milestone.execution_authorize,
|
|
128
|
+
milestone.final_accept, task.execution_authorize и task.final_accept, срок до
|
|
129
|
+
<ДАТА_И_ВРЕМЯ_UTC>. Создай временный JSON вне репозитория и выполни только
|
|
130
|
+
delegation prepare. Покажи всю policy, projectId, policyHash и DGA-код, затем
|
|
131
|
+
остановись. Grant в этом же ответе не выпускай.
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
После проверки ответьте отдельным сообщением:
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
Одобряю выпуск delegated approval grant для policy hash <POLICY_HASH>
|
|
138
|
+
с кодом <DGA-CODE>. Выпусти grant и покажи DGR-ID, scope, transitions,
|
|
139
|
+
expiresAt и revision.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`delegation list` и `status` показывают grants. Для досрочной остановки автономности агент
|
|
143
|
+
выполняет `delegation revoke` от имени точного principal с текущей revision и причиной.
|
|
144
|
+
Revocation запрещает будущие использования, но не переписывает уже записанные события.
|
|
145
|
+
|
|
146
|
+
Важно: это локальная проверка policy и audit trail, а не криптографическая аутентификация
|
|
147
|
+
Codex-процесса. Любой процесс с доступом к локальному state и CLI может заявить строку
|
|
148
|
+
delegate. Поэтому project-wide grant должен быть короткоживущим, а секреты, платежи, реальные
|
|
149
|
+
торговые операции и иные необратимые действия требуют отдельных технических ограничений и не
|
|
150
|
+
должны полагаться только на delegated approval.
|
|
151
|
+
|
|
152
|
+
## 3.2. Запустите delegate в новом чате
|
|
153
|
+
|
|
154
|
+
Grant сам не запускает агента и не прикрепляется к существующему чату. После получения
|
|
155
|
+
`DGR-ID` откройте новый Local-чат в том же Codex Project. Новый чат нужен ещё и потому, что он
|
|
156
|
+
загрузит актуальную gateway-инструкцию. Передайте точные `delegate` и `DGR-ID`; `DGA-код`
|
|
157
|
+
больше не нужен.
|
|
158
|
+
|
|
159
|
+
Перед запуском проверьте выбор scope:
|
|
160
|
+
|
|
161
|
+
- новый Milestone или новая standalone Task с `AUTO` требуют project scope;
|
|
162
|
+
- существующий Milestone и его linked Tasks могут использовать Milestone scope;
|
|
163
|
+
- одна существующая Task может использовать Task scope;
|
|
164
|
+
- Knowledge Map approval доступен только project-scoped grant с
|
|
165
|
+
`project_memory.approve`.
|
|
166
|
+
|
|
167
|
+
Полные копируемые промпты для Milestone delegate и Task delegate находятся в
|
|
168
|
+
`docs/delegated-approval.md` и chat-only PDF. В обоих промптах delegate обязан сначала
|
|
169
|
+
выполнить `delegation show`, а каждый approval применять только при exact записи в текущем
|
|
170
|
+
`next.delegatedApprovalOptions`. Внутренние Worker и Independent Reviewer grant не используют:
|
|
171
|
+
его применяет координатор после получения их evidence.
|
|
172
|
+
|
|
173
|
+
Рекомендуемые названия чатов:
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
NN - M2 delegated coordinator
|
|
177
|
+
NN - M2/T1 delegated execution
|
|
178
|
+
NN - Standalone delegated task
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
После завершения автономного окна попросите отдельный контрольный чат показать
|
|
182
|
+
`delegation list`, использованные authorization events и отозвать ненужный широкий grant.
|
|
183
|
+
|
|
184
|
+
## 4. Продолжите начатый Milestone или создайте следующий
|
|
185
|
+
|
|
186
|
+
Terminal Milestone со статусом `accepted` остаётся закрытым. Для следующего результата нужно
|
|
187
|
+
начать новый Discovery и материализовать новый Milestone; переписывать историю предыдущего не
|
|
188
|
+
следует.
|
|
189
|
+
|
|
190
|
+
Промпт для планирования следующего Milestone:
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
Создай следующий Milestone проекта через Workflow V2.
|
|
194
|
+
Все команды выполняешь ты. Начни с AGENTS.md, gateway handshake, doctor,
|
|
195
|
+
status и next. Проверь Knowledge Map штатно и показывай мне её смысловые
|
|
196
|
+
изменения до approve.
|
|
197
|
+
|
|
198
|
+
Проведи Discovery: outcome, scope, out-of-scope, acceptance, constraints,
|
|
199
|
+
unknowns и success signal. Не materialize сущность при blocking unknowns.
|
|
200
|
+
После согласования создай Milestone и тонкие связанные Tasks, подготовь
|
|
201
|
+
membership Plan и покажи его мне для execution authorization. После моей
|
|
202
|
+
явной авторизации доведи Milestone до active, выдай порядок required Tasks
|
|
203
|
+
и остановись. Реализацию в этом чате не начинай.
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## 5. Как теперь закрывается Milestone
|
|
207
|
+
|
|
208
|
+
После merge всех `required` Tasks откройте отдельный чат финальной проверки:
|
|
209
|
+
|
|
210
|
+
```text
|
|
211
|
+
Возобнови Milestone <MS-ID> и подготовь его к финальному принятию.
|
|
212
|
+
Все команды и проверки выполняешь ты. Начни с AGENTS.md, handshake,
|
|
213
|
+
doctor, status и next. Проверь, что все current required memberships merged,
|
|
214
|
+
выполни штатную Milestone validation и покажи Result, evidence, checks и
|
|
215
|
+
validated HEAD.
|
|
216
|
+
|
|
217
|
+
Когда next вернёт requiredHumanGate, покажи мне все связанные поля и код
|
|
218
|
+
подтверждения, запроси моё явное final acceptance и заверши ответ. Не
|
|
219
|
+
вызывай milestone accept в этом же ответе и не считай этот промпт заранее
|
|
220
|
+
выданным согласием.
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
После этого Codex должен остановиться. Если результат устраивает, ответьте отдельным сообщением:
|
|
224
|
+
|
|
225
|
+
```text
|
|
226
|
+
Принимаю Milestone <MS-ID> для revision <REVISION> с кодом <MSA-CODE>.
|
|
227
|
+
Выполни штатный final acceptance и подтверди status accepted.
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Код связан с Milestone ID, revision, Plan hash, Result hash, evidence hash и validated HEAD.
|
|
231
|
+
Если любой из них изменился, старый код недействителен и агент должен повторно показать новую
|
|
232
|
+
границу принятия.
|
|
233
|
+
|
|
234
|
+
## 6. Проверка исправленного `next`
|
|
235
|
+
|
|
236
|
+
`next` не должен возвращать незапущенную историческую Task, если её текущее membership имеет
|
|
237
|
+
disposition `waived`/`cancelled` либо её Milestone уже `accepted`/`cancelled`. Для активного
|
|
238
|
+
Milestone он выбирает только `required` Tasks. Уже начатая Task может завершить допустимый
|
|
239
|
+
переход, поэтому её наличие анализируется отдельно от незапущенной истории.
|
|
240
|
+
|
|
241
|
+
Если после совместимого обновления `next` всё ещё показывает неподходящую Task, агент должен
|
|
242
|
+
собрать `status`, целевые Task/Milestone state и memberships и остановиться с диагностикой. Не
|
|
243
|
+
следует вручную менять JSON state или обходить transition checks.
|
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
# V2 Alpha Validation Report
|
|
2
2
|
|
|
3
|
-
Release candidate `2.0.0-alpha.
|
|
3
|
+
Release candidate `2.0.0-alpha.4` was validated on 2026-08-12 with Node.js 24.17.0.
|
|
4
4
|
|
|
5
5
|
- TypeScript typecheck and build passed.
|
|
6
|
-
- All
|
|
6
|
+
- All 47 unit and integration tests passed. Coverage includes the complete Task lifecycle,
|
|
7
7
|
a Project Knowledge Map change between Steps, preservation of completed Step evidence,
|
|
8
8
|
mandatory reauthorization, the public `task knowledge-rebind` CLI route, no-op and active
|
|
9
9
|
Worker rejection, current gateway capability negotiation, and rejection of deprecated
|
|
10
10
|
state schema instead of migration.
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
- Delegated approval coverage includes DGA-bound grant issuance, project/Milestone/Task
|
|
12
|
+
scopes, Knowledge Map approval, all Task/Milestone execution and final transitions,
|
|
13
|
+
`next.delegatedApprovalOptions`, explicit principal/delegate audit metadata, actor,
|
|
14
|
+
transition and scope rejection, expiry, revocation, duplicate issuance, and policy-hash
|
|
15
|
+
tamper rejection.
|
|
16
|
+
- Milestone scheduling now ignores unstarted Tasks with cancelled/waived or terminal
|
|
17
|
+
membership paths. Final Milestone acceptance exposes a revision/hash/HEAD-bound human gate,
|
|
18
|
+
rejects a wrong code, and regenerates its code after base advancement and revalidation.
|
|
19
|
+
- Milestone amendments, graph binding, deterministic V1 snapshot, symlink rejection, writer
|
|
20
|
+
leases, and strict reviewer fail-closed behavior also passed.
|
|
21
|
+
- npm dry-run packaging produced `codex-workflow-v2-2.0.0-alpha.4.tgz` with runtime, schemas,
|
|
14
22
|
roles, references, docs, and plugin source.
|
|
15
23
|
- Downstream installation from that tarball and the packaged CLI handshake passed; the
|
|
16
24
|
installation created none of the forbidden repository workflow directories.
|
|
17
|
-
- Plugin validation and the repository release check passed for `2.0.0-alpha.
|
|
25
|
+
- Plugin validation and the repository release check passed for `2.0.0-alpha.4`.
|
|
26
|
+
- The alpha.4 CLI read the existing Signal schema 2 project state without migration:
|
|
27
|
+
project ID `b06d0f18f790f4521a23c770`, accepted Milestone 1 revision 10, historical
|
|
28
|
+
authorization events, and all entity IDs were preserved; `delegations` was an empty
|
|
29
|
+
additive collection and repository-level `next` remained `idle`.
|
|
30
|
+
- The three Russian PDFs were regenerated and all 40 pages were rendered to PNG for visual
|
|
31
|
+
inspection; delegated approval, compatibility, grant issuance, audit, revocation, and
|
|
32
|
+
chat-only grant issuance and Milestone/Task delegate launch prompts are present without
|
|
33
|
+
layout defects.
|
|
18
34
|
|
|
19
35
|
The strict reviewer implementation did not change in this release candidate. Its original
|
|
20
36
|
2026-07-16 real Codex CLI isolation probe denied a repository write and returned
|
package/package.json
CHANGED
|
@@ -11,6 +11,36 @@ codex-workflow gateway handshake --repo <git-root>
|
|
|
11
11
|
Require package name `codex-workflow-v2`, protocol version `1`, state
|
|
12
12
|
schema version `2`, and the capabilities needed for the requested operation. Task execution
|
|
13
13
|
that may cross a Project Knowledge Map revision requires `task-knowledge-rebind-v1`.
|
|
14
|
+
Milestone final acceptance requires `milestone-human-final-gate-v1`.
|
|
15
|
+
Autonomous approval requires `delegated-approval-v1`.
|
|
16
|
+
|
|
17
|
+
## Milestone Human Gate
|
|
18
|
+
|
|
19
|
+
At `awaiting_final_acceptance`, `next` returns `requiredHumanGate` with kind
|
|
20
|
+
`milestone_final_acceptance`, Milestone ID, revision, Plan/Result/evidence hashes, validated
|
|
21
|
+
HEAD, and a confirmation code. Display the complete object and end the turn. Only a later
|
|
22
|
+
explicit user message that approves the same code authorizes:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
codex-workflow milestone accept --repo <git-root> --id <MS-ID> \
|
|
26
|
+
--expected-revision <REVISION> --actor <USER-ACTOR> \
|
|
27
|
+
--confirmation-code <MSA-CODE>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Do not infer approval from the request that initiated validation. A changed revision, hash,
|
|
31
|
+
or HEAD requires a new gate.
|
|
32
|
+
|
|
33
|
+
## Delegated Approval
|
|
34
|
+
|
|
35
|
+
`delegation prepare --file <policy.json>` returns a `delegation_grant_issuance` gate with a
|
|
36
|
+
project-bound policy hash and `DGA-*` confirmation code. Display it and end the turn. A later
|
|
37
|
+
explicit user message containing the exact code permits `delegation grant`.
|
|
38
|
+
|
|
39
|
+
Active eligible grants appear in `next.delegatedApprovalOptions`. Use only the option whose
|
|
40
|
+
transition matches the requested command, with the named delegate as actor and the grant ID
|
|
41
|
+
as `--delegation-grant`. The resulting authorization event records the grant and both actors.
|
|
42
|
+
For `milestone.final_accept`, also pass the current `MSA-*` code; the existing grant replaces
|
|
43
|
+
the later-message requirement, not the state binding.
|
|
14
44
|
|
|
15
45
|
## Graph Refresh Request
|
|
16
46
|
|
|
@@ -45,7 +45,7 @@ Do not create a memory directory or write project files during scan.
|
|
|
45
45
|
3. Stop for user selection when more than one project remains plausible.
|
|
46
46
|
4. Check `index_status`; call `index_repository` with the request source root,
|
|
47
47
|
mode, and `persistence: false` when missing or stale.
|
|
48
|
-
5. Build evidence exactly as specified in
|
|
48
|
+
5. Build evidence exactly as specified in `../../references/protocol.md`.
|
|
49
49
|
6. Pipe `{ "request": ..., "evidence": ... }` to `graph bind --stdin`, passing
|
|
50
50
|
the current binding revision when one exists.
|
|
51
51
|
|
|
@@ -62,6 +62,39 @@ independently blocks the workflow.
|
|
|
62
62
|
- Independent Reviewer: receives recorded evidence and confirms critical
|
|
63
63
|
claims against files, Git, and tests.
|
|
64
64
|
|
|
65
|
+
## Human Gates
|
|
66
|
+
|
|
67
|
+
Treat `requiredHumanGate` from the project-local package as a mandatory turn boundary unless
|
|
68
|
+
the same `next` response contains a currently eligible `delegatedApprovalOptions` entry for
|
|
69
|
+
the exact transition and the agent is the entry's named delegate.
|
|
70
|
+
For `milestone_final_acceptance`, show the user the Milestone ID, revision, Plan hash,
|
|
71
|
+
Result hash, evidence hash, validated HEAD, and confirmation code. Ask whether the user
|
|
72
|
+
accepts that exact result, then stop without invoking `milestone accept`.
|
|
73
|
+
|
|
74
|
+
Only after a later user message explicitly approves and repeats the same confirmation code
|
|
75
|
+
may you invoke `milestone accept` with explicit `--actor` and `--confirmation-code` values.
|
|
76
|
+
A generic instruction such as “continue”, “finish”, or “bring it to final status” is not
|
|
77
|
+
final acceptance. If `next` returns a different code or binding, discard the old response
|
|
78
|
+
and ask again.
|
|
79
|
+
|
|
80
|
+
## Delegated Approval
|
|
81
|
+
|
|
82
|
+
Delegation issuance is itself a mandatory human turn boundary. Run `delegation prepare` with
|
|
83
|
+
the proposed policy, show the complete principal, delegate, scope, transitions, expiry,
|
|
84
|
+
policy hash, and `DGA-*` confirmation code, then stop. Only after a later user message
|
|
85
|
+
explicitly approves that exact code may `delegation grant` be invoked.
|
|
86
|
+
|
|
87
|
+
Never create, broaden, renew, or replace a grant from an agent's own judgment. Never record
|
|
88
|
+
the delegate as the user. When `next` exposes an eligible option, pass its grant ID through
|
|
89
|
+
`--delegation-grant` and use the exact delegate string as `--actor`. The core remains the
|
|
90
|
+
authority for status, expiry, scope, transition, and revocation checks.
|
|
91
|
+
|
|
92
|
+
For delegated Milestone final acceptance, the current `MSA-*` code is still required, but a
|
|
93
|
+
new user turn is not: the previously issued grant is the controlling decision. If no eligible
|
|
94
|
+
option is returned, follow the ordinary human-gate rule above. Knowledge Map approval is
|
|
95
|
+
delegable only through an explicit project-scoped `project_memory.approve` permission. Scope
|
|
96
|
+
changes, grant issuance, and grant expansion are never delegated by `delegated-approval-v1`.
|
|
97
|
+
|
|
65
98
|
## Stop Conditions
|
|
66
99
|
|
|
67
100
|
- Dependency version is missing, ranged, or differs from the installed package.
|
|
@@ -70,3 +103,5 @@ independently blocks the workflow.
|
|
|
70
103
|
- A request changes before evidence is bound.
|
|
71
104
|
- An action would make MCP or the local map authoritative project memory.
|
|
72
105
|
- A requested mutation is not authorized by the package CLI state.
|
|
106
|
+
- A human gate was emitted but the user has not approved its exact confirmation code in a
|
|
107
|
+
later message and no exact eligible delegated approval option exists.
|
|
@@ -6,6 +6,14 @@ to the task commit and Brief, Plan, and evidence hashes. Final acceptance is a s
|
|
|
6
6
|
human event bound to Result, evidence, and commit. Locks expire only diagnostically;
|
|
7
7
|
removing a stale lock is always an explicit repair operation.
|
|
8
8
|
|
|
9
|
+
Human approval remains the default. A user may instead issue a time-bound delegation grant
|
|
10
|
+
after confirming a deterministic `DGA-*` code bound to the project and exact policy hash.
|
|
11
|
+
The policy names a distinct principal and delegate, a project/Milestone/Task scope, and an
|
|
12
|
+
allow-list of approval transitions. Delegated transitions fail closed on actor, scope,
|
|
13
|
+
transition, expiry, revocation, or project mismatch. Their authorization events record
|
|
14
|
+
`authorizationMode: delegated` plus the grant ID, policy hash, principal, delegate, and exact
|
|
15
|
+
transition; the delegate is never recorded as the user.
|
|
16
|
+
|
|
9
17
|
When an approved Project Knowledge Map changes between Task Steps, the coordinator first
|
|
10
18
|
reconciles and obtains approval for the new map, then uses `task knowledge-rebind`. This
|
|
11
19
|
mechanical transition preserves Step definitions, runtime status, and evidence, records both
|
|
@@ -15,4 +23,18 @@ Task is `blocked`; unrelated blocks must be resolved through their owning transi
|
|
|
15
23
|
|
|
16
24
|
Milestone authorization is bound to its Plan and membership revision. Plan amendments
|
|
17
25
|
supersede authorization. Milestone validation and acceptance are bound to the current base
|
|
18
|
-
HEAD
|
|
26
|
+
HEAD. In `awaiting_final_acceptance`, `next` returns a state-bound human gate. The agent must
|
|
27
|
+
display its revision, hashes, HEAD, and confirmation code, then end the turn. Acceptance is
|
|
28
|
+
valid only after a later explicit user response repeats that code; the CLI requires both an
|
|
29
|
+
explicit actor and the exact code. Cancellation records intent but performs no Git reversal.
|
|
30
|
+
If the base HEAD or final artifacts change before acceptance, `next` withholds the gate and
|
|
31
|
+
requires Milestone validation again; revalidation supersedes the previous candidate binding.
|
|
32
|
+
An already issued grant containing `milestone.final_accept` may cross that gate autonomously,
|
|
33
|
+
but the acceptance command still requires the current `MSA-*` code so the use remains bound
|
|
34
|
+
to the validated revision, hashes, and HEAD. Grant issuance itself always remains a prior
|
|
35
|
+
human turn boundary.
|
|
36
|
+
|
|
37
|
+
Repository-level scheduling respects current Milestone membership. An unstarted linked Task
|
|
38
|
+
is eligible only for an `active` Milestone with `required` disposition. Historical unstarted
|
|
39
|
+
Tasks from `waived`, `cancelled`, accepted, or cancelled Milestone paths cannot shadow the
|
|
40
|
+
Milestone/repository transition returned by `next`.
|
|
@@ -11,3 +11,8 @@ configuration and rules ignored, a read-only sandbox, structured output, and an
|
|
|
11
11
|
write probe. The core seals repository HEAD, status, and content before/after the process.
|
|
12
12
|
Any process error, malformed output, successful write, or changed seal records an
|
|
13
13
|
`unverified` review and blocks Result creation and final acceptance.
|
|
14
|
+
|
|
15
|
+
Milestone validation similarly binds Result and evidence to the clean base HEAD. Its final
|
|
16
|
+
acceptance is a separate turn: `next` emits a confirmation code bound to the current
|
|
17
|
+
revision, Plan, Result, evidence, and HEAD; the coordinator shows it and stops. A later user
|
|
18
|
+
response must explicitly approve that exact code before the CLI transition is invoked.
|
|
@@ -8,5 +8,10 @@ Own state transitions, dispatch envelopes, evidence collection, and recovery gui
|
|
|
8
8
|
- Own derived map revisions and context selection, but never edit the meaning of canonical project files.
|
|
9
9
|
- Treat CLI `status`, `next`, revision, and lock state as authoritative machine state.
|
|
10
10
|
- Never bypass authorization, scope checks, failed validation, or stale review.
|
|
11
|
+
- When `next.requiredHumanGate` is present, show every bound field and confirmation code,
|
|
12
|
+
request the user's explicit decision, and end the turn. Never call the acceptance command
|
|
13
|
+
in the same turn that produced or displayed the gate.
|
|
14
|
+
- Accept a Milestone only after a later user message explicitly approves that exact
|
|
15
|
+
confirmation code. Do not infer approval from a request to validate, finish, or continue.
|
|
11
16
|
- Dispatch one Worker at a time for a concrete Step.
|
|
12
17
|
- Do not make product-scope decisions or implement production changes.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://codex-workflow.local/schemas/authorization-event.schema.json",
|
|
4
|
+
"title": "Codex Workflow V2 Authorization Event",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"kind", "decision", "actor", "recordedAt", "briefHash", "planHash", "resultHash",
|
|
9
|
+
"evidenceHash", "headCommit", "reason"
|
|
10
|
+
],
|
|
11
|
+
"properties": {
|
|
12
|
+
"kind": { "enum": ["execution", "final_acceptance", "exception"] },
|
|
13
|
+
"decision": { "enum": ["approved", "rejected", "waived", "superseded"] },
|
|
14
|
+
"actor": { "type": "string", "minLength": 1 },
|
|
15
|
+
"recordedAt": { "type": "string", "format": "date-time" },
|
|
16
|
+
"briefHash": { "$ref": "#/$defs/nullableHash" },
|
|
17
|
+
"planHash": { "$ref": "#/$defs/nullableHash" },
|
|
18
|
+
"resultHash": { "$ref": "#/$defs/nullableHash" },
|
|
19
|
+
"evidenceHash": { "$ref": "#/$defs/nullableHash" },
|
|
20
|
+
"headCommit": { "$ref": "#/$defs/nullableHash" },
|
|
21
|
+
"reason": { "type": "string" },
|
|
22
|
+
"authorizationMode": { "enum": ["human", "delegated"] },
|
|
23
|
+
"delegation": { "$ref": "#/$defs/delegation" }
|
|
24
|
+
},
|
|
25
|
+
"allOf": [
|
|
26
|
+
{
|
|
27
|
+
"if": {
|
|
28
|
+
"properties": { "authorizationMode": { "const": "delegated" } },
|
|
29
|
+
"required": ["authorizationMode"]
|
|
30
|
+
},
|
|
31
|
+
"then": { "required": ["delegation"] }
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"$defs": {
|
|
35
|
+
"nullableHash": { "type": ["string", "null"], "pattern": "^[a-f0-9]{40,64}$" },
|
|
36
|
+
"delegation": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"required": ["grantId", "policyHash", "principal", "delegate", "transition"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"grantId": { "type": "string", "pattern": "^DGR-[0-9A-HJKMNP-TV-Z]{26}$" },
|
|
42
|
+
"policyHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
43
|
+
"principal": { "type": "string", "minLength": 1 },
|
|
44
|
+
"delegate": { "type": "string", "minLength": 1 },
|
|
45
|
+
"transition": {
|
|
46
|
+
"enum": [
|
|
47
|
+
"project_memory.approve",
|
|
48
|
+
"task.execution_authorize", "task.final_accept",
|
|
49
|
+
"milestone.execution_authorize", "milestone.final_accept"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://codex-workflow.local/schemas/delegation-grant.schema.json",
|
|
4
|
+
"title": "Codex Workflow V2 Delegation Grant",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schemaVersion", "revision", "id", "projectId", "createdAt", "updatedAt", "kind",
|
|
9
|
+
"status", "principal", "delegate", "scope", "transitions", "expiresAt", "policyHash",
|
|
10
|
+
"revokedAt", "revokedBy", "revokeReason"
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"schemaVersion": { "const": 2 },
|
|
14
|
+
"revision": { "type": "integer", "minimum": 1 },
|
|
15
|
+
"id": { "type": "string", "pattern": "^DGR-[0-9A-HJKMNP-TV-Z]{26}$" },
|
|
16
|
+
"projectId": { "type": "string", "pattern": "^[a-f0-9]{24}$" },
|
|
17
|
+
"createdAt": { "type": "string", "format": "date-time" },
|
|
18
|
+
"updatedAt": { "type": "string", "format": "date-time" },
|
|
19
|
+
"kind": { "const": "delegation-grant" },
|
|
20
|
+
"status": { "enum": ["active", "revoked"] },
|
|
21
|
+
"principal": { "type": "string", "minLength": 1 },
|
|
22
|
+
"delegate": { "type": "string", "minLength": 1 },
|
|
23
|
+
"scope": {
|
|
24
|
+
"oneOf": [
|
|
25
|
+
{
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["kind"],
|
|
29
|
+
"properties": { "kind": { "const": "project" } }
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"required": ["kind", "id"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"kind": { "const": "milestone" },
|
|
37
|
+
"id": { "type": "string", "pattern": "^MS-[0-9A-HJKMNP-TV-Z]{26}$" }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"required": ["kind", "id"],
|
|
44
|
+
"properties": {
|
|
45
|
+
"kind": { "const": "task" },
|
|
46
|
+
"id": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"transitions": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"minItems": 1,
|
|
54
|
+
"uniqueItems": true,
|
|
55
|
+
"items": {
|
|
56
|
+
"enum": [
|
|
57
|
+
"project_memory.approve",
|
|
58
|
+
"task.execution_authorize", "task.final_accept",
|
|
59
|
+
"milestone.execution_authorize", "milestone.final_accept"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"expiresAt": { "type": "string", "format": "date-time" },
|
|
64
|
+
"policyHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
65
|
+
"revokedAt": { "type": ["string", "null"], "format": "date-time" },
|
|
66
|
+
"revokedBy": { "type": ["string", "null"] },
|
|
67
|
+
"revokeReason": { "type": ["string", "null"] }
|
|
68
|
+
}
|
|
69
|
+
}
|