@foldrun/core 24.7.0 → 24.7.1
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/failure.d.ts +4 -0
- package/dist/src/failure.js +16 -0
- package/dist/src/run-event.d.ts +1 -1
- package/dist/src/run-event.js +8 -3
- package/package.json +1 -1
- package/src/failure.ts +18 -0
- package/src/run-event.ts +7 -3
package/dist/src/failure.d.ts
CHANGED
|
@@ -89,4 +89,8 @@ export declare function failureFactsOf(step: FailedStepLike): FailureFacts | und
|
|
|
89
89
|
* Why this failed step failed, for the customer. `reason` is its last error
|
|
90
90
|
* (store.ts runFailure); the step gives the figures a limit's message says.
|
|
91
91
|
*/
|
|
92
|
+
/** The runner's (and model-env's) refusal when a hosted account has no model
|
|
93
|
+
* key of its own: the whole sentence, so a step's own "no model key …" error
|
|
94
|
+
* is not mistaken for it (Codex). */
|
|
95
|
+
export declare const NO_MODEL_KEY: RegExp;
|
|
92
96
|
export declare function explainFailure(reason: string, step?: FailedStepLike | null): FailureExplained;
|
package/dist/src/failure.js
CHANGED
|
@@ -166,6 +166,10 @@ const NODE_PRESSURE = /\bEvicted\b[^\n]*\bThe node (was|had) (low on|condition)|
|
|
|
166
166
|
* Why this failed step failed, for the customer. `reason` is its last error
|
|
167
167
|
* (store.ts runFailure); the step gives the figures a limit's message says.
|
|
168
168
|
*/
|
|
169
|
+
/** The runner's (and model-env's) refusal when a hosted account has no model
|
|
170
|
+
* key of its own: the whole sentence, so a step's own "no model key …" error
|
|
171
|
+
* is not mistaken for it (Codex). */
|
|
172
|
+
export const NO_MODEL_KEY = /^no model key: this account runs on its own API key, and none is set\b/;
|
|
169
173
|
export function explainFailure(reason, step) {
|
|
170
174
|
const facts = step?.failureFacts;
|
|
171
175
|
const text = String(reason ?? "");
|
|
@@ -243,6 +247,18 @@ export function explainFailure(reason, step) {
|
|
|
243
247
|
if (/^(run )?stopped by |stopped while waiting for room/.test(text)) {
|
|
244
248
|
return { class: "cancelled", kind: "stopped", message: firstSentence(text), fix: null };
|
|
245
249
|
}
|
|
250
|
+
// The runner's own refusal before a sandbox is rented: the account has no
|
|
251
|
+
// model key and may not run on the platform's. The account's setting,
|
|
252
|
+
// not foldrun's fault: it fell to the platform_error bucket below and was
|
|
253
|
+
// counted as ours (customer bench, 20 Nov 2026).
|
|
254
|
+
if (NO_MODEL_KEY.test(text)) {
|
|
255
|
+
return {
|
|
256
|
+
class: "policy_denied",
|
|
257
|
+
kind: "credential",
|
|
258
|
+
message: "This account has no model key for this run, and foldrun's models are not open to it.",
|
|
259
|
+
fix: "Add one in Settings → Models (or `foldrun account model set <provider> --key …`), or a provider: block in AGENTS.md, then rerun.",
|
|
260
|
+
};
|
|
261
|
+
}
|
|
246
262
|
const cause = platformCause(text);
|
|
247
263
|
if (cause) {
|
|
248
264
|
const kind = cause.key === "model-auth" ? "credential" : cause.key === "sandbox" || cause.key === "worker" ? "platform" : "model";
|
package/dist/src/run-event.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const SLO_REASONS: readonly ["completed", "cancelled", "customer_
|
|
|
14
14
|
export type SloReason = (typeof SLO_REASONS)[number];
|
|
15
15
|
/** The SLO rule's version, on every row: a row says which rule judged it,
|
|
16
16
|
* so a change to the rule never silently rewrites history's meaning. */
|
|
17
|
-
export declare const SLO_RULES_VERSION =
|
|
17
|
+
export declare const SLO_RULES_VERSION = 2;
|
|
18
18
|
export interface RunWideEvent {
|
|
19
19
|
runId: string;
|
|
20
20
|
tenant: string;
|
package/dist/src/run-event.js
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
import crypto from "node:crypto";
|
|
38
38
|
import { isSplicedRecord, runFailure } from "./store.js";
|
|
39
39
|
import { ERROR_CLASSES, opsLine } from "./ops-log.js";
|
|
40
|
-
import { explainFailure } from "./failure.js";
|
|
40
|
+
import { explainFailure, NO_MODEL_KEY } from "./failure.js";
|
|
41
41
|
import { startupBreakdown } from "./startup.js";
|
|
42
42
|
/** The funnel's marks, in order. */
|
|
43
43
|
export const FUNNEL = ["submitted", "queued", "eligible", "claimed", "scheduled", "podReady", "sandboxUp", "firstOutput", "finished"];
|
|
@@ -51,7 +51,8 @@ export const SLO_REASONS = [
|
|
|
51
51
|
];
|
|
52
52
|
/** The SLO rule's version, on every row: a row says which rule judged it,
|
|
53
53
|
* so a change to the rule never silently rewrites history's meaning. */
|
|
54
|
-
|
|
54
|
+
// 2 (20 Nov 2026): the no-model-key refusal is the account's, excluded.
|
|
55
|
+
export const SLO_RULES_VERSION = 2;
|
|
55
56
|
const iso = (ms) => (ms === null || !Number.isFinite(ms) ? null : new Date(ms).toISOString());
|
|
56
57
|
const msOf = (s) => {
|
|
57
58
|
if (!s)
|
|
@@ -157,7 +158,11 @@ export function sloOutcome(run, failure = terminalFailure(run)) {
|
|
|
157
158
|
return sloOutcome(run, { ...bare, text: failure.text, step });
|
|
158
159
|
}
|
|
159
160
|
case "credential":
|
|
160
|
-
|
|
161
|
+
// An account with no model key of its own is refused before a sandbox
|
|
162
|
+
// is rented: its setting, never foldrun's (customer bench, 20 Nov 2026).
|
|
163
|
+
if (failure.step?.supply === "own" || NO_MODEL_KEY.test(failure.text ?? ""))
|
|
164
|
+
return excluded("customer_credential");
|
|
165
|
+
return bad("model");
|
|
161
166
|
case "memory":
|
|
162
167
|
case "cpu":
|
|
163
168
|
case "disk":
|
package/package.json
CHANGED
package/src/failure.ts
CHANGED
|
@@ -230,6 +230,11 @@ const NODE_PRESSURE = /\bEvicted\b[^\n]*\bThe node (was|had) (low on|condition)|
|
|
|
230
230
|
* Why this failed step failed, for the customer. `reason` is its last error
|
|
231
231
|
* (store.ts runFailure); the step gives the figures a limit's message says.
|
|
232
232
|
*/
|
|
233
|
+
/** The runner's (and model-env's) refusal when a hosted account has no model
|
|
234
|
+
* key of its own: the whole sentence, so a step's own "no model key …" error
|
|
235
|
+
* is not mistaken for it (Codex). */
|
|
236
|
+
export const NO_MODEL_KEY = /^no model key: this account runs on its own API key, and none is set\b/;
|
|
237
|
+
|
|
233
238
|
export function explainFailure(reason: string, step?: FailedStepLike | null): FailureExplained {
|
|
234
239
|
const facts = step?.failureFacts;
|
|
235
240
|
const text = String(reason ?? "");
|
|
@@ -313,6 +318,19 @@ export function explainFailure(reason: string, step?: FailedStepLike | null): Fa
|
|
|
313
318
|
return { class: "cancelled", kind: "stopped", message: firstSentence(text), fix: null };
|
|
314
319
|
}
|
|
315
320
|
|
|
321
|
+
// The runner's own refusal before a sandbox is rented: the account has no
|
|
322
|
+
// model key and may not run on the platform's. The account's setting,
|
|
323
|
+
// not foldrun's fault: it fell to the platform_error bucket below and was
|
|
324
|
+
// counted as ours (customer bench, 20 Nov 2026).
|
|
325
|
+
if (NO_MODEL_KEY.test(text)) {
|
|
326
|
+
return {
|
|
327
|
+
class: "policy_denied",
|
|
328
|
+
kind: "credential",
|
|
329
|
+
message: "This account has no model key for this run, and foldrun's models are not open to it.",
|
|
330
|
+
fix: "Add one in Settings → Models (or `foldrun account model set <provider> --key …`), or a provider: block in AGENTS.md, then rerun.",
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
316
334
|
const cause = platformCause(text);
|
|
317
335
|
if (cause) {
|
|
318
336
|
const kind: FailureKind = cause.key === "model-auth" ? "credential" : cause.key === "sandbox" || cause.key === "worker" ? "platform" : "model";
|
package/src/run-event.ts
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
import crypto from "node:crypto";
|
|
39
39
|
import { isSplicedRecord, runFailure, type RunRecord, type StepRecord } from "./store.ts";
|
|
40
40
|
import { ERROR_CLASSES, opsLine, type ErrorClass, type OpsFields } from "./ops-log.ts";
|
|
41
|
-
import { explainFailure, type FailureExplained, type FailureKind, type LimitScope } from "./failure.ts";
|
|
41
|
+
import { explainFailure, NO_MODEL_KEY, type FailureExplained, type FailureKind, type LimitScope } from "./failure.ts";
|
|
42
42
|
import { startupBreakdown, type StartupPhase } from "./startup.ts";
|
|
43
43
|
|
|
44
44
|
/** The funnel's marks, in order. */
|
|
@@ -63,7 +63,8 @@ export type SloReason = (typeof SLO_REASONS)[number];
|
|
|
63
63
|
|
|
64
64
|
/** The SLO rule's version, on every row: a row says which rule judged it,
|
|
65
65
|
* so a change to the rule never silently rewrites history's meaning. */
|
|
66
|
-
|
|
66
|
+
// 2 (20 Nov 2026): the no-model-key refusal is the account's, excluded.
|
|
67
|
+
export const SLO_RULES_VERSION = 2;
|
|
67
68
|
|
|
68
69
|
export interface RunWideEvent {
|
|
69
70
|
runId: string;
|
|
@@ -235,7 +236,10 @@ export function sloOutcome(run: RunRecord, failure = terminalFailure(run)): { sl
|
|
|
235
236
|
return sloOutcome(run, { ...bare, text: failure.text, step });
|
|
236
237
|
}
|
|
237
238
|
case "credential":
|
|
238
|
-
|
|
239
|
+
// An account with no model key of its own is refused before a sandbox
|
|
240
|
+
// is rented: its setting, never foldrun's (customer bench, 20 Nov 2026).
|
|
241
|
+
if (failure.step?.supply === "own" || NO_MODEL_KEY.test(failure.text ?? "")) return excluded("customer_credential");
|
|
242
|
+
return bad("model");
|
|
239
243
|
case "memory":
|
|
240
244
|
case "cpu":
|
|
241
245
|
case "disk":
|