@atolis-hq/wake 0.3.59 → 0.3.61
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/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/application/advance-once.js +3 -1
- package/dist/src/control-plane/application/execution-reconciliation.js +1 -1
- package/dist/src/integrations/github/application/inbound-review-signals.js +1 -2
- package/dist/src/orchestration/application/advance-workflow.js +1 -1
- package/dist/src/orchestration/application/orchestration-service.js +10 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActivationClaimConflictError, RunStatus, WorkspaceMode } from '../../execution/index.js';
|
|
2
2
|
import { correlationId, EventActorKind, } from '../../kernel/index.js';
|
|
3
|
-
import { WorkflowStatus } from '../../orchestration/index.js';
|
|
3
|
+
import { isAmbiguityResolutionBlock, WorkflowStatus } from '../../orchestration/index.js';
|
|
4
4
|
import { WorkStatus } from '../../work/index.js';
|
|
5
5
|
import { ControlStreamKind } from '../contracts/streams.js';
|
|
6
6
|
import { DispatchPolicy } from '../domain/dispatch-policy.js';
|
|
@@ -84,7 +84,9 @@ export function createAdvanceOnce(orchestration, execution, resources, clock, de
|
|
|
84
84
|
(options.workItemId === undefined || workflow.workItemId === options.workItemId)
|
|
85
85
|
? [{ workflow, activation: workflow.pendingActivation }]
|
|
86
86
|
: []);
|
|
87
|
+
const ambiguityBlocked = blocked.filter((item) => isAmbiguityResolutionBlock(item.workflow.blockReason));
|
|
87
88
|
const recovery = (await findUnresolvedTerminal(pending, execution)) ??
|
|
89
|
+
(await findUnresolvedTerminal(ambiguityBlocked, execution)) ??
|
|
88
90
|
(await findUnresolvedSucceededTerminal(blocked, execution));
|
|
89
91
|
if (recovery !== undefined) {
|
|
90
92
|
if (await isDispatchPaused())
|
|
@@ -17,5 +17,5 @@ export async function findUnresolvedSucceededTerminal(pending, execution) {
|
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
19
|
export function isExecutionFailureTerminal(status) {
|
|
20
|
-
return
|
|
20
|
+
return status === RunStatus.Failed || status === RunStatus.Cancelled;
|
|
21
21
|
}
|
|
@@ -128,11 +128,10 @@ async function applyIssueRetrySignal(input) {
|
|
|
128
128
|
const workItemIds = (await resources.correlations(resourceIdValue))
|
|
129
129
|
.filter((correlation) => correlation.role === ResourceCorrelationRole.Primary)
|
|
130
130
|
.map((correlation) => correlation.workItemId);
|
|
131
|
-
const workflows = await orchestration.listAll();
|
|
132
131
|
for (const workItemId of workItemIds) {
|
|
133
132
|
if (!(await isEligibleWorkItem(work, workItemId)))
|
|
134
133
|
continue;
|
|
135
|
-
const target = selectOperatorRetryTarget(
|
|
134
|
+
const target = selectOperatorRetryTarget(await orchestration.listForWorkItem(workItemId));
|
|
136
135
|
if (target === undefined)
|
|
137
136
|
continue;
|
|
138
137
|
await ignoreIneligibleOperatorRetry(() => orchestration.retryBlockedFailedStage(target.workflowInstanceId, commandContext(event)));
|
|
@@ -204,6 +204,6 @@ export class AdvanceWorkflow {
|
|
|
204
204
|
return matchWatches(await this.listAllLoaded(), event, this.workflows, context);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function isAmbiguityResolutionBlock(reason) {
|
|
207
|
+
export function isAmbiguityResolutionBlock(reason) {
|
|
208
208
|
return reason !== undefined && /^run-ambiguous-after-\d+-attempts$/.test(reason);
|
|
209
209
|
}
|
|
@@ -3,6 +3,7 @@ import { AcceptSignal } from './accept-signal.js';
|
|
|
3
3
|
import { AdvanceWorkflow } from './advance-workflow.js';
|
|
4
4
|
import { CoordinationClaims } from './coordination-claims.js';
|
|
5
5
|
import { GroupBudgetRecorder } from './group-budget-recorder.js';
|
|
6
|
+
import { workflowsByWorkItemProjection } from './orchestration-projection.js';
|
|
6
7
|
import { OrchestrationRepository } from './orchestration-repository.js';
|
|
7
8
|
import { RequestChild } from './request-child.js';
|
|
8
9
|
import { StartWorkflow } from './start-workflow.js';
|
|
@@ -14,9 +15,11 @@ export class OrchestrationService {
|
|
|
14
15
|
acceptWorkflowSignal;
|
|
15
16
|
advanceWorkflow;
|
|
16
17
|
childWorkflows;
|
|
18
|
+
projections;
|
|
17
19
|
coordinateAcceptSignal = (operation) => operation();
|
|
18
20
|
watchChildCancellation;
|
|
19
21
|
constructor(journal, work, definitions, projections) {
|
|
22
|
+
this.projections = projections;
|
|
20
23
|
const repository = new OrchestrationRepository(journal);
|
|
21
24
|
const claims = new CoordinationClaims(journal);
|
|
22
25
|
this.startWorkflow = new StartWorkflow(repository, claims, work, new WorkflowDefinitionRegistry(journal, projections, definitions));
|
|
@@ -85,6 +88,13 @@ export class OrchestrationService {
|
|
|
85
88
|
listAll() {
|
|
86
89
|
return this.advanceWorkflow.listAll();
|
|
87
90
|
}
|
|
91
|
+
async listForWorkItem(workItemId) {
|
|
92
|
+
if (this.projections === undefined)
|
|
93
|
+
return (await this.advanceWorkflow.listAll()).filter((workflow) => workflow.workItemId === workItemId);
|
|
94
|
+
const stored = await this.projections.read(workflowsByWorkItemProjection.name, workItemId);
|
|
95
|
+
const workflows = await Promise.all((stored?.value ?? []).map((workflowInstanceId) => this.advanceWorkflow.get(workflowInstanceId)));
|
|
96
|
+
return workflows.filter((workflow) => workflow !== null);
|
|
97
|
+
}
|
|
88
98
|
reconcileChildCompletions(context) {
|
|
89
99
|
return this.transitionWatchChildren(context, () => this.childWorkflows.reconcileChildCompletions(context));
|
|
90
100
|
}
|