@stigmer/runner 3.37.0 → 3.38.0
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/.build-fingerprint +1 -1
- package/dist/__test-utils__/hermetic-activity.d.ts +5 -2
- package/dist/__test-utils__/hermetic-activity.js +12 -2
- package/dist/__test-utils__/hermetic-activity.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn-setup.js +6 -0
- package/dist/activities/execute-deep-agent/turn-setup.js.map +1 -1
- package/dist/harness/run-turn.js +13 -13
- package/dist/harness/run-turn.js.map +1 -1
- package/dist/harness/terminal-table.d.ts +20 -5
- package/dist/harness/terminal-table.js +22 -8
- package/dist/harness/terminal-table.js.map +1 -1
- package/dist/shared/model-client.d.ts +10 -2
- package/dist/shared/model-client.js +1 -1
- package/dist/shared/model-client.js.map +1 -1
- package/dist/shared/worker-shutdown.d.ts +10 -5
- package/dist/shared/worker-shutdown.js +3 -3
- package/dist/shared/worker-shutdown.js.map +1 -1
- package/package.json +5 -5
- package/src/__test-utils__/harness-contract/runtime-contract.ts +27 -16
- package/src/__test-utils__/hermetic-activity.ts +11 -2
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/pause.status.json +0 -6
- package/src/activities/execute-cursor/__tests__/hermetic/pause-vs-shutdown.test.ts +28 -21
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.after-tool.status.json +0 -6
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.mid-tool.status.json +0 -6
- package/src/activities/execute-deep-agent/__tests__/hermetic/pause-vs-shutdown.test.ts +27 -21
- package/src/activities/execute-deep-agent/turn-setup.ts +6 -0
- package/src/harness/run-turn.ts +13 -13
- package/src/harness/terminal-table.ts +23 -8
- package/src/shared/__tests__/model-client-sampling.test.ts +56 -0
- package/src/shared/__tests__/model-client.test.ts +15 -0
- package/src/shared/__tests__/worker-shutdown.test.ts +2 -2
- package/src/shared/model-client.ts +11 -3
- package/src/shared/worker-shutdown.ts +11 -6
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Per-task-queue worker-shutdown signals — the classification channel that
|
|
3
3
|
* lets an in-flight activity distinguish "my worker is shutting down" from
|
|
4
|
-
* "the orchestrator cancelled me" (a user
|
|
4
|
+
* "the orchestrator cancelled me" (a user's Pause or Cancel).
|
|
5
5
|
*
|
|
6
6
|
* The signal carries NO lifecycle authority: aborting it never stops a
|
|
7
7
|
* worker or an activity (Temporal's own drain does that). It exists purely
|
|
8
8
|
* so the activity's cancellation handling can classify the interruption
|
|
9
|
-
* honestly — a shutdown is not a
|
|
9
|
+
* honestly — a shutdown is not a user's stop, and must surface as the
|
|
10
10
|
* worker-shutdown failure shape the control planes recognize (issue #776).
|
|
11
11
|
*
|
|
12
12
|
* Ownership contract:
|
|
@@ -88,13 +88,18 @@ export interface TurnInterruptionEvidence {
|
|
|
88
88
|
* How Temporal's cancellation reads to the turn:
|
|
89
89
|
* - `worker-shutdown`: the runner is draining (the queue's signal, or the
|
|
90
90
|
* SDK's own `WORKER_SHUTDOWN`); FAILED with the shutdown copy, thrown.
|
|
91
|
-
* - `
|
|
92
|
-
*
|
|
91
|
+
* - `orchestrator-stop`: the workflow asked (`CANCELLED`). That is a Pause
|
|
92
|
+
* or a Cancel, and the turn cannot tell which: both reach the activity
|
|
93
|
+
* as the same workflow-requested cancellation, and both RPCs signal the
|
|
94
|
+
* engine before they persist the phase, so no stored fact tells them
|
|
95
|
+
* apart in time. The turn settles its transcript with no phase and no
|
|
96
|
+
* row, thrown; the workflow, which knows which stop it runs, writes the
|
|
97
|
+
* phase and the stop row (stigmer#980).
|
|
93
98
|
* - `infrastructure`: the platform cancelled for its own reason (a heartbeat
|
|
94
99
|
* timeout, a closed run); FAILED with the unresponsive copy, thrown.
|
|
95
100
|
* - `none`: nothing was delivered.
|
|
96
101
|
*/
|
|
97
|
-
export type TurnInterruption = "worker-shutdown" | "
|
|
102
|
+
export type TurnInterruption = "worker-shutdown" | "orchestrator-stop" | "infrastructure" | "none";
|
|
98
103
|
|
|
99
104
|
/**
|
|
100
105
|
* Classify how (whether) Temporal interrupted the turn, from the two live
|
|
@@ -125,5 +130,5 @@ export function classifyTurnInterruption(evidence: TurnInterruptionEvidence): Tu
|
|
|
125
130
|
if (shutdownSignalAborted || cancellationReason === "WORKER_SHUTDOWN") {
|
|
126
131
|
return "worker-shutdown";
|
|
127
132
|
}
|
|
128
|
-
return cancellationReason === "CANCELLED" ? "
|
|
133
|
+
return cancellationReason === "CANCELLED" ? "orchestrator-stop" : "infrastructure";
|
|
129
134
|
}
|