agents-relay 2.0.209 → 2.0.210
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/dist/cli-help.js +10 -4
- package/dist/cli-prompt.js +2 -1
- package/dist/cli-revision.js +49 -0
- package/dist/cli-worker-task.js +15 -0
- package/dist/cli.js +11 -2
- package/dist/dashboard-html.js +2 -2
- package/dist/dependency-revision-execution.js +152 -0
- package/dist/dependency-validity.js +17 -0
- package/dist/final-review-role.js +17 -0
- package/dist/force-restate-validation.js +3 -2
- package/dist/job-pr-number-migration.js +2 -1
- package/dist/managed-worker-input.js +2 -1
- package/dist/planner-agent-roles.js +18 -0
- package/dist/planner-runtime.js +7 -1
- package/dist/planner-task-ids.js +1 -0
- package/dist/planner.js +11 -6
- package/dist/reconciler-review.js +78 -96
- package/dist/reconciler-runtime.js +13 -4
- package/dist/reconciler.js +21 -11
- package/dist/relay-store.js +2 -0
- package/dist/relayd-control.js +31 -0
- package/dist/review-evidence.js +44 -0
- package/dist/review-generation-fence.js +2 -1
- package/dist/review-revision-execution.js +86 -0
- package/dist/review-revision-merge.js +15 -0
- package/dist/review-revision-model.js +191 -0
- package/dist/review-revision-policy.js +49 -0
- package/dist/review-revision-settlement.js +54 -0
- package/dist/review-revision-stale.js +57 -0
- package/dist/reviewer-thread.js +41 -1
- package/dist/runtime-status.js +13 -4
- package/dist/single-job-task-control.js +1 -1
- package/dist/task-context.js +3 -2
- package/dist/worker-failure-recovery.js +2 -1
- package/dist/workflow/dependency-revision-v2.js +16 -0
- package/dist/workflow/entity-creation.js +2 -0
- package/dist/workflow/review-v2.js +6 -2
- package/dist/workflow/revision-v2.js +32 -0
- package/dist/workflow/task-reconcile.js +3 -0
- package/package.json +1 -1
- package/skills/agents-relay/agents/job-acceptance-reviewer.agent.md +41 -0
- package/skills/agents-relay/agents/planner.agent.md +6 -3
- package/skills/agents-relay/contracts/event-contract.md +7 -0
- package/skills/agents-relay/contracts/task-job-contract.md +6 -0
- package/workflow/dependency-revision.mmd +30 -0
- package/workflow/review-lifecycle.mmd +40 -9
- package/workflow/revision-lifecycle.mmd +68 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function reviewRecord(value) {
|
|
2
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
3
|
+
}
|
|
4
|
+
function reviewHeadSha(event) {
|
|
5
|
+
const data = reviewRecord(event.data);
|
|
6
|
+
const outcome = reviewRecord(data.outcome);
|
|
7
|
+
const review = reviewRecord(data.review);
|
|
8
|
+
return [outcome.head_sha, outcome.headSha, review.head_sha, review.headSha, data.head_sha, data.headSha]
|
|
9
|
+
.find((value) => typeof value === 'string' && value.length > 0);
|
|
10
|
+
}
|
|
11
|
+
function reviewIssues(event) {
|
|
12
|
+
const data = reviewRecord(event.data);
|
|
13
|
+
const outcome = reviewRecord(data.outcome);
|
|
14
|
+
const review = reviewRecord(data.review);
|
|
15
|
+
const rawIssues = data.findings !== undefined ? data.findings
|
|
16
|
+
: outcome.blocking_findings !== undefined ? outcome.blocking_findings
|
|
17
|
+
: outcome.blockingFindings !== undefined ? outcome.blockingFindings
|
|
18
|
+
: outcome.findings !== undefined ? outcome.findings
|
|
19
|
+
: review.findings !== undefined ? review.findings
|
|
20
|
+
: review.issues !== undefined ? review.issues
|
|
21
|
+
: data.blocking_findings !== undefined ? data.blocking_findings
|
|
22
|
+
: data.issues;
|
|
23
|
+
if (rawIssues === undefined)
|
|
24
|
+
return [];
|
|
25
|
+
if (!Array.isArray(rawIssues))
|
|
26
|
+
return ['[unparseable blocking finding]'];
|
|
27
|
+
return rawIssues.map(item => {
|
|
28
|
+
if (typeof item === 'string')
|
|
29
|
+
return item.trim() || '[unparseable blocking finding]';
|
|
30
|
+
if (!item || typeof item !== 'object' || Array.isArray(item))
|
|
31
|
+
return '[unparseable blocking finding]';
|
|
32
|
+
const value = item;
|
|
33
|
+
const text = [value.summary, value.message, value.finding, value.title, value.id]
|
|
34
|
+
.find(candidate => typeof candidate === 'string' && candidate.trim().length > 0);
|
|
35
|
+
return typeof text === 'string' ? text.trim() : '[unparseable blocking finding]';
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function normalizeReviewEvidence(event, task) {
|
|
39
|
+
const explicitHeadSha = reviewHeadSha(event);
|
|
40
|
+
const headSha = explicitHeadSha ?? (event.type === 'review.approved' ? task.reviewHeadSha : undefined);
|
|
41
|
+
if (!headSha)
|
|
42
|
+
return null;
|
|
43
|
+
return { headSha, issues: reviewIssues(event) };
|
|
44
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isFinalReviewAgent } from './final-review-role.js';
|
|
1
2
|
/** Called inside SQLite mutateJob against the latest durable Job snapshot. */
|
|
2
3
|
export function reviewGenerationMatches(current, original, task, headSha) {
|
|
3
4
|
const fresh = current.tasks.find(item => item.id === task.id);
|
|
@@ -10,7 +11,7 @@ export function reviewGenerationMatches(current, original, task, headSha) {
|
|
|
10
11
|
// generation. Reject competing reviewers of that same head deterministically.
|
|
11
12
|
if (current.review?.outcome === 'stale' && original.review?.outcome === 'stale'
|
|
12
13
|
&& current.review.headSha !== headSha && task.planningDecisionId) {
|
|
13
|
-
const currentHeadReviewers = current.tasks.filter(item => item.agentName
|
|
14
|
+
const currentHeadReviewers = current.tasks.filter(item => isFinalReviewAgent(item.agentName)
|
|
14
15
|
&& item.reviewHeadSha === headSha && item.state !== 'CANCELLED');
|
|
15
16
|
return currentHeadReviewers.at(-1)?.id === task.id;
|
|
16
17
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { decideRevisionLifecycle } from './workflow/revision-v2.js';
|
|
2
|
+
/** Only Graph-authorized, fully covered review feedback can dispatch a child. */
|
|
3
|
+
export function revisionRequestReady(job, task) {
|
|
4
|
+
if (task.revision?.kind !== 'targeted')
|
|
5
|
+
return true;
|
|
6
|
+
const review = job.review;
|
|
7
|
+
if (!review || review.outcome !== 'changes_required' || review.revisionDisposition !== 'targeted'
|
|
8
|
+
|| review.taskId !== task.revision.reviewTaskId)
|
|
9
|
+
return false;
|
|
10
|
+
const requests = job.reviewRevisionRequests ?? [];
|
|
11
|
+
return task.revision.requestIds.length > 0 && task.revision.requestIds.every(id => {
|
|
12
|
+
const request = requests.find(item => item.requestId === id);
|
|
13
|
+
return request?.revisionTaskId === task.id && request.status === 'queued'
|
|
14
|
+
&& request.reviewHeadSha === task.revision?.basedOnHeadSha;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function updateStatus(request, next) {
|
|
18
|
+
request.status = next;
|
|
19
|
+
}
|
|
20
|
+
/** Reconstruct Graph transitions from durable correlated Task results on restart.
|
|
21
|
+
* Task completion is independently fenced by the canonical Task Graph and its
|
|
22
|
+
* execution generation. Never infer success from a browser submission receipt.
|
|
23
|
+
*/
|
|
24
|
+
export function reconcileReviewRevisionFacts(job) {
|
|
25
|
+
let changed = false;
|
|
26
|
+
for (const request of job.reviewRevisionRequests ?? []) {
|
|
27
|
+
const task = request.revisionTaskId && job.tasks.find(item => item.id === request.revisionTaskId);
|
|
28
|
+
if (!task || task.revision?.reviewTaskId !== request.reviewTaskId || !task.revision.requestIds.includes(request.requestId))
|
|
29
|
+
continue;
|
|
30
|
+
// Only the Task Graph's already-authorized recovery to QUEUED can reopen
|
|
31
|
+
// a failed/in-flight revision request. Never retry from a stale event.
|
|
32
|
+
if ((request.status === 'failed' || request.status === 'running')
|
|
33
|
+
&& task.state === 'QUEUED' && task.executionId === null
|
|
34
|
+
&& job.review?.outcome === 'changes_required' && job.review.revisionDisposition === 'targeted'
|
|
35
|
+
&& job.review.taskId === request.reviewTaskId) {
|
|
36
|
+
const decision = decideRevisionLifecycle(request.status === 'failed' ? 'FAILED' : 'RUNNING', 'revision.retry', { taskRetryQueued: true });
|
|
37
|
+
if (decision.accepted && decision.target === 'QUEUED'
|
|
38
|
+
&& decision.actions.some(action => action.id === 'revision.queueTask')) {
|
|
39
|
+
updateStatus(request, 'queued');
|
|
40
|
+
changed = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (request.status === 'requested' && job.review?.outcome === 'changes_required'
|
|
44
|
+
&& job.review.taskId === request.reviewTaskId && job.review.revisionDisposition === 'targeted') {
|
|
45
|
+
const decision = decideRevisionLifecycle('REQUESTED', 'revision.queue', { changesRequiredRecorded: true });
|
|
46
|
+
if (decision.accepted && decision.target === 'QUEUED' && decision.actions.some(action => action.id === 'revision.queueTask')) {
|
|
47
|
+
updateStatus(request, 'queued');
|
|
48
|
+
changed = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (request.status === 'queued' && ['RUNNING', 'SUCCEEDED', 'FAILED'].includes(task.state)) {
|
|
52
|
+
const started = decideRevisionLifecycle('QUEUED', 'revision.started');
|
|
53
|
+
if (started.accepted && started.target === 'RUNNING') {
|
|
54
|
+
if (task.state === 'RUNNING') {
|
|
55
|
+
updateStatus(request, 'running');
|
|
56
|
+
changed = true;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const finished = decideRevisionLifecycle('RUNNING', task.state === 'SUCCEEDED' ? 'revision.verified' : 'revision.failed');
|
|
60
|
+
if (finished.accepted && finished.target === (task.state === 'SUCCEEDED' ? 'VERIFIED' : 'FAILED')) {
|
|
61
|
+
updateStatus(request, task.state === 'SUCCEEDED' ? 'verified' : 'failed');
|
|
62
|
+
changed = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (request.status === 'running' && (task.state === 'SUCCEEDED' || task.state === 'FAILED')) {
|
|
68
|
+
const finished = decideRevisionLifecycle('RUNNING', task.state === 'SUCCEEDED' ? 'revision.verified' : 'revision.failed');
|
|
69
|
+
if (finished.accepted && finished.target === (task.state === 'SUCCEEDED' ? 'VERIFIED' : 'FAILED')) {
|
|
70
|
+
updateStatus(request, task.state === 'SUCCEEDED' ? 'verified' : 'failed');
|
|
71
|
+
changed = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (changed)
|
|
76
|
+
job.updatedAt = new Date().toISOString();
|
|
77
|
+
return changed;
|
|
78
|
+
}
|
|
79
|
+
export async function reconcileReviewRevisions(store, jobId) {
|
|
80
|
+
if (!store.mutateJob)
|
|
81
|
+
return;
|
|
82
|
+
await store.mutateJob(jobId, current => {
|
|
83
|
+
reconcileReviewRevisionFacts(current);
|
|
84
|
+
return current;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Revision and Review-round provenance belongs exclusively to local SQLite.
|
|
2
|
+
* Collaboration projections must NEVER invent or advance these records.
|
|
3
|
+
* The remote snapshot may be newer for other data, but it is not the source
|
|
4
|
+
* of operational review requests, statuses, or execution generations.
|
|
5
|
+
*/
|
|
6
|
+
export function preserveReviewRevisionHistory(local, merged) {
|
|
7
|
+
if (local.reviewRevisionRequests)
|
|
8
|
+
merged.reviewRevisionRequests = structuredClone(local.reviewRevisionRequests);
|
|
9
|
+
else
|
|
10
|
+
delete merged.reviewRevisionRequests;
|
|
11
|
+
if (local.reviewRevisionRounds)
|
|
12
|
+
merged.reviewRevisionRounds = structuredClone(local.reviewRevisionRounds);
|
|
13
|
+
else
|
|
14
|
+
delete merged.reviewRevisionRounds;
|
|
15
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { isFinalReviewAgent } from './final-review-role.js';
|
|
2
|
+
import { appendTaskComment } from './task-comments.js';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { createTaskEntity } from './workflow/entity-creation.js';
|
|
5
|
+
import { decideRevisionLifecycle } from './workflow/revision-v2.js';
|
|
6
|
+
/** A stable child identity per immutable review round and responsible owner.
|
|
7
|
+
* The request IDs are append-only feedback attached to this single child.
|
|
8
|
+
*/
|
|
9
|
+
export function targetedRevisionTaskId(reviewTaskId, ownerTaskId) {
|
|
10
|
+
return 'revision-' + createHash('sha256').update(JSON.stringify([reviewTaskId, ownerTaskId])).digest('hex').slice(0, 24);
|
|
11
|
+
}
|
|
12
|
+
/** A request and its source Task comment are one atomic SQLite Job snapshot mutation.
|
|
13
|
+
* The caller MUST execute this reducer inside RelayStore.mutateJob. It is never
|
|
14
|
+
* an out-of-band Task write and never reopens the original result.
|
|
15
|
+
*/
|
|
16
|
+
export function recordTargetedRevisionRequest(job, input) {
|
|
17
|
+
if (!input.requestId?.trim() || input.requestId.length > 160)
|
|
18
|
+
throw new Error('revision request requires stable request ID (max 160)');
|
|
19
|
+
if (!input.headSha?.trim() || !input.reviewExecutionId?.trim())
|
|
20
|
+
throw new Error('revision requires exact reviewer execution and immutable head');
|
|
21
|
+
if (!input.findings?.length || input.findings.some(item => !item.id?.trim() || !item.summary?.trim() || item.summary.length > 4000))
|
|
22
|
+
throw new Error('revision requires identified, nonempty findings');
|
|
23
|
+
if (new Set(input.findings.map(item => item.id)).size !== input.findings.length)
|
|
24
|
+
throw new Error('duplicate finding IDs in revision request');
|
|
25
|
+
const existing = job.reviewRevisionRequests?.find(item => item.requestId === input.requestId);
|
|
26
|
+
if (existing) {
|
|
27
|
+
const same = existing.reviewTaskId === input.reviewTaskId
|
|
28
|
+
&& existing.reviewExecutionId === input.reviewExecutionId
|
|
29
|
+
&& existing.reviewHeadSha === input.headSha
|
|
30
|
+
&& existing.originalTaskId === input.originalTaskId
|
|
31
|
+
&& JSON.stringify(existing.findings) === JSON.stringify(input.findings);
|
|
32
|
+
if (!same)
|
|
33
|
+
throw new Error('revision request ID reused with different immutable feedback');
|
|
34
|
+
return { request: existing, created: false };
|
|
35
|
+
}
|
|
36
|
+
const reviewer = job.tasks.find(item => item.id === input.reviewTaskId);
|
|
37
|
+
const owner = job.tasks.find(item => item.id === input.originalTaskId);
|
|
38
|
+
const facts = {
|
|
39
|
+
reviewerAuthorized: job.state === 'ACTIVE'
|
|
40
|
+
&& isFinalReviewAgent(reviewer?.agentName)
|
|
41
|
+
&& reviewer?.state === 'RUNNING'
|
|
42
|
+
&& reviewer?.executionId === input.reviewExecutionId,
|
|
43
|
+
reviewHeadCurrent: reviewer?.reviewHeadSha === input.headSha
|
|
44
|
+
&& job.headSha === input.headSha
|
|
45
|
+
&& (!job.review || (job.review.headSha === input.headSha
|
|
46
|
+
&& job.review.taskId === input.reviewTaskId
|
|
47
|
+
&& ['pending', 'started'].includes(job.review.outcome))),
|
|
48
|
+
originalTaskSucceeded: owner?.state === 'SUCCEEDED'
|
|
49
|
+
&& owner.kind !== 'planner'
|
|
50
|
+
&& !isFinalReviewAgent(owner.agentName)
|
|
51
|
+
&& owner.id !== reviewer?.id
|
|
52
|
+
&& !owner.revision,
|
|
53
|
+
};
|
|
54
|
+
const decision = decideRevisionLifecycle('NONE', 'revision.submit', facts);
|
|
55
|
+
if (!decision.accepted || decision.target !== 'REQUESTED'
|
|
56
|
+
|| decision.actions.map(item => item.id).join(',') !== 'revision.recordRequest') {
|
|
57
|
+
throw new Error('revision rejected: reviewer, head, execution or original owner is not current/eligible');
|
|
58
|
+
}
|
|
59
|
+
const now = new Date().toISOString();
|
|
60
|
+
const childId = targetedRevisionTaskId(input.reviewTaskId, input.originalTaskId);
|
|
61
|
+
const request = {
|
|
62
|
+
requestId: input.requestId,
|
|
63
|
+
reviewTaskId: input.reviewTaskId,
|
|
64
|
+
reviewExecutionId: input.reviewExecutionId,
|
|
65
|
+
reviewHeadSha: input.headSha,
|
|
66
|
+
originalTaskId: input.originalTaskId,
|
|
67
|
+
findings: structuredClone(input.findings),
|
|
68
|
+
createdAt: now,
|
|
69
|
+
status: 'requested', revisionTaskId: childId,
|
|
70
|
+
feedbackOrigin: 'final-review',
|
|
71
|
+
};
|
|
72
|
+
job.reviewRevisionRequests = [...(job.reviewRevisionRequests ?? []), request];
|
|
73
|
+
appendTaskComment(job, input.originalTaskId, 'Final Review ' + input.reviewTaskId + ' requested revision at ' + input.headSha + ':\n'
|
|
74
|
+
+ input.findings.map(f => '- ' + f.id + ': ' + f.summary).join('\n'), { author: 'reviewer', kind: 'review.feedback', executionId: input.reviewExecutionId,
|
|
75
|
+
transition: 'revision.requested', idempotencyKey: 'review-revision/' + input.requestId });
|
|
76
|
+
// Child creation and finding association are committed together with the
|
|
77
|
+
// request and owner comment: a crash cannot orphan an accepted request.
|
|
78
|
+
const existingChild = job.tasks.find(item => item.id === childId);
|
|
79
|
+
if (existingChild) {
|
|
80
|
+
if (existingChild.revision?.kind !== 'targeted' || existingChild.revision.originalTaskId !== input.originalTaskId
|
|
81
|
+
|| existingChild.revision.reviewTaskId !== input.reviewTaskId || existingChild.revision.basedOnHeadSha !== input.headSha
|
|
82
|
+
|| existingChild.state !== 'DRAFT')
|
|
83
|
+
throw new Error('revision child no longer accepts feedback in this immutable review round');
|
|
84
|
+
existingChild.revision.requestIds = [...new Set([...existingChild.revision.requestIds, input.requestId])];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (!owner || !reviewer)
|
|
88
|
+
throw new Error('review revision owner/reviewer missing');
|
|
89
|
+
const originalEvidence = owner.result ? JSON.stringify(owner.result) : 'No original result';
|
|
90
|
+
const child = createTaskEntity(job, {
|
|
91
|
+
jobId: job.id, id: childId, kind: 'work', title: 'Revise ' + (owner.title ?? owner.id),
|
|
92
|
+
priority: owner.priority ?? job.priority, storySize: owner.storySize ?? 'M', projectName: owner.projectName,
|
|
93
|
+
agentName: owner.agentName, parentTaskId: owner.id, dependencies: [reviewer.id],
|
|
94
|
+
capabilities: [...owner.capabilities], workerRequirements: owner.workerRequirements,
|
|
95
|
+
adapter: owner.adapter, input: [
|
|
96
|
+
`Revision of original Task ${owner.id} for Job ${job.id}; Final Review ${reviewer.id}, immutable reviewed head ${input.headSha}.`,
|
|
97
|
+
'Retrieve the authoritative Task Context; follow ALL append-only review.feedback comments and associated request IDs. Repair the original result without changing the historical succeeded Task. Review the full current Job objective and repository head, implement and verify the correction, and include root cause, solution, validation and self-review evidence in the durable result.',
|
|
98
|
+
'Original Task input:\n' + owner.input,
|
|
99
|
+
'Original completed evidence:\n' + originalEvidence,
|
|
100
|
+
].join('\n\n'), output: owner.output ?? { kind: 'task_pr' },
|
|
101
|
+
revision: { kind: 'targeted', originalTaskId: owner.id, requestIds: [input.requestId],
|
|
102
|
+
reviewTaskId: reviewer.id, basedOnHeadSha: input.headSha },
|
|
103
|
+
attempt: 0, maxAttempts: Math.max(3, owner.maxAttempts),
|
|
104
|
+
leaseOwner: null, leaseExpiresAt: null, executionId: null, threadId: null,
|
|
105
|
+
result: null, error: null, continuation: null, continuationDeliveredAt: null,
|
|
106
|
+
timeoutMs: owner.timeoutMs, createdAt: now, updatedAt: now,
|
|
107
|
+
}, { defer: true });
|
|
108
|
+
job.tasks.push(child);
|
|
109
|
+
}
|
|
110
|
+
appendTaskComment(job, childId, 'Review feedback request ' + input.requestId + ' for owner ' + input.originalTaskId + ' at ' + input.headSha + ':\n'
|
|
111
|
+
+ input.findings.map(f => '- ' + f.id + ': ' + f.summary + (f.evidence ? '\n Evidence: ' + f.evidence : '')).join('\n'), { author: 'reviewer', kind: 'review.feedback', executionId: input.reviewExecutionId,
|
|
112
|
+
transition: 'revision.requested', idempotencyKey: 'review-revision-child/' + input.requestId });
|
|
113
|
+
return { request, created: true };
|
|
114
|
+
}
|
|
115
|
+
/** Transaction-safe public intake boundary for the later reviewer CLI.
|
|
116
|
+
* No caller can publish a request or its owner comment outside one SQLite
|
|
117
|
+
* authoritative Job mutation. The store is responsible for rollback.
|
|
118
|
+
*/
|
|
119
|
+
export async function submitTargetedRevisionRequest(store, jobId, input) {
|
|
120
|
+
if (!store.mutateJob)
|
|
121
|
+
throw new Error('targeted revision requires an authoritative atomic Job store');
|
|
122
|
+
let created = false;
|
|
123
|
+
const committed = await store.mutateJob(jobId, current => {
|
|
124
|
+
created = recordTargetedRevisionRequest(current, input).created;
|
|
125
|
+
return current;
|
|
126
|
+
});
|
|
127
|
+
const request = committed.reviewRevisionRequests?.find(item => item.requestId === input.requestId);
|
|
128
|
+
if (!request)
|
|
129
|
+
throw new Error('targeted revision mutation did not persist the request');
|
|
130
|
+
return { request, created };
|
|
131
|
+
}
|
|
132
|
+
/** Only exact current-generation targeted requests count for the Review Graph.
|
|
133
|
+
* The record is not a worker success and does not itself authorize dispatch.
|
|
134
|
+
*/
|
|
135
|
+
export function targetedRequestsForReview(job, reviewTask, headSha) {
|
|
136
|
+
return (job.reviewRevisionRequests ?? []).filter(request => request.reviewTaskId === reviewTask.id
|
|
137
|
+
&& request.reviewExecutionId === reviewTask.executionId
|
|
138
|
+
&& request.reviewHeadSha === headSha
|
|
139
|
+
&& request.status !== 'stale'
|
|
140
|
+
&& job.tasks.some(task => task.id === request.originalTaskId && task.state === 'SUCCEEDED'));
|
|
141
|
+
}
|
|
142
|
+
/** Full finding coverage is a fact supplied to the Review Graph, not a
|
|
143
|
+
* second procedural review policy. Unknown findings fail closed to ownership
|
|
144
|
+
* resolution rather than silently disappearing behind a partial request.
|
|
145
|
+
*/
|
|
146
|
+
export function targetedRequestsCoverReview(job, reviewTask, headSha, verdictIssues) {
|
|
147
|
+
if (!verdictIssues.length || verdictIssues.some(issue => issue.trim() === '[unparseable blocking finding]'))
|
|
148
|
+
return false;
|
|
149
|
+
const requests = targetedRequestsForReview(job, reviewTask, headSha);
|
|
150
|
+
if (!requests.length)
|
|
151
|
+
return false;
|
|
152
|
+
const covered = new Set(requests.flatMap(request => request.findings.flatMap(finding => [finding.id.trim(), finding.summary.trim()])));
|
|
153
|
+
return verdictIssues.every(issue => covered.has(issue.trim()));
|
|
154
|
+
}
|
|
155
|
+
export function dependencyValidity(task, dependencyTaskId) {
|
|
156
|
+
if (!task.dependencies.includes(dependencyTaskId))
|
|
157
|
+
throw new Error('dependency is not declared on Task');
|
|
158
|
+
const mode = task.dependencyValidity?.[dependencyTaskId] ?? 'order-only';
|
|
159
|
+
if (mode !== 'order-only' && mode !== 'revalidate' && mode !== 'rerun')
|
|
160
|
+
throw new Error('invalid dependency validity policy');
|
|
161
|
+
return mode;
|
|
162
|
+
}
|
|
163
|
+
/** Deterministic semantic evidence vector; never infer validity from filenames.
|
|
164
|
+
* Historical successful owners remain immutable. The latest successful child
|
|
165
|
+
* is new evidence; pending/failed children must be gated by the future scheduler.
|
|
166
|
+
*/
|
|
167
|
+
export function dependencyRevisionVector(job, task) {
|
|
168
|
+
const vector = {};
|
|
169
|
+
for (const dependencyId of [...new Set(task.dependencies)].sort()) {
|
|
170
|
+
if (dependencyValidity(task, dependencyId) === 'order-only')
|
|
171
|
+
continue;
|
|
172
|
+
const original = job.tasks.find(item => item.id === dependencyId);
|
|
173
|
+
if (!original)
|
|
174
|
+
throw new Error('dependency Task not found: ' + dependencyId);
|
|
175
|
+
// Task-array order is not provenance: inbound snapshots and restarts may
|
|
176
|
+
// reorder historical children. Creation time plus ID gives stable ordering.
|
|
177
|
+
const latest = job.tasks.filter(item => item.revision?.originalTaskId === dependencyId && item.state === 'SUCCEEDED').sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id)).at(-1);
|
|
178
|
+
const selected = latest ?? original;
|
|
179
|
+
if (selected.state !== 'SUCCEEDED')
|
|
180
|
+
throw new Error('dependency has no successful evidence: ' + dependencyId);
|
|
181
|
+
// The successful Task ID and attempt identify the generation. Revision
|
|
182
|
+
// children are distinct and never rewrite a successful parent.
|
|
183
|
+
vector[dependencyId] = selected.id + ':' + selected.attempt;
|
|
184
|
+
}
|
|
185
|
+
return vector;
|
|
186
|
+
}
|
|
187
|
+
export function sameDependencyRevisionVector(a, b) {
|
|
188
|
+
const keysA = Object.keys(a).sort(), keysB = Object.keys(b).sort();
|
|
189
|
+
return keysA.length === keysB.length
|
|
190
|
+
&& keysA.every((key, index) => key === keysB[index] && a[key] === b[key]);
|
|
191
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
function positiveIntegerSetting(env, name, fallback) {
|
|
3
|
+
const raw = env[name];
|
|
4
|
+
if (raw === undefined || raw.trim() === '')
|
|
5
|
+
return fallback;
|
|
6
|
+
const value = Number(raw);
|
|
7
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > 100) {
|
|
8
|
+
throw new Error(`${name} must be an integer from 1 to 100`);
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
/** Operator-controlled loop bounds; defaults preserve the existing five-round gate. */
|
|
13
|
+
export function reviewRevisionLimits(env = process.env) {
|
|
14
|
+
return {
|
|
15
|
+
maxRounds: positiveIntegerSetting(env, 'AGENTS_RELAY_REVIEW_MAX_ROUNDS', 5),
|
|
16
|
+
maxNoProgressRounds: positiveIntegerSetting(env, 'AGENTS_RELAY_REVIEW_NO_PROGRESS_LIMIT', 1),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Stable identity for the review findings, independent of ordering and whitespace. */
|
|
20
|
+
export function reviewFindingFingerprint(findings) {
|
|
21
|
+
const normalized = [...new Set(findings.map(finding => finding.trim().replace(/\s+/g, ' ').toLocaleLowerCase('en-US')).filter(Boolean))].sort();
|
|
22
|
+
if (!normalized.length)
|
|
23
|
+
return undefined;
|
|
24
|
+
return createHash('sha256').update(JSON.stringify(normalized)).digest('hex');
|
|
25
|
+
}
|
|
26
|
+
/** Derive the fingerprint for pre-field rounds from their durable request evidence. */
|
|
27
|
+
export function reviewRoundFindingFingerprint(job, round) {
|
|
28
|
+
if (round.findingFingerprint)
|
|
29
|
+
return round.findingFingerprint;
|
|
30
|
+
const findings = (job.reviewRevisionRequests ?? [])
|
|
31
|
+
.filter(request => round.requestIds.includes(request.requestId))
|
|
32
|
+
.flatMap(request => request.findings.map(finding => finding.summary));
|
|
33
|
+
return reviewFindingFingerprint(findings);
|
|
34
|
+
}
|
|
35
|
+
export function repeatedFindingRounds(job, currentRound) {
|
|
36
|
+
const currentFingerprint = reviewRoundFindingFingerprint(job, currentRound);
|
|
37
|
+
if (!currentFingerprint || currentRound.status !== 'changes_required')
|
|
38
|
+
return 0;
|
|
39
|
+
let count = 0;
|
|
40
|
+
const previousRounds = (job.reviewRevisionRounds ?? [])
|
|
41
|
+
.filter(round => round.reviewTaskId !== currentRound.reviewTaskId && round.status === 'changes_required')
|
|
42
|
+
.sort((a, b) => a.recordedAt.localeCompare(b.recordedAt) || a.reviewTaskId.localeCompare(b.reviewTaskId));
|
|
43
|
+
for (let index = previousRounds.length - 1; index >= 0; index -= 1) {
|
|
44
|
+
if (reviewRoundFindingFingerprint(job, previousRounds[index]) !== currentFingerprint)
|
|
45
|
+
break;
|
|
46
|
+
count += 1;
|
|
47
|
+
}
|
|
48
|
+
return count;
|
|
49
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { appendTaskComment } from './task-comments.js';
|
|
2
|
+
import { dispatchReviewLifecycle } from './workflow/review-v2.js';
|
|
3
|
+
import { repeatedFindingRounds, reviewRevisionLimits } from './review-revision-policy.js';
|
|
4
|
+
/** Pure durable facts for the canonical Review Graph, not an alternate decision engine. */
|
|
5
|
+
function settlementFacts(job, taskId, limits) {
|
|
6
|
+
const requests = (job.reviewRevisionRequests ?? []).filter(item => item.reviewTaskId === taskId);
|
|
7
|
+
const targetedRevisionsVerified = requests.length > 0 && requests.every(request => request.status === 'verified' && job.tasks.some(task => task.id === request.revisionTaskId && task.state === 'SUCCEEDED'));
|
|
8
|
+
const rounds = (job.reviewRevisionRounds ?? []).filter(item => item.status === 'changes_required');
|
|
9
|
+
const currentRound = rounds.find(item => item.reviewTaskId === taskId);
|
|
10
|
+
return {
|
|
11
|
+
targetedRevisionsVerified,
|
|
12
|
+
reviewRoundWithinLimit: rounds.length < limits.maxRounds,
|
|
13
|
+
reviewNoProgressWithinLimit: !currentRound || repeatedFindingRounds(job, currentRound) < limits.maxNoProgressRounds,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** The Graph alone decides whether the verified round can proceed or must escalate. */
|
|
17
|
+
export async function settleReviewRevisionRound(store, job) {
|
|
18
|
+
if (!store.mutateJob)
|
|
19
|
+
return job;
|
|
20
|
+
const review = job.review;
|
|
21
|
+
if (review?.outcome !== 'changes_required' || review.revisionDisposition !== 'targeted' || !review.taskId)
|
|
22
|
+
return job;
|
|
23
|
+
const limits = reviewRevisionLimits();
|
|
24
|
+
const facts = settlementFacts(job, review.taskId, limits);
|
|
25
|
+
const decision = await dispatchReviewLifecycle(review.outcome, 'revision.settled', facts);
|
|
26
|
+
if (!decision.accepted)
|
|
27
|
+
return job;
|
|
28
|
+
const action = decision.actions.map(item => item.id);
|
|
29
|
+
const prepare = decision.accepted && decision.target === 'STALE' && action.includes('review.prepareRereview');
|
|
30
|
+
const exhausted = decision.accepted && decision.target === 'CHANGES_REQUIRED' && action.includes('review.requireOwnerResolution');
|
|
31
|
+
if (!prepare && !exhausted)
|
|
32
|
+
return job;
|
|
33
|
+
return store.mutateJob(job.id, current => {
|
|
34
|
+
const latest = current.review;
|
|
35
|
+
if (latest?.outcome !== 'changes_required' || latest.revisionDisposition !== 'targeted'
|
|
36
|
+
|| latest.taskId !== review.taskId || latest.headSha !== review.headSha)
|
|
37
|
+
return current;
|
|
38
|
+
const currentFacts = settlementFacts(current, review.taskId, limits);
|
|
39
|
+
if (Object.keys(facts).some(key => currentFacts[key] !== facts[key]))
|
|
40
|
+
return current;
|
|
41
|
+
const at = new Date().toISOString();
|
|
42
|
+
if (exhausted) {
|
|
43
|
+
current.review = { ...latest, revisionDisposition: 'needs-ownership', updatedAt: at };
|
|
44
|
+
const reason = !currentFacts.reviewRoundWithinLimit
|
|
45
|
+
? `Targeted review loop reached its configured ${limits.maxRounds}-round limit`
|
|
46
|
+
: `The same blocking findings recurred without progress ${limits.maxNoProgressRounds} time(s)`;
|
|
47
|
+
appendTaskComment(current, review.taskId, `${reason}; explicit Planner/owner recovery required. No approval or merge authorized.`, { author: 'relay', idempotencyKey: 'review-round-limit/' + review.taskId });
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
current.review = { ...latest, outcome: 'stale', updatedAt: at };
|
|
51
|
+
}
|
|
52
|
+
return current;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { tryTransitionTaskEvent } from './task-transitions.js';
|
|
2
|
+
import { decideRevisionLifecycle } from './workflow/revision-v2.js';
|
|
3
|
+
/** Revision Graph-authorized cleanup of requests whose head OR reviewer
|
|
4
|
+
* execution generation became stale. Request + child disposition are atomic.
|
|
5
|
+
* An old-generation receipt must never cancel a currently active generation.
|
|
6
|
+
*/
|
|
7
|
+
export async function staleReviewRevisions(store, job, reviewTaskId, headSha, cancelExecution, activeExecutionId) {
|
|
8
|
+
if (!store.mutateJob)
|
|
9
|
+
return;
|
|
10
|
+
const cancelled = [];
|
|
11
|
+
await store.mutateJob(job.id, current => {
|
|
12
|
+
if (current.review?.taskId !== reviewTaskId || current.review.headSha !== headSha)
|
|
13
|
+
return current;
|
|
14
|
+
if (activeExecutionId && current.tasks.find(task => task.id === reviewTaskId)?.executionId !== activeExecutionId)
|
|
15
|
+
return current;
|
|
16
|
+
let changed = false;
|
|
17
|
+
for (const request of current.reviewRevisionRequests ?? []) {
|
|
18
|
+
if (request.reviewTaskId !== reviewTaskId || request.reviewHeadSha !== headSha)
|
|
19
|
+
continue;
|
|
20
|
+
if (activeExecutionId && request.reviewExecutionId === activeExecutionId)
|
|
21
|
+
continue;
|
|
22
|
+
const states = { requested: 'REQUESTED', queued: 'QUEUED', running: 'RUNNING', failed: 'FAILED' };
|
|
23
|
+
const state = states[request.status];
|
|
24
|
+
if (!state)
|
|
25
|
+
continue;
|
|
26
|
+
const event = activeExecutionId ? 'review.execution_changed' : 'review.head_changed';
|
|
27
|
+
const decision = decideRevisionLifecycle(state, event);
|
|
28
|
+
if (!decision.accepted || decision.target !== 'STALE' || !decision.actions.some(action => action.id === 'revision.markStale'))
|
|
29
|
+
continue;
|
|
30
|
+
const child = request.revisionTaskId ? current.tasks.find(task => task.id === request.revisionTaskId) : undefined;
|
|
31
|
+
if (child && ['DRAFT', 'QUEUED', 'RUNNING'].includes(child.state)) {
|
|
32
|
+
const executionId = child.executionId ?? child.executionHistory?.at(-1)?.id ?? null;
|
|
33
|
+
if (!tryTransitionTaskEvent(child, 'cancel').accepted)
|
|
34
|
+
continue;
|
|
35
|
+
child.error = activeExecutionId
|
|
36
|
+
? 'Targeted revision evidence became stale after reviewer execution changed'
|
|
37
|
+
: 'Targeted revision evidence became stale after review head changed';
|
|
38
|
+
child.leaseOwner = null;
|
|
39
|
+
child.leaseExpiresAt = null;
|
|
40
|
+
child.executionId = null;
|
|
41
|
+
child.updatedAt = new Date().toISOString();
|
|
42
|
+
if (executionId)
|
|
43
|
+
cancelled.push({ taskId: child.id, executionId });
|
|
44
|
+
}
|
|
45
|
+
else if (child && child.state !== 'FAILED' && child.state !== 'SUCCEEDED' && child.state !== 'CANCELLED') {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
request.status = 'stale';
|
|
49
|
+
changed = true;
|
|
50
|
+
}
|
|
51
|
+
if (changed)
|
|
52
|
+
current.updatedAt = new Date().toISOString();
|
|
53
|
+
return current;
|
|
54
|
+
});
|
|
55
|
+
for (const execution of cancelled)
|
|
56
|
+
cancelExecution(execution.taskId, execution.executionId);
|
|
57
|
+
}
|
package/dist/reviewer-thread.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isFinalReviewAgent } from './final-review-role.js';
|
|
1
2
|
import { arg, hasArg } from './cli-support.js';
|
|
2
3
|
export function resolveImplementationThreadDestination(job) {
|
|
3
4
|
return job.implementationThreadId ? normalizeThreadId(job.implementationThreadId, 'Job implementation thread ID') ?? null : null;
|
|
@@ -24,11 +25,20 @@ export function resolveReviewerThreadDestination(job, override) {
|
|
|
24
25
|
const reviewerThreadId = job.reviewerThreadId ? normalizeThreadId(job.reviewerThreadId, 'Job reviewer thread ID') : undefined;
|
|
25
26
|
if (reviewerThreadId)
|
|
26
27
|
return { threadId: reviewerThreadId, source: 'reviewer' };
|
|
28
|
+
// A prior SHA-bound Reviewer is an explicit historical destination only when
|
|
29
|
+
// its ChatGPT route, surviving durable thread ID and URL prove compatibility.
|
|
30
|
+
const previous = 'tasks' in job && Array.isArray(job.tasks)
|
|
31
|
+
? [...job.tasks].reverse().find(task => isFinalReviewAgent(task.agentName) && task.state === 'SUCCEEDED'
|
|
32
|
+
&& task.adapter === 'chatgpt' && task.routing?.provider === 'chatgpt'
|
|
33
|
+
&& task.threadId && task.threadUrl?.startsWith('https://chatgpt.com/c/') && !task.threadDeletedAt)
|
|
34
|
+
: undefined;
|
|
35
|
+
if (previous?.threadId)
|
|
36
|
+
return { threadId: normalizeThreadId(previous.threadId), source: 'reviewer' };
|
|
27
37
|
const creatorThreadId = job.creatorThreadId ? normalizeThreadId(job.creatorThreadId, 'Job creator thread ID') : undefined;
|
|
28
38
|
return creatorThreadId ? { threadId: creatorThreadId, source: 'creator' } : null;
|
|
29
39
|
}
|
|
30
40
|
export function prepareReviewerThreadDelivery(job, task, override) {
|
|
31
|
-
if (task.agentName
|
|
41
|
+
if (!isFinalReviewAgent(task.agentName))
|
|
32
42
|
return undefined;
|
|
33
43
|
const destination = resolveReviewerThreadDestination(job, override);
|
|
34
44
|
if (!destination)
|
|
@@ -82,3 +92,33 @@ export async function recordThreadDelivery(store, jobId, taskId, executionId, wo
|
|
|
82
92
|
current.chatgptThreadDelivery = { ...current.chatgptThreadDelivery, executionId, deliveredAt: new Date().toISOString() };
|
|
83
93
|
await store.saveTask(current);
|
|
84
94
|
}
|
|
95
|
+
/** Persisted safety evidence for exact original-thread reuse or explicit fallback. */
|
|
96
|
+
export function prepareRevisionThreadDelivery(job, child) {
|
|
97
|
+
if (!child.revision || child.revision.kind !== 'targeted')
|
|
98
|
+
return undefined;
|
|
99
|
+
const original = job.tasks.find(item => item.id === child.revision?.originalTaskId);
|
|
100
|
+
if (!original)
|
|
101
|
+
throw new Error('revision original Task missing');
|
|
102
|
+
const compatible = child.adapter === 'chatgpt' && original.adapter === 'chatgpt'
|
|
103
|
+
&& child.routing?.provider === original.routing?.provider && original.routing?.provider === 'chatgpt'
|
|
104
|
+
&& child.routing?.projectId === original.routing?.projectId && Boolean(child.executionId)
|
|
105
|
+
&& Boolean(original.threadId && original.threadUrl?.startsWith('https://chatgpt.com/c/') && !original.threadDeletedAt);
|
|
106
|
+
const existing = child.revision.threadContinuation;
|
|
107
|
+
const reason = compatible ? 'matched original ChatGPT provider/project and durable live-compatible thread provenance'
|
|
108
|
+
: 'original thread missing/deleted or adapter/provider/project incompatible; safe full-context new execution';
|
|
109
|
+
if (existing && existing.decision === 'reuse' && !compatible) {
|
|
110
|
+
throw new Error('revision original-thread affinity changed after being selected; refuse uncertain duplicate send');
|
|
111
|
+
}
|
|
112
|
+
child.revision.threadContinuation = {
|
|
113
|
+
decision: compatible ? 'reuse' : 'fallback', reason, decidedAt: existing?.decidedAt ?? new Date().toISOString(),
|
|
114
|
+
...(compatible ? { originalThreadId: original.threadId } : {}),
|
|
115
|
+
};
|
|
116
|
+
if (!compatible)
|
|
117
|
+
return undefined;
|
|
118
|
+
return {
|
|
119
|
+
kind: 'new-turn', threadId: original.threadId, threadSource: 'original-task',
|
|
120
|
+
requestId: `${job.id}:${child.id}:${child.executionId}`, jobId: job.id,
|
|
121
|
+
repository: job.repository, taskId: child.id, prNumber: job.prNumber,
|
|
122
|
+
executionId: child.executionId, projectId: child.routing?.projectId ?? null, deliveredAt: null,
|
|
123
|
+
};
|
|
124
|
+
}
|
package/dist/runtime-status.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isFinalReviewAgent } from './final-review-role.js';
|
|
1
2
|
export function isSuperseded(task, byId) {
|
|
2
3
|
if (task.state === 'CANCELLED' && task.resolution?.path === 'cancel_supersede' && task.resolution.state === 'resolved')
|
|
3
4
|
return true;
|
|
@@ -8,13 +9,20 @@ export function isSuperseded(task, byId) {
|
|
|
8
9
|
&& typeof classification.reason === 'string' && Boolean(classification.reason.trim())
|
|
9
10
|
&& byId.get(classification.targetTaskId)?.state === 'SUCCEEDED';
|
|
10
11
|
}
|
|
12
|
+
function staleTargetedRevisionTaskIds(job) {
|
|
13
|
+
return new Set((job.reviewRevisionRequests ?? [])
|
|
14
|
+
.filter(request => request.status === 'stale' && request.revisionTaskId)
|
|
15
|
+
.map(request => request.revisionTaskId));
|
|
16
|
+
}
|
|
11
17
|
export function implementationTasks(job) {
|
|
12
18
|
const byId = new Map(job.tasks.map(task => [task.id, task]));
|
|
19
|
+
const staleRevisions = staleTargetedRevisionTaskIds(job);
|
|
13
20
|
return job.tasks.filter(task => task.kind !== 'planner'
|
|
14
|
-
&& task.agentName
|
|
21
|
+
&& !isFinalReviewAgent(task.agentName)
|
|
15
22
|
&& task.agentName !== 'troubleshooter'
|
|
16
23
|
&& !isSuperseded(task, byId)
|
|
17
|
-
&& task.
|
|
24
|
+
&& !staleRevisions.has(task.id)
|
|
25
|
+
&& (task.state !== 'DRAFT' || Boolean(task.revision)));
|
|
18
26
|
}
|
|
19
27
|
export function implementationComplete(job) {
|
|
20
28
|
const tasks = implementationTasks(job);
|
|
@@ -39,7 +47,7 @@ export function deriveJobRuntimeStatus(job, _prState = 'OPEN') {
|
|
|
39
47
|
return 'RUNNING';
|
|
40
48
|
if (implementation.some(task => task.state === 'QUEUED'))
|
|
41
49
|
return 'QUEUED';
|
|
42
|
-
const reviewRunning = job.tasks.some(task => task.agentName
|
|
50
|
+
const reviewRunning = job.tasks.some(task => isFinalReviewAgent(task.agentName) && task.state === 'RUNNING');
|
|
43
51
|
if (job.review?.outcome === 'approved')
|
|
44
52
|
return 'MERGE_PENDING';
|
|
45
53
|
if (reviewRunning)
|
|
@@ -50,7 +58,8 @@ export function deriveJobRuntimeStatus(job, _prState = 'OPEN') {
|
|
|
50
58
|
return 'QUEUED';
|
|
51
59
|
if (job.tasks.some(task => task.state === 'BLOCKED'))
|
|
52
60
|
return 'BLOCKED';
|
|
53
|
-
|
|
61
|
+
const staleRevisions = staleTargetedRevisionTaskIds(job);
|
|
62
|
+
if (job.tasks.some(task => task.state === 'FAILED' && !staleRevisions.has(task.id)))
|
|
54
63
|
return 'FAILED';
|
|
55
64
|
if (job.tasks.some(task => task.state === 'DRAFT'))
|
|
56
65
|
return 'WAITING';
|
|
@@ -17,7 +17,7 @@ export async function createSingleJobTaskControl(jobId, store, reconciler, bus)
|
|
|
17
17
|
unblockTask: unblock.unblockTask,
|
|
18
18
|
publishTaskUnblocked, dispatchTaskAction,
|
|
19
19
|
});
|
|
20
|
-
const allowed = new Set(['task.unblock', 'task.recover', 'task.escalate', 'task.resume-troubleshooter', 'task.classify']);
|
|
20
|
+
const allowed = new Set(['task.unblock', 'task.recover', 'task.escalate', 'task.resume-troubleshooter', 'task.classify', 'task.revise']);
|
|
21
21
|
return async (body) => {
|
|
22
22
|
if (!allowed.has(String(body.command ?? '')))
|
|
23
23
|
throw new Error('Single-Job control command not supported');
|