@opengeni/worker-bundle 1.3.0 → 1.4.2
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/activities/agent-turn/errors.d.ts +1 -13
- package/dist/activities/agent-turn/sandbox-provision.d.ts +22 -0
- package/dist/activities/agent-turn/subscription-lease.d.ts +1 -0
- package/dist/activities/agent-turn/tool-policy.d.ts +10 -1
- package/dist/activities/agent-turn/turn-context.d.ts +6 -0
- package/dist/activities/agent-turn/web-search.d.ts +37 -0
- package/dist/activities/codemode-dispatcher.d.ts +8 -0
- package/dist/activities/sandbox-lease.d.ts +4 -0
- package/dist/{activities-control-PEXBWKQJ.js → activities-control-AKJZHDTY.js} +53 -13
- package/dist/activities-control-AKJZHDTY.js.map +1 -0
- package/dist/{activities-turn-W27A2SBO.js → activities-turn-AOXNE6BM.js} +5984 -5571
- package/dist/activities-turn-AOXNE6BM.js.map +1 -0
- package/dist/{chunk-XONQEVAD.js → chunk-DCQ7XTXW.js} +108 -3
- package/dist/chunk-DCQ7XTXW.js.map +1 -0
- package/dist/{chunk-QUX5LT2B.js → chunk-WVZQJBGD.js} +166 -45
- package/dist/chunk-WVZQJBGD.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/observability-metrics.d.ts +51 -13
- package/dist/sandbox-resume.d.ts +3 -0
- package/package.json +21 -21
- package/src/activities/agent-turn/agent-build.ts +4 -2
- package/src/activities/agent-turn/errors.ts +89 -10
- package/src/activities/agent-turn/finalization.ts +16 -0
- package/src/activities/agent-turn/governance-model.ts +8 -8
- package/src/activities/agent-turn/run.ts +12 -0
- package/src/activities/agent-turn/sandbox-establish.ts +87 -80
- package/src/activities/agent-turn/sandbox-provision.ts +51 -0
- package/src/activities/agent-turn/sandbox-runtime.ts +16 -0
- package/src/activities/agent-turn/stream-attempt.ts +36 -15
- package/src/activities/agent-turn/subscription-lease.ts +10 -1
- package/src/activities/agent-turn/tool-environment.ts +19 -0
- package/src/activities/agent-turn/tool-policy.ts +25 -0
- package/src/activities/agent-turn/turn-context.ts +8 -0
- package/src/activities/agent-turn/web-search.ts +381 -0
- package/src/activities/codemode-dispatcher.ts +57 -8
- package/src/activities/connector-attachments.ts +3 -1
- package/src/activities/sandbox-lease.ts +63 -10
- package/src/activity-services.ts +8 -0
- package/src/observability-metrics.ts +130 -17
- package/src/sandbox-resume.ts +24 -5
- package/src/sandbox-routing.ts +70 -24
- package/dist/activities-control-PEXBWKQJ.js.map +0 -1
- package/dist/activities-turn-W27A2SBO.js.map +0 -1
- package/dist/chunk-QUX5LT2B.js.map +0 -1
- package/dist/chunk-XONQEVAD.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
observabilityEventBusOptions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DCQ7XTXW.js";
|
|
4
4
|
|
|
5
5
|
// src/activity-services.ts
|
|
6
6
|
import {
|
|
7
7
|
codeSearchDeploymentPolicy,
|
|
8
|
+
resolveWebSearchProvider,
|
|
8
9
|
dbSearchPath,
|
|
9
10
|
getSettings,
|
|
10
11
|
resolveNatsControlPlaneAuth
|
|
@@ -413,6 +414,12 @@ function createSharedActivityServices(dependencies) {
|
|
|
413
414
|
const resolvedSettings = (await resolveCatalogSettings(db, settings)).settings;
|
|
414
415
|
configureChildLifecycleNotices({ enabled: settings.childLifecycleNoticesEnabled });
|
|
415
416
|
configureCodeSearchDeploymentPolicy(codeSearchDeploymentPolicy(settings));
|
|
417
|
+
const webSearchProvider = resolveWebSearchProvider(settings);
|
|
418
|
+
if (webSearchProvider.status === "invalid") {
|
|
419
|
+
observability.warn("web search provider is misconfigured; web_search stays off", {
|
|
420
|
+
reason: webSearchProvider.reason
|
|
421
|
+
});
|
|
422
|
+
}
|
|
416
423
|
return {
|
|
417
424
|
settings: resolvedSettings,
|
|
418
425
|
catalogSourceSettings: settings,
|
|
@@ -1558,7 +1565,7 @@ var GoogleDriveProviderTransportError = class extends Error {
|
|
|
1558
1565
|
};
|
|
1559
1566
|
async function fetchGoogleDriveProvider(input) {
|
|
1560
1567
|
const now = input.now ?? Date.now;
|
|
1561
|
-
const
|
|
1568
|
+
const sleep2 = input.sleep ?? Bun.sleep;
|
|
1562
1569
|
let retryDelaySpentMs = 0;
|
|
1563
1570
|
for (let attempt = 1; attempt <= input.policy.attempts; attempt += 1) {
|
|
1564
1571
|
let response;
|
|
@@ -1579,7 +1586,7 @@ async function fetchGoogleDriveProvider(input) {
|
|
|
1579
1586
|
recordRetry(input.observability, input.operation, "transport", attempt, delayMs2);
|
|
1580
1587
|
retryDelaySpentMs += delayMs2;
|
|
1581
1588
|
input.heartbeat?.({ operation: input.operation, attempt, phase: "retry_delay_start" });
|
|
1582
|
-
await
|
|
1589
|
+
await sleep2(delayMs2);
|
|
1583
1590
|
input.heartbeat?.({ operation: input.operation, attempt, phase: "retry_delay_end" });
|
|
1584
1591
|
continue;
|
|
1585
1592
|
}
|
|
@@ -1609,7 +1616,7 @@ async function fetchGoogleDriveProvider(input) {
|
|
|
1609
1616
|
);
|
|
1610
1617
|
retryDelaySpentMs += delayMs;
|
|
1611
1618
|
input.heartbeat?.({ operation: input.operation, attempt, phase: "retry_delay_start" });
|
|
1612
|
-
await
|
|
1619
|
+
await sleep2(delayMs);
|
|
1613
1620
|
input.heartbeat?.({ operation: input.operation, attempt, phase: "retry_delay_end" });
|
|
1614
1621
|
}
|
|
1615
1622
|
throw new GoogleDriveProviderTransportError();
|
|
@@ -4990,7 +4997,9 @@ import {
|
|
|
4990
4997
|
readLease as readLease2,
|
|
4991
4998
|
readActiveSandbox,
|
|
4992
4999
|
resolvePersonalMachineConnectionForAttempt,
|
|
4993
|
-
SandboxRetainedProcessPromotionFencedError
|
|
5000
|
+
SandboxRetainedProcessPromotionFencedError,
|
|
5001
|
+
SandboxRetainedProcessTerminalError,
|
|
5002
|
+
SandboxWorkspaceMutationOutputRejectedError
|
|
4994
5003
|
} from "@opengeni/db";
|
|
4995
5004
|
import {
|
|
4996
5005
|
observeSessionBackgroundCommandCompletion,
|
|
@@ -5008,6 +5017,7 @@ import {
|
|
|
5008
5017
|
NatsOpStreamTransport,
|
|
5009
5018
|
RoutingBackendRecoveryRequiredError,
|
|
5010
5019
|
RoutingSandboxSession,
|
|
5020
|
+
RoutingMutationOutputRejectedError,
|
|
5011
5021
|
resolveModalCheckpointProviderBindingForSession as resolveModalCheckpointProviderBindingForSession2,
|
|
5012
5022
|
resolveConnectedMachineWorkspaceRoot,
|
|
5013
5023
|
sandboxProviderInstanceIdFromEnvelope,
|
|
@@ -5208,9 +5218,6 @@ var SandboxLeaseInstanceLostError = class extends SandboxLeaseSupersededError {
|
|
|
5208
5218
|
}
|
|
5209
5219
|
};
|
|
5210
5220
|
var WARMING_POLL_INTERVAL_MS = 250;
|
|
5211
|
-
async function sleep(ms) {
|
|
5212
|
-
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
5213
|
-
}
|
|
5214
5221
|
async function waitForSandboxExecReadiness(established, timeoutMs = MODAL_EXEC_READINESS_TIMEOUT_MS, identity = {}, signal) {
|
|
5215
5222
|
try {
|
|
5216
5223
|
await verifySandboxExecReadiness(established, timeoutMs, signal);
|
|
@@ -5940,6 +5947,7 @@ async function resumeBoxForTurnOnce(services, ids, kind, holderId) {
|
|
|
5940
5947
|
if (acquired.role === "spawner") {
|
|
5941
5948
|
const expectedEpoch = acquired.lease.leaseEpoch;
|
|
5942
5949
|
let createdEstablished = null;
|
|
5950
|
+
let published = false;
|
|
5943
5951
|
let providerCreateOperationId;
|
|
5944
5952
|
let providerCreateBindingKey;
|
|
5945
5953
|
let rematerialization = null;
|
|
@@ -6262,13 +6270,19 @@ async function resumeBoxForTurnOnce(services, ids, kind, holderId) {
|
|
|
6262
6270
|
await release();
|
|
6263
6271
|
throw new SandboxLeaseSupersededError(ids.sandboxGroupId, expectedEpoch);
|
|
6264
6272
|
}
|
|
6273
|
+
published = true;
|
|
6265
6274
|
holderLeaseHeartbeat = {
|
|
6266
6275
|
expectedEpoch: committed.lease.leaseEpoch,
|
|
6267
6276
|
leaseTtlMs
|
|
6268
6277
|
};
|
|
6278
|
+
await services.onSpawnedSandboxPublished?.();
|
|
6269
6279
|
throwIfReleasedOrCancelled();
|
|
6270
6280
|
return { established, leaseEpoch: committed.lease.leaseEpoch, release };
|
|
6271
6281
|
} catch (error) {
|
|
6282
|
+
if (published) {
|
|
6283
|
+
await release();
|
|
6284
|
+
throw error;
|
|
6285
|
+
}
|
|
6272
6286
|
if (error instanceof SandboxLeaseSupersededError) {
|
|
6273
6287
|
await terminateEstablishedSandbox(createdEstablished);
|
|
6274
6288
|
await release();
|
|
@@ -6393,7 +6407,9 @@ async function waitForWarm(services, ids) {
|
|
|
6393
6407
|
const deadline = Date.now() + settings.sandboxWarmingTimeoutMs;
|
|
6394
6408
|
let instanceId = null;
|
|
6395
6409
|
while (Date.now() < deadline) {
|
|
6396
|
-
await
|
|
6410
|
+
if (!await sleepUnlessCancelled(WARMING_POLL_INTERVAL_MS, services.cancellationSignal)) {
|
|
6411
|
+
throw services.cancellationSignal?.reason instanceof Error ? services.cancellationSignal.reason : new Error("Sandbox warming wait was cancelled with its owning turn attempt");
|
|
6412
|
+
}
|
|
6397
6413
|
const lease = await readLease(db, ids.workspaceId, ids.sandboxGroupId);
|
|
6398
6414
|
if (!lease) {
|
|
6399
6415
|
throw new SandboxLeaseSupersededError(ids.sandboxGroupId, 0);
|
|
@@ -6655,21 +6671,34 @@ function afterPersistableHomeMutation(services, ids, home) {
|
|
|
6655
6671
|
}
|
|
6656
6672
|
if (outcome === "outcome_unknown")
|
|
6657
6673
|
throw new Error("Outcome-unknown command settlement requires its exact retained invocation");
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6674
|
+
try {
|
|
6675
|
+
await verifyWorkspaceMutationSettlement(services.db, {
|
|
6676
|
+
accountId: fence.accountId,
|
|
6677
|
+
workspaceId: ids.workspaceId,
|
|
6678
|
+
sessionId: ids.sessionId,
|
|
6679
|
+
turnId: fence.turnId,
|
|
6680
|
+
executionGeneration: fence.executionGeneration,
|
|
6681
|
+
attemptId: fence.attemptId,
|
|
6682
|
+
holderId: sandboxLeaseHolderIdForAttempt(fence.attemptId),
|
|
6683
|
+
sandboxGroupId: home.sandboxGroupId,
|
|
6684
|
+
expectedEpoch: backend.leaseEpoch,
|
|
6685
|
+
expectedInstanceId: backend.providerInstanceId,
|
|
6686
|
+
admission: exactAdmission,
|
|
6687
|
+
operation: op,
|
|
6688
|
+
outcome
|
|
6689
|
+
});
|
|
6690
|
+
} catch (error) {
|
|
6691
|
+
if (error instanceof SandboxWorkspaceMutationOutputRejectedError && error.matchesPhysicalSettlement({
|
|
6692
|
+
accountId: fence.accountId,
|
|
6693
|
+
workspaceId: ids.workspaceId,
|
|
6694
|
+
admission: exactAdmission,
|
|
6695
|
+
operation: op,
|
|
6696
|
+
outcome
|
|
6697
|
+
})) {
|
|
6698
|
+
throw new RoutingMutationOutputRejectedError(op, error.code, { cause: error });
|
|
6699
|
+
}
|
|
6700
|
+
throw error;
|
|
6701
|
+
}
|
|
6673
6702
|
};
|
|
6674
6703
|
}
|
|
6675
6704
|
function beforeRetainedProcessMutation(services, ids) {
|
|
@@ -6692,15 +6721,34 @@ function afterRetainedProcessMutation(services, ids) {
|
|
|
6692
6721
|
if (!admission || typeof admission !== "object" || typeof admission.id !== "string" || typeof admission.workspaceGeneration !== "number") {
|
|
6693
6722
|
throw new Error("Retained-process mutation settlement lacked its exact admission");
|
|
6694
6723
|
}
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6724
|
+
try {
|
|
6725
|
+
await verifyRetainedProcessMutationSettlement(services.db, {
|
|
6726
|
+
accountId: fence.accountId,
|
|
6727
|
+
workspaceId: ids.workspaceId,
|
|
6728
|
+
sessionId: ids.sessionId,
|
|
6729
|
+
processId: process2.id,
|
|
6730
|
+
admission,
|
|
6731
|
+
operation: op,
|
|
6732
|
+
outcome
|
|
6733
|
+
});
|
|
6734
|
+
} catch (error) {
|
|
6735
|
+
if (error instanceof SandboxWorkspaceMutationOutputRejectedError && error.matchesPhysicalSettlement({
|
|
6736
|
+
accountId: fence.accountId,
|
|
6737
|
+
workspaceId: ids.workspaceId,
|
|
6738
|
+
admission,
|
|
6739
|
+
operation: op,
|
|
6740
|
+
outcome
|
|
6741
|
+
})) {
|
|
6742
|
+
if (error.retainedProcessTerminal) {
|
|
6743
|
+
throw new SandboxRetainedProcessTerminalError(
|
|
6744
|
+
error.retainedProcessTerminal.state,
|
|
6745
|
+
error.retainedProcessTerminal.exitCode
|
|
6746
|
+
);
|
|
6747
|
+
}
|
|
6748
|
+
throw new RoutingMutationOutputRejectedError(op, error.code, { cause: error });
|
|
6749
|
+
}
|
|
6750
|
+
throw error;
|
|
6751
|
+
}
|
|
6704
6752
|
};
|
|
6705
6753
|
}
|
|
6706
6754
|
function captureConnectedCommandOutput(db, ids, bus) {
|
|
@@ -8509,7 +8557,30 @@ async function waitForTurnOperation(operation, signal, disposeLateResult) {
|
|
|
8509
8557
|
signal.removeEventListener("abort", cancel);
|
|
8510
8558
|
}
|
|
8511
8559
|
}
|
|
8512
|
-
|
|
8560
|
+
var PHYSICAL_SANDBOX_RESUME_DRAIN_TIMEOUT_MS = 6e4;
|
|
8561
|
+
function trackPhysicalSandboxResume(inFlight, operation) {
|
|
8562
|
+
inFlight.add(operation);
|
|
8563
|
+
const settle = () => {
|
|
8564
|
+
inFlight.delete(operation);
|
|
8565
|
+
};
|
|
8566
|
+
operation.then(settle, settle);
|
|
8567
|
+
return operation;
|
|
8568
|
+
}
|
|
8569
|
+
async function drainPhysicalSandboxResumes(inFlight, timeoutMs = PHYSICAL_SANDBOX_RESUME_DRAIN_TIMEOUT_MS) {
|
|
8570
|
+
if (inFlight.size === 0) return "none";
|
|
8571
|
+
let timer;
|
|
8572
|
+
try {
|
|
8573
|
+
return await Promise.race([
|
|
8574
|
+
Promise.allSettled([...inFlight]).then(() => "settled"),
|
|
8575
|
+
new Promise((resolve) => {
|
|
8576
|
+
timer = setTimeout(() => resolve("timed_out"), Math.max(1, timeoutMs));
|
|
8577
|
+
})
|
|
8578
|
+
]);
|
|
8579
|
+
} finally {
|
|
8580
|
+
if (timer) clearTimeout(timer);
|
|
8581
|
+
}
|
|
8582
|
+
}
|
|
8583
|
+
function sleep(ms) {
|
|
8513
8584
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
8514
8585
|
}
|
|
8515
8586
|
function sandboxProvisionErrorChain(error) {
|
|
@@ -8734,7 +8805,7 @@ function createTurnSandboxProvisioner(establish, options = {}) {
|
|
|
8734
8805
|
if (!retrying) {
|
|
8735
8806
|
throw error;
|
|
8736
8807
|
}
|
|
8737
|
-
await
|
|
8808
|
+
await sleep(backoffMs * internalAttempts);
|
|
8738
8809
|
}
|
|
8739
8810
|
}
|
|
8740
8811
|
};
|
|
@@ -8869,7 +8940,7 @@ async function persistOrSignalSessionAttemptQuiescence(input) {
|
|
|
8869
8940
|
cause: receiptError
|
|
8870
8941
|
});
|
|
8871
8942
|
}
|
|
8872
|
-
const delay = input.sleep ??
|
|
8943
|
+
const delay = input.sleep ?? sleep;
|
|
8873
8944
|
let retryMs = QUIESCENCE_PROOF_SIGNAL_INITIAL_RETRY_MS;
|
|
8874
8945
|
let attempt = 1;
|
|
8875
8946
|
for (; ; ) {
|
|
@@ -8918,7 +8989,7 @@ async function drainAttemptOwnedSandboxWriters(input) {
|
|
|
8918
8989
|
async function releaseTurnSandboxAfterWriterDrain(sandbox, options = {}) {
|
|
8919
8990
|
const maxAttempts = Math.max(1, options.maxAttempts ?? 3);
|
|
8920
8991
|
const retryDelayMs2 = Math.max(0, options.retryDelayMs ?? 50);
|
|
8921
|
-
const wait = options.wait ??
|
|
8992
|
+
const wait = options.wait ?? sleep;
|
|
8922
8993
|
let lastError;
|
|
8923
8994
|
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
8924
8995
|
try {
|
|
@@ -9101,8 +9172,12 @@ import {
|
|
|
9101
9172
|
isModalTaskExecStartPreDispatchUnavailableError,
|
|
9102
9173
|
isModalCommandStartOutcomeUnknownError,
|
|
9103
9174
|
isProviderCommandObservationUnavailableError,
|
|
9175
|
+
ProviderCommandInputOutcomeUnknownError,
|
|
9176
|
+
ProviderCommandStartOutcomeUnknownError,
|
|
9104
9177
|
isRoutingMutationOutcomeUnknownError,
|
|
9178
|
+
isRoutingMutationOutputRejectedError,
|
|
9105
9179
|
RoutingWorkspaceRootChangedError,
|
|
9180
|
+
RoutingBackendRecoveryRequiredError as RoutingBackendRecoveryRequiredError2,
|
|
9106
9181
|
ResponsesStreamingTerminalError,
|
|
9107
9182
|
SandboxMaterializationVerificationError,
|
|
9108
9183
|
materializationVerificationDiagnostic,
|
|
@@ -9900,7 +9975,7 @@ function preClaimAdmissionFailure(error) {
|
|
|
9900
9975
|
details: [detail]
|
|
9901
9976
|
});
|
|
9902
9977
|
}
|
|
9903
|
-
function
|
|
9978
|
+
function structuredRecoveryCauseGraph(error) {
|
|
9904
9979
|
const graph = /* @__PURE__ */ new Map();
|
|
9905
9980
|
const queue = [];
|
|
9906
9981
|
let links = 0;
|
|
@@ -9928,7 +10003,7 @@ function databaseRecoveryCauseGraph(error) {
|
|
|
9928
10003
|
}
|
|
9929
10004
|
function retryableDatabaseFailureCode(error, requireDatabaseProvenance = false) {
|
|
9930
10005
|
try {
|
|
9931
|
-
const graph =
|
|
10006
|
+
const graph = structuredRecoveryCauseGraph(error);
|
|
9932
10007
|
if (!graph) return null;
|
|
9933
10008
|
const transports = /* @__PURE__ */ new Set();
|
|
9934
10009
|
const boundaries = /* @__PURE__ */ new Set();
|
|
@@ -9940,7 +10015,8 @@ function retryableDatabaseFailureCode(error, requireDatabaseProvenance = false)
|
|
|
9940
10015
|
[...graph.get(node)].filter((child) => child === node.cause)
|
|
9941
10016
|
) : [...graph.get(node)];
|
|
9942
10017
|
for (const node of graph.keys()) {
|
|
9943
|
-
if (isRoutingMutationOutcomeUnknownError(node)
|
|
10018
|
+
if (isRoutingMutationOutcomeUnknownError(node) || isRoutingMutationOutputRejectedError(node))
|
|
10019
|
+
return null;
|
|
9944
10020
|
const record = node;
|
|
9945
10021
|
if (requireDatabaseProvenance ? isRunningTurnDatabaseTransportFailure(record) : isRetryableDatabaseTransportFailure({ code: record.code, errno: record.errno }))
|
|
9946
10022
|
transports.add(node);
|
|
@@ -9978,8 +10054,9 @@ function retryableDatabaseFailureCode(error, requireDatabaseProvenance = false)
|
|
|
9978
10054
|
boundaries.add(node);
|
|
9979
10055
|
const sqlState = typed ? node.details.sqlState : typeof record.code === "string" ? record.code : null;
|
|
9980
10056
|
const connectionOutage = requireDatabaseProvenance ? isRunningTurnDatabaseConnectionSqlState(sqlState) : isDatabaseConnectionSqlState(sqlState);
|
|
9981
|
-
const
|
|
9982
|
-
|
|
10057
|
+
const rolledBack = isRetryablePersistenceSqlState(sqlState);
|
|
10058
|
+
const code = typed ? retryablePersistenceFailureCode(sqlState) : connectionOutage || rolledBack ? databaseFailureCode(sqlState) : null;
|
|
10059
|
+
if (!code || requireDatabaseProvenance && !connectionOutage && !rolledBack && !(sqlState === null && hasOwnTransport(node)))
|
|
9983
10060
|
return null;
|
|
9984
10061
|
if (!requireDatabaseProvenance || ownDatabaseNodes.has(node)) codes.add(code);
|
|
9985
10062
|
}
|
|
@@ -10022,8 +10099,7 @@ function retryablePersistenceFailureCode(sqlState) {
|
|
|
10022
10099
|
}
|
|
10023
10100
|
function postClaimDatabaseRecoveryFailure(input) {
|
|
10024
10101
|
const code = retryableDatabaseFailureCode(input.error, input.requireDatabaseProvenance);
|
|
10025
|
-
if (!code || input.executionGeneration < 1
|
|
10026
|
-
return null;
|
|
10102
|
+
if (!code || input.executionGeneration < 1) return null;
|
|
10027
10103
|
if (input.sandboxSetupOutcomeUnknown && input.sandboxSetupRecoveryExhausted || (input.sandboxSetupOutcomeUnknown || input.sandboxSetupRecoveryExhausted) && input.providerRecovery) {
|
|
10028
10104
|
return null;
|
|
10029
10105
|
}
|
|
@@ -10095,7 +10171,29 @@ function modelPreparationFailureEventPayload(error, durationMs) {
|
|
|
10095
10171
|
} : {}
|
|
10096
10172
|
};
|
|
10097
10173
|
}
|
|
10174
|
+
function isPreDispatchHomeBackendRecoveryRequired(error) {
|
|
10175
|
+
const graph = structuredRecoveryCauseGraph(error);
|
|
10176
|
+
if (!graph) return false;
|
|
10177
|
+
let found = false;
|
|
10178
|
+
try {
|
|
10179
|
+
for (const node of graph.keys()) {
|
|
10180
|
+
if (isRoutingMutationOutcomeUnknownError(node) || isRoutingMutationOutputRejectedError(node) || isRawProviderCommandOutcomeUnknown(node) || isModalCommandStartOutcomeUnknownError(node) || isProviderCommandObservationUnavailableError(node))
|
|
10181
|
+
return false;
|
|
10182
|
+
if (node instanceof RoutingBackendRecoveryRequiredError2) {
|
|
10183
|
+
if (node.op !== "resolve_home_backend" || !Number.isSafeInteger(node.leaseEpoch) || node.leaseEpoch < 0 || !node.retryable || node.recovery !== "pending" && node.recovery !== "superseded")
|
|
10184
|
+
return false;
|
|
10185
|
+
found = true;
|
|
10186
|
+
}
|
|
10187
|
+
}
|
|
10188
|
+
} catch {
|
|
10189
|
+
return false;
|
|
10190
|
+
}
|
|
10191
|
+
return found;
|
|
10192
|
+
}
|
|
10098
10193
|
function sandboxRouteTransitionCode(error) {
|
|
10194
|
+
if (isPreDispatchHomeBackendRecoveryRequired(error)) {
|
|
10195
|
+
return "home_backend_recovery_pending";
|
|
10196
|
+
}
|
|
10099
10197
|
const pending = [error];
|
|
10100
10198
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
10101
10199
|
let inspected = 0;
|
|
@@ -10385,7 +10483,28 @@ function anthropicRequestDiagnostic(error) {
|
|
|
10385
10483
|
if (error instanceof AnthropicRequestError) return error;
|
|
10386
10484
|
return error instanceof Error && error.cause instanceof AnthropicRequestError ? error.cause : void 0;
|
|
10387
10485
|
}
|
|
10486
|
+
function isRawProviderCommandOutcomeUnknown(error) {
|
|
10487
|
+
try {
|
|
10488
|
+
return error instanceof ProviderCommandInputOutcomeUnknownError || error instanceof ProviderCommandStartOutcomeUnknownError;
|
|
10489
|
+
} catch {
|
|
10490
|
+
return false;
|
|
10491
|
+
}
|
|
10492
|
+
}
|
|
10388
10493
|
function agentRunFailurePayload(error, options = {}) {
|
|
10494
|
+
const graph = structuredRecoveryCauseGraph(error);
|
|
10495
|
+
const nodes = graph ? [...graph.keys()] : [];
|
|
10496
|
+
const outputRejected = nodes.find(isRoutingMutationOutputRejectedError);
|
|
10497
|
+
if (outputRejected) {
|
|
10498
|
+
const unknown = nodes.find(
|
|
10499
|
+
(node) => isRoutingMutationOutcomeUnknownError(node) || isModalCommandStartOutcomeUnknownError(node) || isProviderCommandObservationUnavailableError(node) || isRawProviderCommandOutcomeUnknown(node)
|
|
10500
|
+
);
|
|
10501
|
+
if (unknown) return { ...baseAgentRunFailurePayload(unknown, options), retryable: false };
|
|
10502
|
+
return {
|
|
10503
|
+
error: outputRejected.message,
|
|
10504
|
+
code: outputRejected.code,
|
|
10505
|
+
retryable: false
|
|
10506
|
+
};
|
|
10507
|
+
}
|
|
10389
10508
|
const failure = baseAgentRunFailurePayload(error, options);
|
|
10390
10509
|
const diagnostic = materializationVerificationDiagnostic(error);
|
|
10391
10510
|
const anthropic = anthropicRequestDiagnostic(error);
|
|
@@ -10874,6 +10993,8 @@ export {
|
|
|
10874
10993
|
turnOperationCancellationFailure,
|
|
10875
10994
|
throwIfTurnOperationCancelled,
|
|
10876
10995
|
waitForTurnOperation,
|
|
10996
|
+
trackPhysicalSandboxResume,
|
|
10997
|
+
drainPhysicalSandboxResumes,
|
|
10877
10998
|
classifySandboxLogicalProvisionFailure,
|
|
10878
10999
|
isLazySandboxProvisionRetryable,
|
|
10879
11000
|
sandboxDeadlineRotationRecoveryDelayMs,
|
|
@@ -10926,4 +11047,4 @@ export {
|
|
|
10926
11047
|
CODEX_USAGE_LIMIT_MAX_RESUME_MS,
|
|
10927
11048
|
classifyClaudeCredentialFailure
|
|
10928
11049
|
};
|
|
10929
|
-
//# sourceMappingURL=chunk-
|
|
11050
|
+
//# sourceMappingURL=chunk-WVZQJBGD.js.map
|