@usine/executor 0.2.1 → 0.4.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/LICENSE +661 -21
- package/README.md +212 -37
- package/dist/child-command.d.ts +5 -8
- package/dist/child-command.d.ts.map +1 -1
- package/dist/child-command.js +10 -14
- package/dist/child-command.js.map +1 -1
- package/dist/child-environment.d.ts +19 -0
- package/dist/child-environment.d.ts.map +1 -0
- package/dist/child-environment.js +18 -0
- package/dist/child-environment.js.map +1 -0
- package/dist/claude-login-lock.d.ts +9 -0
- package/dist/claude-login-lock.d.ts.map +1 -0
- package/dist/claude-login-lock.js +15 -0
- package/dist/claude-login-lock.js.map +1 -0
- package/dist/cloudflare/client.d.ts +50 -0
- package/dist/cloudflare/client.d.ts.map +1 -0
- package/dist/cloudflare/client.js +108 -0
- package/dist/cloudflare/client.js.map +1 -0
- package/dist/cloudflare/cloudflare.d.ts +17 -0
- package/dist/cloudflare/cloudflare.d.ts.map +1 -0
- package/dist/cloudflare/cloudflare.js +704 -0
- package/dist/cloudflare/cloudflare.js.map +1 -0
- package/dist/cloudflare/model.d.ts +42 -0
- package/dist/cloudflare/model.d.ts.map +1 -0
- package/dist/cloudflare/model.js +2 -0
- package/dist/cloudflare/model.js.map +1 -0
- package/dist/cloudflare/shell/environment.d.ts +12 -0
- package/dist/cloudflare/shell/environment.d.ts.map +1 -0
- package/dist/cloudflare/shell/environment.js +12 -0
- package/dist/cloudflare/shell/environment.js.map +1 -0
- package/dist/cloudflare/shell/shell.d.ts +2 -0
- package/dist/cloudflare/shell/shell.d.ts.map +1 -0
- package/dist/cloudflare/shell/shell.js +155 -0
- package/dist/cloudflare/shell/shell.js.map +1 -0
- package/dist/credential-environment.d.ts +20 -0
- package/dist/credential-environment.d.ts.map +1 -0
- package/dist/credential-environment.js +20 -0
- package/dist/credential-environment.js.map +1 -0
- package/dist/durable-session.d.ts +81 -0
- package/dist/durable-session.d.ts.map +1 -0
- package/dist/durable-session.js +550 -0
- package/dist/durable-session.js.map +1 -0
- package/dist/exe-dev/commands.d.ts +23 -13
- package/dist/exe-dev/commands.d.ts.map +1 -1
- package/dist/exe-dev/commands.js +11 -57
- package/dist/exe-dev/commands.js.map +1 -1
- package/dist/exe-dev/exe-dev.d.ts +9 -3
- package/dist/exe-dev/exe-dev.d.ts.map +1 -1
- package/dist/exe-dev/exe-dev.js +61 -128
- package/dist/exe-dev/exe-dev.js.map +1 -1
- package/dist/exe-dev/grants.d.ts.map +1 -1
- package/dist/exe-dev/grants.js +35 -15
- package/dist/exe-dev/grants.js.map +1 -1
- package/dist/exe-dev/model.d.ts +15 -19
- package/dist/exe-dev/model.d.ts.map +1 -1
- package/dist/exe-dev/model.js +9 -12
- package/dist/exe-dev/model.js.map +1 -1
- package/dist/exe-dev/preflight.d.ts +8 -4
- package/dist/exe-dev/preflight.d.ts.map +1 -1
- package/dist/exe-dev/preflight.js +26 -35
- package/dist/exe-dev/preflight.js.map +1 -1
- package/dist/executor.d.ts +292 -44
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +187 -19
- package/dist/executor.js.map +1 -1
- package/dist/guard.d.ts +57 -7
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +274 -59
- package/dist/guard.js.map +1 -1
- package/dist/harness-preflight.d.ts +27 -5
- package/dist/harness-preflight.d.ts.map +1 -1
- package/dist/harness-preflight.js +32 -31
- package/dist/harness-preflight.js.map +1 -1
- package/dist/keyed-lock.d.ts +2 -3
- package/dist/keyed-lock.d.ts.map +1 -1
- package/dist/keyed-lock.js +2 -3
- package/dist/keyed-lock.js.map +1 -1
- package/dist/leftovers.d.ts +9 -0
- package/dist/leftovers.d.ts.map +1 -0
- package/dist/leftovers.js +14 -0
- package/dist/leftovers.js.map +1 -0
- package/dist/local/credentials.d.ts +21 -0
- package/dist/local/credentials.d.ts.map +1 -0
- package/dist/local/credentials.js +39 -0
- package/dist/local/credentials.js.map +1 -0
- package/dist/local/leftovers.d.ts +8 -0
- package/dist/local/leftovers.d.ts.map +1 -0
- package/dist/local/leftovers.js +23 -0
- package/dist/local/leftovers.js.map +1 -0
- package/dist/local/local.d.ts +17 -11
- package/dist/local/local.d.ts.map +1 -1
- package/dist/local/local.js +205 -132
- package/dist/local/local.js.map +1 -1
- package/dist/memory-preflight.d.ts +27 -0
- package/dist/memory-preflight.d.ts.map +1 -0
- package/dist/memory-preflight.js +83 -0
- package/dist/memory-preflight.js.map +1 -0
- package/dist/pre-push-hook.d.ts +20 -0
- package/dist/pre-push-hook.d.ts.map +1 -0
- package/dist/pre-push-hook.js +33 -0
- package/dist/pre-push-hook.js.map +1 -0
- package/dist/prepared-attempt.d.ts +41 -3
- package/dist/prepared-attempt.d.ts.map +1 -1
- package/dist/prepared-attempt.js +109 -31
- package/dist/prepared-attempt.js.map +1 -1
- package/dist/provision.d.ts +129 -15
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +428 -69
- package/dist/provision.js.map +1 -1
- package/dist/remote/commands.d.ts +51 -0
- package/dist/remote/commands.d.ts.map +1 -0
- package/dist/remote/commands.js +94 -0
- package/dist/remote/commands.js.map +1 -0
- package/dist/remote/container.d.ts +90 -0
- package/dist/remote/container.d.ts.map +1 -0
- package/dist/remote/container.js +480 -0
- package/dist/remote/container.js.map +1 -0
- package/dist/remote/leftovers.d.ts +14 -0
- package/dist/remote/leftovers.d.ts.map +1 -0
- package/dist/remote/leftovers.js +22 -0
- package/dist/remote/leftovers.js.map +1 -0
- package/dist/remote/liveness.d.ts +33 -0
- package/dist/remote/liveness.d.ts.map +1 -0
- package/dist/remote/liveness.js +196 -0
- package/dist/remote/liveness.js.map +1 -0
- package/dist/remote/machine.d.ts +110 -0
- package/dist/remote/machine.d.ts.map +1 -0
- package/dist/remote/machine.js +2 -0
- package/dist/remote/machine.js.map +1 -0
- package/dist/remote/remote.d.ts +28 -0
- package/dist/remote/remote.d.ts.map +1 -0
- package/dist/remote/remote.js +556 -0
- package/dist/remote/remote.js.map +1 -0
- package/dist/remote/sweep.d.ts +17 -0
- package/dist/remote/sweep.d.ts.map +1 -0
- package/dist/remote/sweep.js +117 -0
- package/dist/remote/sweep.js.map +1 -0
- package/dist/renewable-credential.d.ts +17 -0
- package/dist/renewable-credential.d.ts.map +1 -0
- package/dist/renewable-credential.js +58 -0
- package/dist/renewable-credential.js.map +1 -0
- package/dist/salvage.d.ts +38 -0
- package/dist/salvage.d.ts.map +1 -0
- package/dist/salvage.js +198 -0
- package/dist/salvage.js.map +1 -0
- package/dist/ssh/api-keys.d.ts +36 -0
- package/dist/ssh/api-keys.d.ts.map +1 -0
- package/dist/ssh/api-keys.js +72 -0
- package/dist/ssh/api-keys.js.map +1 -0
- package/dist/ssh/codex-homes.d.ts +21 -0
- package/dist/ssh/codex-homes.d.ts.map +1 -0
- package/dist/ssh/codex-homes.js +78 -0
- package/dist/ssh/codex-homes.js.map +1 -0
- package/dist/ssh/container.d.ts +32 -0
- package/dist/ssh/container.d.ts.map +1 -0
- package/dist/ssh/container.js +282 -0
- package/dist/ssh/container.js.map +1 -0
- package/dist/ssh/credentials.d.ts +43 -0
- package/dist/ssh/credentials.d.ts.map +1 -0
- package/dist/ssh/credentials.js +86 -0
- package/dist/ssh/credentials.js.map +1 -0
- package/dist/ssh/gateway/admin.d.ts +45 -0
- package/dist/ssh/gateway/admin.d.ts.map +1 -0
- package/dist/ssh/gateway/admin.js +129 -0
- package/dist/ssh/gateway/admin.js.map +1 -0
- package/dist/ssh/gateway/attachments.d.ts +31 -0
- package/dist/ssh/gateway/attachments.d.ts.map +1 -0
- package/dist/ssh/gateway/attachments.js +168 -0
- package/dist/ssh/gateway/attachments.js.map +1 -0
- package/dist/ssh/gateway/environment.d.ts +71 -0
- package/dist/ssh/gateway/environment.d.ts.map +1 -0
- package/dist/ssh/gateway/environment.js +148 -0
- package/dist/ssh/gateway/environment.js.map +1 -0
- package/dist/ssh/gateway/forward.d.ts +74 -0
- package/dist/ssh/gateway/forward.d.ts.map +1 -0
- package/dist/ssh/gateway/forward.js +247 -0
- package/dist/ssh/gateway/forward.js.map +1 -0
- package/dist/ssh/gateway/preflight.d.ts +67 -0
- package/dist/ssh/gateway/preflight.d.ts.map +1 -0
- package/dist/ssh/gateway/preflight.js +320 -0
- package/dist/ssh/gateway/preflight.js.map +1 -0
- package/dist/ssh/limits.d.ts +60 -0
- package/dist/ssh/limits.d.ts.map +1 -0
- package/dist/ssh/limits.js +84 -0
- package/dist/ssh/limits.js.map +1 -0
- package/dist/ssh/model.d.ts +153 -0
- package/dist/ssh/model.d.ts.map +1 -0
- package/dist/ssh/model.js +2 -0
- package/dist/ssh/model.js.map +1 -0
- package/dist/ssh/preflight.d.ts +35 -0
- package/dist/ssh/preflight.d.ts.map +1 -0
- package/dist/ssh/preflight.js +87 -0
- package/dist/ssh/preflight.js.map +1 -0
- package/dist/ssh/provisioner/boat.d.ts +33 -0
- package/dist/ssh/provisioner/boat.d.ts.map +1 -0
- package/dist/ssh/provisioner/boat.js +247 -0
- package/dist/ssh/provisioner/boat.js.map +1 -0
- package/dist/ssh/provisioner/hetzner.d.ts +32 -0
- package/dist/ssh/provisioner/hetzner.d.ts.map +1 -0
- package/dist/ssh/provisioner/hetzner.js +337 -0
- package/dist/ssh/provisioner/hetzner.js.map +1 -0
- package/dist/ssh/provisioner/host-key.d.ts +11 -0
- package/dist/ssh/provisioner/host-key.d.ts.map +1 -0
- package/dist/ssh/provisioner/host-key.js +57 -0
- package/dist/ssh/provisioner/host-key.js.map +1 -0
- package/dist/ssh/provisioner/http.d.ts +45 -0
- package/dist/ssh/provisioner/http.d.ts.map +1 -0
- package/dist/ssh/provisioner/http.js +72 -0
- package/dist/ssh/provisioner/http.js.map +1 -0
- package/dist/ssh/provisioner/machines.d.ts +48 -0
- package/dist/ssh/provisioner/machines.d.ts.map +1 -0
- package/dist/ssh/provisioner/machines.js +686 -0
- package/dist/ssh/provisioner/machines.js.map +1 -0
- package/dist/ssh/provisioner/model.d.ts +92 -0
- package/dist/ssh/provisioner/model.d.ts.map +1 -0
- package/dist/ssh/provisioner/model.js +37 -0
- package/dist/ssh/provisioner/model.js.map +1 -0
- package/dist/ssh/ssh.d.ts +23 -0
- package/dist/ssh/ssh.d.ts.map +1 -0
- package/dist/ssh/ssh.js +145 -0
- package/dist/ssh/ssh.js.map +1 -0
- package/dist/ssh/worker-records.d.ts +18 -0
- package/dist/ssh/worker-records.d.ts.map +1 -0
- package/dist/ssh/worker-records.js +100 -0
- package/dist/ssh/worker-records.js.map +1 -0
- package/dist/ssh/workers.d.ts +80 -0
- package/dist/ssh/workers.d.ts.map +1 -0
- package/dist/ssh/workers.js +247 -0
- package/dist/ssh/workers.js.map +1 -0
- package/package.json +25 -9
- package/dist/exe-dev/channel.d.ts +0 -12
- package/dist/exe-dev/channel.d.ts.map +0 -1
- package/dist/exe-dev/channel.js +0 -42
- package/dist/exe-dev/channel.js.map +0 -1
- package/dist/exe-dev/shell.d.ts +0 -12
- package/dist/exe-dev/shell.d.ts.map +0 -1
- package/dist/exe-dev/shell.js +0 -31
- package/dist/exe-dev/shell.js.map +0 -1
- package/dist/exe-dev/sweep.d.ts +0 -10
- package/dist/exe-dev/sweep.d.ts.map +0 -1
- package/dist/exe-dev/sweep.js +0 -117
- package/dist/exe-dev/sweep.js.map +0 -1
- package/dist/invalid-frame.d.ts +0 -17
- package/dist/invalid-frame.d.ts.map +0 -1
- package/dist/invalid-frame.js +0 -111
- package/dist/invalid-frame.js.map +0 -1
- package/dist/run-host-session.d.ts +0 -27
- package/dist/run-host-session.d.ts.map +0 -1
- package/dist/run-host-session.js +0 -303
- package/dist/run-host-session.js.map +0 -1
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import * as AttemptChannel from "@usine/core/attempt/channel";
|
|
2
|
+
import { AgentFailure, InfraFailure, RunawayFailure, } from "@usine/core/attempt/failure";
|
|
3
|
+
import { AttemptRequest, AttemptRuntime, harvestedResult, } from "@usine/durable/attempt-runtime";
|
|
4
|
+
import { Cause, Deferred, Duration, Effect, Exit, Fiber, Match, Option, Ref, Result, } from "effect";
|
|
5
|
+
import { ExecutorOperationError, } from "./executor.js";
|
|
6
|
+
import { guardSeed } from "./guard.js";
|
|
7
|
+
import { preparedAttemptsFor } from "./prepared-attempt.js";
|
|
8
|
+
const cancelError = (attemptId, cause) => new ExecutorOperationError({
|
|
9
|
+
operation: "cancel",
|
|
10
|
+
message: `Can't cancel attempt ${attemptId}`,
|
|
11
|
+
cause,
|
|
12
|
+
});
|
|
13
|
+
/** The reason that the log of each engine-requested stop gives. */
|
|
14
|
+
const stopReasons = {
|
|
15
|
+
cancel: "the Attempt was canceled",
|
|
16
|
+
failed: "the Attempt failed",
|
|
17
|
+
startup: "a restart found the Attempt closed or not reattached",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Returns the session that runs Attempts whose Pi parent is a durable task in this process
|
|
21
|
+
* (`AttemptRuntime`), for every Worker kind. If a launch is interrupted without a stop, the
|
|
22
|
+
* parent task stays live and the checkout stays on disk for reattachment after restart; every
|
|
23
|
+
* other ending stops the parent task. If that stop can't be confirmed, the checkout stays on disk
|
|
24
|
+
* until a `cancel` confirms it (#523).
|
|
25
|
+
*/
|
|
26
|
+
export const durableSessionFor = Effect.fn("DurableSession.for")(function* (options) {
|
|
27
|
+
const runtime = yield* AttemptRuntime;
|
|
28
|
+
const attempts = new Map();
|
|
29
|
+
/**
|
|
30
|
+
* The reconciliation of each checkout kept while its parent task isn't confirmed stopped, by
|
|
31
|
+
* Attempt. The `cancel` that confirms the stop runs it.
|
|
32
|
+
*/
|
|
33
|
+
const unstopped = new Map();
|
|
34
|
+
/** Completed by each launch after it adds its Attempt to `attempts`. */
|
|
35
|
+
const registrations = new Map();
|
|
36
|
+
const registration = (attemptId) => {
|
|
37
|
+
const existing = registrations.get(attemptId);
|
|
38
|
+
if (existing !== undefined)
|
|
39
|
+
return existing;
|
|
40
|
+
const created = Deferred.makeUnsafe();
|
|
41
|
+
registrations.set(attemptId, created);
|
|
42
|
+
return created;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Cancels the Attempt's parent task if durable storage reports it live. Fails with a `cancel`
|
|
46
|
+
* `ExecutorOperationError` if liveness can't be read, or the cancel fails or exceeds
|
|
47
|
+
* `interruptGrace`.
|
|
48
|
+
*/
|
|
49
|
+
const stopTask = Effect.fn("DurableSession.stopTask")(function* (attemptId, reason) {
|
|
50
|
+
yield* Effect.annotateCurrentSpan({ attemptId, reason });
|
|
51
|
+
const live = yield* runtime.isLive(attemptId).pipe(Effect.result);
|
|
52
|
+
if (Result.isFailure(live)) {
|
|
53
|
+
yield* Effect.logWarning("Could not read whether the Attempt's parent task is live", {
|
|
54
|
+
attemptId,
|
|
55
|
+
reason,
|
|
56
|
+
errorTag: live.failure._tag,
|
|
57
|
+
message: live.failure.message,
|
|
58
|
+
});
|
|
59
|
+
return yield* cancelError(attemptId, live.failure);
|
|
60
|
+
}
|
|
61
|
+
if (!live.success) {
|
|
62
|
+
yield* Effect.logDebug("The Attempt's parent task is not live; nothing to stop", {
|
|
63
|
+
attemptId,
|
|
64
|
+
reason,
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
yield* Effect.logInfo("Canceling the Attempt's parent task", { attemptId, reason });
|
|
69
|
+
const canceled = yield* runtime
|
|
70
|
+
.cancel(attemptId)
|
|
71
|
+
.pipe(Effect.timeoutOption(options.interruptGrace), Effect.result);
|
|
72
|
+
if (Result.isFailure(canceled)) {
|
|
73
|
+
yield* Effect.logWarning("The Attempt's parent task could not be canceled", {
|
|
74
|
+
attemptId,
|
|
75
|
+
reason,
|
|
76
|
+
errorTag: canceled.failure._tag,
|
|
77
|
+
message: canceled.failure.message,
|
|
78
|
+
});
|
|
79
|
+
return yield* cancelError(attemptId, canceled.failure);
|
|
80
|
+
}
|
|
81
|
+
if (Option.isNone(canceled.success)) {
|
|
82
|
+
yield* Effect.logWarning("Canceling the Attempt's parent task exceeded the interrupt grace", {
|
|
83
|
+
attemptId,
|
|
84
|
+
reason,
|
|
85
|
+
});
|
|
86
|
+
return yield* cancelError(attemptId, new Error("canceling the parent task exceeded the interrupt grace"));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
/** Calls `record` with `comments`; failures are logged, not raised. */
|
|
90
|
+
const recordComments = Effect.fn("DurableSession.recordComments")(function* (attemptId, comments, record) {
|
|
91
|
+
yield* Effect.annotateCurrentSpan({ attemptId, comments: comments.length });
|
|
92
|
+
if (comments.length === 0) {
|
|
93
|
+
yield* Effect.logDebug("The Attempt posted no comment on its Item before it ended", {
|
|
94
|
+
attemptId,
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
yield* record(comments).pipe(Effect.tapError((error) => Effect.logWarning("Could not record the comments the Attempt posted before it ended", {
|
|
99
|
+
attemptId,
|
|
100
|
+
comments: comments.length,
|
|
101
|
+
message: String(error),
|
|
102
|
+
})), Effect.ignore);
|
|
103
|
+
});
|
|
104
|
+
/**
|
|
105
|
+
* Records the comments and reviews an unsuccessful Attempt posted on its Run's Item, after its
|
|
106
|
+
* parent task stops. A canceled Attempt's window ends when the orchestrator closes it, so later
|
|
107
|
+
* comments are excluded. Failures are logged without changing the Attempt's result.
|
|
108
|
+
*/
|
|
109
|
+
const recordPostedComments = Effect.fn("DurableSession.recordPostedComments")(function* (attemptId, checkout, io) {
|
|
110
|
+
yield* Effect.annotateCurrentSpan({ attemptId });
|
|
111
|
+
yield* recordComments(attemptId, yield* checkout.harvestComments(io.windows), io.comments);
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* Keeps the checkout of an Attempt whose parent task may still run in it, so neither salvage nor
|
|
115
|
+
* removal runs under the task, and registers its reconciliation for the `cancel` that confirms
|
|
116
|
+
* the stop (#523).
|
|
117
|
+
*/
|
|
118
|
+
const keepUntilStopped = Effect.fn("DurableSession.keepUntilStopped")(function* (attemptId, worker, checkout, io) {
|
|
119
|
+
const fields = { attemptId, worker };
|
|
120
|
+
yield* Effect.annotateCurrentSpan(fields);
|
|
121
|
+
yield* checkout.keepUntilStopped;
|
|
122
|
+
unstopped.set(attemptId, checkout.reconcileKept(io.salvage).pipe(Effect.tap(() => Effect.logInfo("Reconciled the checkout kept while the Attempt's parent task was not confirmed stopped", fields)), Effect.tapError((error) => Effect.logError("Could not reconcile the checkout kept while the Attempt's parent task was not confirmed stopped; the checkout stays until the next start reconciles it", { ...fields, errorTag: error._tag, message: String(error) })), Effect.ignore));
|
|
123
|
+
yield* Effect.logWarning("The Attempt's parent task may still run in its checkout; the checkout stays, without salvage, until a stop is confirmed", fields);
|
|
124
|
+
});
|
|
125
|
+
const launch = Effect.fn("DurableSession.launch")(function* (prepared, io, checkout) {
|
|
126
|
+
const spec = prepared.spec;
|
|
127
|
+
const attemptId = spec.attemptId;
|
|
128
|
+
yield* Effect.annotateCurrentSpan({ attemptId, worker: prepared.worker });
|
|
129
|
+
const stopping = yield* Ref.make(Option.none());
|
|
130
|
+
const execution = yield* Ref.make(Option.none());
|
|
131
|
+
const settled = yield* Deferred.make();
|
|
132
|
+
const run = Effect.gen(function* () {
|
|
133
|
+
attempts.set(attemptId, {
|
|
134
|
+
worker: prepared.worker,
|
|
135
|
+
scope: yield* Effect.scope,
|
|
136
|
+
stopping,
|
|
137
|
+
execution,
|
|
138
|
+
settled,
|
|
139
|
+
});
|
|
140
|
+
yield* Deferred.succeed(registration(attemptId), undefined);
|
|
141
|
+
yield* Effect.logInfo("Running the Attempt's parent task", {
|
|
142
|
+
attemptId,
|
|
143
|
+
worker: prepared.worker,
|
|
144
|
+
worktree: prepared.worktree,
|
|
145
|
+
childHost: checkout.host._tag,
|
|
146
|
+
gatewayCredential: Option.getOrElse(yield* checkout.gatewayCredential, () => "none"),
|
|
147
|
+
});
|
|
148
|
+
const running = yield* runtime
|
|
149
|
+
.execute(new AttemptRequest({
|
|
150
|
+
spec,
|
|
151
|
+
worker: prepared.worker,
|
|
152
|
+
cwd: prepared.worktree,
|
|
153
|
+
host: checkout.host,
|
|
154
|
+
machine: checkout.machine,
|
|
155
|
+
environment: checkout.environment,
|
|
156
|
+
gatewayCredential: checkout.gatewayCredential,
|
|
157
|
+
}), io)
|
|
158
|
+
.pipe(Effect.forkScoped);
|
|
159
|
+
yield* Ref.set(execution, Option.some(running));
|
|
160
|
+
const executed = yield* Fiber.await(running);
|
|
161
|
+
const stop = yield* Ref.get(stopping);
|
|
162
|
+
if (Option.isSome(stop) && stop.value._tag === "Runaway")
|
|
163
|
+
return yield* new RunawayFailure({ ceiling: stop.value.ceiling });
|
|
164
|
+
if (Option.isSome(stop) && stop.value._tag === "Drain")
|
|
165
|
+
return yield* new InfraFailure({
|
|
166
|
+
message: stop.value.message,
|
|
167
|
+
cause: new Error(stop.value.message),
|
|
168
|
+
});
|
|
169
|
+
if (Option.isSome(stop) &&
|
|
170
|
+
Exit.isFailure(executed) &&
|
|
171
|
+
Cause.hasInterruptsOnly(executed.cause))
|
|
172
|
+
return yield* new AgentFailure({ message: "The attempt's parent task was canceled" });
|
|
173
|
+
const report = yield* executed;
|
|
174
|
+
// Reads the windows after GitHub lists the comments, because a later Attempt of the same Agent
|
|
175
|
+
// can overlap this one and a cancel can close this window first (#429). A failed read fails
|
|
176
|
+
// the Attempt.
|
|
177
|
+
const facts = yield* checkout.harvest(io.windows);
|
|
178
|
+
const harvested = harvestedResult(report, facts);
|
|
179
|
+
if (Result.isFailure(harvested)) {
|
|
180
|
+
yield* Effect.logWarning("The parent's last turn answered the operator and the checkout holds no facts; the Attempt fails", { attemptId });
|
|
181
|
+
return yield* harvested.failure;
|
|
182
|
+
}
|
|
183
|
+
const result = harvested.success;
|
|
184
|
+
yield* Effect.logInfo("The Attempt's parent task finished", {
|
|
185
|
+
attemptId,
|
|
186
|
+
facts: result.facts.length,
|
|
187
|
+
answeredOperator: report.answeredOperator,
|
|
188
|
+
});
|
|
189
|
+
yield* runtime.recordResult(attemptId, result).pipe(Effect.tapError((error) => Effect.logWarning("Could not record the Attempt's result in durable storage; preserving the checkout for reattachment", { attemptId, errorTag: error._tag, message: error.message }).pipe(Effect.andThen(checkout.keepForReattach))), Effect.ignore);
|
|
190
|
+
return result;
|
|
191
|
+
});
|
|
192
|
+
return yield* Effect.scoped(run).pipe(Effect.onExit((exit) => Effect.gen(function* () {
|
|
193
|
+
// Complete `settled` first so `stopping` cannot change while the branches below read it.
|
|
194
|
+
yield* Deferred.succeed(settled, undefined);
|
|
195
|
+
if (Exit.isFailure(exit)) {
|
|
196
|
+
const stop = yield* Ref.get(stopping);
|
|
197
|
+
if (Option.isNone(stop) && Cause.hasInterruptsOnly(exit.cause)) {
|
|
198
|
+
yield* Effect.logInfo("This process is stopping; the Attempt's parent task stays live for reattachment", { attemptId, worker: prepared.worker });
|
|
199
|
+
yield* checkout.keepForReattach;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
// stopTask logs its own failure; the Attempt's result is unchanged. The engine then
|
|
203
|
+
// confirms the stop through `cancel` before it frees the Worker slot.
|
|
204
|
+
const stopped = yield* stopTask(attemptId, Option.match(stop, {
|
|
205
|
+
onNone: () => stopReasons.failed,
|
|
206
|
+
onSome: (reason) => Match.valueTags(reason, {
|
|
207
|
+
Cancel: () => stopReasons.cancel,
|
|
208
|
+
Runaway: () => "a ceiling tripped",
|
|
209
|
+
Drain: () => "the Worker is losing the Attempt's machine",
|
|
210
|
+
}),
|
|
211
|
+
})).pipe(Effect.result);
|
|
212
|
+
if (Result.isFailure(stopped))
|
|
213
|
+
yield* keepUntilStopped(attemptId, prepared.worker, checkout, io);
|
|
214
|
+
yield* recordPostedComments(attemptId, checkout, io);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
})));
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* Stops a launched Attempt for `reason` and returns whether one was running here. Cancels the
|
|
221
|
+
* parent task, then waits up to `interruptGrace` before interrupting the Attempt; the launch
|
|
222
|
+
* fails with the first reason. For a run that already ended, does nothing, and the caller waits
|
|
223
|
+
* for its resources to be released.
|
|
224
|
+
*/
|
|
225
|
+
const stop = Effect.fn("DurableSession.stop")(function* (attemptId, reason) {
|
|
226
|
+
const active = attempts.get(attemptId);
|
|
227
|
+
if (active === undefined)
|
|
228
|
+
return false;
|
|
229
|
+
return yield* Effect.uninterruptible(Effect.gen(function* () {
|
|
230
|
+
yield* Effect.annotateCurrentSpan({ attemptId, worker: active.worker, stop: reason._tag });
|
|
231
|
+
if (yield* Deferred.isDone(active.settled)) {
|
|
232
|
+
yield* Effect.logDebug("The Attempt's run has ended; nothing to stop before its release", {
|
|
233
|
+
attemptId,
|
|
234
|
+
worker: active.worker,
|
|
235
|
+
stop: reason,
|
|
236
|
+
});
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
const first = yield* Ref.modify(active.stopping, (stopping) => Option.isNone(stopping)
|
|
240
|
+
? [true, Option.some(reason)]
|
|
241
|
+
: [false, stopping]);
|
|
242
|
+
if (!first) {
|
|
243
|
+
yield* Effect.logDebug("The Attempt is already stopping", {
|
|
244
|
+
attemptId,
|
|
245
|
+
worker: active.worker,
|
|
246
|
+
stop: reason,
|
|
247
|
+
});
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
yield* Effect.logInfo("Canceling the Attempt's parent task", {
|
|
251
|
+
attemptId,
|
|
252
|
+
worker: active.worker,
|
|
253
|
+
stop: reason,
|
|
254
|
+
});
|
|
255
|
+
const canceled = yield* runtime
|
|
256
|
+
.cancel(attemptId)
|
|
257
|
+
.pipe(Effect.timeoutOption(options.interruptGrace), Effect.result);
|
|
258
|
+
const settledInGrace = yield* Deferred.await(active.settled).pipe(Effect.timeoutOption(options.interruptGrace));
|
|
259
|
+
if (Option.isNone(settledInGrace)) {
|
|
260
|
+
yield* Effect.logWarning("The Attempt did not stop within the interrupt grace", {
|
|
261
|
+
attemptId,
|
|
262
|
+
worker: active.worker,
|
|
263
|
+
});
|
|
264
|
+
const running = yield* Ref.get(active.execution);
|
|
265
|
+
if (Option.isSome(running)) {
|
|
266
|
+
const stopped = yield* Fiber.interrupt(running.value).pipe(Effect.timeoutOption(options.interruptGrace));
|
|
267
|
+
if (Option.isNone(stopped))
|
|
268
|
+
yield* Effect.logWarning("The Attempt's execution did not stop when interrupted", {
|
|
269
|
+
attemptId,
|
|
270
|
+
worker: active.worker,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
yield* Effect.logInfo("The Attempt stopped within the interrupt grace", {
|
|
276
|
+
attemptId,
|
|
277
|
+
worker: active.worker,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
if (Result.isFailure(canceled)) {
|
|
281
|
+
yield* Effect.logWarning("The Attempt's parent task could not be canceled", {
|
|
282
|
+
attemptId,
|
|
283
|
+
worker: active.worker,
|
|
284
|
+
errorTag: canceled.failure._tag,
|
|
285
|
+
message: canceled.failure.message,
|
|
286
|
+
});
|
|
287
|
+
return yield* cancelError(attemptId, canceled.failure);
|
|
288
|
+
}
|
|
289
|
+
if (Option.isNone(canceled.success)) {
|
|
290
|
+
yield* Effect.logWarning("Canceling the parent task exceeded the interrupt grace", {
|
|
291
|
+
attemptId,
|
|
292
|
+
worker: active.worker,
|
|
293
|
+
});
|
|
294
|
+
return yield* cancelError(attemptId, new Error("canceling the parent task exceeded the interrupt grace"));
|
|
295
|
+
}
|
|
296
|
+
return true;
|
|
297
|
+
}));
|
|
298
|
+
});
|
|
299
|
+
const intervene = Effect.fn("DurableSession.intervene")(function* (attemptId, intervention) {
|
|
300
|
+
yield* Effect.annotateCurrentSpan({
|
|
301
|
+
attemptId,
|
|
302
|
+
target: intervention.target._tag,
|
|
303
|
+
action: intervention.action._tag,
|
|
304
|
+
});
|
|
305
|
+
const active = attempts.get(attemptId);
|
|
306
|
+
if (active === undefined ||
|
|
307
|
+
(yield* Deferred.isDone(active.settled)) ||
|
|
308
|
+
Option.isSome(yield* Ref.get(active.stopping)))
|
|
309
|
+
return yield* new AgentFailure({
|
|
310
|
+
message: "This attempt has no live session in this orchestrator",
|
|
311
|
+
});
|
|
312
|
+
yield* runtime.intervene(attemptId, intervention).pipe(Effect.tap(() => Effect.logInfo("Operator input delivered to the Attempt's parent task", {
|
|
313
|
+
attemptId,
|
|
314
|
+
action: intervention.action._tag,
|
|
315
|
+
})), Effect.tapError((error) => Effect.logWarning("Operator input delivery failed", {
|
|
316
|
+
attemptId,
|
|
317
|
+
action: intervention.action._tag,
|
|
318
|
+
errorTag: error._tag,
|
|
319
|
+
})),
|
|
320
|
+
// Forks into the Attempt's scope so a disconnected HTTP caller doesn't interrupt delivery.
|
|
321
|
+
Effect.forkIn(active.scope), Effect.flatMap(Fiber.join));
|
|
322
|
+
});
|
|
323
|
+
/**
|
|
324
|
+
* Sends the runaway guard's warning steer through `intervene` after `execute` attaches to the
|
|
325
|
+
* Attempt's channel. The guard starts before `execute` reads durable storage, so sending
|
|
326
|
+
* immediately would drop a warning restored on reattachment (#178).
|
|
327
|
+
*/
|
|
328
|
+
const warnParent = Effect.fn("DurableSession.warnParent")(function* (attemptId, intervention) {
|
|
329
|
+
yield* Effect.annotateCurrentSpan({ attemptId });
|
|
330
|
+
yield* runtime.attached(attemptId);
|
|
331
|
+
yield* intervene(attemptId, intervention);
|
|
332
|
+
});
|
|
333
|
+
/**
|
|
334
|
+
* Wraps `read`, one `part` of the guard's restored state. If `read` fails after the store's
|
|
335
|
+
* retries, stops the parent task and fails the reattachment with an `InfraFailure` for `part`,
|
|
336
|
+
* because restarting that part would reset the Attempt's allowance (#178).
|
|
337
|
+
*/
|
|
338
|
+
const seedPart = (attemptId, part) => (read) => read.pipe(Effect.catch((error) => Effect.gen(function* () {
|
|
339
|
+
yield* Effect.logError(`Could not read the reattached Attempt's ${part}; the reattachment fails instead of starting its runaway guard over`, { attemptId, part, errorTag: error._tag, message: error.message });
|
|
340
|
+
yield* stopTask(attemptId, `its runaway guard cannot read the Attempt's ${part}`).pipe(Effect.ignore);
|
|
341
|
+
return yield* new InfraFailure({
|
|
342
|
+
message: `Can't read the ${part} of the reattached attempt, which the runaway guard needs to resume`,
|
|
343
|
+
cause: error,
|
|
344
|
+
});
|
|
345
|
+
})));
|
|
346
|
+
/**
|
|
347
|
+
* Returns the initial runaway guard state for `request`, empty for a new Attempt. On
|
|
348
|
+
* reattachment, reads the transcript if any ceiling is set and the unsupervised time if
|
|
349
|
+
* `maxAttemptMinutes` is set. Fails with an `InfraFailure` after stopping the parent task if a
|
|
350
|
+
* read fails.
|
|
351
|
+
*/
|
|
352
|
+
const guardSeedFor = Effect.fn("DurableSession.guardSeed")(function* (request, io) {
|
|
353
|
+
const attemptId = request.attemptId;
|
|
354
|
+
const wallClock = Option.isSome(request.maxAttemptMinutes);
|
|
355
|
+
const armed = wallClock || Option.isSome(request.maxAttemptTokens);
|
|
356
|
+
yield* Effect.annotateCurrentSpan({ attemptId, reattach: request.reattach, armed });
|
|
357
|
+
if (!request.reattach)
|
|
358
|
+
return guardSeed([], Duration.zero);
|
|
359
|
+
if (!armed) {
|
|
360
|
+
yield* Effect.logDebug("The reattached Attempt arms no ceiling; its guard resumes nothing", {
|
|
361
|
+
attemptId,
|
|
362
|
+
});
|
|
363
|
+
return guardSeed([], Duration.zero);
|
|
364
|
+
}
|
|
365
|
+
const transcript = yield* io.transcript.pipe(seedPart(attemptId, "transcript"));
|
|
366
|
+
const recorded = wallClock
|
|
367
|
+
? yield* runtime.unsupervised(attemptId).pipe(seedPart(attemptId, "unsupervised time"))
|
|
368
|
+
: Option.none();
|
|
369
|
+
const seed = guardSeed(transcript, Option.getOrElse(recorded, () => Duration.zero));
|
|
370
|
+
yield* Effect.logInfo("Resuming the reattached Attempt's ceilings", {
|
|
371
|
+
attemptId,
|
|
372
|
+
envelopes: transcript.length,
|
|
373
|
+
tokens: [...seed.tokens.values()].reduce((sum, value) => sum + value, 0),
|
|
374
|
+
unsupervisedRecorded: Option.isSome(recorded),
|
|
375
|
+
unsupervisedMinutes: Math.round(Duration.toMillis(seed.unsupervised) / 6_000) / 10,
|
|
376
|
+
parentHeld: seed.parentHeld,
|
|
377
|
+
warned: [...seed.warned],
|
|
378
|
+
});
|
|
379
|
+
return seed;
|
|
380
|
+
});
|
|
381
|
+
const prepared = yield* preparedAttemptsFor(stop, warnParent, (attemptId) => Deferred.await(registration(attemptId)), guardSeedFor, runtime.recordUnsupervised);
|
|
382
|
+
/**
|
|
383
|
+
* Wraps an executor's `acquire` with `preparedAttemptsFor`. If a reattachment can't be prepared,
|
|
384
|
+
* cancels its parent task so the engine retries on a new Attempt.
|
|
385
|
+
*/
|
|
386
|
+
const prepare = (acquire, request) => prepared
|
|
387
|
+
.prepare(
|
|
388
|
+
// Added first so it runs last: the session stays registered until checkout and credential
|
|
389
|
+
// cleanup finish (#197).
|
|
390
|
+
Effect.addFinalizer(() => Effect.sync(() => {
|
|
391
|
+
attempts.delete(request.attemptId);
|
|
392
|
+
registrations.delete(request.attemptId);
|
|
393
|
+
})).pipe(Effect.andThen(acquire)), request)
|
|
394
|
+
.pipe(Effect.tapError(() => request.reattach
|
|
395
|
+
? // stopTask logs its own failure; the preparation error is returned.
|
|
396
|
+
stopTask(request.attemptId, "its reattachment could not be prepared").pipe(Effect.ignore)
|
|
397
|
+
: Effect.void));
|
|
398
|
+
/**
|
|
399
|
+
* Stops the launched Attempt because the Worker is losing its machine, such as a sandbox whose
|
|
400
|
+
* host the platform restarts. The launch fails with a retryable `InfraFailure` with `message`,
|
|
401
|
+
* and its release salvages the checkout, so the next Attempt resumes from the salvage. Returns
|
|
402
|
+
* whether the Attempt ran here.
|
|
403
|
+
*/
|
|
404
|
+
const drain = Effect.fn("DurableSession.drain")(function* (attemptId, message) {
|
|
405
|
+
yield* Effect.annotateCurrentSpan({ attemptId });
|
|
406
|
+
yield* Effect.logWarning("Draining the Attempt before the Worker loses its machine", {
|
|
407
|
+
attemptId,
|
|
408
|
+
message,
|
|
409
|
+
});
|
|
410
|
+
return yield* stop(attemptId, { _tag: "Drain", message });
|
|
411
|
+
});
|
|
412
|
+
/**
|
|
413
|
+
* Cancels the Attempt at any stage, then stops a live parent task this process didn't launch,
|
|
414
|
+
* for example one awaiting reattachment. Fails if that task can't be confirmed stopped. Once it
|
|
415
|
+
* is, reconciles the checkout that a launch kept while the stop was unconfirmed.
|
|
416
|
+
*/
|
|
417
|
+
const cancel = Effect.fn("DurableSession.cancel")(function* (attemptId, reason) {
|
|
418
|
+
yield* Effect.annotateCurrentSpan({ attemptId, reason });
|
|
419
|
+
yield* prepared.cancel(attemptId);
|
|
420
|
+
yield* stopTask(attemptId, stopReasons[reason]);
|
|
421
|
+
const kept = unstopped.get(attemptId);
|
|
422
|
+
if (kept === undefined)
|
|
423
|
+
return;
|
|
424
|
+
unstopped.delete(attemptId);
|
|
425
|
+
yield* Effect.logInfo("The Attempt's parent task is confirmed stopped; reconciling the checkout kept while it was not", { attemptId, reason });
|
|
426
|
+
yield* kept;
|
|
427
|
+
});
|
|
428
|
+
/**
|
|
429
|
+
* Returns whether the open Attempt's parent task is running or reported success without a
|
|
430
|
+
* recorded harvest. If true, a restart reattaches it.
|
|
431
|
+
*/
|
|
432
|
+
const isLive = Effect.fn("DurableSession.isLive")(function* (attemptId) {
|
|
433
|
+
yield* Effect.annotateCurrentSpan({ attemptId });
|
|
434
|
+
if (yield* runtime.isLive(attemptId)) {
|
|
435
|
+
yield* Effect.logDebug("The Attempt's parent task is live", { attemptId });
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
const finished = yield* runtime.finished(attemptId);
|
|
439
|
+
const unharvested = Option.exists(finished, ({ _tag }) => _tag === "ParentReported");
|
|
440
|
+
yield* Effect.logDebug(unharvested
|
|
441
|
+
? "The Attempt's parent task finished before its checkout was harvested; it is reattached"
|
|
442
|
+
: "The Attempt's parent task is not live", { attemptId });
|
|
443
|
+
return unharvested;
|
|
444
|
+
});
|
|
445
|
+
/** Returns the stored result of a finished parent task: the recorded harvest or the parent's failure. */
|
|
446
|
+
const outcome = Effect.fn("DurableSession.outcome")(function* (attemptId) {
|
|
447
|
+
yield* Effect.annotateCurrentSpan({ attemptId });
|
|
448
|
+
const finished = yield* runtime.finished(attemptId);
|
|
449
|
+
const stored = Option.flatMap(finished, (found) => Match.valueTags(found, {
|
|
450
|
+
ParentReported: () => Option.none(),
|
|
451
|
+
ResultRecorded: ({ result }) => Option.some(Result.succeed(result)),
|
|
452
|
+
ParentFailed: ({ failure }) => Option.some(Result.fail(failure)),
|
|
453
|
+
}));
|
|
454
|
+
yield* Effect.logDebug("Read the Attempt's stored outcome", {
|
|
455
|
+
attemptId,
|
|
456
|
+
stored: Option.match(stored, {
|
|
457
|
+
onNone: () => "none",
|
|
458
|
+
onSome: Result.match({ onSuccess: () => "Succeeded", onFailure: ({ _tag }) => _tag }),
|
|
459
|
+
}),
|
|
460
|
+
});
|
|
461
|
+
return stored;
|
|
462
|
+
});
|
|
463
|
+
/**
|
|
464
|
+
* Stops `attempt`'s parent task before recovery reconciles its checkout, even if `isLive` returns
|
|
465
|
+
* true. An unharvested report stays unharvested while the checkout is salvaged (#180). Fails if
|
|
466
|
+
* the task can't be confirmed stopped.
|
|
467
|
+
*/
|
|
468
|
+
const stopForRecovery = Effect.fn("DurableSession.stopForRecovery")(function* (attempt) {
|
|
469
|
+
yield* Effect.annotateCurrentSpan({ attemptId: attempt.attemptId, worker: attempt.worker });
|
|
470
|
+
yield* stopTask(attempt.attemptId, attempt.open ? "its Run does not reattach the Attempt" : "its Attempt is closed");
|
|
471
|
+
});
|
|
472
|
+
/**
|
|
473
|
+
* During startup reconciliation, records the comments and reviews an open Attempt posted on its
|
|
474
|
+
* Run's Item if durable storage has its parent's failure. `harvest` is `None` if the checkout is
|
|
475
|
+
* gone. Does nothing for other Attempts; failures are logged, not raised.
|
|
476
|
+
*/
|
|
477
|
+
const recoverPostedComments = Effect.fn("DurableSession.recoverPostedComments")(function* (attempt, harvest, record) {
|
|
478
|
+
if (!attempt.open)
|
|
479
|
+
return;
|
|
480
|
+
const { attemptId, worker } = attempt;
|
|
481
|
+
yield* Effect.annotateCurrentSpan({ attemptId, worker });
|
|
482
|
+
const finished = yield* runtime.finished(attemptId).pipe(Effect.result);
|
|
483
|
+
if (Result.isFailure(finished)) {
|
|
484
|
+
yield* Effect.logWarning("Could not read how the open Attempt's parent task ended; the comments it posted are not recorded", { attemptId, worker, errorTag: finished.failure._tag, message: finished.failure.message });
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (!Option.exists(finished.success, ({ _tag }) => _tag === "ParentFailed")) {
|
|
488
|
+
yield* Effect.logDebug("Durable storage holds no failure of the open Attempt's parent task; reconciliation records no comment", {
|
|
489
|
+
attemptId,
|
|
490
|
+
worker,
|
|
491
|
+
finished: Option.match(finished.success, {
|
|
492
|
+
onNone: () => "none",
|
|
493
|
+
onSome: ({ _tag }) => _tag,
|
|
494
|
+
}),
|
|
495
|
+
});
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
if (Option.isNone(harvest)) {
|
|
499
|
+
yield* Effect.logWarning("The open Attempt's parent task failed and its checkout is gone; the comments it posted are not recorded", { attemptId, worker });
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
const stored = yield* runtime.request(attemptId).pipe(Effect.result);
|
|
503
|
+
if (Result.isFailure(stored) || Option.isNone(stored.success)) {
|
|
504
|
+
yield* Effect.logWarning("The open Attempt's parent task failed and its durable request cannot be read; the comments it posted are not recorded", {
|
|
505
|
+
attemptId,
|
|
506
|
+
worker,
|
|
507
|
+
message: Result.isFailure(stored) ? stored.failure.message : "no durable request",
|
|
508
|
+
});
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
yield* Effect.logInfo("The open Attempt's parent task failed before this process recorded it; harvesting the comments it posted from its checkout", { attemptId, worker });
|
|
512
|
+
const comments = yield* harvest
|
|
513
|
+
.value(stored.success.value.spec, record.windows)
|
|
514
|
+
.pipe(Effect.result);
|
|
515
|
+
if (Result.isFailure(comments)) {
|
|
516
|
+
yield* Effect.logWarning("Could not acquire a credential to harvest the open Attempt's comments; the comments it posted are not recorded", { attemptId, worker, errorTag: comments.failure._tag, message: comments.failure.message });
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
yield* recordComments(attemptId, comments.success, record.comments);
|
|
520
|
+
});
|
|
521
|
+
/** Returns the request the reattached Attempt's parent task was created with. Fails with a `prepare` `ExecutorOperationError` if it's missing or unreadable. */
|
|
522
|
+
const storedRequest = Effect.fn("DurableSession.storedRequest")(function* (attemptId) {
|
|
523
|
+
yield* Effect.annotateCurrentSpan({ attemptId });
|
|
524
|
+
const stored = yield* runtime.request(attemptId).pipe(Effect.mapError((cause) => new ExecutorOperationError({
|
|
525
|
+
operation: "prepare",
|
|
526
|
+
message: "Can't read the durable request of the reattached attempt",
|
|
527
|
+
cause,
|
|
528
|
+
})));
|
|
529
|
+
if (Option.isNone(stored))
|
|
530
|
+
return yield* new ExecutorOperationError({
|
|
531
|
+
operation: "prepare",
|
|
532
|
+
message: "The reattached attempt has no durable request",
|
|
533
|
+
cause: new Error(attemptId),
|
|
534
|
+
});
|
|
535
|
+
return stored.value;
|
|
536
|
+
});
|
|
537
|
+
return {
|
|
538
|
+
launch,
|
|
539
|
+
prepare,
|
|
540
|
+
cancel,
|
|
541
|
+
drain,
|
|
542
|
+
intervene,
|
|
543
|
+
isLive,
|
|
544
|
+
outcome,
|
|
545
|
+
stopForRecovery,
|
|
546
|
+
recoverPostedComments,
|
|
547
|
+
storedRequest,
|
|
548
|
+
};
|
|
549
|
+
});
|
|
550
|
+
//# sourceMappingURL=durable-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durable-session.js","sourceRoot":"","sources":["../src/durable-session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACL,YAAY,EAEZ,YAAY,EACZ,cAAc,GACf,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,gCAAg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DAA0D;YACnE,KAAK;SACN,CAAC,CACL,CACF,CAAC;QACF,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;YACvB,OAAO,KAAK,CAAC,CAAC,IAAI,sBAAsB,CAAC;gBACvC,SAAS,EAAE,SAAS;gBACpB,OAAO,EAAE,+CAA+C;gBACxD,KAAK,EAAE,IAAI,KAAK,CAAC,SAAS,CAAC;aAC5B,CAAC,CAAC;QACL,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;QACN,OAAO;QACP,MAAM;QACN,KAAK;QACL,SAAS;QACT,MAAM;QACN,OAAO;QACP,eAAe;QACf,qBAAqB;QACrB,aAAa;KACL,CAAC;AACb,CAAC,CAAC,CAAC"}
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
+
import type { RemoteShell, SshCommand } from "@usine/agents/child-host";
|
|
2
|
+
import type { SshDestination } from "@usine/core/worker";
|
|
1
3
|
import { Effect } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import type { SshDestination } from "./model.ts";
|
|
4
|
+
import type { CommandResult } from "../child-command.ts";
|
|
5
|
+
import type { ExecutorOperation, ExecutorOperationError } from "../executor.ts";
|
|
6
|
+
import { type RemoteCommands, type RemoteContext } from "../remote/commands.ts";
|
|
6
7
|
export interface ExeDevCommands {
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
8
|
+
readonly shared: RemoteCommands;
|
|
9
|
+
readonly childHost: (sshDest: SshDestination) => RemoteShell;
|
|
9
10
|
readonly lobby: (operation: ExecutorOperation, args: ReadonlyArray<string>) => Effect.Effect<string, ExecutorOperationError>;
|
|
10
11
|
readonly lobbyJson: (operation: ExecutorOperation, args: ReadonlyArray<string>) => Effect.Effect<string, ExecutorOperationError>;
|
|
11
12
|
readonly remoteRaw: (operation: ExecutorOperation, sshDest: SshDestination, command: string, args: ReadonlyArray<string>) => Effect.Effect<CommandResult, ExecutorOperationError>;
|
|
12
|
-
readonly remote: (operation: ExecutorOperation, sshDest: SshDestination, command: string, args: ReadonlyArray<string
|
|
13
|
+
readonly remote: (operation: ExecutorOperation, sshDest: SshDestination, command: string, args: ReadonlyArray<string>, context?: RemoteContext) => Effect.Effect<string, ExecutorOperationError>;
|
|
13
14
|
}
|
|
14
|
-
export declare const commandsFor: (configuredSsh?:
|
|
15
|
-
|
|
15
|
+
export declare const commandsFor: (configuredSsh?: {
|
|
16
|
+
readonly command: string;
|
|
17
|
+
readonly args: readonly string[];
|
|
18
|
+
} | undefined) => Effect.Effect<{
|
|
19
|
+
shared: {
|
|
20
|
+
shellFor: (ssh: SshCommand, destination: SshDestination) => RemoteShell;
|
|
21
|
+
local: (operation: "cancel" | "cleanup" | "launch" | "preflight" | "prepare", host: string, command: string, args: readonly string[]) => Effect.Effect<string, ExecutorOperationError, never>;
|
|
22
|
+
inspect: (operation: ExecutorOperation, shell: RemoteShell, command: string, args: ReadonlyArray<string>) => Effect.Effect<CommandResult, ExecutorOperationError>;
|
|
23
|
+
run: (operation: "cancel" | "cleanup" | "launch" | "preflight" | "prepare", shell: RemoteShell, command: string, args: readonly string[], context?: RemoteContext | undefined) => Effect.Effect<string, ExecutorOperationError, never>;
|
|
24
|
+
runWithInput: (operation: "cancel" | "cleanup" | "launch" | "preflight" | "prepare", shell: RemoteShell, command: string, args: readonly string[], input: import("effect/Redacted").Redacted<string>) => Effect.Effect<string, ExecutorOperationError, never>;
|
|
25
|
+
};
|
|
26
|
+
childHost: (sshDest: SshDestination) => RemoteShell;
|
|
16
27
|
lobby: (operation: ExecutorOperation, args: ReadonlyArray<string>) => Effect.Effect<string, ExecutorOperationError>;
|
|
17
28
|
lobbyJson: (operation: ExecutorOperation, args: ReadonlyArray<string>) => Effect.Effect<string, ExecutorOperationError>;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, never, ChildProcessSpawner.ChildProcessSpawner>;
|
|
29
|
+
remoteRaw: (operation: "cancel" | "cleanup" | "launch" | "preflight" | "prepare", sshDest: string & import("effect/Brand").Brand<"SshDestination">, command: string, args: readonly string[]) => Effect.Effect<CommandResult, ExecutorOperationError, never>;
|
|
30
|
+
remote: (operation: "cancel" | "cleanup" | "launch" | "preflight" | "prepare", sshDest: string & import("effect/Brand").Brand<"SshDestination">, command: string, args: readonly string[], context: RemoteContext | undefined) => Effect.Effect<string, ExecutorOperationError, never>;
|
|
31
|
+
}, never, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
22
32
|
//# sourceMappingURL=commands.d.ts.map
|