@fungi.computer/oyster 0.21.5 → 0.21.7
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.
|
@@ -24,24 +24,36 @@ const unconfirmed = {
|
|
|
24
24
|
outcome: "outcome_unknown",
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
* Delays before each further
|
|
28
|
-
* backend construction, a Durable Object reset or an overloaded
|
|
29
|
-
* fail its first generic
|
|
27
|
+
* Delays before each further attempt at one Instance step. A cold Instance
|
|
28
|
+
* (first backend construction, a Durable Object reset or an overloaded
|
|
29
|
+
* isolate) can fail its first generic attempt and pass the next one.
|
|
30
30
|
*/
|
|
31
|
-
const
|
|
32
|
-
/**
|
|
33
|
-
|
|
31
|
+
const instanceRetryDelaysMs = [500, 2_000];
|
|
32
|
+
/**
|
|
33
|
+
* Retry only generic Instance failures; typed refusals are final. Both steps
|
|
34
|
+
* are safe to repeat: preparation never changes the active runtime, and apply
|
|
35
|
+
* replays the pinned committed fact (an applied selection is `unchanged`).
|
|
36
|
+
*/
|
|
37
|
+
async function withColdRetry(step, run) {
|
|
34
38
|
for (let attempt = 1;; attempt++) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
// The Instance's RPC can throw instead of answering (a dropped
|
|
40
|
+
// connection, a reset Durable Object). That says nothing about whether
|
|
41
|
+
// the step ran, and repeating either step is safe, so it is one more
|
|
42
|
+
// generic failure rather than an unknown outcome.
|
|
43
|
+
const outcome = await run().then((settled) => settled, (cause) => {
|
|
44
|
+
const diagnostic = failureDiagnostic(cause);
|
|
45
|
+
console.error(`Installation ${step} threw`, { attempt, ...diagnostic });
|
|
46
|
+
return { ok: false, code: "failed", causeClass: diagnostic.causeClass };
|
|
47
|
+
});
|
|
48
|
+
if (outcome.ok || outcome.code !== "failed")
|
|
49
|
+
return outcome;
|
|
50
|
+
console.error(`Installation ${step} failed`, {
|
|
39
51
|
attempt,
|
|
40
|
-
causeClass:
|
|
52
|
+
causeClass: outcome.causeClass,
|
|
41
53
|
});
|
|
42
|
-
const wait =
|
|
54
|
+
const wait = instanceRetryDelaysMs[attempt - 1];
|
|
43
55
|
if (wait === undefined)
|
|
44
|
-
return
|
|
56
|
+
return outcome;
|
|
45
57
|
await new Promise((resolve) => setTimeout(resolve, wait));
|
|
46
58
|
}
|
|
47
59
|
}
|
|
@@ -160,7 +172,7 @@ export async function executeInstallation(host, input) {
|
|
|
160
172
|
}
|
|
161
173
|
}
|
|
162
174
|
else {
|
|
163
|
-
const prepared = await
|
|
175
|
+
const prepared = await withColdRetry("preparation", () => instance.prepare(state, next.release));
|
|
164
176
|
if (!prepared.ok)
|
|
165
177
|
// Preparation never changes the active runtime and runs before the
|
|
166
178
|
// commit, so a generic failure here leaves the previous release live.
|
|
@@ -177,13 +189,18 @@ export async function executeInstallation(host, input) {
|
|
|
177
189
|
return refused(409, commit.code);
|
|
178
190
|
if (instance !== null) {
|
|
179
191
|
// Replay the pinned fact; NEVER derive version N+1 from a current row here.
|
|
180
|
-
const applied = await instance.apply(state, next.release);
|
|
181
|
-
if (!applied.ok)
|
|
192
|
+
const applied = await withColdRetry("activation", () => instance.apply(state, next.release));
|
|
193
|
+
if (!applied.ok) {
|
|
194
|
+
// The selection is committed, so a persistent generic failure is not
|
|
195
|
+
// "nothing changed": it is a definitive, retryable activation failure.
|
|
196
|
+
if (applied.code === "failed")
|
|
197
|
+
return refused(503, "installation_not_activated");
|
|
182
198
|
// Native apply can return stale_authority from its POST-application
|
|
183
199
|
// owner check. That code does not establish that application never ran.
|
|
184
|
-
return applied.code === "
|
|
200
|
+
return applied.code === "stale_authority"
|
|
185
201
|
? unconfirmed
|
|
186
202
|
: refused(instanceRefusalStatus(applied.code), applied.code);
|
|
203
|
+
}
|
|
187
204
|
const receipt = Schema.decodeUnknownSync(instanceSchema)(applied.value);
|
|
188
205
|
if (receipt.instanceId !== state.instanceId ||
|
|
189
206
|
receipt.owner.kind !== "installation" ||
|
|
@@ -3,6 +3,8 @@ import type { AppInstanceErrorCode } from "./index.js";
|
|
|
3
3
|
export declare function instanceRefusalStatus(code: AppInstanceErrorCode): number;
|
|
4
4
|
/** The host-authored settlement for an installation that changed nothing. */
|
|
5
5
|
export declare const installationNotAppliedMessage = "The new release was not applied: Oyster could not prepare it. The previous release is still installed; install again to retry.";
|
|
6
|
+
/** The host-authored settlement for a committed release whose backend would not start. */
|
|
7
|
+
export declare const installationNotActivatedMessage = "The new release was selected, but its backend did not start. Install again to retry activation.";
|
|
6
8
|
/** Only closed host-authored reasons produce a caller-facing message. */
|
|
7
9
|
export declare function instanceRefusalBody(code: string): {
|
|
8
10
|
error: string;
|
package/dist/instance-refusal.js
CHANGED
|
@@ -14,10 +14,14 @@ export function instanceRefusalStatus(code) {
|
|
|
14
14
|
}
|
|
15
15
|
/** The host-authored settlement for an installation that changed nothing. */
|
|
16
16
|
export const installationNotAppliedMessage = "The new release was not applied: Oyster could not prepare it. The previous release is still installed; install again to retry.";
|
|
17
|
+
/** The host-authored settlement for a committed release whose backend would not start. */
|
|
18
|
+
export const installationNotActivatedMessage = "The new release was selected, but its backend did not start. Install again to retry activation.";
|
|
17
19
|
/** Only closed host-authored reasons produce a caller-facing message. */
|
|
18
20
|
export function instanceRefusalBody(code) {
|
|
19
21
|
if (code === "installation_not_applied")
|
|
20
22
|
return { error: code, message: installationNotAppliedMessage };
|
|
23
|
+
if (code === "installation_not_activated")
|
|
24
|
+
return { error: code, message: installationNotActivatedMessage };
|
|
21
25
|
const boot = bootFailureSchema.safeParse(code);
|
|
22
26
|
return boot.success
|
|
23
27
|
? { error: boot.data, message: new BootGateError(boot.data).message }
|
|
@@ -5,7 +5,7 @@ import { setTimeout as sleep } from "node:timers/promises";
|
|
|
5
5
|
import * as Option from "effect/Option";
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
7
7
|
import { olderOysterStoreCode } from "../older-oyster-store.js";
|
|
8
|
-
import { installationNotAppliedMessage } from "../instance-refusal.js";
|
|
8
|
+
import { installationNotActivatedMessage, installationNotAppliedMessage, } from "../instance-refusal.js";
|
|
9
9
|
import { publishSource } from "../pack.js";
|
|
10
10
|
import { appBuildRecipe, readBuildManifest } from "../build/workspace-build.js";
|
|
11
11
|
import { parseSourceRevision } from "@fungi.computer/puffball";
|
|
@@ -374,7 +374,9 @@ export async function installStandaloneAppSet(options) {
|
|
|
374
374
|
if (operation.state === "refused")
|
|
375
375
|
throw new Error(operation.code === "installation_not_applied"
|
|
376
376
|
? `${name}: ${installationNotAppliedMessage}`
|
|
377
|
-
:
|
|
377
|
+
: operation.code === "installation_not_activated"
|
|
378
|
+
? `${name}: ${installationNotActivatedMessage}`
|
|
379
|
+
: `${name} installation refused (${operation.code})`);
|
|
378
380
|
const record = operation.installation;
|
|
379
381
|
if (record === null)
|
|
380
382
|
throw new Error(`${name} completed installation version is unavailable`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/oyster",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.7",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Oyster by Fungi: open-source Apps for people and AI agents. Try with one command or run on your own Cloudflare account.",
|
|
6
6
|
"homepage": "https://docs.fungi.computer/oyster",
|
|
@@ -344,7 +344,7 @@
|
|
|
344
344
|
"@fungi.computer/burrow": "0.2.1",
|
|
345
345
|
"@fungi.computer/cairn": "0.1.0",
|
|
346
346
|
"@fungi.computer/capnweb": "0.12.0-fungi.0",
|
|
347
|
-
"@fungi.computer/caps": "0.11.
|
|
347
|
+
"@fungi.computer/caps": "0.11.2",
|
|
348
348
|
"@fungi.computer/carrier": "0.2.4",
|
|
349
349
|
"@fungi.computer/computer": "0.8.6",
|
|
350
350
|
"@fungi.computer/computer-contract": "0.1.0",
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
"@fungi.computer/lantern": "0.4.2",
|
|
357
357
|
"@fungi.computer/mycelium": "0.3.8",
|
|
358
358
|
"@fungi.computer/nacre": "0.5.2",
|
|
359
|
-
"@fungi.computer/parakeet": "0.11.
|
|
359
|
+
"@fungi.computer/parakeet": "0.11.20",
|
|
360
360
|
"@fungi.computer/puffball": "0.5.5",
|
|
361
361
|
"@fungi.computer/seam": "0.2.5",
|
|
362
362
|
"@fungi.computer/shiitake": "0.13.1",
|