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.
Files changed (47) hide show
  1. package/dist/cli-help.js +10 -4
  2. package/dist/cli-prompt.js +2 -1
  3. package/dist/cli-revision.js +49 -0
  4. package/dist/cli-worker-task.js +15 -0
  5. package/dist/cli.js +11 -2
  6. package/dist/dashboard-html.js +2 -2
  7. package/dist/dependency-revision-execution.js +152 -0
  8. package/dist/dependency-validity.js +17 -0
  9. package/dist/final-review-role.js +17 -0
  10. package/dist/force-restate-validation.js +3 -2
  11. package/dist/job-pr-number-migration.js +2 -1
  12. package/dist/managed-worker-input.js +2 -1
  13. package/dist/planner-agent-roles.js +18 -0
  14. package/dist/planner-runtime.js +7 -1
  15. package/dist/planner-task-ids.js +1 -0
  16. package/dist/planner.js +11 -6
  17. package/dist/reconciler-review.js +78 -96
  18. package/dist/reconciler-runtime.js +13 -4
  19. package/dist/reconciler.js +21 -11
  20. package/dist/relay-store.js +2 -0
  21. package/dist/relayd-control.js +31 -0
  22. package/dist/review-evidence.js +44 -0
  23. package/dist/review-generation-fence.js +2 -1
  24. package/dist/review-revision-execution.js +86 -0
  25. package/dist/review-revision-merge.js +15 -0
  26. package/dist/review-revision-model.js +191 -0
  27. package/dist/review-revision-policy.js +49 -0
  28. package/dist/review-revision-settlement.js +54 -0
  29. package/dist/review-revision-stale.js +57 -0
  30. package/dist/reviewer-thread.js +41 -1
  31. package/dist/runtime-status.js +13 -4
  32. package/dist/single-job-task-control.js +1 -1
  33. package/dist/task-context.js +3 -2
  34. package/dist/worker-failure-recovery.js +2 -1
  35. package/dist/workflow/dependency-revision-v2.js +16 -0
  36. package/dist/workflow/entity-creation.js +2 -0
  37. package/dist/workflow/review-v2.js +6 -2
  38. package/dist/workflow/revision-v2.js +32 -0
  39. package/dist/workflow/task-reconcile.js +3 -0
  40. package/package.json +1 -1
  41. package/skills/agents-relay/agents/job-acceptance-reviewer.agent.md +41 -0
  42. package/skills/agents-relay/agents/planner.agent.md +6 -3
  43. package/skills/agents-relay/contracts/event-contract.md +7 -0
  44. package/skills/agents-relay/contracts/task-job-contract.md +6 -0
  45. package/workflow/dependency-revision.mmd +30 -0
  46. package/workflow/review-lifecycle.mmd +40 -9
  47. package/workflow/revision-lifecycle.mmd +68 -0
@@ -1,3 +1,4 @@
1
+ import { isFinalReviewAgent } from './final-review-role.js';
1
2
  /** Resolve the execution-scoped contract from the authoritative Job snapshot. */
2
3
  export function taskExecutionContext(job, taskId, executionId) {
3
4
  if (!executionId)
@@ -9,7 +10,7 @@ export function taskExecutionContext(job, taskId, executionId) {
9
10
  throw new Error(`Stale Task execution ${taskId}/${executionId}; current state ${task.state}`);
10
11
  const relevant = task.agentName === 'troubleshooter'
11
12
  ? job.tasks.filter(item => item.id === task.parentTaskId)
12
- : task.agentName === 'reviewer' ? task.dependencies.map(id => job.tasks.find(item => item.id === id)).filter((item) => Boolean(item)) : [];
13
+ : isFinalReviewAgent(task.agentName) ? task.dependencies.map(id => job.tasks.find(item => item.id === id)).filter((item) => Boolean(item)) : [];
13
14
  return { job: { id: job.id, repository: job.repository, title: job.title, objective: job.objective,
14
15
  projectPath: job.projectPath, state: job.state }, task, currentState: task.state, resolution: task.resolution ?? null, escalation: task.escalation ?? null,
15
16
  comments: task.comments ?? [], relevantTasks: relevant.map(item => ({ id: item.id, title: item.title, state: item.state, attempt: item.attempt, executionId: item.executionId, resolution: item.resolution ?? null, escalation: item.escalation ?? null, comments: item.comments ?? [], result: item.result, error: item.error, failureReason: item.failureReason })),
@@ -18,7 +19,7 @@ export function taskExecutionContext(job, taskId, executionId) {
18
19
  }
19
20
  /** Runtime-only task history; durable task.input remains the stable objective. */
20
21
  export function taskAgentHistoryContext(job, task) {
21
- if (task.agentName !== 'troubleshooter' && task.agentName !== 'reviewer')
22
+ if (task.agentName !== 'troubleshooter' && !isFinalReviewAgent(task.agentName))
22
23
  return '';
23
24
  const related = task.agentName === 'troubleshooter'
24
25
  ? job.tasks.filter(item => item.id === task.parentTaskId)
@@ -1,3 +1,4 @@
1
+ import { isFinalReviewAgent } from './final-review-role.js';
1
2
  import { hasSafeAlternativeWorker } from './browser-worker-routing.js';
2
3
  import { codexNoStartFallbackRoute, persistChatGptPlatformFailure } from './chatgpt-platform-fallback.js';
3
4
  import { classifyChatGptPlatformFailure } from './worker-rejection.js';
@@ -17,7 +18,7 @@ export async function handleWorkerLaunchFailure(ports, jobId, taskId, executionI
17
18
  && !activeExecution?.workerStarted;
18
19
  const canRetryNoStart = noStarted && currentJob.executionMode !== 'shortcut'
19
20
  && (currentTask?.adapter === 'chatgpt' || currentTask?.adapter === 'z')
20
- && currentTask.agentName !== 'reviewer'
21
+ && !isFinalReviewAgent(currentTask.agentName)
21
22
  && currentTask.agentName !== 'troubleshooter' && currentTask.kind !== 'planner'
22
23
  && !currentTask.noStartFallback && currentTask.attempt < currentTask.maxAttempts;
23
24
  const codexFallback = canRetryNoStart
@@ -0,0 +1,16 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { GraphRuntime } from './graph-v2.js';
3
+ import { dispatchWorkflowGraphSync } from './dispatcher.js';
4
+ const boolGuard = (key) => (context) => context.durableFacts[key] === true;
5
+ export const dependencyRevisionLifecycle = new GraphRuntime(readFileSync(new URL('../../workflow/dependency-revision.mmd', import.meta.url), 'utf8'), {
6
+ states: new Set(['NONE', 'PROPOSED', 'VERIFIED', 'STALE']),
7
+ guards: Object.fromEntries(['upstreamEvidenceChanged', 'explicitValidityPolicy', 'allInputsSettled', 'notAlreadyRecorded', 'rerunRequired'].map(key => [key, boolGuard(key)])),
8
+ actions: { 'dependencyRevision.createRerun': { id: 'dependencyRevision.createRerun' }, 'dependencyRevision.createRevalidation': { id: 'dependencyRevision.createRevalidation' }, 'dependencyRevision.markStale': { id: 'dependencyRevision.markStale' } },
9
+ events: { 'dependency.reconcile': { id: 'dependency.reconcile' }, 'dependency.verified': { id: 'dependency.verified' }, 'dependency.stale': { id: 'dependency.stale' } },
10
+ });
11
+ export function decideDependencyRevision(event, facts = {}, state = 'NONE') {
12
+ return dispatchWorkflowGraphSync(dependencyRevisionLifecycle, {
13
+ graphName: 'dependency-revision', initialState: state,
14
+ input: { transport: 'event', id: event, payload: {} }, durableFacts: facts,
15
+ });
16
+ }
@@ -1,5 +1,6 @@
1
1
  import { dispatchJobLifecycleSync, dispatchTaskLifecycleSync } from './lifecycle.js';
2
2
  import { deriveTaskTitle } from '../task-title.js';
3
+ import { validateDependencyValidity } from '../dependency-validity.js';
3
4
  function dependenciesSatisfied(job, dependencies) {
4
5
  if (dependencies.length === 0)
5
6
  return true;
@@ -13,6 +14,7 @@ function validateTaskRequirements(value) {
13
14
  if (value.workerRequirements && !Array.isArray(value.workerRequirements.capabilities)) {
14
15
  throw new Error(`Task ${value.id} workerRequirements.capabilities must be an array`);
15
16
  }
17
+ validateDependencyValidity(value.dependencies, value.dependencyValidity, `Task ${value.id} dependencyValidity`);
16
18
  }
17
19
  /**
18
20
  * Canonical creation boundary for new Task entities.
@@ -17,9 +17,13 @@ export const reviewLifecycleV2 = new GraphRuntime(source, {
17
17
  noApprovedCurrentReview: boolGuard('noApprovedCurrentReview'),
18
18
  autoMerge: boolGuard('autoMerge'),
19
19
  reviewUnblocked: boolGuard('reviewUnblocked'),
20
+ targetedRevisionRequestsReady: boolGuard('targetedRevisionRequestsReady'),
21
+ targetedRevisionsVerified: boolGuard('targetedRevisionsVerified'),
22
+ reviewRoundWithinLimit: boolGuard('reviewRoundWithinLimit'),
23
+ reviewNoProgressWithinLimit: boolGuard('reviewNoProgressWithinLimit'),
20
24
  },
21
- actions: Object.fromEntries(['review.create', 'review.cancelStale', 'review.createFix', 'review.requestMerge'].map(id => [id, { id }])),
22
- events: Object.fromEntries(['reconcile', 'review.started', 'review.approved', 'review.changes_required', 'review.legacy_blocked', 'review.retry', 'head.changed'].map(id => [id, { id }])),
25
+ actions: Object.fromEntries(['review.create', 'review.cancelStale', 'review.awaitTargetedRevisions', 'review.requireOwnerResolution', 'review.requestMerge', 'review.prepareRereview'].map(id => [id, { id }])),
26
+ events: Object.fromEntries(['reconcile', 'review.started', 'review.approved', 'review.changes_required', 'review.legacy_blocked', 'review.retry', 'head.changed', 'revision.settled'].map(id => [id, { id }])),
23
27
  });
24
28
  export function reviewGraphState(outcome) {
25
29
  if (!outcome)
@@ -0,0 +1,32 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { GraphRuntime } from './graph-v2.js';
3
+ import { dispatchWorkflowGraph, dispatchWorkflowGraphSync } from './dispatcher.js';
4
+ const source = readFileSync(new URL('../../workflow/revision-lifecycle.mmd', import.meta.url), 'utf8');
5
+ const boolGuard = (name) => (context) => context.durableFacts[name] === true;
6
+ export const revisionLifecycle = new GraphRuntime(source, {
7
+ states: new Set(['NONE', 'REQUESTED', 'QUEUED', 'RUNNING', 'VERIFIED', 'FAILED', 'STALE']),
8
+ guards: {
9
+ reviewerAuthorized: boolGuard('reviewerAuthorized'),
10
+ reviewHeadCurrent: boolGuard('reviewHeadCurrent'),
11
+ originalTaskSucceeded: boolGuard('originalTaskSucceeded'),
12
+ changesRequiredRecorded: boolGuard('changesRequiredRecorded'),
13
+ taskRetryQueued: boolGuard('taskRetryQueued'),
14
+ },
15
+ actions: Object.fromEntries([
16
+ 'revision.recordRequest', 'revision.queueTask', 'revision.recordVerified',
17
+ 'revision.recordFailed', 'revision.markStale',
18
+ ].map(id => [id, { id }])),
19
+ events: Object.fromEntries([
20
+ 'revision.submit', 'revision.queue', 'revision.started', 'revision.verified',
21
+ 'revision.failed', 'revision.retry', 'review.head_changed', 'review.execution_changed',
22
+ ].map(id => [id, { id }])),
23
+ });
24
+ function args(state, event, facts) {
25
+ return { initialState: state, input: { transport: 'event', id: event, payload: {} }, durableFacts: facts, graphName: 'revision-lifecycle' };
26
+ }
27
+ export function decideRevisionLifecycle(state, event, facts = {}) {
28
+ return dispatchWorkflowGraphSync(revisionLifecycle, args(state, event, facts));
29
+ }
30
+ export async function dispatchRevisionLifecycle(state, event, facts = {}, executeAction) {
31
+ return dispatchWorkflowGraph(revisionLifecycle, { ...args(state, event, facts), executeAction });
32
+ }
@@ -1,3 +1,4 @@
1
+ import { revisionRequestReady } from '../review-revision-execution.js';
1
2
  import { dispatchTaskLifecycleSync } from './lifecycle.js';
2
3
  export function dependencyReady(task, tasks) {
3
4
  return task.dependencies.every(id => tasks.get(id)?.state === 'SUCCEEDED');
@@ -27,6 +28,8 @@ export function reconcileTaskDependencies(job) {
27
28
  for (const task of scopedTasks) {
28
29
  if (task.kind === 'planner')
29
30
  continue;
31
+ if (!revisionRequestReady(job, task))
32
+ continue;
30
33
  if (task.state === 'DRAFT' && task.unblock)
31
34
  continue;
32
35
  const ready = dependencyReady(task, tasks);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "2.0.209",
3
+ "version": "2.0.210",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: job-acceptance-reviewer
3
+ description: Independently evaluate one immutable review target against the complete Job objective and acceptance criteria.
4
+ capabilities: [review, evidence-verification]
5
+ restrictions: [no-artifact-edits, no-merge, preserve-review-target]
6
+ ---
7
+
8
+ # Job Acceptance Reviewer
9
+
10
+ Review exactly the immutable target/version specified by the Review Task. Do not silently substitute newer content or a different commit, document, artifact, or SHA.
11
+
12
+ ## Review Scope
13
+
14
+ As the automatically scheduled Final Review gate for the **whole Job**, reconstruct all material acceptance requirements from the durable Job objective and Task, then evaluate each with direct evidence. Check correctness, completeness, provenance, quality, regressions, explicit approvals and externally observable outcomes where applicable. Missing evidence is not PASS. If validation cannot complete, report task.failed. Keep review independent of implementation work.
15
+
16
+ For spec-oriented delivery, select read-only `speckit-analyze` to check
17
+ `spec.md`, `plan.md`, and `tasks.md` consistency when those artifacts exist.
18
+ Use `speckit-checklist` only as requirements-quality guidance; do not create
19
+ or edit checklists in this read-only Reviewer role. A Spec Kit analysis never
20
+ replaces independent implementation and acceptance-evidence review.
21
+
22
+ ## Targeted revision ownership
23
+
24
+ For actionable findings, identify the original responsible durable Task ID. When the **execution-pinned Relay CLI supports** `task revise`, submit each owner's findings with a stable request ID, the exact active Reviewer execution identity, immutable head SHA and findings file; check the durable receipt. An ambiguous owner must be reported, not guessed. Do not edit artifacts, invoke Planner for every issue, or claim CLI submission completed a revision.
25
+
26
+ **Bootstrap compatibility:** During a managed rollout that is itself introducing `task revise`, the execution-pinned CLI may not yet expose the command. Verify genuine command unavailability via its help/usage output. In that one case, **do not fail a completed review solely because the CLI does not exist**. Publish the canonical `task.completed` verdict `changes-required` with exact `head_sha`, complete actionable `data.findings` (including owner Task IDs where known), and `data.revision_submission: "cli-unavailable"`. Relay owns fallback remediation through its existing Review Graph. Never claim targeted requests were persisted. This fallback is NOT permission to ignore an available CLI's validation error, stale execution, authorization failure or missing evidence; those remain fail-closed.
27
+
28
+ ## Review Decision
29
+
30
+ Return a concrete approved or changes-required verdict tied to the declared immutable target, with attributed findings, severity and remediation steps. Do not alter artifacts, generate approvals on behalf of users, or perform publication, merges or external actions. Relay owns the review lifecycle and Task/Job completion.
31
+
32
+ ## Unified execution event
33
+
34
+ After completing the review, publish **`task.completed`**, including `data.verdict`
35
+ (`approved` or `changes-required`), the **exact immutable**
36
+ `data.head_sha`, and actionable `data.findings` for changes required. A
37
+ negative verdict is a successful review, not `task.failed`. If review
38
+ execution fails or required validation evidence is unavailable, publish `task.failed`.
39
+ Never emit `review.*` as the agent's terminal event. The event source must
40
+ match the execution identity supplied by Relay. See
41
+ the independently referenced Event Contract in the Relay Prompt (the cached Agent snapshot is not the repository directory).
@@ -27,13 +27,16 @@ For every non-satisfied objective:
27
27
 
28
28
  1. Reconstruct the end-to-end execution flow from the current durable state to objective completion.
29
29
  2. Express that flow as a compact Mermaid graph in `assessment`.
30
- 3. Mark the points in that graph that deserve durable Task boundaries.
30
+ 3. Mark only the distinct Agent responsibilities and genuine independent approval/recovery boundaries in that graph.
31
31
  4. Create only the next useful executable Task batch from those boundaries.
32
32
 
33
33
  ### Objective decomposition and convergence
34
34
 
35
- - Group implementation, deterministic tests, and self-review under the responsible Agent Task when they share one owner. Create a separate durable Task only for a genuinely independent owner, externally meaningful approval boundary, or separately recoverable outcome; do not split checks by technical layer or require a live-service test before that service can be published.
36
- - Keep technical phases and review-fix iterations within one Agent Task whenever they share responsibility, including a large multi-area implementation. Split only when different Agent roles own independent durable outcomes or a real approval/ownership boundary requires it; preserve genuine dependencies.
35
+ - **Agent-responsibility-first:** for each Plan round create at most ONE new durable Task per effective Agent role. Group design, implementation, test layers, verification and self-review into that Agent's Task internal checklist. Missing or blank `agentName` is the same `implementation` role; it does not evade deduplication.
36
+ - Split Tasks only for genuinely distinct Agent ownership (such as an independent specialist, real human approval boundary, or recovery); technical subsystems and independently testable layers are not independently owned Agents by themselves. A later Plan round may reuse an Agent role for a real revision/recovery.
37
+ - The Relay Final Review gate auto-creates `job-acceptance-reviewer`. Do not emit it as a Planner Task. The independent Final Review validates the entire Job objective, immutable head and Design Principles; worker self-review remains inside implementation work.
38
+ - Recovery/revision work belongs beneath its original artifact Task tree; a future Plan round may assign the same implementation role again when justified by new evidence.
39
+ - Group implementation, deterministic tests, and self-review under the responsible Agent Task when they share one owner; do not require a live-service test before that service can be published.
37
40
  - For a failed Task with repeated deterministic acceptance gaps, do not reissue the identical broad assignment. Identify the *missing acceptance cases*, create focused same-Job repair Tasks with valid `same_job_dependency` resolutions, and specify how their evidence unblocks the original Task. Preserve the original failed Task and failure history.
38
41
  - For event-driven workflows, require deterministic ingress/persistence, negative-path, restart and no-false-completion evidence before publishing. Do not elevate tests that require the newly published live runtime/provider/device to release-blocking Tasks merely because they are independently observable.
39
42
  - In `assessment`, show the entire remaining objective as a dependency graph, clearly distinguishing already proven work, the executable batch, subsequent verification, and Relay-owned review/merge. Never report overall `satisfied` merely because one batch has passed.
@@ -35,6 +35,13 @@ Every Implementation, Reviewer, and Troubleshooter execution publishes `task.sta
35
35
 
36
36
  A Reviewer must **not** publish unstructured `task.completed`: missing verdict or immutable head is invalid. Relay validates the Reviewer verdict; read the accepted review outcome through the matching Relay CLI.
37
37
 
38
+ ### Targeted review findings and original Task revisions
39
+
40
+ The automatically created `job-acceptance-reviewer` (historical `reviewer` records remain valid) owns the integrated Job acceptance gate, not the Implementation Agent's self-review. For blocking findings with an unambiguous original succeeded Task owner, its *active execution* calls `agents-relay task revise --repo ... --id ... --task-id ORIGINAL --review-task-id REVIEW --execution-id REVIEW_EXEC --head-sha REVIEW_SHA --request-id STABLE_ID --findings-file PATH`. A findings file is a JSON array of identified `{id, summary, evidence?}` items. Relay rejects stale execution/head, unsupported owner or conflicting request ID, and transactionally appends `review.feedback` comments and one targeted child per owner/Review round. The CLI receipt is evidence of request persistence, **not** repair or completion. The Reviewer then publishes its single correlated `task.completed` verdict `changes-required` with matching `findings` and immutable `head_sha`; the Review Graph authorizes scheduling only when all blocking findings have durable owners. No direct `task.blocked`/`task.unblocked` event is emitted by the agent.
41
+
42
+ A fix child reports its **own** correlated completion after verified repair. Downstream `dependencyValidity` policy is `order-only` by default, or explicitly `revalidate`/`rerun` per declared input. All changed upstream generations must settle before a fan-in consumer can verify or rerun. Relay derives successful revision lineage from durable Task results, then creates another fresh immutable-head Job Acceptance Review. A partially submitted message, unverified terminal, historical result or stale source SHA does not count as a fix or approval.
43
+
44
+
38
45
  ## Troubleshooter human escalation
39
46
 
40
47
  Only a real user action merits escalation. Troubleshooter invokes the Relay escalation operation, specifying the required action, resolution condition, and diagnostic context. Relay durably records the human action and blocks **the Troubleshooter Task**, leaving the original failed Task `FAILED`. This is a Relay state transition, not a third agent terminal event.
@@ -26,10 +26,16 @@ Before Task decomposition, distinguish tests achievable before publishing from l
26
26
 
27
27
  `Task.timeoutMs` is the inactivity window. Only an accepted `task.started` or newer `task.progress` event for the exact current execution resets it; duplicate, stale, and out-of-order progress does not.
28
28
 
29
+ ### Planner role-first Task granularity
30
+
31
+ New Plan rounds assign at most one newly authored Task per effective Agent role. Group design, coding, Graph changes, CLI, testing, self-review, and internal phases in the same implementation worker Task instead of decomposing by technical subsystem. A missing/blank `agentName` is normalized to `implementation` for duplicate checks. PLAN_APPLY_VALIDATION_FAILED rejects duplicate effective roles atomically, with corrective detail. Distinct Agents may own truly independent work, and a later Plan round can reuse the same role for genuine revision/recovery. The automatic SHA-bound Final Review gate creates `job-acceptance-reviewer` itself; Planner does not emit that agent as an ordinary Task. Legacy review agents and historical Plans are read compatibly.
32
+
29
33
  ### Planning graph and semantic Task tree
30
34
 
31
35
  The planning graph expresses execution flow. The Task tree expresses semantic ownership. `dependencies` answer which durable outcomes must succeed before a Task can run; `parentTaskId` answers which durable artifact or milestone owns the Task. These are independent relationships.
32
36
 
37
+ Each dependency edge may also declare `dependencyValidity`: `order-only` (the default), `revalidate` (check downstream evidence against the latest successful upstream result), or `rerun` (produce downstream verification again). Set this policy explicitly when later upstream revisions can change the validity of downstream evidence. It is execution evidence policy; it does not change Task ownership or normal DAG ordering.
38
+
33
39
  A later Planner round must inspect the existing semantic tree and attach review, revision, re-review, validation rerun, release correction, or recovery work to the existing artifact subtree. Independent milestones remain roots. `plan-N` records are provenance/history and must never be semantic parents. Existing terminal Tasks remain immutable historical evidence and may continue to own later work.
34
40
 
35
41
  ### Task input vs result
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: Dependency Revision
3
+ description: Authorizes a semantic downstream verification or rerun based on explicit edge policy and a settled dependency evidence vector.
4
+ ---
5
+ flowchart LR
6
+ %% relay: initial none
7
+ none["state: NONE"]
8
+ proposed["state: PROPOSED"]
9
+ verified["state: VERIFIED"]
10
+ stale["state: STALE"]
11
+ markStale["action: dependencyRevision.markStale"]
12
+ upstreamChanged["guard: upstreamEvidenceChanged"]
13
+ explicitPolicy["guard: explicitValidityPolicy"]
14
+ allSettled["guard: allInputsSettled"]
15
+ notDuplicated["guard: notAlreadyRecorded"]
16
+ rerunRequired["guard: rerunRequired"]
17
+ createRerun["action: dependencyRevision.createRerun"]
18
+ createRevalidation["action: dependencyRevision.createRevalidation"]
19
+ none -->|on: dependency.reconcile| upstreamChanged
20
+ upstreamChanged -->|true| explicitPolicy
21
+ explicitPolicy -->|true| allSettled
22
+ allSettled -->|true| notDuplicated
23
+ notDuplicated -->|true| rerunRequired
24
+ rerunRequired -->|true| createRerun
25
+ rerunRequired -->|false| createRevalidation
26
+ createRerun --> proposed
27
+ createRevalidation --> proposed
28
+ proposed -->|on: dependency.verified| verified
29
+ proposed -->|on: dependency.stale| markStale
30
+ markStale --> stale
@@ -41,9 +41,15 @@ cancelApproved["action: review.cancelStale"]
41
41
  cancelChanges["action: review.cancelStale"]
42
42
  cancelBlocked["action: review.cancelStale"]
43
43
  reviewUnblocked["guard: reviewUnblocked"]
44
- fixPending["action: review.createFix"]
45
- fixStarted["action: review.createFix"]
46
- fixChanges["action: review.createFix"]
44
+ targetedPending["guard: targetedRevisionRequestsReady"]
45
+ targetedStarted["guard: targetedRevisionRequestsReady"]
46
+ targetedChanges["guard: targetedRevisionRequestsReady"]
47
+ recordTargetedPending["action: review.awaitTargetedRevisions"]
48
+ recordTargetedStarted["action: review.awaitTargetedRevisions"]
49
+ recordTargetedChanges["action: review.awaitTargetedRevisions"]
50
+ ownerPending["action: review.requireOwnerResolution"]
51
+ ownerStarted["action: review.requireOwnerResolution"]
52
+ ownerChanges["action: review.requireOwnerResolution"]
47
53
  mergePending["action: review.requestMerge"]
48
54
  mergeStarted["action: review.requestMerge"]
49
55
 
@@ -96,8 +102,11 @@ pending -->|on: review.approved| autoMergePending
96
102
  autoMergePending -->|true| mergePending
97
103
  mergePending --> approved
98
104
  autoMergePending -->|false| approved
99
- pending -->|on: review.changes_required| fixPending
100
- fixPending --> changes
105
+ pending -->|on: review.changes_required| targetedPending
106
+ targetedPending -->|true| recordTargetedPending
107
+ targetedPending -->|false| ownerPending
108
+ recordTargetedPending --> changes
109
+ ownerPending --> changes
101
110
 
102
111
  %% A failed Reviewer execution may recover with a new Execution ID while
103
112
  %% the Review lifecycle remains STARTED. This is a legal re-start event;
@@ -107,10 +116,16 @@ started -->|on: review.approved| autoMergeStarted
107
116
  autoMergeStarted -->|true| mergeStarted
108
117
  mergeStarted --> approved
109
118
  autoMergeStarted -->|false| approved
110
- started -->|on: review.changes_required| fixStarted
111
- fixStarted --> changes
112
- changes -->|on: review.changes_required| fixChanges
113
- fixChanges --> changes
119
+ started -->|on: review.changes_required| targetedStarted
120
+ targetedStarted -->|true| recordTargetedStarted
121
+ targetedStarted -->|false| ownerStarted
122
+ recordTargetedStarted --> changes
123
+ ownerStarted --> changes
124
+ changes -->|on: review.changes_required| targetedChanges
125
+ targetedChanges -->|true| recordTargetedChanges
126
+ targetedChanges -->|false| ownerChanges
127
+ recordTargetedChanges --> changes
128
+ ownerChanges --> changes
114
129
 
115
130
  pending -->|on: head.changed| cancelPending
116
131
  cancelPending --> stale
@@ -118,6 +133,22 @@ started -->|on: head.changed| cancelStarted
118
133
  cancelStarted --> stale
119
134
  approved -->|on: head.changed| cancelApproved
120
135
  cancelApproved --> stale
136
+ changes -->|on: revision.settled| targetedVerified
137
+ %% Only the Review Graph selects re-review; settlement is proven by correlated
138
+ %% child terminal evidence and explicit revision request provenance.
139
+ targetedVerified["guard: targetedRevisionsVerified"]
140
+ reviewRoundAllowed["guard: reviewRoundWithinLimit"]
141
+ reviewNoProgressAllowed["guard: reviewNoProgressWithinLimit"]
142
+ prepareRereview["action: review.prepareRereview"]
143
+ limitOwnerResolution["action: review.requireOwnerResolution"]
144
+ targetedVerified -->|true| reviewRoundAllowed
145
+ reviewRoundAllowed -->|true| reviewNoProgressAllowed
146
+ reviewNoProgressAllowed -->|true| prepareRereview
147
+ reviewNoProgressAllowed -->|false| limitOwnerResolution
148
+ %% Exhausted re-review rounds require explicit owner/Planner recovery.
149
+ reviewRoundAllowed -->|false| limitOwnerResolution
150
+ limitOwnerResolution --> changes
151
+ prepareRereview --> stale
121
152
  changes -->|on: head.changed| cancelChanges
122
153
  cancelChanges --> stale
123
154
  blocked -->|on: review.retry| reviewUnblocked
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Revision Lifecycle
3
+ description: Authorizes immutable-head targeted feedback and child revision lifecycle; Task graph continues to own worker execution.
4
+ ---
5
+ flowchart LR
6
+ %% relay: initial none
7
+ none["state: NONE"]
8
+ requested["state: REQUESTED"]
9
+ queued["state: QUEUED"]
10
+ running["state: RUNNING"]
11
+ verified["state: VERIFIED"]
12
+ failed["state: FAILED"]
13
+ stale["state: STALE"]
14
+ reviewerAuthorized["guard: reviewerAuthorized"]
15
+ sameHead["guard: reviewHeadCurrent"]
16
+ ownerEligible["guard: originalTaskSucceeded"]
17
+ recordRequest["action: revision.recordRequest"]
18
+ recordQueue["action: revision.queueTask"]
19
+ recordVerified["action: revision.recordVerified"]
20
+ recordFailed["action: revision.recordFailed"]
21
+ retryQueued["guard: taskRetryQueued"]
22
+ retryQueue["action: revision.queueTask"]
23
+ markStaleRequested["action: revision.markStale"]
24
+ markStaleQueued["action: revision.markStale"]
25
+ markStaleRunning["action: revision.markStale"]
26
+ markStaleFailed["action: revision.markStale"]
27
+ verdictReady["guard: changesRequiredRecorded"]
28
+ none -->|on: revision.submit| reviewerAuthorized
29
+ reviewerAuthorized -->|true| sameHead
30
+ reviewerAuthorized -->|false| none
31
+ sameHead -->|true| ownerEligible
32
+ sameHead -->|false| none
33
+ ownerEligible -->|true| recordRequest
34
+ ownerEligible -->|false| none
35
+ recordRequest --> requested
36
+ %% Duplicate submissions are idempotent only when the durable request payload
37
+ %% matches. The reducer rejects a conflicting payload for the same request ID.
38
+ requested -->|on: revision.submit| requested
39
+ requested -->|on: revision.queue| verdictReady
40
+ verdictReady -->|true| recordQueue
41
+ verdictReady -->|false| requested
42
+ recordQueue --> queued
43
+ queued -->|on: revision.started| running
44
+ running -->|on: revision.verified| recordVerified
45
+ recordVerified --> verified
46
+ running -->|on: revision.failed| recordFailed
47
+ recordFailed --> failed
48
+ %% A failed/uncertain revision can resume only after Relay has authoritatively
49
+ %% requeued the SAME child through its recovery Graph.
50
+ failed -->|on: revision.retry| retryQueued
51
+ running -->|on: revision.retry| retryQueued
52
+ retryQueued -->|true| retryQueue
53
+ retryQueue --> queued
54
+ requested -->|on: review.head_changed| markStaleRequested
55
+ markStaleRequested --> stale
56
+ queued -->|on: review.head_changed| markStaleQueued
57
+ markStaleQueued --> stale
58
+ running -->|on: review.head_changed| markStaleRunning
59
+ markStaleRunning --> stale
60
+ failed -->|on: review.head_changed| markStaleFailed
61
+ markStaleFailed --> stale
62
+
63
+ %% A restarted reviewer execution is a new immutable review generation even
64
+ %% when the reviewed SHA is unchanged; old pending feedback cannot hold the gate.
65
+ requested -->|on: review.execution_changed| markStaleRequested
66
+ queued -->|on: review.execution_changed| markStaleQueued
67
+ running -->|on: review.execution_changed| markStaleRunning
68
+ failed -->|on: review.execution_changed| markStaleFailed