@zq-silk/yui 0.15.7 → 0.15.9
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/ARCHITECTURE.md +194 -399
- package/ARCHITECTURE.zh-CN.md +151 -0
- package/README.md +306 -1131
- package/dist/agent/adapterCatalog.js +15 -2
- package/dist/agent/agent.js +23 -3
- package/dist/agent/argumentPolicy.js +7 -1
- package/dist/agent/connectionPlan.js +62 -0
- package/dist/agent/executionComponents.js +158 -0
- package/dist/agent/launchEnvironment.js +31 -3
- package/dist/agent/managedRuntimeEnvironment.js +3 -5
- package/dist/{turn/turn.js → agentRun/agentRun.js} +166 -109
- package/dist/{turn/turnIdentity.js → agentRun/runIdentity.js} +4 -4
- package/dist/artifacts/artifactCapability.js +74 -0
- package/dist/artifacts/artifactCommitLock.js +249 -0
- package/dist/artifacts/artifactPaths.js +151 -0
- package/dist/artifacts/gitArtifactRef.js +146 -0
- package/dist/artifacts/managedGit.js +332 -0
- package/dist/artifacts/taskArtifactRepository.js +277 -0
- package/dist/brief/taskBrief.js +12 -0
- package/dist/cli/agentConfigurationPicker.js +13 -0
- package/dist/cli/commandCatalog.js +165 -74
- package/dist/cli/interactionCandidates.js +5 -5
- package/dist/cli/interactionPolicy.js +38 -8
- package/dist/cli/invocationRouter.js +1 -1
- package/dist/cli/managedDiagnostics.js +28 -0
- package/dist/cli/operatorWizard.js +1 -7
- package/dist/cli/roleOptionOrder.js +27 -0
- package/dist/cli/roleWizard.js +50 -14
- package/dist/cli/updateOrchestrator.js +1 -1
- package/dist/cli/updatePorts.js +3 -4
- package/dist/cli.js +245 -95
- package/dist/commands/agentCommands.js +72 -14
- package/dist/commands/capabilityCommands.js +9 -6
- package/dist/commands/configCommands.js +20 -20
- package/dist/commands/deliveryGuardPreflight.js +2 -2
- package/dist/commands/executionAuditCommands.js +24 -24
- package/dist/commands/globalRoleCommands.js +1 -1
- package/dist/commands/grantCommands.js +4 -4
- package/dist/commands/operatorCommands.js +34 -9
- package/dist/commands/projectCommands.js +4 -4
- package/dist/commands/resourcesCommands.js +2 -2
- package/dist/commands/roleConfiguration.js +25 -5
- package/dist/commands/roleRuntimeGuard.js +4 -5
- package/dist/commands/sessionCommands.js +3 -7
- package/dist/commands/taskActivationCommands.js +281 -0
- package/dist/commands/taskActor.js +28 -49
- package/dist/commands/taskCommands.js +1461 -720
- package/dist/commands/taskContextCommand.js +39 -583
- package/dist/commands/taskExecutionCommands.js +32 -32
- package/dist/commands/taskInputCommands.js +40 -104
- package/dist/commands/taskIntegrationCommands.js +3 -2
- package/dist/commands/taskIntegrationQueueCommands.js +1 -1
- package/dist/commands/taskNextActionCommand.js +8 -8
- package/dist/commands/taskOverviewCommand.js +33 -45
- package/dist/commands/taskRemoteDeliveryCommand.js +2 -2
- package/dist/commands/taskRoleRuntimeStatus.js +133 -102
- package/dist/commands/telemetryCommands.js +36 -38
- package/dist/config/configCatalog.js +4 -4
- package/dist/config/yuiConfig.js +8 -8
- package/dist/context/contextSnapshot.js +10 -10
- package/dist/context/dispatchContext.js +11 -11
- package/dist/context/roleSessionContext.js +6 -3
- package/dist/context/{turnContextPack.js → runContextPack.js} +158 -81
- package/dist/context/{turnInputContract.js → runInputContract.js} +73 -60
- package/dist/context/sessionBootstrapManifest.js +21 -2
- package/dist/context/sourceRunContext.js +30 -0
- package/dist/context/taskContext.js +481 -0
- package/dist/context/wakeNotification.js +27 -27
- package/dist/controller/agentRuntimeObserver.js +21 -24
- package/dist/controller/capabilityBridge.js +17 -6
- package/dist/controller/clientRuntime.js +65 -92
- package/dist/controller/controller.js +120 -188
- package/dist/controller/fileSchedulerStoreAdapter.js +787 -887
- package/dist/controller/jobControl.js +54 -85
- package/dist/controller/resourceInventory.js +8 -27
- package/dist/controller/resourceInventoryLinux.js +12 -13
- package/dist/controller/runtime.js +529 -479
- package/dist/controller/runtimeEventInbox.js +55 -25
- package/dist/controller/runtimeEventProcessor.js +22 -31
- package/dist/controller/{runtimeHookTurnFence.js → runtimeHookRunFence.js} +91 -115
- package/dist/controller/runtimeLaunchCoordinator.js +80 -426
- package/dist/controller/runtimeObservationHook.js +14 -18
- package/dist/controller/sessionNotify.js +16 -24
- package/dist/controller/sessionOwnerReconciliation.js +168 -50
- package/dist/controller/structuredProviderObservation.js +138 -99
- package/dist/coordination/workMailbox.js +3 -3
- package/dist/coordination/workMailboxQueue.js +36 -33
- package/dist/core/boundedRpc.js +8 -1
- package/dist/core/controllerClient.js +20 -1
- package/dist/core/controllerServer.js +4 -4
- package/dist/doctor/doctor.js +13 -2
- package/dist/domain/agentResultTransport.js +9 -9
- package/dist/execution/codexThreadNaming.js +2 -8
- package/dist/execution/executionHealth.js +51 -63
- package/dist/execution/reviewMainRun.js +137 -0
- package/dist/execution/workItemExecution.js +28 -29
- package/dist/execution/workItemExecutionProjection.js +99 -107
- package/dist/execution/workItemMainRun.js +141 -0
- package/dist/executor/agentAdapter.js +227 -20
- package/dist/executor/agentConfigurationCatalog.js +126 -4
- package/dist/executor/agentConfigurationProbe.js +162 -4
- package/dist/executor/agentExecutor.js +79 -78
- package/dist/executor/effectiveLaunch.js +105 -18
- package/dist/executor/executorRegistry.js +29 -44
- package/dist/executor/fileRoleLaunchPlanner.js +229 -154
- package/dist/executor/workspacePreflightClassification.js +16 -16
- package/dist/grant/capabilityGrant.js +6 -3
- package/dist/input/inputRequest.js +12 -10
- package/dist/integration/gitIntegrationService.js +4 -11
- package/dist/integration/integrationQueueService.js +4 -4
- package/dist/interaction/operatorPresentation.js +1 -1
- package/dist/kernel/builtinCapabilities.js +255 -12
- package/dist/kernel/capabilityRegistry.js +64 -18
- package/dist/kernel/instanceHost.js +12 -1
- package/dist/kernel/kernelPorts.js +2 -2
- package/dist/lifecycle/canonicalLifecycleEvent.js +44 -49
- package/dist/lifecycle/exactRunTerminalization.js +449 -0
- package/dist/message/message.js +118 -6
- package/dist/message/messageContinuation.js +204 -0
- package/dist/observability/executionAudit.js +70 -72
- package/dist/observability/faultClassification.js +2 -2
- package/dist/observability/orchestrationMetrics.js +8 -8
- package/dist/operator/operatorSessionHistory.js +1 -7
- package/dist/output/agentConfigurationPresentation.js +8 -3
- package/dist/output/agentRunConfigurationPresentation.js +128 -0
- package/dist/output/rolePresentation.js +54 -3
- package/dist/plugins/pluginChild.js +104 -0
- package/dist/plugins/pluginIntent.js +26 -0
- package/dist/plugins/pluginInterpreter.js +43 -0
- package/dist/plugins/pluginPackage.js +101 -0
- package/dist/plugins/pluginProcess.js +112 -0
- package/dist/plugins/pluginService.js +388 -0
- package/dist/profile/agentProfile.js +1 -1
- package/dist/repository/gitWorkspace.js +26 -4
- package/dist/repository/project.js +19 -4
- package/dist/repository/taskBaseFreshness.js +13 -13
- package/dist/repository/taskWorkspaceCoordinator.js +20 -27
- package/dist/repository/taskWorkspacePreparer.js +344 -83
- package/dist/resources/autoResourceGc.js +3 -3
- package/dist/resources/liveReferences.js +3 -3
- package/dist/resources/projectResource.js +75 -0
- package/dist/resources/projectResourceService.js +343 -0
- package/dist/resources/resourceDiscovery.js +6 -6
- package/dist/resources/resourceGc.js +1 -1
- package/dist/resources/resourceRegistrar.js +1 -1
- package/dist/resources/resourceTypes.js +1 -1
- package/dist/review/deltaRecheck.js +3 -3
- package/dist/review/reviewAcceptance.js +16 -16
- package/dist/review/reviewDecision.js +7 -7
- package/dist/review/reviewRound.js +21 -20
- package/dist/review/reviewerAvailability.js +2 -2
- package/dist/role/role.js +51 -7
- package/dist/role/taskRoleUpdate.js +30 -0
- package/dist/runtime/acpProtocol.js +425 -0
- package/dist/runtime/acpSession.js +731 -0
- package/dist/runtime/acpSessionConfiguration.js +260 -0
- package/dist/runtime/agentDriver.js +30 -11
- package/dist/runtime/agentEndpoint.js +278 -0
- package/dist/runtime/agentEndpointIdentity.js +86 -0
- package/dist/runtime/agentEndpointOwnership.js +239 -0
- package/dist/runtime/agentError.js +2 -10
- package/dist/runtime/agentHost.js +565 -314
- package/dist/runtime/agentRunConfiguration.js +258 -0
- package/dist/runtime/builtinAgentDrivers.js +134 -18
- package/dist/runtime/builtinAgentErrorMappers.js +55 -3
- package/dist/runtime/builtinTranscriptUsage.js +1 -1
- package/dist/runtime/claude-process-owner +0 -0
- package/dist/runtime/codexAppServerRuntime.js +38 -30
- package/dist/runtime/codexInteractiveHost.js +41 -6
- package/dist/runtime/continuationManager.js +2 -6
- package/dist/runtime/executionEnvironment.js +30 -0
- package/dist/runtime/firstProgressAdvisory.js +11 -11
- package/dist/runtime/index.js +4 -3
- package/dist/runtime/jsonLineChannel.js +109 -0
- package/dist/runtime/launchBroker.js +91 -16
- package/dist/runtime/launchDiagnostics.js +2 -2
- package/dist/runtime/lifecycleReservation.js +10 -18
- package/dist/runtime/managedCaller.js +61 -17
- package/dist/runtime/nativeSessionControl.js +102 -0
- package/dist/runtime/ports.js +6 -21
- package/dist/runtime/processExitObservation.js +8 -7
- package/dist/runtime/promptEnvelope.js +17 -6
- package/dist/runtime/providerContinuation.js +3 -9
- package/dist/runtime/providerContinuationReconciliationService.js +4 -13
- package/dist/runtime/providerControl.js +2 -7
- package/dist/runtime/providerRuntimeIdentity.js +110 -222
- package/dist/runtime/providerRuntimeReconciler.js +5 -9
- package/dist/runtime/runtimeBinding.js +0 -1
- package/dist/runtime/runtimeContinuationProjection.js +4 -7
- package/dist/runtime/runtimeDeadlines.js +9 -0
- package/dist/runtime/runtimeHealthPolicy.js +1 -1
- package/dist/runtime/runtimeObservation.js +29 -65
- package/dist/runtime/runtimeProjection.js +43 -51
- package/dist/runtime/runtimeSessionCandidate.js +1 -3
- package/dist/runtime/sessionLaunchRequest.js +3 -7
- package/dist/runtime/sessionOwnerIdentity.js +7 -54
- package/dist/runtime/sessionOwnerRegistry.js +22 -17
- package/dist/runtime/sessionReconciliation.js +4 -8
- package/dist/runtime/sessionTerminationGuard.js +70 -259
- package/dist/runtime/sessionTokenMetrics.js +5 -16
- package/dist/runtime/structuredProviderHost.js +237 -117
- package/dist/runtime/taskRuntimeIsolation.js +39 -122
- package/dist/runtime/tmuxAdapters.js +39 -86
- package/dist/scheduler/activeRoleRunDelivery.js +354 -0
- package/dist/scheduler/leaderWakeupProcessor.js +75 -266
- package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
- package/dist/scheduler/ports.js +80 -9
- package/dist/scheduler/{roleTurnLiveness.js → roleRunLiveness.js} +26 -30
- package/dist/scheduler/{roleTurnStall.js → roleRunStall.js} +128 -139
- package/dist/scheduler/taskExecutionProjection.js +120 -124
- package/dist/scheduler/taskObservabilityProjection.js +29 -29
- package/dist/scheduler/taskWake.js +11 -4
- package/dist/scheduler/wakeReason.js +9 -1
- package/dist/setup/setupCommand.js +3 -7
- package/dist/storage/migrations/agentRunContract.js +159 -0
- package/dist/storage/migrations/artifactsToGit.js +338 -0
- package/dist/storage/migrations/removeRuntimeGeneration.js +207 -0
- package/dist/storage/migrations/submitIntent.js +126 -0
- package/dist/storage/sqliteSchema.js +467 -7
- package/dist/storage/sqliteStore.js +355 -220
- package/dist/storage/storageVersions.js +1 -1
- package/dist/storage/storeRpc.js +10 -5
- package/dist/storage/taskStore.js +13 -11
- package/dist/storage/upgrade/upgradeOrchestrator.js +5 -7
- package/dist/surface/surfaceContributions.js +102 -0
- package/dist/task/completionReadiness.js +32 -6
- package/dist/task/deliveryGuard.js +16 -16
- package/dist/task/draftPlan.js +72 -12
- package/dist/task/nextAction.js +144 -128
- package/dist/task/remoteDelivery.js +6 -6
- package/dist/task/task.js +184 -18
- package/dist/task/taskActivation.js +327 -0
- package/dist/task/taskActivationService.js +408 -0
- package/dist/task/taskRecordReference.js +5 -4
- package/dist/task/taskRecordRetirement.js +1 -1
- package/dist/task/taskSubmission.js +236 -0
- package/dist/telemetry/sqliteTelemetryStore.js +55 -68
- package/dist/telemetry/telemetryConfig.js +14 -14
- package/dist/telemetry/telemetryWiring.js +2 -2
- package/dist/web/assets/assetManifest.js +2 -0
- package/dist/web/assets/client/app.js +121 -20
- package/dist/web/assets/client/components.js +87 -54
- package/dist/web/assets/client/i18n.js +83 -41
- package/dist/web/assets/client/markdown.js +1 -1
- package/dist/web/assets/client/taskSurface.js +442 -0
- package/dist/web/assets/client/view.js +49 -44
- package/dist/web/assets/shell.js +1 -1
- package/dist/web/assets/styles/cards.js +22 -4
- package/dist/web/controllerWeb.js +60 -0
- package/dist/web/webMutation.js +28 -0
- package/dist/web/webServer.js +133 -8
- package/dist/web/webSnapshot.js +81 -74
- package/dist/web/webTaskSurface.js +64 -0
- package/dist/workItem/dependencyGate.js +1 -1
- package/dist/workItem/workItem.js +84 -48
- package/dist/workspace/workItemChangeSetManager.js +16 -9
- package/docs/agent-result-consumption.md +96 -0
- package/docs/agent-result-consumption.zh-CN.md +81 -0
- package/docs/agent-runtime-drivers.md +93 -0
- package/docs/agent-runtime-drivers.zh-CN.md +77 -0
- package/docs/architecture/README.md +50 -0
- package/docs/architecture/README.zh-CN.md +43 -0
- package/docs/architecture/capabilities-and-resources.md +118 -0
- package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
- package/docs/managed-turn-and-session-runtime.md +224 -0
- package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
- package/docs/observability/README.md +83 -0
- package/docs/observability/README.zh-CN.md +71 -0
- package/docs/plugin-sdk.md +393 -0
- package/docs/plugin-sdk.zh-CN.md +293 -0
- package/docs/provider-runtime.md +165 -0
- package/docs/provider-runtime.zh-CN.md +132 -0
- package/docs/release-workflow.md +305 -0
- package/docs/release-workflow.zh-CN.md +237 -0
- package/docs/roles-and-configuration.md +115 -0
- package/docs/roles-and-configuration.zh-CN.md +96 -0
- package/docs/sqlite-control-plane-design.md +78 -0
- package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
- package/docs/task-dag-semantics.md +80 -0
- package/docs/task-dag-semantics.zh-CN.md +59 -0
- package/docs/task-delivery.md +105 -0
- package/docs/task-delivery.zh-CN.md +82 -0
- package/docs/task-local-identity.md +8 -6
- package/docs/task-local-identity.zh-CN.md +58 -0
- package/docs/testing/verification-levels.md +88 -0
- package/docs/testing/verification-levels.zh-CN.md +69 -0
- package/i18n/README.zh-CN.md +270 -722
- package/package.json +3 -2
- package/skills/yui-leader/SKILL.md +88 -304
- package/skills/yui-leader/references/execution.md +303 -0
- package/skills/yui-leader/references/integration.md +39 -0
- package/skills/yui-leader/references/planning.md +109 -0
- package/skills/yui-leader/references/replicated-execution.md +42 -0
- package/skills/yui-leader/references/task-plugins.md +37 -0
- package/skills/yui-operator/SKILL.md +46 -62
- package/skills/yui-reviewer/SKILL.md +35 -36
- package/skills/yui-runtime/SKILL.md +88 -24
- package/skills/yui-runtime/references/publication.md +22 -0
- package/skills/yui-runtime/references/recovery.md +64 -0
- package/skills/yui-worker/SKILL.md +37 -39
- package/dist/cli/roleOptionCatalog.js +0 -68
- package/dist/context/sourceTurnContext.js +0 -30
- package/dist/execution/reviewMainTurn.js +0 -161
- package/dist/execution/workItemMainTurn.js +0 -164
- package/dist/lifecycle/exactTurnTerminalization.js +0 -407
- package/dist/runtime/preallocatedNativeSession.js +0 -13
- package/dist/runtime/runtimeStopReceipt.js +0 -42
- package/dist/scheduler/activeRoleTurnDelivery.js +0 -315
package/dist/task/nextAction.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { governingWorkItemDeliveries, workItemDeliverySettled } from "../integration/deliveryObligation.js";
|
|
3
|
-
import {
|
|
3
|
+
import { isCompletedTaskReviewEvidenceFromRuns } from "../review/reviewAcceptance.js";
|
|
4
4
|
import { actionableExecutionLaneRecoveries } from "../execution/executionHealth.js";
|
|
5
5
|
import { sameTaskFinalReviewContract } from "../review/taskFinalReviewContract.js";
|
|
6
6
|
import { resolveRecordedTaskFinalReviewContract } from "../review/taskFinalReviewContractResolution.js";
|
|
7
7
|
import { draftWorkItemDependencyIssue } from "./draftPlan.js";
|
|
8
|
-
import { currentWorkItemCandidate, governingWorkItemCandidate } from "../workItem/workItem.js";
|
|
9
|
-
const OPEN_WORK_ITEM_STATUSES = new Set(["
|
|
8
|
+
import { currentWorkItemCandidate, currentWorkItemExecutionGroup, governingWorkItemCandidate } from "../workItem/workItem.js";
|
|
9
|
+
const OPEN_WORK_ITEM_STATUSES = new Set(["open"]);
|
|
10
10
|
export function projectNextAction(facts) {
|
|
11
11
|
const { task } = facts;
|
|
12
12
|
const deliveryWorkItems = facts.workItems.filter(({ status }) => status !== "retired");
|
|
@@ -55,18 +55,18 @@ export function projectNextAction(facts) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
const laneRecovery = actionableExecutionLaneRecoveries(facts.executionGroups ?? [])
|
|
58
|
-
.find(
|
|
58
|
+
.find(hasExactRun);
|
|
59
59
|
if (laneRecovery !== undefined) {
|
|
60
60
|
return buildExecutionLaneRecoveryAction(facts, laneRecovery);
|
|
61
61
|
}
|
|
62
|
-
const activeLeader = facts.
|
|
62
|
+
const activeLeader = facts.activeRuns.find((run) => run.roleName === "leader");
|
|
63
63
|
if (activeLeader !== undefined) {
|
|
64
64
|
return buildAction(facts, {
|
|
65
65
|
kind: "wait-for-owned-execution",
|
|
66
|
-
reason: `Leader
|
|
67
|
-
refs: [ref("
|
|
66
|
+
reason: `Leader AgentRun ${activeLeader.id} is active; the protocol position is being executed.`,
|
|
67
|
+
refs: [ref("run", activeLeader.id)],
|
|
68
68
|
preconditions: [
|
|
69
|
-
{ fact: "Leader
|
|
69
|
+
{ fact: "Leader AgentRun is active", satisfied: true, ref: ref("run", activeLeader.id) }
|
|
70
70
|
]
|
|
71
71
|
});
|
|
72
72
|
}
|
|
@@ -121,29 +121,58 @@ export function projectNextAction(facts) {
|
|
|
121
121
|
recommendedCommand: `yui task activate ${task.id}`
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
+
const checkingIntegration = facts.integrations.find(attempt => attempt.status === "running" && attempt.jobId !== undefined);
|
|
125
|
+
if (checkingIntegration !== undefined) {
|
|
126
|
+
const job = facts.integrationJobs?.find(job => job.id === checkingIntegration.jobId);
|
|
127
|
+
const refs = [ref("integration", checkingIntegration.id), ref("job", checkingIntegration.jobId)];
|
|
128
|
+
if (job?.status === "queued" || job?.status === "running") {
|
|
129
|
+
return buildAction(facts, {
|
|
130
|
+
kind: "wait-for-owned-execution",
|
|
131
|
+
reason: `Integration ${checkingIntegration.id} check Job ${job.id} is ${job.status}.`,
|
|
132
|
+
refs,
|
|
133
|
+
preconditions: [{ fact: "Check Job is still executing", satisfied: true, ref: refs[1] }],
|
|
134
|
+
alternatives: [{
|
|
135
|
+
kind: "continue-integration",
|
|
136
|
+
reason: "When the check Job settles, continue this exact Integration to consume its result.",
|
|
137
|
+
recommendedCommand: `yui task integration continue ${task.id}/${checkingIntegration.id}`
|
|
138
|
+
}]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return buildAction(facts, {
|
|
142
|
+
kind: "integrate-work-item",
|
|
143
|
+
reason: `Integration ${checkingIntegration.id} awaits check-result consumption (${job?.status ?? "read current Job"}); an empty integration queue does not finalize this direct attempt.`,
|
|
144
|
+
refs,
|
|
145
|
+
preconditions: [{ fact: "The Integration retains its exact check Job", satisfied: true, ref: refs[0] }],
|
|
146
|
+
recommendedCommand: `yui task integration continue ${task.id}/${checkingIntegration.id}`
|
|
147
|
+
});
|
|
148
|
+
}
|
|
124
149
|
const candidateReady = facts.workItems
|
|
125
|
-
.find((item) => item.status === "
|
|
150
|
+
.find((item) => (item.status === "open" && item.currentCandidateId !== undefined));
|
|
126
151
|
if (candidateReady !== undefined) {
|
|
127
152
|
const candidate = currentWorkItemCandidate(candidateReady);
|
|
128
153
|
const activeReview = latestActiveWorkItemReview(facts.reviewRounds, candidateReady, candidate);
|
|
129
154
|
if (activeReview !== undefined) {
|
|
130
155
|
const reviewRef = ref("review-round", activeReview.id);
|
|
131
156
|
if (activeReview.status === "running") {
|
|
132
|
-
if (activeReview.
|
|
157
|
+
if (activeReview.reviewerRunId === undefined
|
|
133
158
|
&& activeReview.executionGroup === undefined) {
|
|
134
159
|
return buildAction(facts, {
|
|
135
160
|
kind: "repair-protocol-inconsistency",
|
|
136
|
-
reason: `ReviewRound ${activeReview.id} is running but has no Reviewer
|
|
161
|
+
reason: `ReviewRound ${activeReview.id} is running but has no Reviewer AgentRun.`,
|
|
137
162
|
refs: [reviewRef],
|
|
138
163
|
conflicts: [reviewRef],
|
|
139
164
|
preconditions: [
|
|
140
|
-
{ fact: "Running ReviewRound has an exact Reviewer
|
|
165
|
+
{ fact: "Running ReviewRound has an exact Reviewer AgentRun", satisfied: false, ref: reviewRef }
|
|
141
166
|
]
|
|
142
167
|
});
|
|
143
168
|
}
|
|
144
|
-
const reviewRun = activeReviewRoundRun(activeReview, facts.
|
|
169
|
+
const reviewRun = activeReviewRoundRun(activeReview, facts.activeRuns);
|
|
145
170
|
if (reviewRun === undefined) {
|
|
146
|
-
if (
|
|
171
|
+
if (activeReview.executionGroup !== undefined && activeReview.reviewerRunId === undefined
|
|
172
|
+
&& !reviewGroupNeedsDispatch(activeReview, facts.activeRuns)) {
|
|
173
|
+
return synthesisSelectionAction(facts, "review", activeReview.id);
|
|
174
|
+
}
|
|
175
|
+
if (reviewGroupNeedsDispatch(activeReview, facts.activeRuns)) {
|
|
147
176
|
return buildAction(facts, {
|
|
148
177
|
kind: "resume-review",
|
|
149
178
|
reason: `ReviewRound ${activeReview.id} has Review Producer Lanes ready for dispatch or retry.`,
|
|
@@ -155,12 +184,12 @@ export function projectNextAction(facts) {
|
|
|
155
184
|
+ reviewLaneRoleOptions(activeReview)
|
|
156
185
|
});
|
|
157
186
|
}
|
|
158
|
-
const runRef = activeReview.
|
|
187
|
+
const runRef = activeReview.reviewerRunId === undefined
|
|
159
188
|
? reviewRef
|
|
160
|
-
: ref("
|
|
189
|
+
: ref("run", activeReview.reviewerRunId);
|
|
161
190
|
return buildAction(facts, {
|
|
162
191
|
kind: "repair-protocol-inconsistency",
|
|
163
|
-
reason: `ReviewRound ${activeReview.id} has no active Producer or main Reviewer
|
|
192
|
+
reason: `ReviewRound ${activeReview.id} has no active Producer or main Reviewer AgentRun.`,
|
|
164
193
|
refs: [reviewRef, runRef],
|
|
165
194
|
conflicts: [reviewRef, runRef],
|
|
166
195
|
preconditions: [
|
|
@@ -170,23 +199,23 @@ export function projectNextAction(facts) {
|
|
|
170
199
|
}
|
|
171
200
|
return buildAction(facts, {
|
|
172
201
|
kind: "wait-for-owned-execution",
|
|
173
|
-
reason: `Reviewer
|
|
174
|
-
refs: [reviewRef, ref("
|
|
202
|
+
reason: `Reviewer AgentRun ${reviewRun.id} is evaluating Candidate ${candidateReady.id}/${candidate?.id ?? "unknown"}.`,
|
|
203
|
+
refs: [reviewRef, ref("run", reviewRun.id)],
|
|
175
204
|
preconditions: [
|
|
176
205
|
{ fact: "ReviewRound is running", satisfied: true, ref: reviewRef },
|
|
177
|
-
{ fact: "Reviewer
|
|
206
|
+
{ fact: "Reviewer AgentRun is active", satisfied: true, ref: ref("run", reviewRun.id) }
|
|
178
207
|
]
|
|
179
208
|
});
|
|
180
209
|
}
|
|
181
|
-
if (activeReview.
|
|
182
|
-
const runRef = ref("
|
|
210
|
+
if (activeReview.reviewerRunId !== undefined) {
|
|
211
|
+
const runRef = ref("run", activeReview.reviewerRunId);
|
|
183
212
|
return buildAction(facts, {
|
|
184
213
|
kind: "repair-protocol-inconsistency",
|
|
185
|
-
reason: `Pending ReviewRound ${activeReview.id} already references Reviewer
|
|
214
|
+
reason: `Pending ReviewRound ${activeReview.id} already references Reviewer AgentRun ${activeReview.reviewerRunId}.`,
|
|
186
215
|
refs: [reviewRef, runRef],
|
|
187
216
|
conflicts: [reviewRef, runRef],
|
|
188
217
|
preconditions: [
|
|
189
|
-
{ fact: "Pending ReviewRound has no Reviewer
|
|
218
|
+
{ fact: "Pending ReviewRound has no Reviewer AgentRun", satisfied: false, ref: runRef }
|
|
190
219
|
]
|
|
191
220
|
});
|
|
192
221
|
}
|
|
@@ -196,7 +225,7 @@ export function projectNextAction(facts) {
|
|
|
196
225
|
refs: [reviewRef],
|
|
197
226
|
preconditions: [
|
|
198
227
|
{ fact: "ReviewRound is pending", satisfied: true, ref: reviewRef },
|
|
199
|
-
{ fact: "Reviewer
|
|
228
|
+
{ fact: "Reviewer AgentRun exists", satisfied: false }
|
|
200
229
|
],
|
|
201
230
|
recommendedCommand: `yui task work review ${task.id}/${candidateReady.id}`
|
|
202
231
|
+ reviewLaneRoleOptions(activeReview)
|
|
@@ -256,35 +285,15 @@ export function projectNextAction(facts) {
|
|
|
256
285
|
judgmentRequired: `Leader must judge Candidate ${candidateReady.id}/${candidate?.id ?? "unknown"} against the Task objective, acceptance criteria, and delivery risk.`
|
|
257
286
|
});
|
|
258
287
|
}
|
|
259
|
-
//
|
|
288
|
+
// AgentRun purpose owns routing. Review AgentRuns remain attached to their exact
|
|
260
289
|
// ReviewRound branches below instead of being mistaken for Worker delivery.
|
|
261
|
-
const activeDelegatedExecutions = facts.
|
|
290
|
+
const activeDelegatedExecutions = facts.activeRuns.filter((run) => (run.purpose === "execution" && run.roleName !== "leader"));
|
|
262
291
|
if (activeDelegatedExecutions.length > 0) {
|
|
263
292
|
return buildAction(facts, {
|
|
264
293
|
kind: "wait-for-owned-execution",
|
|
265
|
-
reason: `${activeDelegatedExecutions.length} delegated execution
|
|
266
|
-
refs: activeDelegatedExecutions.map((run) => ref("
|
|
267
|
-
preconditions: activeDelegatedExecutions.map((run) => ({ fact: `Execution
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
const failedWork = facts.workItems.find((item) => item.status === "failed");
|
|
271
|
-
if (failedWork !== undefined) {
|
|
272
|
-
const failedReview = latestFailedReviewFor(facts.reviewRounds, failedWork.id);
|
|
273
|
-
return buildAction(facts, {
|
|
274
|
-
kind: "implement-current-work-item",
|
|
275
|
-
reason: failedReview === undefined
|
|
276
|
-
? `Work Item ${failedWork.id} failed; retry implementation after Leader diagnosis.`
|
|
277
|
-
: `Work Item ${failedWork.id} failed after Review ${failedReview.id}; the Leader must read its exact Reviewer Turn result and choose the repair.`,
|
|
278
|
-
refs: [
|
|
279
|
-
ref("work-item", failedWork.id),
|
|
280
|
-
...(failedReview === undefined ? [] : [ref("review-round", failedReview.id)])
|
|
281
|
-
],
|
|
282
|
-
preconditions: [
|
|
283
|
-
{ fact: "Work Item is failed", satisfied: true, ref: ref("work-item", failedWork.id) }
|
|
284
|
-
],
|
|
285
|
-
recommendedCommand: failedWork.assignee === undefined
|
|
286
|
-
? `yui task work update ${task.id}/${failedWork.id} running`
|
|
287
|
-
: `yui task work dispatch ${task.id}/${failedWork.id}`
|
|
294
|
+
reason: `${activeDelegatedExecutions.length} delegated execution AgentRun(s) are active; wait for their completion.`,
|
|
295
|
+
refs: activeDelegatedExecutions.map((run) => ref("run", run.id)),
|
|
296
|
+
preconditions: activeDelegatedExecutions.map((run) => ({ fact: `Execution AgentRun ${run.id} is active`, satisfied: true, ref: ref("run", run.id) }))
|
|
288
297
|
});
|
|
289
298
|
}
|
|
290
299
|
const openWork = selectOpenWorkItem(facts.workItems);
|
|
@@ -305,6 +314,11 @@ export function projectNextAction(facts) {
|
|
|
305
314
|
}
|
|
306
315
|
if (openWork?.kind === "ready") {
|
|
307
316
|
const item = openWork.item;
|
|
317
|
+
const group = currentWorkItemExecutionGroup(item);
|
|
318
|
+
if (item.status === "open" && group !== undefined
|
|
319
|
+
&& !facts.activeRuns.some((run) => run.sourceExecutionGroupId === group.id)) {
|
|
320
|
+
return synthesisSelectionAction(facts, "work", item.id);
|
|
321
|
+
}
|
|
308
322
|
const refs = [ref("work-item", item.id)];
|
|
309
323
|
return buildAction(facts, {
|
|
310
324
|
kind: "implement-current-work-item",
|
|
@@ -342,24 +356,20 @@ export function projectNextAction(facts) {
|
|
|
342
356
|
refs: [ref("task", task.id)]
|
|
343
357
|
}];
|
|
344
358
|
return buildAction(facts, {
|
|
345
|
-
kind: "
|
|
346
|
-
reason: task.
|
|
347
|
-
? `Task ${task.id} is a Leader-owned bugfix; implement and verify it on Task main without manufacturing a WorkItem.`
|
|
348
|
-
: task.type === "feature"
|
|
349
|
-
? `Feature ${task.id} has no independent delivery units; the Leader may implement it on Task main or create WorkItems only if separate ownership is genuinely useful.`
|
|
350
|
-
: `Task ${task.id} has no independent delivery units; the Leader decides whether to own it on Task main or create WorkItems only if separate ownership is genuinely useful.`,
|
|
359
|
+
kind: "advance-task",
|
|
360
|
+
reason: `Task ${task.id} has no recorded WorkItems. This does not determine its required topology or prove completion; advance the user's persisted requirements and Brief.`,
|
|
351
361
|
refs: [ref("task", task.id)],
|
|
352
362
|
preconditions: [
|
|
353
363
|
{ fact: "Task is active", satisfied: task.status === "active", ref: ref("task", task.id) },
|
|
354
364
|
{ fact: "Task main is clean, committed, and verified", satisfied: false }
|
|
355
365
|
],
|
|
356
|
-
recommendedCommand: `yui task
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
366
|
+
recommendedCommand: `yui task context ${task.id} --json`,
|
|
367
|
+
alternatives: [...reviewAlternative, {
|
|
368
|
+
kind: "complete-task",
|
|
369
|
+
reason: "Complete only after every requested outcome, delegation and Review requirement is satisfied and verified; record counts and a clean commit alone do not prove that.",
|
|
370
|
+
recommendedCommand: `yui task complete ${task.id} --summary-file -`
|
|
371
|
+
}],
|
|
372
|
+
judgmentRequired: "Honor explicit user/Project requirements first. Otherwise choose direct work or independently owned WorkItems and proportionate Review. This projection does not authorize weakening the Task Contract."
|
|
363
373
|
});
|
|
364
374
|
}
|
|
365
375
|
const unintegrated = governingWorkItemDeliveries(facts.workItems)
|
|
@@ -386,24 +396,24 @@ export function projectNextAction(facts) {
|
|
|
386
396
|
const failedFinal = latestTaskFinalReview(facts.reviewRounds, finalReviewContract);
|
|
387
397
|
if (finalReviewRequired
|
|
388
398
|
&& failedFinal?.status === "failed") {
|
|
389
|
-
const
|
|
399
|
+
const reviewerRun = failedFinal.reviewerRunId === undefined
|
|
390
400
|
? undefined
|
|
391
|
-
: facts.reviewOutcomeEvidence?.
|
|
392
|
-
const sameRoundCommand = failedFinal.
|
|
401
|
+
: facts.reviewOutcomeEvidence?.runs.find(({ id }) => id === failedFinal.reviewerRunId);
|
|
402
|
+
const sameRoundCommand = failedFinal.reviewerRunId === undefined
|
|
393
403
|
? `yui task review retry ${task.id}/${failedFinal.id}`
|
|
394
|
-
:
|
|
395
|
-
? `yui task
|
|
404
|
+
: reviewerRun?.status === "failed"
|
|
405
|
+
? `yui task run retry ${task.id}/${reviewerRun.id}`
|
|
396
406
|
: undefined;
|
|
397
407
|
return buildAction(facts, {
|
|
398
408
|
kind: "resume-review",
|
|
399
409
|
reason: `Task-final Review ${failedFinal.id} failed during execution: ${failedFinal.failure?.message ?? "unknown Core failure"}.`,
|
|
400
410
|
refs: [
|
|
401
411
|
ref("review-round", failedFinal.id),
|
|
402
|
-
...(
|
|
412
|
+
...(reviewerRun?.status === "failed" ? [ref("run", reviewerRun.id)] : [])
|
|
403
413
|
],
|
|
404
414
|
preconditions: [
|
|
405
415
|
{
|
|
406
|
-
fact: "Task-final Review has one exact completed Reviewer
|
|
416
|
+
fact: "Task-final Review has one exact completed Reviewer AgentRun",
|
|
407
417
|
satisfied: false,
|
|
408
418
|
ref: ref("review-round", failedFinal.id)
|
|
409
419
|
}
|
|
@@ -413,15 +423,15 @@ export function projectNextAction(facts) {
|
|
|
413
423
|
}
|
|
414
424
|
if (finalReviewRequired
|
|
415
425
|
&& failedFinal?.status === "completed"
|
|
416
|
-
&& !
|
|
426
|
+
&& !isCompletedTaskReviewEvidenceFromRuns(failedFinal, facts.reviewOutcomeEvidence?.runs ?? [])) {
|
|
417
427
|
return buildAction(facts, {
|
|
418
428
|
kind: "repair-protocol-inconsistency",
|
|
419
|
-
reason: `Task-final Review ${failedFinal.id} is completed without one exact completed main Reviewer
|
|
429
|
+
reason: `Task-final Review ${failedFinal.id} is completed without one exact completed main Reviewer AgentRun.`,
|
|
420
430
|
refs: [ref("review-round", failedFinal.id)],
|
|
421
431
|
conflicts: [ref("review-round", failedFinal.id)],
|
|
422
432
|
preconditions: [
|
|
423
433
|
{
|
|
424
|
-
fact: "ReviewRound and exact main Reviewer
|
|
434
|
+
fact: "ReviewRound and exact main Reviewer AgentRun agree",
|
|
425
435
|
satisfied: false,
|
|
426
436
|
ref: ref("review-round", failedFinal.id)
|
|
427
437
|
}
|
|
@@ -433,21 +443,25 @@ export function projectNextAction(facts) {
|
|
|
433
443
|
&& (activeFinal.status === "pending" || activeFinal.status === "running")) {
|
|
434
444
|
const reviewRef = ref("review-round", activeFinal.id);
|
|
435
445
|
if (activeFinal.status === "running") {
|
|
436
|
-
if (activeFinal.
|
|
446
|
+
if (activeFinal.reviewerRunId === undefined
|
|
437
447
|
&& activeFinal.executionGroup === undefined) {
|
|
438
448
|
return buildAction(facts, {
|
|
439
449
|
kind: "repair-protocol-inconsistency",
|
|
440
|
-
reason: `Task-final ReviewRound ${activeFinal.id} is running but has no Reviewer
|
|
450
|
+
reason: `Task-final ReviewRound ${activeFinal.id} is running but has no Reviewer AgentRun.`,
|
|
441
451
|
refs: [reviewRef],
|
|
442
452
|
conflicts: [reviewRef],
|
|
443
453
|
preconditions: [
|
|
444
|
-
{ fact: "Running Task-final ReviewRound has an exact Reviewer
|
|
454
|
+
{ fact: "Running Task-final ReviewRound has an exact Reviewer AgentRun", satisfied: false, ref: reviewRef }
|
|
445
455
|
]
|
|
446
456
|
});
|
|
447
457
|
}
|
|
448
|
-
const reviewRun = activeReviewRoundRun(activeFinal, facts.
|
|
458
|
+
const reviewRun = activeReviewRoundRun(activeFinal, facts.activeRuns);
|
|
449
459
|
if (reviewRun === undefined) {
|
|
450
|
-
if (
|
|
460
|
+
if (activeFinal.executionGroup !== undefined && activeFinal.reviewerRunId === undefined
|
|
461
|
+
&& !reviewGroupNeedsDispatch(activeFinal, facts.activeRuns)) {
|
|
462
|
+
return synthesisSelectionAction(facts, "review", activeFinal.id);
|
|
463
|
+
}
|
|
464
|
+
if (reviewGroupNeedsDispatch(activeFinal, facts.activeRuns)) {
|
|
451
465
|
return buildAction(facts, {
|
|
452
466
|
kind: "resume-review",
|
|
453
467
|
reason: `Task-final ReviewRound ${activeFinal.id} has Review Producer Lanes ready for dispatch or retry.`,
|
|
@@ -459,12 +473,12 @@ export function projectNextAction(facts) {
|
|
|
459
473
|
+ reviewLaneRoleOptions(activeFinal)
|
|
460
474
|
});
|
|
461
475
|
}
|
|
462
|
-
const runRef = activeFinal.
|
|
476
|
+
const runRef = activeFinal.reviewerRunId === undefined
|
|
463
477
|
? reviewRef
|
|
464
|
-
: ref("
|
|
478
|
+
: ref("run", activeFinal.reviewerRunId);
|
|
465
479
|
return buildAction(facts, {
|
|
466
480
|
kind: "repair-protocol-inconsistency",
|
|
467
|
-
reason: `Task-final ReviewRound ${activeFinal.id} has no active Producer or main Reviewer
|
|
481
|
+
reason: `Task-final ReviewRound ${activeFinal.id} has no active Producer or main Reviewer AgentRun.`,
|
|
468
482
|
refs: [reviewRef, runRef],
|
|
469
483
|
conflicts: [reviewRef, runRef],
|
|
470
484
|
preconditions: [
|
|
@@ -474,11 +488,11 @@ export function projectNextAction(facts) {
|
|
|
474
488
|
}
|
|
475
489
|
return buildAction(facts, {
|
|
476
490
|
kind: "wait-for-owned-execution",
|
|
477
|
-
reason: `Reviewer
|
|
478
|
-
refs: [reviewRef, ref("
|
|
491
|
+
reason: `Reviewer AgentRun ${reviewRun.id} is executing frozen Task-final Review ${activeFinal.id}; this Review does not globally pause Leader decisions on newer facts.`,
|
|
492
|
+
refs: [reviewRef, ref("run", reviewRun.id)],
|
|
479
493
|
preconditions: [
|
|
480
494
|
{ fact: "Task-final ReviewRound is running", satisfied: true, ref: reviewRef },
|
|
481
|
-
{ fact: "Reviewer
|
|
495
|
+
{ fact: "Reviewer AgentRun is active", satisfied: true, ref: ref("run", reviewRun.id) }
|
|
482
496
|
],
|
|
483
497
|
alternatives: [
|
|
484
498
|
{
|
|
@@ -496,15 +510,15 @@ export function projectNextAction(facts) {
|
|
|
496
510
|
judgmentRequired: "Leader decides whether the current facts justify waiting, continuing development, direct review, or another Reviewer."
|
|
497
511
|
});
|
|
498
512
|
}
|
|
499
|
-
if (activeFinal.
|
|
500
|
-
const runRef = ref("
|
|
513
|
+
if (activeFinal.reviewerRunId !== undefined) {
|
|
514
|
+
const runRef = ref("run", activeFinal.reviewerRunId);
|
|
501
515
|
return buildAction(facts, {
|
|
502
516
|
kind: "repair-protocol-inconsistency",
|
|
503
|
-
reason: `Pending Task-final ReviewRound ${activeFinal.id} already references Reviewer
|
|
517
|
+
reason: `Pending Task-final ReviewRound ${activeFinal.id} already references Reviewer AgentRun ${activeFinal.reviewerRunId}.`,
|
|
504
518
|
refs: [reviewRef, runRef],
|
|
505
519
|
conflicts: [reviewRef, runRef],
|
|
506
520
|
preconditions: [
|
|
507
|
-
{ fact: "Pending Task-final ReviewRound has no Reviewer
|
|
521
|
+
{ fact: "Pending Task-final ReviewRound has no Reviewer AgentRun", satisfied: false, ref: runRef }
|
|
508
522
|
]
|
|
509
523
|
});
|
|
510
524
|
}
|
|
@@ -514,7 +528,7 @@ export function projectNextAction(facts) {
|
|
|
514
528
|
refs: [reviewRef],
|
|
515
529
|
preconditions: [
|
|
516
530
|
{ fact: "Task-final ReviewRound is pending", satisfied: true, ref: reviewRef },
|
|
517
|
-
{ fact: "Reviewer
|
|
531
|
+
{ fact: "Reviewer AgentRun exists", satisfied: false }
|
|
518
532
|
],
|
|
519
533
|
recommendedCommand: `yui task review request ${task.id} --role ${activeFinal.reviewerRoleName}`
|
|
520
534
|
+ reviewLaneRoleOptions(activeFinal)
|
|
@@ -585,24 +599,36 @@ export function projectNextAction(facts) {
|
|
|
585
599
|
recommendedCommand: `yui task complete ${task.id} --summary-file -`
|
|
586
600
|
});
|
|
587
601
|
}
|
|
588
|
-
function
|
|
589
|
-
return
|
|
602
|
+
function synthesisSelectionAction(facts, subject, id) {
|
|
603
|
+
return buildAction(facts, {
|
|
604
|
+
kind: "resolve-execution-stage",
|
|
605
|
+
reason: `Replicated ${subject} ${id} needs Leader judgment over original results and synthesis.`,
|
|
606
|
+
refs: [ref(subject === "work" ? "work-item" : "review-round", id)],
|
|
607
|
+
preconditions: [],
|
|
608
|
+
recommendedCommand: subject === "work"
|
|
609
|
+
? `yui task work show ${facts.task.id}/${id}`
|
|
610
|
+
: `yui task review synthesize ${facts.task.id}/${id} --source-run <task>/<run>`,
|
|
611
|
+
judgmentRequired: "Inspect original results and any existing main AgentRun. Retry a failed main AgentRun or explicitly select synthesis sources; Core does not enforce a success count or voting rule."
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
function hasExactRun(lane) {
|
|
615
|
+
return lane.runId !== undefined;
|
|
590
616
|
}
|
|
591
617
|
function buildExecutionLaneRecoveryAction(facts, lane) {
|
|
592
618
|
const refs = [
|
|
593
619
|
ref("execution-group", lane.groupId),
|
|
594
620
|
ref("execution-lane", lane.laneId),
|
|
595
|
-
ref("
|
|
621
|
+
ref("run", lane.runId)
|
|
596
622
|
];
|
|
597
623
|
return buildAction(facts, {
|
|
598
624
|
kind: "retry-execution-lane",
|
|
599
|
-
reason: `Execution Lane ${lane.laneId} is durably failed; retry only exact
|
|
625
|
+
reason: `Execution Lane ${lane.laneId} is durably failed; retry only exact AgentRun ${lane.runId} and retain sibling results.`,
|
|
600
626
|
refs,
|
|
601
627
|
preconditions: [
|
|
602
628
|
{ fact: "Execution Lane is failed and unresolved", satisfied: true, ref: refs[1] },
|
|
603
|
-
{ fact: "Exact failed
|
|
629
|
+
{ fact: "Exact failed AgentRun is retained", satisfied: true, ref: refs[2] }
|
|
604
630
|
],
|
|
605
|
-
recommendedCommand: `yui task
|
|
631
|
+
recommendedCommand: `yui task run retry ${facts.task.id}/${lane.runId}`
|
|
606
632
|
});
|
|
607
633
|
}
|
|
608
634
|
/**
|
|
@@ -654,16 +680,16 @@ function latestActiveWorkItemReview(rounds, item, candidate) {
|
|
|
654
680
|
&& round.candidateId === candidate.id
|
|
655
681
|
&& (round.status === "pending" || round.status === "running")));
|
|
656
682
|
}
|
|
657
|
-
function activeReviewRoundRun(round,
|
|
658
|
-
if (round.
|
|
659
|
-
const main =
|
|
683
|
+
function activeReviewRoundRun(round, activeRuns) {
|
|
684
|
+
if (round.reviewerRunId !== undefined) {
|
|
685
|
+
const main = activeRuns.find((run) => (run.id === round.reviewerRunId && run.roleName === round.reviewerRoleName));
|
|
660
686
|
if (main !== undefined)
|
|
661
687
|
return main;
|
|
662
688
|
}
|
|
663
689
|
for (const lane of round.executionGroup?.lanes ?? []) {
|
|
664
|
-
if (lane.disposition !== "open" || lane.
|
|
690
|
+
if (lane.disposition !== "open" || lane.currentRunId === undefined)
|
|
665
691
|
continue;
|
|
666
|
-
const run =
|
|
692
|
+
const run = activeRuns.find((candidate) => (candidate.id === lane.currentRunId && candidate.roleName === lane.roleName));
|
|
667
693
|
if (run !== undefined)
|
|
668
694
|
return run;
|
|
669
695
|
}
|
|
@@ -674,37 +700,37 @@ function reviewLaneRoleOptions(round) {
|
|
|
674
700
|
.map(({ roleName }) => ` --lane-role ${roleName}`)
|
|
675
701
|
.join("") ?? "";
|
|
676
702
|
}
|
|
677
|
-
function reviewGroupNeedsDispatch(round,
|
|
703
|
+
function reviewGroupNeedsDispatch(round, runs) {
|
|
678
704
|
return round.executionGroup?.lanes.some((lane) => (lane.disposition === "open"
|
|
679
|
-
&& (lane.
|
|
680
|
-
||
|
|
705
|
+
&& (lane.currentRunId === undefined
|
|
706
|
+
|| runs.find(({ id }) => id === lane.currentRunId)?.status === "failed"))) === true;
|
|
681
707
|
}
|
|
682
|
-
function reviewRoundConflict(round,
|
|
708
|
+
function reviewRoundConflict(round, activeRuns) {
|
|
683
709
|
const reviewRef = ref("review-round", round.id);
|
|
684
710
|
if (round.status === "running") {
|
|
685
|
-
if (round.
|
|
711
|
+
if (round.reviewerRunId === undefined && round.executionGroup === undefined) {
|
|
686
712
|
return {
|
|
687
713
|
reason: `ReviewRound ${round.id} is running but has no execution unit.`,
|
|
688
714
|
conflicts: [reviewRef]
|
|
689
715
|
};
|
|
690
716
|
}
|
|
691
|
-
if (activeReviewRoundRun(round,
|
|
692
|
-
if (round.
|
|
717
|
+
if (activeReviewRoundRun(round, activeRuns) === undefined) {
|
|
718
|
+
if (round.reviewerRunId === undefined && round.executionGroup !== undefined)
|
|
693
719
|
return null;
|
|
694
|
-
const runRef = ref("
|
|
720
|
+
const runRef = ref("run", round.reviewerRunId);
|
|
695
721
|
return {
|
|
696
|
-
reason: `ReviewRound ${round.id} references Reviewer
|
|
722
|
+
reason: `ReviewRound ${round.id} references Reviewer AgentRun ${round.reviewerRunId}, but that AgentRun is not active.`,
|
|
697
723
|
conflicts: [reviewRef, runRef]
|
|
698
724
|
};
|
|
699
725
|
}
|
|
700
726
|
}
|
|
701
727
|
if (round.status === "pending") {
|
|
702
|
-
const
|
|
703
|
-
?? round.executionGroup?.lanes.find((lane) => lane.
|
|
704
|
-
if (
|
|
705
|
-
const runRef = ref("
|
|
728
|
+
const launchedRunId = round.reviewerRunId
|
|
729
|
+
?? round.executionGroup?.lanes.find((lane) => lane.currentRunId !== undefined)?.currentRunId;
|
|
730
|
+
if (launchedRunId !== undefined) {
|
|
731
|
+
const runRef = ref("run", launchedRunId);
|
|
706
732
|
return {
|
|
707
|
-
reason: `Pending ReviewRound ${round.id} already references Reviewer
|
|
733
|
+
reason: `Pending ReviewRound ${round.id} already references Reviewer AgentRun ${launchedRunId}.`,
|
|
708
734
|
conflicts: [reviewRef, runRef]
|
|
709
735
|
};
|
|
710
736
|
}
|
|
@@ -718,7 +744,7 @@ function selectOpenWorkItem(workItems) {
|
|
|
718
744
|
return { kind: "none" };
|
|
719
745
|
const eligible = openItems.find((item) => (item.dependsOn.every((dependencyId) => {
|
|
720
746
|
const status = byId.get(dependencyId)?.status;
|
|
721
|
-
return status === "
|
|
747
|
+
return status === "accepted";
|
|
722
748
|
})));
|
|
723
749
|
if (eligible !== undefined)
|
|
724
750
|
return { kind: "ready", item: eligible };
|
|
@@ -731,7 +757,7 @@ function selectOpenWorkItem(workItems) {
|
|
|
731
757
|
visited.add(current.id);
|
|
732
758
|
const blockedBy = current.dependsOn.find((dependencyId) => {
|
|
733
759
|
const status = byId.get(dependencyId)?.status;
|
|
734
|
-
return status !== "
|
|
760
|
+
return status !== "accepted";
|
|
735
761
|
});
|
|
736
762
|
if (blockedBy === undefined)
|
|
737
763
|
return { kind: "ready", item: current };
|
|
@@ -777,7 +803,7 @@ function hasValidFinalReview(facts) {
|
|
|
777
803
|
.reverse()
|
|
778
804
|
.find((round) => ((round.scope ?? "work-item") === "task"
|
|
779
805
|
&& (contract === undefined || sameTaskFinalReviewContract(round.taskFinalReviewContract, contract))));
|
|
780
|
-
if (final === undefined || !
|
|
806
|
+
if (final === undefined || !isCompletedTaskReviewEvidenceFromRuns(final, facts.reviewOutcomeEvidence?.runs ?? []))
|
|
781
807
|
return false;
|
|
782
808
|
return final.taskCandidate !== undefined;
|
|
783
809
|
}
|
|
@@ -804,7 +830,7 @@ function detectProtocolInconsistency(facts) {
|
|
|
804
830
|
};
|
|
805
831
|
}
|
|
806
832
|
for (const round of facts.reviewRounds) {
|
|
807
|
-
const reviewConflict = reviewRoundConflict(round, facts.
|
|
833
|
+
const reviewConflict = reviewRoundConflict(round, facts.activeRuns);
|
|
808
834
|
if (reviewConflict !== null)
|
|
809
835
|
return reviewConflict;
|
|
810
836
|
}
|
|
@@ -835,15 +861,5 @@ function detectProtocolInconsistency(facts) {
|
|
|
835
861
|
};
|
|
836
862
|
}
|
|
837
863
|
}
|
|
838
|
-
for (const item of facts.workItems) {
|
|
839
|
-
if (item.status !== "awaiting_acceptance")
|
|
840
|
-
continue;
|
|
841
|
-
if (item.candidates.length === 0) {
|
|
842
|
-
return {
|
|
843
|
-
reason: `Work Item ${item.id} is awaiting acceptance but has no Candidate record.`,
|
|
844
|
-
conflicts: [ref("work-item", item.id)]
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
864
|
return null;
|
|
849
865
|
}
|
|
@@ -98,7 +98,7 @@ function expectedDelivery(facts) {
|
|
|
98
98
|
...(event === undefined ? {} : { event })
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
if (task.status === "active" || task.status === "
|
|
101
|
+
if (task.status === "active" || task.status === "cancelled") {
|
|
102
102
|
return {
|
|
103
103
|
source: "current-task-main",
|
|
104
104
|
provisional: true,
|
|
@@ -135,13 +135,13 @@ function projectBaseCommits(facts, event) {
|
|
|
135
135
|
if (!result.has(entry.projectId))
|
|
136
136
|
result.set(entry.projectId, entry.baseCommit);
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
.filter((
|
|
140
|
-
&&
|
|
138
|
+
const taskRuns = facts.runs
|
|
139
|
+
.filter((run) => (run.workspace?.owner.type === "task"
|
|
140
|
+
&& run.workspace.owner.taskId === facts.task.id))
|
|
141
141
|
.slice()
|
|
142
142
|
.sort(compareCreated);
|
|
143
|
-
for (const
|
|
144
|
-
for (const entry of
|
|
143
|
+
for (const run of taskRuns) {
|
|
144
|
+
for (const entry of run.workspace?.entries ?? []) {
|
|
145
145
|
if (!result.has(entry.projectId))
|
|
146
146
|
result.set(entry.projectId, entry.baseCommit);
|
|
147
147
|
}
|