codex-orchestrator 2.0.4 → 2.0.6
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/CHANGELOG.md +50 -0
- package/README.md +30 -3
- package/dist/src/v2/acceptance-proof.d.ts +12 -0
- package/dist/src/v2/acceptance-proof.d.ts.map +1 -1
- package/dist/src/v2/acceptance-proof.js +120 -6
- package/dist/src/v2/acceptance-proof.js.map +1 -1
- package/dist/src/v2/adapters/command.d.ts +2 -0
- package/dist/src/v2/adapters/command.d.ts.map +1 -1
- package/dist/src/v2/adapters/command.js +67 -8
- package/dist/src/v2/adapters/command.js.map +1 -1
- package/dist/src/v2/adapters/gh-issue-adapter.js +16 -5
- package/dist/src/v2/adapters/gh-issue-adapter.js.map +1 -1
- package/dist/src/v2/adapters/gh-pull-request-adapter.d.ts +7 -1
- package/dist/src/v2/adapters/gh-pull-request-adapter.d.ts.map +1 -1
- package/dist/src/v2/adapters/gh-pull-request-adapter.js +288 -0
- package/dist/src/v2/adapters/gh-pull-request-adapter.js.map +1 -1
- package/dist/src/v2/adapters/pull-requests.d.ts +69 -0
- package/dist/src/v2/adapters/pull-requests.d.ts.map +1 -1
- package/dist/src/v2/adapters/pull-requests.js +48 -0
- package/dist/src/v2/adapters/pull-requests.js.map +1 -1
- package/dist/src/v2/adapters/worktree.d.ts +1 -0
- package/dist/src/v2/adapters/worktree.d.ts.map +1 -1
- package/dist/src/v2/adapters/worktree.js +10 -1
- package/dist/src/v2/adapters/worktree.js.map +1 -1
- package/dist/src/v2/android-proof-runner.d.ts +93 -0
- package/dist/src/v2/android-proof-runner.d.ts.map +1 -0
- package/dist/src/v2/android-proof-runner.js +921 -0
- package/dist/src/v2/android-proof-runner.js.map +1 -0
- package/dist/src/v2/cli.d.ts +9 -0
- package/dist/src/v2/cli.d.ts.map +1 -1
- package/dist/src/v2/cli.js +38 -11
- package/dist/src/v2/cli.js.map +1 -1
- package/dist/src/v2/config.d.ts +13 -1
- package/dist/src/v2/config.d.ts.map +1 -1
- package/dist/src/v2/config.js +57 -4
- package/dist/src/v2/config.js.map +1 -1
- package/dist/src/v2/containment.d.ts +11 -2
- package/dist/src/v2/containment.d.ts.map +1 -1
- package/dist/src/v2/containment.js +35 -7
- package/dist/src/v2/containment.js.map +1 -1
- package/dist/src/v2/direct-delivery.d.ts +1 -1
- package/dist/src/v2/direct-delivery.d.ts.map +1 -1
- package/dist/src/v2/direct-delivery.js +9 -3
- package/dist/src/v2/direct-delivery.js.map +1 -1
- package/dist/src/v2/immutable-workflow-publisher.js +6 -1
- package/dist/src/v2/immutable-workflow-publisher.js.map +1 -1
- package/dist/src/v2/mobile-lease.d.ts +9 -0
- package/dist/src/v2/mobile-lease.d.ts.map +1 -1
- package/dist/src/v2/mobile-lease.js +27 -3
- package/dist/src/v2/mobile-lease.js.map +1 -1
- package/dist/src/v2/review-feedback-coordinator.d.ts +54 -0
- package/dist/src/v2/review-feedback-coordinator.d.ts.map +1 -0
- package/dist/src/v2/review-feedback-coordinator.js +245 -0
- package/dist/src/v2/review-feedback-coordinator.js.map +1 -0
- package/dist/src/v2/review-feedback.d.ts +127 -0
- package/dist/src/v2/review-feedback.d.ts.map +1 -0
- package/dist/src/v2/review-feedback.js +436 -0
- package/dist/src/v2/review-feedback.js.map +1 -0
- package/dist/src/v2/run-issue.d.ts +61 -0
- package/dist/src/v2/run-issue.d.ts.map +1 -1
- package/dist/src/v2/run-issue.js +843 -66
- package/dist/src/v2/run-issue.js.map +1 -1
- package/dist/src/v2/run-store.d.ts +48 -1
- package/dist/src/v2/run-store.d.ts.map +1 -1
- package/dist/src/v2/run-store.js +125 -5
- package/dist/src/v2/run-store.js.map +1 -1
- package/dist/src/v2/runtime.d.ts +37 -0
- package/dist/src/v2/runtime.d.ts.map +1 -1
- package/dist/src/v2/runtime.js +183 -15
- package/dist/src/v2/runtime.js.map +1 -1
- package/dist/src/v2/setup.js +1 -1
- package/dist/src/v2/setup.js.map +1 -1
- package/docs/deep-dive.md +71 -7
- package/internal-workflow/docs/agents/contract-test-ledger.md +11 -1
- package/internal-workflow/evals/coding-skill-evals.json +18 -0
- package/internal-workflow/manifest.json +1 -1
- package/internal-workflow/skills/acceptance-proof/SKILL.md +1 -1
- package/internal-workflow/skills/acceptance-proof/references/android.md +6 -6
- package/internal-workflow/skills/code-debugger/SKILL.md +3 -3
- package/internal-workflow/skills/code-review/SKILL.md +18 -6
- package/internal-workflow/skills/implementation-spec-maker/SKILL.md +10 -8
- package/internal-workflow/skills/implementation-spec-maker/agents/openai.yaml +1 -1
- package/internal-workflow/skills/implementation-spec-review/SKILL.md +17 -3
- package/internal-workflow/skills/implementation-spec-review/evals/evals.json +30 -0
- package/internal-workflow/skills/implementation-spec-review/references/review-loop.md +30 -6
- package/internal-workflow/skills/spec-implementer/references/review-loop.md +7 -1
- package/internal-workflow/skills/tdd/SKILL.md +5 -4
- package/internal-workflow/skills/tdd/evals/evals.json +18 -0
- package/internal-workflow/skills/tdd/mocking.md +3 -42
- package/internal-workflow/skills/tdd/refactoring.md +6 -8
- package/package.json +1 -1
- package/internal-workflow/skills/acceptance-proof/tools/android-lease.mjs +0 -280
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { canonicalJson } from './containment.js';
|
|
3
|
+
const SHA256 = /^[0-9a-f]{64}$/u;
|
|
4
|
+
const GIT_SHA = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u;
|
|
5
|
+
const SOURCE_ID = /^pr-(?:thread|review):[^\s]+$/u;
|
|
6
|
+
const MAX_SOURCES = 256;
|
|
7
|
+
export function createReviewFeedbackBootstrap() {
|
|
8
|
+
return {
|
|
9
|
+
version: 1,
|
|
10
|
+
phase: 'bootstrap-required',
|
|
11
|
+
consumedSourceIds: [],
|
|
12
|
+
previousPublishedHeadSha: null,
|
|
13
|
+
repairRound: 0,
|
|
14
|
+
activeBatch: null,
|
|
15
|
+
implementationInvocation: null,
|
|
16
|
+
history: [],
|
|
17
|
+
verifiedReceipt: null,
|
|
18
|
+
terminal: null,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function createFrozenReviewFeedbackBatch(input) {
|
|
22
|
+
const sources = structuredClone(input.sources).map((source) => ({
|
|
23
|
+
...source,
|
|
24
|
+
body: normalizeReviewFeedbackBody(source.body),
|
|
25
|
+
})).sort((left, right) => left.sourceId.localeCompare(right.sourceId));
|
|
26
|
+
const identity = {
|
|
27
|
+
runId: input.runId,
|
|
28
|
+
canonicalRepository: input.canonicalRepository,
|
|
29
|
+
pullRequest: input.pullRequest,
|
|
30
|
+
priorPublishedHeadSha: input.priorPublishedHeadSha,
|
|
31
|
+
sources,
|
|
32
|
+
};
|
|
33
|
+
const batch = {
|
|
34
|
+
version: 1,
|
|
35
|
+
batchId: createHash('sha256')
|
|
36
|
+
.update(`codex-orchestrator-review-feedback-batch-v1\0${canonicalJson(identity)}`)
|
|
37
|
+
.digest('hex'),
|
|
38
|
+
...structuredClone(input),
|
|
39
|
+
sources,
|
|
40
|
+
};
|
|
41
|
+
validateFrozenReviewFeedbackBatch(batch);
|
|
42
|
+
return batch;
|
|
43
|
+
}
|
|
44
|
+
export function normalizeReviewFeedbackBody(body) {
|
|
45
|
+
return body.replace(/\r\n?/gu, '\n');
|
|
46
|
+
}
|
|
47
|
+
export function hashReviewFeedbackText(body) {
|
|
48
|
+
return createHash('sha256').update(normalizeReviewFeedbackBody(body)).digest('hex');
|
|
49
|
+
}
|
|
50
|
+
export function hashReviewFeedbackSnapshot(value) {
|
|
51
|
+
return createHash('sha256')
|
|
52
|
+
.update(`codex-orchestrator-review-feedback-snapshot-v1\0${canonicalJson(value)}`)
|
|
53
|
+
.digest('hex');
|
|
54
|
+
}
|
|
55
|
+
export function projectReviewFeedbackBatch(batch, targetRevision) {
|
|
56
|
+
validateFrozenReviewFeedbackBatch(batch);
|
|
57
|
+
if (!Number.isSafeInteger(targetRevision) || targetRevision < 1)
|
|
58
|
+
throw new Error('review feedback target revision is invalid');
|
|
59
|
+
const sources = [...batch.sources].sort((left, right) => left.sourceId.localeCompare(right.sourceId));
|
|
60
|
+
return {
|
|
61
|
+
repairFindings: sources.map((source) => ({
|
|
62
|
+
id: source.sourceId,
|
|
63
|
+
provenance: 'pr-review',
|
|
64
|
+
sourceId: source.sourceId,
|
|
65
|
+
targetRevision,
|
|
66
|
+
summary: [
|
|
67
|
+
`${source.kind === 'thread' ? 'Pull request review thread' : 'Pull request changes-requested review'}: ${source.sourceUrl}`,
|
|
68
|
+
...(source.path ? [`Location: ${source.path}${source.line === null ? '' : `:${source.line}`}`] : []),
|
|
69
|
+
source.body,
|
|
70
|
+
].join('\n'),
|
|
71
|
+
affectedContracts: [...new Set([
|
|
72
|
+
'pr-review',
|
|
73
|
+
...(source.path ? [`path:${source.path}`] : []),
|
|
74
|
+
])].sort(),
|
|
75
|
+
status: 'open',
|
|
76
|
+
})),
|
|
77
|
+
workerFeedback: sources.map((source) => ({
|
|
78
|
+
id: source.sourceId,
|
|
79
|
+
sourceUrl: source.sourceUrl,
|
|
80
|
+
path: source.path,
|
|
81
|
+
line: source.line,
|
|
82
|
+
body: source.body,
|
|
83
|
+
})),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function appendConsumedReviewSourceIds(execution, sourceIds) {
|
|
87
|
+
validateReviewFeedbackExecution(execution);
|
|
88
|
+
const seen = new Set(execution.consumedSourceIds);
|
|
89
|
+
const consumedSourceIds = [...execution.consumedSourceIds];
|
|
90
|
+
for (const sourceId of [...sourceIds].sort()) {
|
|
91
|
+
assertSourceId(sourceId, 'review feedback consumed source ID');
|
|
92
|
+
if (!seen.has(sourceId)) {
|
|
93
|
+
seen.add(sourceId);
|
|
94
|
+
consumedSourceIds.push(sourceId);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return { ...structuredClone(execution), consumedSourceIds };
|
|
98
|
+
}
|
|
99
|
+
export function bootstrapReviewFeedback(execution, previousPublishedHeadSha, existingSourceIds) {
|
|
100
|
+
if (execution.phase !== 'bootstrap-required')
|
|
101
|
+
throw new Error('review feedback bootstrap is already complete');
|
|
102
|
+
assertGitSha(previousPublishedHeadSha, 'review feedback previous published head');
|
|
103
|
+
const next = appendConsumedReviewSourceIds(execution, existingSourceIds);
|
|
104
|
+
const result = {
|
|
105
|
+
...next, phase: 'idle', previousPublishedHeadSha, repairRound: 0,
|
|
106
|
+
};
|
|
107
|
+
validateReviewFeedbackExecution(result);
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
export function activateReviewFeedback(execution, batch) {
|
|
111
|
+
validateReviewFeedbackExecution(execution);
|
|
112
|
+
validateFrozenReviewFeedbackBatch(batch);
|
|
113
|
+
if (execution.phase !== 'idle' || execution.previousPublishedHeadSha !== batch.priorPublishedHeadSha
|
|
114
|
+
|| batch.sources.some((source) => execution.consumedSourceIds.includes(source.sourceId))) {
|
|
115
|
+
throw new Error('review feedback execution cannot activate this batch');
|
|
116
|
+
}
|
|
117
|
+
const withConsumed = appendConsumedReviewSourceIds(execution, batch.sources.map((source) => source.sourceId));
|
|
118
|
+
const result = {
|
|
119
|
+
...withConsumed,
|
|
120
|
+
phase: 'frozen',
|
|
121
|
+
repairRound: 1,
|
|
122
|
+
activeBatch: structuredClone(batch),
|
|
123
|
+
implementationInvocation: null,
|
|
124
|
+
verifiedReceipt: null,
|
|
125
|
+
terminal: null,
|
|
126
|
+
};
|
|
127
|
+
validateReviewFeedbackExecution(result);
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
export function reserveNextReviewFeedbackRound(execution) {
|
|
131
|
+
validateReviewFeedbackExecution(execution);
|
|
132
|
+
if (!['frozen', 'repairing'].includes(execution.phase) || execution.repairRound >= 3) {
|
|
133
|
+
throw new Error('review feedback repair budget is exhausted or inactive');
|
|
134
|
+
}
|
|
135
|
+
const result = { ...structuredClone(execution), phase: 'repairing', repairRound: (execution.repairRound + 1) };
|
|
136
|
+
validateReviewFeedbackExecution(result);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
export function markReviewFeedbackRepairing(execution) {
|
|
140
|
+
validateReviewFeedbackExecution(execution);
|
|
141
|
+
if (execution.phase !== 'frozen' && execution.phase !== 'repairing')
|
|
142
|
+
throw new Error('review feedback is not ready for repair');
|
|
143
|
+
const result = { ...structuredClone(execution), phase: 'repairing' };
|
|
144
|
+
validateReviewFeedbackExecution(result);
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
export function markReviewFeedbackVerified(execution, input) {
|
|
148
|
+
validateReviewFeedbackExecution(execution);
|
|
149
|
+
if (execution.phase !== 'repairing' || !execution.activeBatch)
|
|
150
|
+
throw new Error('review feedback is not ready to verify');
|
|
151
|
+
const result = {
|
|
152
|
+
...structuredClone(execution),
|
|
153
|
+
phase: 'verified',
|
|
154
|
+
implementationInvocation: null,
|
|
155
|
+
verifiedReceipt: { batchId: execution.activeBatch.batchId, ...structuredClone(input) },
|
|
156
|
+
};
|
|
157
|
+
validateReviewFeedbackExecution(result);
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
export function markReviewFeedbackPublishing(execution) {
|
|
161
|
+
validateReviewFeedbackExecution(execution);
|
|
162
|
+
if (execution.phase !== 'verified')
|
|
163
|
+
throw new Error('review feedback is not verified for publication');
|
|
164
|
+
const result = { ...structuredClone(execution), phase: 'publishing' };
|
|
165
|
+
validateReviewFeedbackExecution(result);
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
export function publishReviewFeedback(execution, receipt) {
|
|
169
|
+
validateReviewFeedbackExecution(execution);
|
|
170
|
+
validatePublishedReceipt(receipt);
|
|
171
|
+
if (execution.phase !== 'publishing' || !execution.activeBatch || receipt.batchId !== execution.activeBatch.batchId) {
|
|
172
|
+
throw new Error('review feedback publication receipt does not match active batch');
|
|
173
|
+
}
|
|
174
|
+
const result = {
|
|
175
|
+
...createReviewFeedbackBootstrap(),
|
|
176
|
+
phase: 'idle',
|
|
177
|
+
consumedSourceIds: [...execution.consumedSourceIds],
|
|
178
|
+
previousPublishedHeadSha: receipt.publishedHeadSha,
|
|
179
|
+
history: [...execution.history, structuredClone(receipt)],
|
|
180
|
+
};
|
|
181
|
+
validateReviewFeedbackExecution(result);
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
export function blockReviewFeedback(execution, kind, blockedAt) {
|
|
185
|
+
validateReviewFeedbackExecution(execution);
|
|
186
|
+
if (!execution.activeBatch)
|
|
187
|
+
throw new Error('review feedback has no active batch to block');
|
|
188
|
+
const receipt = {
|
|
189
|
+
kind: kind === 'safety' ? 'blocked-safety' : 'blocked-exhausted',
|
|
190
|
+
batchId: execution.activeBatch.batchId,
|
|
191
|
+
blockedAt,
|
|
192
|
+
};
|
|
193
|
+
const result = {
|
|
194
|
+
...structuredClone(execution),
|
|
195
|
+
phase: receipt.kind,
|
|
196
|
+
activeBatch: null,
|
|
197
|
+
implementationInvocation: null,
|
|
198
|
+
history: [...execution.history, receipt],
|
|
199
|
+
verifiedReceipt: null,
|
|
200
|
+
terminal: { kind, blockedAt },
|
|
201
|
+
};
|
|
202
|
+
validateReviewFeedbackExecution(result);
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
export function validateReviewFeedbackExecution(value) {
|
|
206
|
+
exactObject(value, [
|
|
207
|
+
'version', 'phase', 'consumedSourceIds', 'previousPublishedHeadSha', 'repairRound', 'activeBatch',
|
|
208
|
+
'implementationInvocation', 'history', 'verifiedReceipt', 'terminal',
|
|
209
|
+
], 'review feedback execution');
|
|
210
|
+
if (value.version !== 1)
|
|
211
|
+
throw new Error('review feedback execution version is invalid');
|
|
212
|
+
const phases = ['bootstrap-required', 'idle', 'frozen', 'repairing', 'verified', 'publishing', 'blocked-safety', 'blocked-exhausted'];
|
|
213
|
+
if (!phases.includes(value.phase))
|
|
214
|
+
throw new Error('review feedback execution phase is invalid');
|
|
215
|
+
validateSourceIds(value.consumedSourceIds, 'review feedback consumed source IDs');
|
|
216
|
+
if (value.previousPublishedHeadSha !== null)
|
|
217
|
+
assertGitSha(value.previousPublishedHeadSha, 'review feedback previous published head');
|
|
218
|
+
if (![0, 1, 2, 3].includes(value.repairRound))
|
|
219
|
+
throw new Error('review feedback repair round is invalid');
|
|
220
|
+
if (!Array.isArray(value.history) || value.history.length > MAX_SOURCES)
|
|
221
|
+
throw new Error('review feedback history is invalid');
|
|
222
|
+
for (const item of value.history)
|
|
223
|
+
validateHistory(item);
|
|
224
|
+
if (value.activeBatch !== null)
|
|
225
|
+
validateFrozenReviewFeedbackBatch(value.activeBatch);
|
|
226
|
+
if (value.implementationInvocation !== null)
|
|
227
|
+
validateImplementationInvocation(value.implementationInvocation);
|
|
228
|
+
if (value.verifiedReceipt !== null)
|
|
229
|
+
validateVerifiedReceipt(value.verifiedReceipt);
|
|
230
|
+
if (value.terminal !== null)
|
|
231
|
+
validateTerminal(value.terminal);
|
|
232
|
+
const phase = value.phase;
|
|
233
|
+
const active = ['frozen', 'repairing', 'verified', 'publishing'].includes(phase);
|
|
234
|
+
const blocked = phase === 'blocked-safety' || phase === 'blocked-exhausted';
|
|
235
|
+
if (phase === 'bootstrap-required' && (value.previousPublishedHeadSha !== null || value.repairRound !== 0 || value.activeBatch !== null)) {
|
|
236
|
+
throw new Error('review feedback bootstrap state is invalid');
|
|
237
|
+
}
|
|
238
|
+
if (phase === 'idle' && (value.previousPublishedHeadSha === null || value.repairRound !== 0 || value.activeBatch !== null
|
|
239
|
+
|| value.implementationInvocation !== null || value.terminal !== null)) {
|
|
240
|
+
throw new Error('review feedback idle state is invalid');
|
|
241
|
+
}
|
|
242
|
+
if (active && (value.previousPublishedHeadSha === null || value.activeBatch === null
|
|
243
|
+
|| ![1, 2, 3].includes(value.repairRound) || value.terminal !== null
|
|
244
|
+
|| value.activeBatch.priorPublishedHeadSha !== value.previousPublishedHeadSha)) {
|
|
245
|
+
throw new Error('review feedback active state is invalid');
|
|
246
|
+
}
|
|
247
|
+
if (blocked && (value.activeBatch !== null || value.implementationInvocation !== null || value.terminal === null
|
|
248
|
+
|| (phase === 'blocked-safety') !== (value.terminal.kind === 'safety'))) {
|
|
249
|
+
throw new Error('review feedback terminal state cannot retain active execution');
|
|
250
|
+
}
|
|
251
|
+
if (!active && value.implementationInvocation !== null)
|
|
252
|
+
throw new Error('review feedback invocation requires an active batch');
|
|
253
|
+
if (phase !== 'verified' && phase !== 'publishing' && value.verifiedReceipt !== null) {
|
|
254
|
+
throw new Error('review feedback verified receipt is invalid for phase');
|
|
255
|
+
}
|
|
256
|
+
if ((phase === 'verified' || phase === 'publishing')
|
|
257
|
+
&& value.verifiedReceipt?.batchId !== value.activeBatch?.batchId) {
|
|
258
|
+
throw new Error('review feedback verified receipt batch does not match active batch');
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
export function validateFrozenReviewFeedbackBatch(value) {
|
|
262
|
+
exactObject(value, ['version', 'batchId', 'runId', 'canonicalRepository', 'pullRequest', 'priorPublishedHeadSha', 'sources', 'frozenAt'], 'review feedback batch');
|
|
263
|
+
if (value.version !== 1)
|
|
264
|
+
throw new Error('review feedback batch version is invalid');
|
|
265
|
+
assertSha(value.batchId, 'review feedback batch ID');
|
|
266
|
+
assertString(value.runId, 'review feedback run ID');
|
|
267
|
+
if (typeof value.canonicalRepository !== 'string' || !/^[a-z0-9._-]+\/[a-z0-9._-]+$/u.test(value.canonicalRepository)) {
|
|
268
|
+
throw new Error('review feedback canonical repository is invalid');
|
|
269
|
+
}
|
|
270
|
+
exactObject(value.pullRequest, ['nodeId', 'number', 'headSha', 'headRefName', 'baseRefName', 'marker'], 'review feedback pull request');
|
|
271
|
+
assertString(value.pullRequest.nodeId, 'review feedback pull request node ID');
|
|
272
|
+
if (!Number.isSafeInteger(value.pullRequest.number) || value.pullRequest.number < 1)
|
|
273
|
+
throw new Error('review feedback pull request number is invalid');
|
|
274
|
+
assertGitSha(value.pullRequest.headSha, 'review feedback pull request head');
|
|
275
|
+
for (const field of ['headRefName', 'baseRefName', 'marker'])
|
|
276
|
+
assertString(value.pullRequest[field], `review feedback pull request ${field}`);
|
|
277
|
+
assertGitSha(value.priorPublishedHeadSha, 'review feedback prior published head');
|
|
278
|
+
if (!Array.isArray(value.sources) || value.sources.length === 0 || value.sources.length > MAX_SOURCES)
|
|
279
|
+
throw new Error('review feedback sources are invalid');
|
|
280
|
+
let prior = '';
|
|
281
|
+
for (const source of value.sources) {
|
|
282
|
+
validateFrozenSource(source);
|
|
283
|
+
if (source.sourceId <= prior)
|
|
284
|
+
throw new Error('review feedback sources must be sorted and unique');
|
|
285
|
+
prior = source.sourceId;
|
|
286
|
+
}
|
|
287
|
+
assertTimestamp(value.frozenAt, 'review feedback frozenAt');
|
|
288
|
+
const expected = createHash('sha256').update(`codex-orchestrator-review-feedback-batch-v1\0${canonicalJson({
|
|
289
|
+
runId: value.runId,
|
|
290
|
+
canonicalRepository: value.canonicalRepository,
|
|
291
|
+
pullRequest: value.pullRequest,
|
|
292
|
+
priorPublishedHeadSha: value.priorPublishedHeadSha,
|
|
293
|
+
sources: value.sources,
|
|
294
|
+
})}`).digest('hex');
|
|
295
|
+
if (value.batchId !== expected)
|
|
296
|
+
throw new Error('review feedback batch hash is invalid');
|
|
297
|
+
}
|
|
298
|
+
function validateFrozenSource(value) {
|
|
299
|
+
exactObject(value, ['sourceId', 'kind', 'sourceUrl', 'path', 'line', 'body', 'bodySha256', 'snapshotSha256', 'threadState', 'commitSha', 'sourceCreatedAt', 'sourceUpdatedAt', 'author', 'permission'], 'review feedback source');
|
|
300
|
+
assertSourceId(value.sourceId, 'review feedback source ID');
|
|
301
|
+
if (value.kind !== 'thread' && value.kind !== 'review')
|
|
302
|
+
throw new Error('review feedback source kind is invalid');
|
|
303
|
+
if ((value.kind === 'thread') !== value.sourceId.startsWith('pr-thread:'))
|
|
304
|
+
throw new Error('review feedback source ID kind mismatch');
|
|
305
|
+
assertString(value.sourceUrl, 'review feedback source URL');
|
|
306
|
+
if (value.path !== null)
|
|
307
|
+
assertString(value.path, 'review feedback source path');
|
|
308
|
+
if (value.line !== null && (!Number.isSafeInteger(value.line) || value.line < 1))
|
|
309
|
+
throw new Error('review feedback source line is invalid');
|
|
310
|
+
if (typeof value.body !== 'string' || value.body.length === 0 || value.body.length > 131_072)
|
|
311
|
+
throw new Error('review feedback source body is invalid');
|
|
312
|
+
assertSha(value.bodySha256, 'review feedback source body hash');
|
|
313
|
+
if (value.bodySha256 !== hashReviewFeedbackText(value.body))
|
|
314
|
+
throw new Error('review feedback source body hash is invalid');
|
|
315
|
+
assertSha(value.snapshotSha256, 'review feedback source snapshot hash');
|
|
316
|
+
if (value.kind === 'thread') {
|
|
317
|
+
exactObject(value.threadState, ['isResolved', 'isOutdated'], 'review feedback thread state');
|
|
318
|
+
if (typeof value.threadState.isResolved !== 'boolean' || typeof value.threadState.isOutdated !== 'boolean')
|
|
319
|
+
throw new Error('review feedback thread state is invalid');
|
|
320
|
+
}
|
|
321
|
+
else if (value.threadState !== null)
|
|
322
|
+
throw new Error('review feedback review source cannot have thread state');
|
|
323
|
+
assertGitSha(value.commitSha, 'review feedback source commit');
|
|
324
|
+
assertTimestamp(value.sourceCreatedAt, 'review feedback source createdAt');
|
|
325
|
+
assertTimestamp(value.sourceUpdatedAt, 'review feedback source updatedAt');
|
|
326
|
+
exactObject(value.author, ['login', 'userId'], 'review feedback source author');
|
|
327
|
+
assertString(value.author.login, 'review feedback source author login');
|
|
328
|
+
assertString(value.author.userId, 'review feedback source author ID');
|
|
329
|
+
exactObject(value.permission, ['permission', 'userId', 'checkedAt'], 'review feedback source permission');
|
|
330
|
+
if (value.permission.permission !== 'write' && value.permission.permission !== 'admin')
|
|
331
|
+
throw new Error('review feedback source permission is invalid');
|
|
332
|
+
if (value.permission.userId !== value.author.userId)
|
|
333
|
+
throw new Error('review feedback permission identity mismatch');
|
|
334
|
+
assertTimestamp(value.permission.checkedAt, 'review feedback permission checkedAt');
|
|
335
|
+
}
|
|
336
|
+
function validateImplementationInvocation(value) {
|
|
337
|
+
exactObject(value, ['phase', 'attemptId', 'reportPath', 'preparedAt', 'baseline', 'pid', 'processGroupId', 'launchedAt'], 'review feedback implementation invocation');
|
|
338
|
+
if (value.phase !== 'prepared' && value.phase !== 'launched')
|
|
339
|
+
throw new Error('review feedback invocation phase is invalid');
|
|
340
|
+
assertString(value.attemptId, 'review feedback invocation attempt ID');
|
|
341
|
+
assertString(value.reportPath, 'review feedback invocation report path');
|
|
342
|
+
assertTimestamp(value.preparedAt, 'review feedback invocation preparedAt');
|
|
343
|
+
exactObject(value.baseline, ['headSha', 'indexTreeSha', 'trackedContentSha256', 'untrackedContentSha256', 'worktreeIdentity'], 'review feedback invocation baseline');
|
|
344
|
+
assertGitSha(value.baseline.headSha, 'review feedback invocation head');
|
|
345
|
+
assertGitSha(value.baseline.indexTreeSha, 'review feedback invocation index tree');
|
|
346
|
+
assertSha(value.baseline.trackedContentSha256, 'review feedback invocation tracked hash');
|
|
347
|
+
assertSha(value.baseline.untrackedContentSha256, 'review feedback invocation untracked hash');
|
|
348
|
+
assertString(value.baseline.worktreeIdentity, 'review feedback invocation worktree identity');
|
|
349
|
+
if (value.phase === 'prepared' && (value.pid !== null || value.processGroupId !== null || value.launchedAt !== null))
|
|
350
|
+
throw new Error('prepared review feedback invocation has launch evidence');
|
|
351
|
+
if (value.phase === 'launched') {
|
|
352
|
+
if (!Number.isSafeInteger(value.pid) || value.pid < 1 || !Number.isSafeInteger(value.processGroupId) || value.processGroupId < 1)
|
|
353
|
+
throw new Error('launched review feedback invocation process is invalid');
|
|
354
|
+
assertTimestamp(value.launchedAt, 'review feedback invocation launchedAt');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
function validateHistory(value) {
|
|
358
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
359
|
+
throw new Error('review feedback history item is invalid');
|
|
360
|
+
const kind = value.kind;
|
|
361
|
+
if (kind === 'published')
|
|
362
|
+
validatePublishedReceipt(value);
|
|
363
|
+
else if (kind === 'blocked-safety' || kind === 'blocked-exhausted') {
|
|
364
|
+
exactObject(value, ['kind', 'batchId', 'blockedAt'], 'review feedback blocked receipt');
|
|
365
|
+
assertSha(value.batchId, 'review feedback blocked batch ID');
|
|
366
|
+
assertTimestamp(value.blockedAt, 'review feedback blockedAt');
|
|
367
|
+
}
|
|
368
|
+
else
|
|
369
|
+
throw new Error('review feedback history kind is invalid');
|
|
370
|
+
}
|
|
371
|
+
function validatePublishedReceipt(value) {
|
|
372
|
+
exactObject(value, ['kind', 'batchId', 'sourceIds', 'priorHeadSha', 'publishedHeadSha', 'pullRequestNumber', 'summaryCommentId', 'publishedAt'], 'review feedback published receipt');
|
|
373
|
+
if (value.kind !== 'published')
|
|
374
|
+
throw new Error('review feedback published receipt kind is invalid');
|
|
375
|
+
assertSha(value.batchId, 'review feedback published batch ID');
|
|
376
|
+
validateSourceIds(value.sourceIds, 'review feedback published source IDs');
|
|
377
|
+
assertGitSha(value.priorHeadSha, 'review feedback prior head');
|
|
378
|
+
assertGitSha(value.publishedHeadSha, 'review feedback published head');
|
|
379
|
+
if (!Number.isSafeInteger(value.pullRequestNumber) || value.pullRequestNumber < 1)
|
|
380
|
+
throw new Error('review feedback published PR number is invalid');
|
|
381
|
+
assertString(value.summaryCommentId, 'review feedback summary comment ID');
|
|
382
|
+
assertTimestamp(value.publishedAt, 'review feedback publishedAt');
|
|
383
|
+
}
|
|
384
|
+
function validateVerifiedReceipt(value) {
|
|
385
|
+
exactObject(value, ['batchId', 'checkedChangeSha256', 'proofId', 'verifiedAt'], 'review feedback verified receipt');
|
|
386
|
+
assertSha(value.batchId, 'review feedback verified batch ID');
|
|
387
|
+
assertSha(value.checkedChangeSha256, 'review feedback checked change hash');
|
|
388
|
+
assertString(value.proofId, 'review feedback proof ID');
|
|
389
|
+
assertTimestamp(value.verifiedAt, 'review feedback verifiedAt');
|
|
390
|
+
}
|
|
391
|
+
function validateTerminal(value) {
|
|
392
|
+
exactObject(value, ['kind', 'blockedAt'], 'review feedback terminal');
|
|
393
|
+
if (value.kind !== 'safety' && value.kind !== 'exhausted')
|
|
394
|
+
throw new Error('review feedback terminal kind is invalid');
|
|
395
|
+
assertTimestamp(value.blockedAt, 'review feedback terminal blockedAt');
|
|
396
|
+
}
|
|
397
|
+
function validateSourceIds(value, field) {
|
|
398
|
+
if (!Array.isArray(value) || value.length > MAX_SOURCES * 4)
|
|
399
|
+
throw new Error(`${field} is invalid`);
|
|
400
|
+
const seen = new Set();
|
|
401
|
+
for (const item of value) {
|
|
402
|
+
assertSourceId(item, field);
|
|
403
|
+
if (seen.has(item))
|
|
404
|
+
throw new Error(`${field} must be unique`);
|
|
405
|
+
seen.add(item);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function assertSourceId(value, field) {
|
|
409
|
+
if (typeof value !== 'string' || !SOURCE_ID.test(value))
|
|
410
|
+
throw new Error(`${field} is invalid`);
|
|
411
|
+
}
|
|
412
|
+
function exactObject(value, keys, field) {
|
|
413
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
414
|
+
throw new Error(`${field} must be an object`);
|
|
415
|
+
const actual = Object.keys(value).sort();
|
|
416
|
+
const expected = [...keys].sort();
|
|
417
|
+
if (actual.length !== expected.length || actual.some((key, index) => key !== expected[index]))
|
|
418
|
+
throw new Error(`${field} has unknown or missing keys`);
|
|
419
|
+
}
|
|
420
|
+
function assertString(value, field) {
|
|
421
|
+
if (typeof value !== 'string' || value.length === 0 || value.length > 131_072)
|
|
422
|
+
throw new Error(`${field} is invalid`);
|
|
423
|
+
}
|
|
424
|
+
function assertSha(value, field) {
|
|
425
|
+
if (typeof value !== 'string' || !SHA256.test(value))
|
|
426
|
+
throw new Error(`${field} is invalid`);
|
|
427
|
+
}
|
|
428
|
+
function assertGitSha(value, field) {
|
|
429
|
+
if (typeof value !== 'string' || !GIT_SHA.test(value))
|
|
430
|
+
throw new Error(`${field} is invalid`);
|
|
431
|
+
}
|
|
432
|
+
function assertTimestamp(value, field) {
|
|
433
|
+
if (typeof value !== 'string' || Number.isNaN(Date.parse(value)) || new Date(value).toISOString() !== value)
|
|
434
|
+
throw new Error(`${field} is invalid`);
|
|
435
|
+
}
|
|
436
|
+
//# sourceMappingURL=review-feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-feedback.js","sourceRoot":"","sources":["../../../src/v2/review-feedback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACjC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AACnD,MAAM,SAAS,GAAG,gCAAgC,CAAC;AACnD,MAAM,WAAW,GAAG,GAAG,CAAC;AA0FxB,MAAM,UAAU,6BAA6B;IAC3C,OAAO;QACL,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,oBAAoB;QAC3B,iBAAiB,EAAE,EAAE;QACrB,wBAAwB,EAAE,IAAI;QAC9B,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,IAAI;QACjB,wBAAwB,EAAE,IAAI;QAC9B,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,IAAI;QACrB,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,KAA+D;IAE/D,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9D,GAAG,MAAM;QACT,IAAI,EAAE,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC;KAC/C,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvE,MAAM,QAAQ,GAAG;QACf,KAAK,EAAE,KA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,SAAS,YAAY,CAAC,KAAc,EAAE,KAAa;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC;AAChG,CAAC;AAED,SAAS,eAAe,CAAC,KAAc,EAAE,KAAa;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC;AACtJ,CAAC"}
|
|
@@ -7,10 +7,13 @@ import { type RouteCoordinatorInput, type RouteCoordinatorResult, type RouteCoor
|
|
|
7
7
|
import type { RoutedContinuationRegistry } from './route-continuations.js';
|
|
8
8
|
import type { FrozenSpecReceiptV1 } from './spec-delivery.js';
|
|
9
9
|
import type { RunRecordV1, RunRecordWriter, RunStateFileV1 } from './run-store.js';
|
|
10
|
+
import type { ReviewFeedbackCoordinator } from './review-feedback-coordinator.js';
|
|
11
|
+
import { type ReviewFeedbackImplementationInvocationV1 } from './review-feedback.js';
|
|
10
12
|
export type RunIssueResult = {
|
|
11
13
|
status: 'review-ready';
|
|
12
14
|
pullRequestUrl: string;
|
|
13
15
|
evidencePath: string;
|
|
16
|
+
continuationEpoch?: string;
|
|
14
17
|
} | {
|
|
15
18
|
status: 'route-ready';
|
|
16
19
|
route: 'spec-required' | 'awaiting-user';
|
|
@@ -56,8 +59,11 @@ export interface RunIssueSnapshot {
|
|
|
56
59
|
state: 'OPEN' | 'CLOSED';
|
|
57
60
|
labels: string[];
|
|
58
61
|
comments: Array<{
|
|
62
|
+
id?: string;
|
|
59
63
|
body: string;
|
|
60
64
|
authorAssociation: string;
|
|
65
|
+
createdAt?: string;
|
|
66
|
+
updatedAt?: string;
|
|
61
67
|
}>;
|
|
62
68
|
}
|
|
63
69
|
export interface RunIssueGit {
|
|
@@ -72,6 +78,13 @@ export interface RunIssueGit {
|
|
|
72
78
|
baseBranch: string;
|
|
73
79
|
baseSha: string;
|
|
74
80
|
}): Promise<void>;
|
|
81
|
+
ensureContinuationWorktree?(input: {
|
|
82
|
+
targetRoot: string;
|
|
83
|
+
worktreePath: string;
|
|
84
|
+
branchName: string;
|
|
85
|
+
baseBranch: string;
|
|
86
|
+
publishedHeadSha: string;
|
|
87
|
+
}): Promise<void>;
|
|
75
88
|
inspectWorktree(input: {
|
|
76
89
|
worktreePath: string;
|
|
77
90
|
branchName: string;
|
|
@@ -80,6 +93,7 @@ export interface RunIssueGit {
|
|
|
80
93
|
snapshot(worktreePath: string): Promise<Omit<CheckedChangeFreshness, 'checkPolicySha256'>>;
|
|
81
94
|
fingerprintDeniedPaths(worktreePath: string, deniedPaths: string[]): Promise<string>;
|
|
82
95
|
listChangedFiles(worktreePath: string): Promise<string[]>;
|
|
96
|
+
listChangedFilesIgnoringUntrackedRoot(worktreePath: string, ignoredRoot: string): Promise<string[]>;
|
|
83
97
|
fingerprintChangedFiles(worktreePath: string, changedFiles: string[]): Promise<string>;
|
|
84
98
|
stageAll(worktreePath: string): Promise<void>;
|
|
85
99
|
getTreeSha(worktreePath: string): Promise<string>;
|
|
@@ -143,6 +157,9 @@ export interface RunIssueDependencies {
|
|
|
143
157
|
}): Promise<{
|
|
144
158
|
url: string;
|
|
145
159
|
body: string;
|
|
160
|
+
number?: number;
|
|
161
|
+
nodeId?: string;
|
|
162
|
+
headSha?: string;
|
|
146
163
|
} | undefined>;
|
|
147
164
|
createDraft(input: {
|
|
148
165
|
title: string;
|
|
@@ -152,7 +169,16 @@ export interface RunIssueDependencies {
|
|
|
152
169
|
}): Promise<{
|
|
153
170
|
url: string;
|
|
154
171
|
}>;
|
|
172
|
+
listConversationComments?(number: number): Promise<Array<{
|
|
173
|
+
id: string;
|
|
174
|
+
body: string;
|
|
175
|
+
}>>;
|
|
176
|
+
postConversationComment?(number: number, body: string): Promise<{
|
|
177
|
+
id: string;
|
|
178
|
+
body: string;
|
|
179
|
+
}>;
|
|
155
180
|
};
|
|
181
|
+
reviewFeedback?: ReviewFeedbackCoordinator;
|
|
156
182
|
git: RunIssueGit;
|
|
157
183
|
implementationAgent: {
|
|
158
184
|
run(input: {
|
|
@@ -164,8 +190,30 @@ export interface RunIssueDependencies {
|
|
|
164
190
|
reworkFindings: string[];
|
|
165
191
|
repairOnly: boolean;
|
|
166
192
|
workflowGeneration: WorkflowGenerationReceipt;
|
|
193
|
+
reviewFeedbackRound?: number;
|
|
194
|
+
reviewFeedback?: Array<{
|
|
195
|
+
id: string;
|
|
196
|
+
sourceUrl: string;
|
|
197
|
+
path: string | null;
|
|
198
|
+
line: number | null;
|
|
199
|
+
body: string;
|
|
200
|
+
}>;
|
|
201
|
+
onPrepared?: (input: Omit<ReviewFeedbackImplementationInvocationV1, 'phase' | 'pid' | 'processGroupId' | 'launchedAt'>) => Promise<void>;
|
|
202
|
+
onLaunched?: (input: {
|
|
203
|
+
attemptId: string;
|
|
204
|
+
pid: number;
|
|
205
|
+
processGroupId: number;
|
|
206
|
+
launchedAt: string;
|
|
207
|
+
}) => Promise<void>;
|
|
167
208
|
signal: AbortSignal;
|
|
168
209
|
}): Promise<ImplementationAgentResult>;
|
|
210
|
+
recover?(input: {
|
|
211
|
+
runId: string;
|
|
212
|
+
canonicalRepository: string;
|
|
213
|
+
invocation: ReviewFeedbackImplementationInvocationV1;
|
|
214
|
+
}): Promise<Extract<ImplementationAgentResult, {
|
|
215
|
+
kind: 'completed';
|
|
216
|
+
}> | undefined>;
|
|
169
217
|
};
|
|
170
218
|
implementationReviewer: {
|
|
171
219
|
run(input: ImplementationReviewerInput): Promise<ImplementationReviewerResult>;
|
|
@@ -195,6 +243,7 @@ export interface RunIssueDependencies {
|
|
|
195
243
|
frozenCriteria: FrozenCriterion[];
|
|
196
244
|
checkedChange: CheckedChange;
|
|
197
245
|
workflowGeneration: WorkflowGenerationReceipt;
|
|
246
|
+
beforeAgentLaunch?: () => Promise<void>;
|
|
198
247
|
}): Promise<ProveChangeResult>;
|
|
199
248
|
};
|
|
200
249
|
checkedChangeMint: CheckedChangeMintCapability;
|
|
@@ -226,6 +275,7 @@ export declare class OwnerLockContentionError extends Error {
|
|
|
226
275
|
interface ActiveRun {
|
|
227
276
|
state: RunStateFileV1;
|
|
228
277
|
record: RunRecordV1;
|
|
278
|
+
config: AgentAutoConfig;
|
|
229
279
|
}
|
|
230
280
|
export declare class RunIssue {
|
|
231
281
|
private readonly dependencies;
|
|
@@ -234,6 +284,10 @@ export declare class RunIssue {
|
|
|
234
284
|
private reconcileClaim;
|
|
235
285
|
private publish;
|
|
236
286
|
private publicationDiverged;
|
|
287
|
+
private updateExistingPullRequest;
|
|
288
|
+
private continueReviewReady;
|
|
289
|
+
private resumeActivatedReviewFeedback;
|
|
290
|
+
private reviewReadyObservationBlocked;
|
|
237
291
|
runIssue(input: {
|
|
238
292
|
targetRoot: string;
|
|
239
293
|
issueNumber: number;
|
|
@@ -252,11 +306,18 @@ export declare class RunIssue {
|
|
|
252
306
|
private clearIntent;
|
|
253
307
|
private confirmEffect;
|
|
254
308
|
private authorized;
|
|
309
|
+
private isAuthorizedIssue;
|
|
310
|
+
private authorizedForExactLabels;
|
|
311
|
+
private hasTrustedClaim;
|
|
255
312
|
private readIssue;
|
|
313
|
+
private revalidateFeedbackWorker;
|
|
314
|
+
private mapFeedbackRevalidation;
|
|
256
315
|
private runImplementation;
|
|
257
316
|
private runDirectReviewFull;
|
|
258
317
|
private recoverDirectReviewInvocation;
|
|
259
318
|
private startNextCycle;
|
|
319
|
+
private repairBudgetExhausted;
|
|
320
|
+
private blockReviewFeedback;
|
|
260
321
|
private mapImplementationFailure;
|
|
261
322
|
private mapProofFailure;
|
|
262
323
|
private revoked;
|