@atolis-hq/wake 0.2.27 → 0.2.28
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.
|
@@ -234,6 +234,12 @@ async function applyEvent(current, event, ctx, config) {
|
|
|
234
234
|
...(payload.sentinel === 'AWAITING_APPROVAL' && payload.action !== undefined
|
|
235
235
|
? { pendingApprovalAction: payload.action }
|
|
236
236
|
: {}),
|
|
237
|
+
...(payload.executionOutcome !== undefined
|
|
238
|
+
? { lastExecutionOutcome: payload.executionOutcome }
|
|
239
|
+
: {}),
|
|
240
|
+
...(payload.workflowOutcome !== undefined
|
|
241
|
+
? { lastWorkflowOutcome: payload.workflowOutcome }
|
|
242
|
+
: {}),
|
|
237
243
|
};
|
|
238
244
|
if (payload.sentinel === 'BLOCKED' || payload.sentinel === 'FAILED') {
|
|
239
245
|
nextContext.blockedFromStage = current.wake.stage;
|
|
@@ -48,6 +48,7 @@ export function createStaleRunReconciler(deps) {
|
|
|
48
48
|
...record,
|
|
49
49
|
status: 'superseded',
|
|
50
50
|
finishedAt,
|
|
51
|
+
executionOutcome: 'SUPERSEDED',
|
|
51
52
|
summary: 'Stale running record was superseded by a newer run.',
|
|
52
53
|
metadata: {
|
|
53
54
|
...record.metadata,
|
|
@@ -57,11 +58,13 @@ export function createStaleRunReconciler(deps) {
|
|
|
57
58
|
});
|
|
58
59
|
continue;
|
|
59
60
|
}
|
|
61
|
+
const staleExecutionOutcome = reason === 'timeout' ? 'TIMED_OUT' : 'STALLED';
|
|
60
62
|
await deps.stateStore.writeRunRecord({
|
|
61
63
|
...record,
|
|
62
64
|
status: 'failed',
|
|
63
65
|
finishedAt,
|
|
64
66
|
sentinel: 'FAILED',
|
|
67
|
+
executionOutcome: staleExecutionOutcome,
|
|
65
68
|
summary: `Run exceeded timeout while marked running and was reconciled by a later tick.`,
|
|
66
69
|
metadata: {
|
|
67
70
|
...record.metadata,
|
|
@@ -88,6 +91,7 @@ export function createStaleRunReconciler(deps) {
|
|
|
88
91
|
payload: {
|
|
89
92
|
action: record.action,
|
|
90
93
|
sentinel: 'FAILED',
|
|
94
|
+
executionOutcome: staleExecutionOutcome,
|
|
91
95
|
runId: record.runId,
|
|
92
96
|
reason: reason === 'timeout' ? 'runner:stale-timeout' : 'runner:orphaned-process',
|
|
93
97
|
...(record.routing === undefined ? {} : { routing: record.routing }),
|
|
@@ -571,6 +571,18 @@ export function createTickRunner(deps) {
|
|
|
571
571
|
: { failureClass: runnerResult.failureClass }),
|
|
572
572
|
...(runnerResult.routing === undefined ? {} : { routing: runnerResult.routing }),
|
|
573
573
|
};
|
|
574
|
+
const executionOutcome = runnerResult.failureClass === 'quota'
|
|
575
|
+
? 'QUOTA_EXHAUSTED'
|
|
576
|
+
: runnerResult.failureClass === 'infra'
|
|
577
|
+
? 'PROCESS_FAILED'
|
|
578
|
+
: 'COMPLETED';
|
|
579
|
+
const workflowOutcome = sentinel === 'DONE'
|
|
580
|
+
? 'DONE'
|
|
581
|
+
: sentinel === 'BLOCKED'
|
|
582
|
+
? 'BLOCKED'
|
|
583
|
+
: sentinel === 'AWAITING_APPROVAL'
|
|
584
|
+
? 'AWAITING_APPROVAL'
|
|
585
|
+
: undefined;
|
|
574
586
|
await deps.stateStore.writeRunRecord({
|
|
575
587
|
...runningRecord,
|
|
576
588
|
status: sentinel === 'DONE'
|
|
@@ -583,6 +595,8 @@ export function createTickRunner(deps) {
|
|
|
583
595
|
finishedAt,
|
|
584
596
|
sessionId: runnerResult.session_id,
|
|
585
597
|
sentinel,
|
|
598
|
+
executionOutcome,
|
|
599
|
+
...(workflowOutcome !== undefined ? { workflowOutcome } : {}),
|
|
586
600
|
summary: parsedRunnerResult.body,
|
|
587
601
|
...(runnerResult.routing === undefined ? {} : { routing: runnerResult.routing }),
|
|
588
602
|
...(runnerResult.tokenUsage === undefined ? {} : { tokenUsage: runnerResult.tokenUsage }),
|
|
@@ -626,6 +640,8 @@ export function createTickRunner(deps) {
|
|
|
626
640
|
: { handledCommentId: latestHumanCommentId(candidate) }),
|
|
627
641
|
body: parsedRunnerResult.body,
|
|
628
642
|
envelope: parsedRunnerResult.envelope,
|
|
643
|
+
executionOutcome,
|
|
644
|
+
...(workflowOutcome !== undefined ? { workflowOutcome } : {}),
|
|
629
645
|
},
|
|
630
646
|
});
|
|
631
647
|
await deps.stateStore.appendEventEnvelope(runCompletedEvent);
|
|
@@ -673,6 +689,7 @@ export function createTickRunner(deps) {
|
|
|
673
689
|
status: 'failed',
|
|
674
690
|
finishedAt,
|
|
675
691
|
sentinel,
|
|
692
|
+
executionOutcome: 'PROCESS_FAILED',
|
|
676
693
|
summary: err instanceof Error ? err.message : String(err),
|
|
677
694
|
metadata: {
|
|
678
695
|
failureClass: 'infra',
|
|
@@ -699,6 +716,7 @@ export function createTickRunner(deps) {
|
|
|
699
716
|
runId,
|
|
700
717
|
reason: 'runner:infrastructure-error',
|
|
701
718
|
failureClass: 'infra',
|
|
719
|
+
executionOutcome: 'PROCESS_FAILED',
|
|
702
720
|
// Deliberately omit handledCommentId: an infra blip (CLI crash, timeout,
|
|
703
721
|
// network error) never reached the agent, so it isn't an answer to the
|
|
704
722
|
// triggering comment. Leaving it unset lets the next tick retry the same
|
|
@@ -15,6 +15,27 @@ export const wakeArtifactsEnvelopeSchema = z.object({
|
|
|
15
15
|
artifacts: z.array(reportedArtifactSchema).default([]),
|
|
16
16
|
});
|
|
17
17
|
export const runnerSentinelSchema = z.enum(runnerSentinelValues);
|
|
18
|
+
export const executionOutcomeValues = [
|
|
19
|
+
'COMPLETED',
|
|
20
|
+
'STARTUP_FAILED',
|
|
21
|
+
'PROCESS_FAILED',
|
|
22
|
+
'TIMED_OUT',
|
|
23
|
+
'STALLED',
|
|
24
|
+
'CANCELED_BY_RECONCILIATION',
|
|
25
|
+
'CANCELED_BY_OPERATOR',
|
|
26
|
+
'QUOTA_EXHAUSTED',
|
|
27
|
+
'MALFORMED_OUTPUT',
|
|
28
|
+
'SUPERSEDED',
|
|
29
|
+
];
|
|
30
|
+
export const workflowOutcomeValues = [
|
|
31
|
+
'DONE',
|
|
32
|
+
'BLOCKED',
|
|
33
|
+
'AWAITING_APPROVAL',
|
|
34
|
+
'AWAITING_INPUT',
|
|
35
|
+
'CHANGES_REQUESTED',
|
|
36
|
+
];
|
|
37
|
+
export const executionOutcomeSchema = z.enum(executionOutcomeValues);
|
|
38
|
+
export const workflowOutcomeSchema = z.enum(workflowOutcomeValues);
|
|
18
39
|
export const defaultAgentIdentity = 'Wake';
|
|
19
40
|
export const defaultSmokePrompt = `This is ${defaultAgentIdentity}, reply with "hi ${defaultAgentIdentity} only"`;
|
|
20
41
|
const modelOverridesSchema = z
|
|
@@ -290,6 +311,8 @@ export const runRecordSchema = z.object({
|
|
|
290
311
|
finishedAt: isoTimestampSchema.optional(),
|
|
291
312
|
sessionId: z.string().optional(),
|
|
292
313
|
sentinel: runnerSentinelSchema.optional(),
|
|
314
|
+
executionOutcome: executionOutcomeSchema.optional(),
|
|
315
|
+
workflowOutcome: workflowOutcomeSchema.optional(),
|
|
293
316
|
summary: z.string().optional(),
|
|
294
317
|
routing: runnerRoutingSchema.optional(),
|
|
295
318
|
tokenUsage: runTokenUsageSchema.optional(),
|
package/dist/src/version.js
CHANGED