@tangle-network/agent-runtime 4.0.0 → 5.0.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/CHANGELOG.md +5263 -0
- package/dist/{activation-B49A14V5.d.ts → activation-CtLdCiH3.d.ts} +2 -2
- package/dist/{activation-BiQYCayd.js → activation-DGLWxFJu.js} +2 -2
- package/dist/{activation-BiQYCayd.js.map → activation-DGLWxFJu.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +4 -4
- package/dist/candidate-execution/index.d.ts +1 -1
- package/dist/{coordination-manager-C-ZoeZ73.js → coordination-manager-D74AZg7m.js} +7 -7
- package/dist/{coordination-manager-C-ZoeZ73.js.map → coordination-manager-D74AZg7m.js.map} +1 -1
- package/dist/{coordination-map-routing-SnsZp287.js → coordination-map-routing-DVjW5Gx0.js} +2 -2
- package/dist/{coordination-map-routing-SnsZp287.js.map → coordination-map-routing-DVjW5Gx0.js.map} +1 -1
- package/dist/{delegate-d9HcOFC5.js → delegate-BVyFJ9AX.js} +2 -2
- package/dist/{delegate-d9HcOFC5.js.map → delegate-BVyFJ9AX.js.map} +1 -1
- package/dist/durable.d.ts +4 -2
- package/dist/durable.js +12 -184
- package/dist/durable.js.map +1 -1
- package/dist/{graph-C_Z0Ua10.js → graph-r8zcRxbi.js} +6 -8
- package/dist/{graph-C_Z0Ua10.js.map → graph-r8zcRxbi.js.map} +1 -1
- package/dist/{graph-registry-CI1o16DH.js → graph-registry-B25FxBZN.js} +5 -5
- package/dist/graph-registry-B25FxBZN.js.map +1 -0
- package/dist/{graph-registry-BU7pcrUW.js → graph-registry-C-hjRx2t.js} +1 -1
- package/dist/{improve-B4v4S8jY.js → improve-D12GulmK.js} +7 -7
- package/dist/{improve-B4v4S8jY.js.map → improve-D12GulmK.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +3 -3
- package/dist/intelligence.js +5 -5
- package/dist/{jsonl-file-CvPuwM0a.js → jsonl-file-CeVYTIQJ.js} +41 -32
- package/dist/jsonl-file-CeVYTIQJ.js.map +1 -0
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +14 -13
- package/dist/{loop-runner-DKvA0JJr.d.ts → loop-runner-BHBabRIw.d.ts} +2 -2
- package/dist/{loop-runner-DMZkwlND.js → loop-runner-CYcN11I4.js} +2 -2
- package/dist/{loop-runner-DMZkwlND.js.map → loop-runner-CYcN11I4.js.map} +1 -1
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +5 -5
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-Cjs4SQ9Q.js → provision-supervisor-BiqHJ-d4.js} +5 -5
- package/dist/{provision-supervisor-Cjs4SQ9Q.js.map → provision-supervisor-BiqHJ-d4.js.map} +1 -1
- package/dist/{run-cancellation-CGgk54Md.js → run-cancellation-D5R-7UQt.js} +3 -3
- package/dist/{run-cancellation-CGgk54Md.js.map → run-cancellation-D5R-7UQt.js.map} +1 -1
- package/dist/run-state-DRh8BOFi.js +350 -0
- package/dist/run-state-DRh8BOFi.js.map +1 -0
- package/dist/{runtime-BmxmsaNz.js → runtime-BX_9-DJB.js} +18 -17
- package/dist/runtime-BX_9-DJB.js.map +1 -0
- package/dist/{scope-CJ7xtrs8.js → scope-JcCkUy_z.js} +151 -106
- package/dist/scope-JcCkUy_z.js.map +1 -0
- package/dist/{search-executor-DSB6XAl1.js → search-executor-CdmaS5r4.js} +3 -3
- package/dist/{search-executor-DSB6XAl1.js.map → search-executor-CdmaS5r4.js.map} +1 -1
- package/dist/{server-FWT2Nt_w.js → server-BY6OluUf.js} +3 -3
- package/dist/{server-FWT2Nt_w.js.map → server-BY6OluUf.js.map} +1 -1
- package/dist/settle-record-BSDDf9Z4.js +130 -0
- package/dist/settle-record-BSDDf9Z4.js.map +1 -0
- package/dist/{structural-rollout-Bl23HSOd.js → structural-rollout-BjMUUXLn.js} +3 -3
- package/dist/{structural-rollout-Bl23HSOd.js.map → structural-rollout-BjMUUXLn.js.map} +1 -1
- package/dist/{supervise-MAzd0hOk.js → supervise-rYEsVVcn.js} +172 -384
- package/dist/supervise-rYEsVVcn.js.map +1 -0
- package/dist/{supervision-discovery-6EtvKCsU.js → supervision-discovery-D95Ack4J.js} +4 -129
- package/dist/supervision-discovery-D95Ack4J.js.map +1 -0
- package/dist/{supervisor-CwANBb9-.js → supervisor-B-bX69uL.js} +178 -120
- package/dist/supervisor-B-bX69uL.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{top-web-CZP3RRhD.js → top-web-D-wH9ipn.js} +13 -9
- package/dist/{top-web-CZP3RRhD.js.map → top-web-D-wH9ipn.js.map} +1 -1
- package/dist/tui/bin.js +3 -3
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-ooyUaxq_.d.ts → types-DblV14Oe.d.ts} +187 -222
- package/package.json +7 -8
- package/dist/graph-registry-CI1o16DH.js.map +0 -1
- package/dist/jsonl-file-CvPuwM0a.js.map +0 -1
- package/dist/runtime-BmxmsaNz.js.map +0 -1
- package/dist/scope-CJ7xtrs8.js.map +0 -1
- package/dist/supervise-MAzd0hOk.js.map +0 -1
- package/dist/supervision-discovery-6EtvKCsU.js.map +0 -1
- package/dist/supervisor-CwANBb9-.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $i as
|
|
1
|
+
import { $i as sandboxEventServedBackend, $n as harnessTranscriptUnavailable, $r as runtimeProviderCode, $t as closesCursorSlot, A as nestedScopeSeamKey, Ai as createBudgetPool, An as WORKER_TRACE_PROPAGATION, Bi as sandboxOutputMarker, Br as runtimeOwnedScopeOwnerControl, Bt as bindScopeRetainedOwnerWorkspaceRetention, Cn as captureProviderWorkspaceSnapshot, Di as hashJson, Dr as knownMaterializationReceipt, Ei as turnFailurePolicy, En as workspaceCaptureReceipt, Er as knownExecutionBindingReceipt, Gi as assertSandboxServedModel, Gr as executableAgentSpecSnapshot, Gt as ownedTreeRootSpawn, Hr as unknownExecutionBindingReceipt, Ii as createSandboxToolPartState, Ir as runtimeOwnedExecutorExecutionBinding, Ji as createSandboxUsageLedger, Jn as HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS, Jt as driverRuntime, Ki as canonicalSandboxUsageMode, Lr as runtimeOwnedExecutorMaterialization, Lt as scopeRetainedOwnerCheckpointing, Mn as workerTraceHeaders, Mr as recordRuntimeOwnedProviderDispatchNotStarted, Nr as recordRuntimeOwnedProviderIdentityConflict, Oi as credentialCommandExit, Or as newExecutionAttemptId, Pn as mergeTraceEnv, Pr as recordRuntimeOwnedProviderModel, Q as assertRecursiveReservationPolicy, Qi as sameModelId, Qn as harnessTranscriptFromLines, Qr as runtimeFailureRemediationSchema, Qt as SpawnEventIndex, R as appendSpawnEvents, Si as contentRef, Sn as captureProviderLiveWorkspace, T as sumSpendFromEvents, Ti as turnFailureOf, Tn as openNativeMirror, Tr as inheritRuntimeOwnedExecutorAttestation, Ur as unknownMaterializationReceipt, V as finalizeScopeOwnerMaterialization, Vi as sandboxProgressEvents, Vr as runtimeOwnedScopeOwnerRuntime, Vt as retainedOwnerWorkspaceRetentionSeamKey, Wi as extractTransportEventIdentity, Wr as executableAgentProfileSnapshot, Wt as loadSpawnForest, X as reenteredWorkers, Xi as isSandboxTerminalEvent, Xn as captureHarnessTranscript, Xr as runtimeFailureCause, Yr as reportedFailureCause, Yt as nestedDriverTreeRoot, Zi as notifySandboxEventObserver, Zt as encodeResultBlob, _i as unavailableResumeAt, _r as subscriptionUsageLimitSignal, _t as startScopeRecoveries, aa as RetainedRunProviderContractError, ai as isProvisioningRefusal, an as mintRetainedIdentity, ar as retainHarnessTranscript, at as hasRetriableTeardowns, br as attestRuntimeOwnedPendingExecutor, ca as exactSession, ci as retainedExecutorContext, cn as startRetainedRun, cr as describeToolArgs, da as sameControlCoordinates, di as UNAVAILABLE_STATUSES, dt as registerNestedTeardownScope, ea as sandboxTerminalUsageField, fa as RunCancellationReason, ft as releaseHeldEnvironments, gi as unavailablePauseMs, gt as settleManagerWork, ha as runAbortable, hi as reportedResetAt, ht as retryUnconfirmedTeardowns, ia as recordValue, ii as TRANSPORT_ERROR_CODES, in as assertRetainedRunReplayMaterial, it as closeScopeAdmission, jn as workerTraceEnv, jr as recordRuntimeOwnedProviderAttemptStart, jt as scopeRetainedOwnerSettled, ki as isCredentialRefusal, kn as resolveWorkerSlots, la as freezeControlRef, li as retainedExecutorSeamKey, ma as linkAbort, mi as printedStatus, mt as releaseRetainedEnvironments, ni as DISPATCH_NOT_ADMITTED_CODE, nn as describeRetainedNativeStops, oa as assertEventBinding, oi as isSchemaRejection, on as reconnectRetainedRun, pa as abortReason, pt as releaseManagerEnvironment, qi as createSandboxTurnEventCollector, qt as attestNestedDriverTreeOwner, ra as parseCodexUsageRecord, ri as RetainedExecutionPendingError, rn as stopRetainedNativeExecution, rt as closeRetainedSlots, sa as awaitAbortable, sn as recoverRetainedRun, sr as createActivityLog, t as createScope, ti as DISPATCH_EXECUTION_CHANGED_CODE, tn as verifyWorkspaceMarker, ua as isTerminalSessionStatus, ui as UNAVAILABLE_CODES, ur as isLiveNodeStatus, va as promptOptionsFromAgentTurnInput, vi as unavailableSignalOfFailure, vr as attestRuntimeOwnedDeferredExecutor, vt as unconfirmedTeardowns, w as prepareScopeResume, wi as executorFailureInfra, wn as nativeCopyDelayMs, wr as finalizeRuntimeOwnedPendingExecutor, xi as contentAddress, xn as assertProviderWorkspaceRetentionPort, yn as environmentGone, yr as attestRuntimeOwnedExecutor, yt as waitForScopeChildren, zi as sandboxLeafOutputFromEvents, zt as bindScopeRetainedOwnerProvider } from "./scope-JcCkUy_z.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError } from "./errors-AzSuGI23.js";
|
|
3
3
|
import { $ as isAsyncIterable, J as deleteBoxSafe, Ot as teardownSurfaces, Q as isAbortError, St as armDeadlineTimer, Tt as isDeadlineAbortReason, U as addSpend, V as hasControlCharacter, W as addTokenUsage, Y as errorMessage, _t as ACCEPTED_RESULT_GRACE_MS, at as sleep, ct as throwIfAborted, dt as zeroSpend, et as mapWithConcurrency, ft as zeroTokenUsage, gt as withBudgetResources, it as roundBoxMinutes, lt as unmeteredSpend, nt as randomSuffix, ot as stringifySafe, pt as addResourceSpend, q as cloneTokenUsage, rt as randomUuid, st as throwAbort, tt as promptCacheTokenClasses, ut as withTimeout, xt as ROOT_DEADLINE_REASON } from "./workspace-streams-8ALHaZzx.js";
|
|
4
4
|
import { t as runTaskQueue } from "./task-queue-DbpZAp6C.js";
|
|
5
|
-
import { _ as errorText, d as detachedSnapshot, g as errorProperty, h as errorHttpStatus, l as sha256, m as errMessage, p as causeChain, v as defaultRedactor } from "./jsonl-file-
|
|
5
|
+
import { _ as errorText, d as detachedSnapshot, g as errorProperty, h as errorHttpStatus, l as sha256, m as errMessage, p as causeChain, v as defaultRedactor } from "./jsonl-file-CeVYTIQJ.js";
|
|
6
6
|
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, d as assertRouterAutoDeclaration, f as assertRouterAutoResponse, g as observedModelMatchesDeclared, h as observedModelHasSnapshot, l as profileProviderModel, m as mergeObservedModelIdentity, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-JOcg3NRs.js";
|
|
7
7
|
import { r as nativeSystemPrompt, t as assertSandboxProfileCompatibility } from "./sandbox-profile-compat-oFGWESLn.js";
|
|
8
8
|
import { a as writeAtomicDurableFile, s as fenceRunWrite } from "./durable-file-DstVeHcj.js";
|
|
@@ -5591,13 +5591,7 @@ const causedByPartialFailure = (error) => causeChain(error).some((cause) => caus
|
|
|
5591
5591
|
function abandonablePending(error) {
|
|
5592
5592
|
return error instanceof RetainedExecutionPendingError && (error.pendingCause === "unobservable" || error.pendingCause === "nested-recovery") ? error : void 0;
|
|
5593
5593
|
}
|
|
5594
|
-
/**
|
|
5595
|
-
* Bridge error classes the bridge itself never retries: a request that fails identically on
|
|
5596
|
-
* every attempt, mapped below 5xx on its HTTP path (`parse_error` 400, the other two 501). On the
|
|
5597
|
-
* stream path the same failure arrives with no status at all — a profile that cannot materialize
|
|
5598
|
-
* is a `parse_error` — and the status split alone read it as a bad moment and re-drove it to the
|
|
5599
|
-
* attempt ceiling.
|
|
5600
|
-
*/
|
|
5594
|
+
/** Deterministic bridge refusals remain terminal even when transport omits HTTP status. */
|
|
5601
5595
|
const DETERMINISTIC_BRIDGE_CODES = /* @__PURE__ */ new Set([
|
|
5602
5596
|
"parse_error",
|
|
5603
5597
|
"not_configured",
|
|
@@ -5612,15 +5606,7 @@ const DETERMINISTIC_BRIDGE_CODES = /* @__PURE__ */ new Set([
|
|
|
5612
5606
|
*/
|
|
5613
5607
|
const CONTENT_FILTER_REASON = "refused by the model provider's content filter";
|
|
5614
5608
|
const isContentFilterRefusal = (error) => causeChain(error).some((cause) => cause instanceof Error && /\bcontent was flagged for possible\b/iu.test(errorProperty(cause, "message") ?? ""));
|
|
5615
|
-
/**
|
|
5616
|
-
* A driver's harness turn ran to its terminal result, and that result reported failure.
|
|
5617
|
-
*
|
|
5618
|
-
* A provider executor returns a failed turn as an outcome; without this error it reads as a
|
|
5619
|
-
* completed drive and never reaches the retry decision (a turn ended `status code 524`).
|
|
5620
|
-
*
|
|
5621
|
-
* `errorCode` is the provider's machine code when it reported one. The classifier reads the code;
|
|
5622
|
-
* text decides only a printed capacity code and a content-filter refusal, which have none.
|
|
5623
|
-
*/
|
|
5609
|
+
/** A completed failed turn enters retry with its producer classification and legacy metadata intact. */
|
|
5624
5610
|
var HarnessTurnFailedError = class extends Error {
|
|
5625
5611
|
runtime;
|
|
5626
5612
|
/** The failure as the harness reported it, before this error's framing. */
|
|
@@ -5629,11 +5615,13 @@ var HarnessTurnFailedError = class extends Error {
|
|
|
5629
5615
|
statusCode;
|
|
5630
5616
|
/** The shared HTTP error reader also uses this status for persisted diagnostics. */
|
|
5631
5617
|
status;
|
|
5618
|
+
failure;
|
|
5632
5619
|
constructor(runtime, failure) {
|
|
5633
5620
|
super(`${runtime} harness turn ended with a failed outcome` + (failure.errorCode === void 0 ? "" : ` (${failure.errorCode})`) + `: ${failure.error}`);
|
|
5634
5621
|
this.name = "HarnessTurnFailedError";
|
|
5635
5622
|
this.runtime = runtime;
|
|
5636
5623
|
this.reported = failure.error;
|
|
5624
|
+
if (failure.failure !== void 0) this.failure = failure.failure;
|
|
5637
5625
|
if (failure.errorCode !== void 0) this.errorCode = failure.errorCode;
|
|
5638
5626
|
if (failure.statusCode !== void 0) {
|
|
5639
5627
|
this.statusCode = failure.statusCode;
|
|
@@ -5665,23 +5653,21 @@ function isDispatchExecutionChanged(value) {
|
|
|
5665
5653
|
return false;
|
|
5666
5654
|
}
|
|
5667
5655
|
}
|
|
5668
|
-
/**
|
|
5669
|
-
* The code or status that marks `error` as an upstream capacity refusal, or `undefined`.
|
|
5670
|
-
*
|
|
5671
|
-
* A structured field is read first: a turn outcome's `errorCode`, a transport error's
|
|
5672
|
-
* `upstreamCode` and `status`, a provider SDK error's `code` and `status`. The failure text is read
|
|
5673
|
-
* only as {@link unavailableSignalOfFailure} says, because a harness CLI reports the router's
|
|
5674
|
-
* refusal as text and Sandbox's held-room refusal shares its code with a shape that never fits.
|
|
5675
|
-
*/
|
|
5656
|
+
/** Read Runtime admission evidence before producer hints and legacy transport metadata. */
|
|
5676
5657
|
function upstreamUnavailableSignal(error) {
|
|
5677
5658
|
if (undispatchedCredentialExit(error) !== void 0) return "credential-unavailable";
|
|
5659
|
+
if (error instanceof CheckUnavailableError) return "check-unavailable";
|
|
5660
|
+
if (error instanceof CoordinationUnreachableError) return "coordination-unreachable";
|
|
5661
|
+
const typed = turnFailureOf(error);
|
|
5662
|
+
if (typed) return turnFailurePolicy(typed).classification === "unavailable" ? subscriptionUsageLimitSignal({
|
|
5663
|
+
error: "",
|
|
5664
|
+
errorCode: typed.code
|
|
5665
|
+
}) ?? typed.code : void 0;
|
|
5678
5666
|
const refusal = retainedAdmissionCause(error) ?? reconciliationCapacityRefusal(error);
|
|
5679
5667
|
if (refusal !== void 0) return upstreamUnavailableSignal(refusal);
|
|
5680
5668
|
if (!(error instanceof Error)) return void 0;
|
|
5681
5669
|
if (isCredentialRefusal(error)) return void 0;
|
|
5682
5670
|
if (isProviderSchemaRejection(error)) return void 0;
|
|
5683
|
-
if (error instanceof CheckUnavailableError) return "check-unavailable";
|
|
5684
|
-
if (error instanceof CoordinationUnreachableError) return "coordination-unreachable";
|
|
5685
5671
|
const transport = error instanceof BackendTransportError;
|
|
5686
5672
|
if (error instanceof AgentEvalError && !transport) return void 0;
|
|
5687
5673
|
const harness = error instanceof HarnessTurnFailedError;
|
|
@@ -5692,13 +5678,7 @@ function upstreamUnavailableSignal(error) {
|
|
|
5692
5678
|
};
|
|
5693
5679
|
return (harness ? subscriptionUsageLimitSignal(failure) : void 0) ?? unavailableSignalOfFailure(failure);
|
|
5694
5680
|
}
|
|
5695
|
-
/**
|
|
5696
|
-
* The capacity refusal an admitted execution's reconciliation met: a cause with an upstream
|
|
5697
|
-
* capacity code or HTTP 429. The execution is unresolved, not failed, so the driver pauses and
|
|
5698
|
-
* reconciles it again, never abandoning it; a contract violation stays terminal (#1204).
|
|
5699
|
-
* magnetar-rust-sandbox-20261102a's managers met `TangleCredentialCapacityError: HTTP 429` on
|
|
5700
|
-
* 1,407 reconciliations, each classed transient.
|
|
5701
|
-
*/
|
|
5681
|
+
/** Capacity encountered while reconciling an admitted execution pauses that same execution. */
|
|
5702
5682
|
function reconciliationCapacityRefusal(error) {
|
|
5703
5683
|
if (!(error instanceof RetainedExecutionPendingError) || error.phase !== "execution") return void 0;
|
|
5704
5684
|
if (error.pendingCause !== "unobservable" && error.pendingCause !== "transport") return void 0;
|
|
@@ -5714,21 +5694,10 @@ function ownCode(error) {
|
|
|
5714
5694
|
return;
|
|
5715
5695
|
}
|
|
5716
5696
|
}
|
|
5717
|
-
/**
|
|
5718
|
-
* Classify one driver failure. Runtime's own typed refusals are decisions and stay terminal; an
|
|
5719
|
-
* upstream capacity refusal is `unavailable`; anything else foreign is an accident and is
|
|
5720
|
-
* retryable. A `BackendTransportError` is split by status because the taxonomy already promises
|
|
5721
|
-
* consumers may branch on it: a 5xx/408 is the upstream having a bad moment, a 429/503/529 is the
|
|
5722
|
-
* upstream out of capacity, and a 401/404/422 is a request that will fail identically forever. The
|
|
5723
|
-
* bridge's own never-retry classes are terminal whether or not a status rides with them.
|
|
5724
|
-
*
|
|
5725
|
-
* An `AbortError` is the run's own only when `signal` (the run) or `stopSignal` (the manager's own
|
|
5726
|
-
* stop: an accepted result, `stop`, a stop rule) has fired. Any other is a lost stream and is
|
|
5727
|
-
* retried: on magnetar-rust-20261019b a 4.0 h root turn ended "bridgeExecutor: turn aborted" and,
|
|
5728
|
-
* classed terminal, settled the run after one attempt.
|
|
5729
|
-
*/
|
|
5697
|
+
/** Runtime cancellation/contracts dominate producer policy; untyped foreign failures retain legacy rules. */
|
|
5730
5698
|
function classifyDriverFailure(error, signal, stopSignal) {
|
|
5731
5699
|
if (signal?.aborted) return "terminal";
|
|
5700
|
+
if (error instanceof CheckUnavailableError || error instanceof CoordinationUnreachableError) return "unavailable";
|
|
5732
5701
|
if (error instanceof RetainedExecutionPendingError && error.pendingCause === "provider-contract") return "terminal";
|
|
5733
5702
|
if (undispatchedCredentialExit(error) !== void 0) return "unavailable";
|
|
5734
5703
|
const admission = retainedAdmissionCause(error);
|
|
@@ -5739,6 +5708,9 @@ function classifyDriverFailure(error, signal, stopSignal) {
|
|
|
5739
5708
|
if (error instanceof Error && isProviderSchemaRejection(error)) return "terminal";
|
|
5740
5709
|
if (isCredentialRefusal(error)) return "terminal";
|
|
5741
5710
|
if (causeChain(error).some(isProvisioningRefusal)) return "terminal";
|
|
5711
|
+
if (error instanceof AgentEvalError && !(error instanceof BackendTransportError)) return "terminal";
|
|
5712
|
+
const typed = turnFailureOf(error);
|
|
5713
|
+
if (typed) return turnFailurePolicy(typed).classification;
|
|
5742
5714
|
if (error instanceof HarnessTurnFailedError) {
|
|
5743
5715
|
if (error.errorCode !== void 0 && DETERMINISTIC_BRIDGE_CODES.has(error.errorCode)) return "terminal";
|
|
5744
5716
|
if (upstreamUnavailableSignal(error) !== void 0) return "unavailable";
|
|
@@ -5750,7 +5722,6 @@ function classifyDriverFailure(error, signal, stopSignal) {
|
|
|
5750
5722
|
const status = error.status;
|
|
5751
5723
|
return status === void 0 || status === 408 || status >= 500 ? "transient" : "terminal";
|
|
5752
5724
|
}
|
|
5753
|
-
if (error instanceof AgentEvalError) return "terminal";
|
|
5754
5725
|
if (upstreamUnavailableSignal(error) !== void 0) return "unavailable";
|
|
5755
5726
|
return foreignHttpStatusVerdict(error) ?? "transient";
|
|
5756
5727
|
}
|
|
@@ -5821,14 +5792,10 @@ const TRANSPORT_NAMES = /* @__PURE__ */ new Set([
|
|
|
5821
5792
|
"AbortError",
|
|
5822
5793
|
"RetainedStreamError"
|
|
5823
5794
|
]);
|
|
5824
|
-
/**
|
|
5825
|
-
* A transient failure's kind, read from typed fields on any cause, never its text. `infra` is a
|
|
5826
|
-
* transport that dropped, timed out or answered 408 or 5xx, and earns the outage bound; anything
|
|
5827
|
-
* else foreign is `deterministic`, an answer that repeats, and earns no window. Of 4,449 failed
|
|
5828
|
-
* attempts over the week to 2026-11-04, 2,019 were deterministic answers retried as transient
|
|
5829
|
-
* (a failed box's 409, a play repository's exit 128, an expired key's 401, a harness refusal).
|
|
5830
|
-
*/
|
|
5795
|
+
/** Producer infra earns the outage window; producer work earns only the bounded deterministic streak. */
|
|
5831
5796
|
function transientFailureKind(error) {
|
|
5797
|
+
const typed = turnFailureOf(error);
|
|
5798
|
+
if (typed) return turnFailurePolicy(typed).failureKind;
|
|
5832
5799
|
if (causedByPartialFailure(error)) return "deterministic";
|
|
5833
5800
|
return causeChain(error).some((cause) => {
|
|
5834
5801
|
if (!(cause instanceof Error)) return false;
|
|
@@ -8576,13 +8543,15 @@ function providerFailureEvent(event, sandboxEvent) {
|
|
|
8576
8543
|
const detail = failureDetail(sandboxEvent.data) ?? failureDetail(outcome) ?? failureDetail(result) ?? (normalized?.type === "status" ? normalized.detail : void 0);
|
|
8577
8544
|
const errorCode = failureCode(sandboxEvent.data) ?? failureCode(outcome) ?? failureCode(result);
|
|
8578
8545
|
const statusCode = failureStatusCode(sandboxEvent.data) ?? failureStatusCode(outcome) ?? failureStatusCode(result);
|
|
8546
|
+
const failure = turnFailureOf(sandboxEvent.data) ?? turnFailureOf(outcome) ?? turnFailureOf(result);
|
|
8579
8547
|
return {
|
|
8580
8548
|
type: "result",
|
|
8581
8549
|
data: {
|
|
8582
8550
|
status: "failed",
|
|
8583
8551
|
...detail ? { error: detail } : {},
|
|
8584
8552
|
...errorCode ? { errorCode } : {},
|
|
8585
|
-
...statusCode === void 0 ? {} : { statusCode }
|
|
8553
|
+
...statusCode === void 0 ? {} : { statusCode },
|
|
8554
|
+
...failure === void 0 ? {} : { failure }
|
|
8586
8555
|
}
|
|
8587
8556
|
};
|
|
8588
8557
|
}
|
|
@@ -8617,26 +8586,7 @@ function providerTerminalSuccess(event, sandboxEvent) {
|
|
|
8617
8586
|
result?.status
|
|
8618
8587
|
].some((status) => typeof status === "string" && TERMINAL_SUCCESS_STATUSES.has(status));
|
|
8619
8588
|
}
|
|
8620
|
-
/**
|
|
8621
|
-
* Holds a stream's failure frames until it ends, so the terminal frame decides the outcome.
|
|
8622
|
-
*
|
|
8623
|
-
* The sandbox outcome tracker latches the first `error` frame as the run's error and settles
|
|
8624
|
-
* `failed` on it whatever the terminal frame says; and until this ledger existed the runtime
|
|
8625
|
-
* only ever showed the tracker its failure frames, so a terminal `success: true` was never in
|
|
8626
|
-
* evidence at all. A transport error that the harness recovered from — a stream break the
|
|
8627
|
-
* sidecar re-attached, a tool backend that failed once — therefore settled the whole child
|
|
8628
|
-
* `down` with the transient error as its reason, and the artifact the child had banked was
|
|
8629
|
-
* discarded. On the 2026-09-20 fleet corpus, 25 children that finished their work settled that
|
|
8630
|
-
* way.
|
|
8631
|
-
*
|
|
8632
|
-
* The rule: `error` frames are forgiven when the stream reports success and carries no verdict;
|
|
8633
|
-
* a failed status or a failed terminal frame is the provider's own verdict on the run, and once
|
|
8634
|
-
* one exists every failure frame is evidence again, in order, so the tracker names the first
|
|
8635
|
-
* `error` as it always did. The existing contracts hold unchanged: `status: failed` then
|
|
8636
|
-
* `done: {}` is failed, and the retained Claude tail `completed → failed → error → done` is
|
|
8637
|
-
* failed with the error frame's message. The forgiven frames stay in the event archive the trace
|
|
8638
|
-
* reads; only the outcome stops claiming them.
|
|
8639
|
-
*/
|
|
8589
|
+
/** Terminal success forgives recovered error frames; explicit failed verdicts retain their evidence. */
|
|
8640
8590
|
function createProviderFailureLedger() {
|
|
8641
8591
|
const failures = [];
|
|
8642
8592
|
let verdicts = 0;
|
|
@@ -8655,7 +8605,12 @@ function createProviderFailureLedger() {
|
|
|
8655
8605
|
if (failures.length === 0 || verdicts === 0 && succeeded) return void 0;
|
|
8656
8606
|
const tracker = createAgentRunOutcomeTracker();
|
|
8657
8607
|
for (const frame of failures) tracker.observe(frame);
|
|
8658
|
-
|
|
8608
|
+
const outcome = tracker.finish();
|
|
8609
|
+
const failure = failures.slice().reverse().map((frame) => turnFailureOf(frame.data)).find((value) => value !== void 0);
|
|
8610
|
+
return outcome === void 0 ? void 0 : {
|
|
8611
|
+
...outcome,
|
|
8612
|
+
...failure === void 0 ? {} : { failure }
|
|
8613
|
+
};
|
|
8659
8614
|
}
|
|
8660
8615
|
};
|
|
8661
8616
|
}
|
|
@@ -8853,13 +8808,19 @@ function exactQuotaRefusal(error) {
|
|
|
8853
8808
|
try {
|
|
8854
8809
|
const refusal = causeChain(error).find((cause) => Reflect.get(cause, "name") === "TangleCredentialCapacityError" && Reflect.get(cause, "code") === "provider_quota_exhausted");
|
|
8855
8810
|
if (refusal === void 0) return void 0;
|
|
8811
|
+
const failure = turnFailureOf(refusal);
|
|
8856
8812
|
const resetAt = Reflect.get(refusal, "resetAt");
|
|
8857
8813
|
return {
|
|
8858
8814
|
text: "",
|
|
8859
8815
|
success: false,
|
|
8860
8816
|
error: `Subscription account capacity is unavailable${typeof resetAt === "string" ? ` until ${resetAt}` : ""}`,
|
|
8861
8817
|
errorCode: "provider_quota_exhausted",
|
|
8862
|
-
statusCode: 429
|
|
8818
|
+
statusCode: 429,
|
|
8819
|
+
failure: failure ?? {
|
|
8820
|
+
kind: "capacity",
|
|
8821
|
+
code: "provider_quota_exhausted",
|
|
8822
|
+
...typeof resetAt === "string" && Number.isFinite(Date.parse(resetAt)) ? { resetAt: new Date(resetAt).toISOString() } : {}
|
|
8823
|
+
}
|
|
8863
8824
|
};
|
|
8864
8825
|
} catch {
|
|
8865
8826
|
return;
|
|
@@ -8955,6 +8916,7 @@ var RetainedObservation = class {
|
|
|
8955
8916
|
finalText: result.text,
|
|
8956
8917
|
success: result.success,
|
|
8957
8918
|
...result.error ? { error: result.error } : {},
|
|
8919
|
+
...result.failure === void 0 ? {} : { failure: result.failure },
|
|
8958
8920
|
...result.errorCode ? {
|
|
8959
8921
|
errorCode: result.errorCode,
|
|
8960
8922
|
statusCode: result.statusCode
|
|
@@ -9006,7 +8968,10 @@ var RetainedObservation = class {
|
|
|
9006
8968
|
wake = setImmediate(() => {
|
|
9007
8969
|
const close = () => {
|
|
9008
8970
|
const flowing = this.sawTerminal ? 0 : RETAINED_TAIL_FLOW_MS - (Date.now() - this.lastObservedAt);
|
|
9009
|
-
if (flowing <= 0)
|
|
8971
|
+
if (flowing <= 0) {
|
|
8972
|
+
wake = setImmediate(() => resolve({ kind: "exact-result" }));
|
|
8973
|
+
return;
|
|
8974
|
+
}
|
|
9010
8975
|
grace = setTimeout(() => {
|
|
9011
8976
|
wake = setImmediate(() => resolve({ kind: "exact-result" }));
|
|
9012
8977
|
}, flowing);
|
|
@@ -9119,7 +9084,10 @@ var RetainedObservation = class {
|
|
|
9119
9084
|
}
|
|
9120
9085
|
this.pendingRead = void 0;
|
|
9121
9086
|
if (observed.value.done) break;
|
|
9122
|
-
if (this.acceptFrame(observed.value.value))
|
|
9087
|
+
if (this.acceptFrame(observed.value.value)) {
|
|
9088
|
+
yield observed.value.value;
|
|
9089
|
+
this.lastObservedAt = Date.now();
|
|
9090
|
+
}
|
|
9123
9091
|
}
|
|
9124
9092
|
} finally {
|
|
9125
9093
|
Promise.resolve().then(() => iterator?.return?.()).catch(() => void 0);
|
|
@@ -10021,6 +9989,7 @@ var ProviderTurnSettlement = class {
|
|
|
10021
9989
|
const statusCode = failureStatusCode(outcome);
|
|
10022
9990
|
const nativeFailure = outcome?.status === "failed" ? {
|
|
10023
9991
|
success: false,
|
|
9992
|
+
...outcome.failure === void 0 ? {} : { failure: outcome.failure },
|
|
10024
9993
|
...outcome.error ? { error: outcome.error } : {},
|
|
10025
9994
|
...outcome.errorCode ? { errorCode: outcome.errorCode } : {},
|
|
10026
9995
|
...statusCode === void 0 ? {} : { statusCode }
|
|
@@ -10041,7 +10010,8 @@ var ProviderTurnSettlement = class {
|
|
|
10041
10010
|
});
|
|
10042
10011
|
if (signal !== void 0) this.unavailable = {
|
|
10043
10012
|
signal,
|
|
10044
|
-
cause: errorText(nativeFailure.error ?? "")
|
|
10013
|
+
cause: errorText(nativeFailure.error ?? ""),
|
|
10014
|
+
...nativeFailure.failure ? { failure: nativeFailure.failure } : {}
|
|
10045
10015
|
};
|
|
10046
10016
|
}
|
|
10047
10017
|
if (this.retained) await args.retention?.onResult(settled);
|
|
@@ -10447,7 +10417,9 @@ async function pauseForContinuation(scope, invocation, ended, attempt, refusalsB
|
|
|
10447
10417
|
const continueInvocation = invocation.retention?.continueInvocation;
|
|
10448
10418
|
if (refusal === void 0 || continueInvocation === void 0 || state.workspacePreservationRequired || state.workspaceCaptureFailure !== void 0) return;
|
|
10449
10419
|
const refusalsInARow = ended.madeProgress ? 1 : refusalsBefore + 1;
|
|
10450
|
-
const
|
|
10420
|
+
const now = Date.now();
|
|
10421
|
+
const reset = unavailableResumeAt(reportedResetAt(refusal, now), now);
|
|
10422
|
+
const pauseMs = reset === void 0 ? unavailablePauseMs(refusalsInARow, options.unavailablePause || {}) : Math.max(1e3, reset - now);
|
|
10451
10423
|
await invocation.retention?.onPause?.({
|
|
10452
10424
|
attempt,
|
|
10453
10425
|
signal: refusal.signal,
|
|
@@ -15195,7 +15167,7 @@ function singleShotDriver(maxIterations) {
|
|
|
15195
15167
|
* model, process, limits, or backend behavior is detached and deeply frozen.
|
|
15196
15168
|
* Explicit service/function fields remain live by reference because they are executable ports,
|
|
15197
15169
|
* not portable configuration. */
|
|
15198
|
-
function snapshotExecutorConfig(config) {
|
|
15170
|
+
function snapshotExecutorConfig(config, mode = "execution") {
|
|
15199
15171
|
switch (config.backend) {
|
|
15200
15172
|
case "router-tools": {
|
|
15201
15173
|
const { complete, executeToolCall, onMessages, onToolStep, onProviderResponse, ...decisionData } = config;
|
|
@@ -15253,7 +15225,7 @@ function snapshotExecutorConfig(config) {
|
|
|
15253
15225
|
const { provider, registry, profileForCreate, taskToTurn, validator, workspaceRetention, shared, ...decisionData } = config;
|
|
15254
15226
|
if (shared !== void 0 && (decisionData.steering !== void 0 || decisionData.placements !== void 0 || workspaceRetention !== void 0)) throw new ValidationError$1("createExecutor(provider): shared placement cannot combine with steering, placements, or workspaceRetention");
|
|
15255
15227
|
const snapshot = detachedSnapshot(decisionData, "createExecutor provider config");
|
|
15256
|
-
const resolvedProvider = resolveAgentEnvironmentProvider(provider, registry);
|
|
15228
|
+
const resolvedProvider = mode === "control" && typeof provider === "string" ? registry?.get(provider) ?? provider : resolveAgentEnvironmentProvider(provider, registry);
|
|
15257
15229
|
return Object.freeze({
|
|
15258
15230
|
...snapshot,
|
|
15259
15231
|
provider: resolvedProvider,
|
|
@@ -16844,8 +16816,8 @@ function allSpawnedChildrenDown(tree) {
|
|
|
16844
16816
|
}
|
|
16845
16817
|
function poolExhausted(pool, opts) {
|
|
16846
16818
|
const r = pool.readout();
|
|
16847
|
-
if (r.iterationsLeft <= 0) return true;
|
|
16848
|
-
if (r.tokensLeft <= 0) return true;
|
|
16819
|
+
if (r.iterationsCapped !== false && r.iterationsLeft <= 0) return true;
|
|
16820
|
+
if (r.tokensCapped !== false && r.tokensLeft <= 0) return true;
|
|
16849
16821
|
return opts.budget.maxUsd !== void 0 && r.usdLeft <= 0;
|
|
16850
16822
|
}
|
|
16851
16823
|
function deadlinePassed(pool, opts) {
|
|
@@ -17129,7 +17101,7 @@ async function joinRunChildren(join, settleGraceMs) {
|
|
|
17129
17101
|
if (!persistence.failed && join.retainedAtSettlement === "release") join.teardownUnconfirmed = await releaseRetainedEnvironments(scope);
|
|
17130
17102
|
const releasing = !persistence.failed && join.retainedAtSettlement === "release";
|
|
17131
17103
|
await confirmRetriableTeardowns(join, releasing);
|
|
17132
|
-
join.teardownUnconfirmed =
|
|
17104
|
+
join.teardownUnconfirmed = await unrecoveredRetainedChildren(join);
|
|
17133
17105
|
for (const node of join.teardownUnconfirmed) await join.opts.journal.appendEvent(join.opts.runId, {
|
|
17134
17106
|
kind: "teardown-unconfirmed",
|
|
17135
17107
|
...unconfirmedRecord(node),
|
|
@@ -17138,6 +17110,112 @@ async function joinRunChildren(join, settleGraceMs) {
|
|
|
17138
17110
|
});
|
|
17139
17111
|
if (releasing) await closeRetainedSlots(scope);
|
|
17140
17112
|
}
|
|
17113
|
+
/** Retained custody absent from the live scope, including a cold cancellation without ports. */
|
|
17114
|
+
async function unrecoveredRetainedChildren(join) {
|
|
17115
|
+
const { scope, resumeFrom } = join;
|
|
17116
|
+
const adopted = new Set(scope.view.nodes.map((node) => node.id));
|
|
17117
|
+
const unrecovered = [];
|
|
17118
|
+
for (const recovery of resumeFrom?.recoveries ?? []) {
|
|
17119
|
+
if (adopted.has(recovery.spawned.id)) continue;
|
|
17120
|
+
const environments = /* @__PURE__ */ new Map();
|
|
17121
|
+
for (const admission of recovery.admissions) {
|
|
17122
|
+
const environment = admission.phase === "environment" ? admission : admission.phase === "dispatched" ? admission.controlRef : void 0;
|
|
17123
|
+
if (environment === void 0) continue;
|
|
17124
|
+
const ref = {
|
|
17125
|
+
provider: environment.provider,
|
|
17126
|
+
environmentId: environment.environmentId,
|
|
17127
|
+
keptFor: "evidence"
|
|
17128
|
+
};
|
|
17129
|
+
environments.set(JSON.stringify([ref.provider, ref.environmentId]), ref);
|
|
17130
|
+
}
|
|
17131
|
+
unrecovered.push({
|
|
17132
|
+
id: recovery.spawned.id,
|
|
17133
|
+
label: recovery.spawned.label,
|
|
17134
|
+
runtime: recovery.spawned.runtime,
|
|
17135
|
+
status: resumeFrom?.view.nodes.find((node) => node.id === recovery.spawned.id)?.status ?? "pending",
|
|
17136
|
+
...environments.size === 0 ? {} : { kept: [...environments.values()] },
|
|
17137
|
+
attempts: 0,
|
|
17138
|
+
detail: "Retained child was not recovered before settlement; source evidence and teardown remain unverified."
|
|
17139
|
+
});
|
|
17140
|
+
}
|
|
17141
|
+
const unconfirmed = new Map([...join.teardownUnconfirmed, ...unrecovered].map((node) => [node.id, node]));
|
|
17142
|
+
if (resumeFrom === void 0 || !(join.opts.signal?.reason instanceof RunCancellationReason)) return [...unconfirmed.values()];
|
|
17143
|
+
const forest = await loadSpawnForest(join.opts.journal, join.opts.runId);
|
|
17144
|
+
const destroyed = /* @__PURE__ */ new Map();
|
|
17145
|
+
const confirmed = /* @__PURE__ */ new Map();
|
|
17146
|
+
const refs = /* @__PURE__ */ new Map();
|
|
17147
|
+
const pending = /* @__PURE__ */ new Map();
|
|
17148
|
+
const keyOf = (provider, environmentId) => JSON.stringify([provider, environmentId]);
|
|
17149
|
+
const later = (proof, admission) => proof.tree === admission.tree ? proof.index > admission.index : Number.isFinite(proof.at) && Number.isFinite(admission.at) && proof.at > admission.at;
|
|
17150
|
+
for (const [index, { treeRoot, event }] of forest.events.entries()) {
|
|
17151
|
+
const position = {
|
|
17152
|
+
tree: treeRoot,
|
|
17153
|
+
index,
|
|
17154
|
+
at: Date.parse(event.at)
|
|
17155
|
+
};
|
|
17156
|
+
const invocation = JSON.stringify([treeRoot, event.id]);
|
|
17157
|
+
if (event.kind === "environment-teardown" && event.destroyed) {
|
|
17158
|
+
const key = keyOf(event.provider, event.environmentId);
|
|
17159
|
+
destroyed.set(key, [...destroyed.get(key) ?? [], position]);
|
|
17160
|
+
}
|
|
17161
|
+
if (event.kind === "teardown-confirmed") confirmed.set(event.id, [...confirmed.get(event.id) ?? [], position]);
|
|
17162
|
+
if (event.kind === "execution-input" || event.kind === "execution-result" || event.kind === "execution-abandoned") pending.delete(invocation);
|
|
17163
|
+
if (event.kind !== "execution-admitted") continue;
|
|
17164
|
+
const admission = event.admission;
|
|
17165
|
+
const environment = admission.phase === "environment" ? admission : admission.phase === "dispatched" ? admission.controlRef : void 0;
|
|
17166
|
+
if (environment === void 0) {
|
|
17167
|
+
pending.set(invocation, {
|
|
17168
|
+
id: event.id,
|
|
17169
|
+
position
|
|
17170
|
+
});
|
|
17171
|
+
continue;
|
|
17172
|
+
}
|
|
17173
|
+
pending.delete(invocation);
|
|
17174
|
+
const held = refs.get(event.id) ?? /* @__PURE__ */ new Map();
|
|
17175
|
+
const key = keyOf(environment.provider, environment.environmentId);
|
|
17176
|
+
const custody = held.get(key) ?? {
|
|
17177
|
+
ref: {
|
|
17178
|
+
provider: environment.provider,
|
|
17179
|
+
environmentId: environment.environmentId,
|
|
17180
|
+
keptFor: "evidence"
|
|
17181
|
+
},
|
|
17182
|
+
admissions: /* @__PURE__ */ new Map()
|
|
17183
|
+
};
|
|
17184
|
+
custody.admissions.set(treeRoot, position);
|
|
17185
|
+
held.set(key, custody);
|
|
17186
|
+
refs.set(event.id, held);
|
|
17187
|
+
}
|
|
17188
|
+
const discharged = (id, key, custody) => [...custody.admissions.values()].every((admission) => [...destroyed.get(key) ?? [], ...confirmed.get(id) ?? []].some((proof) => later(proof, admission)));
|
|
17189
|
+
const unknown = new Set([...pending.values()].filter(({ id, position }) => !(confirmed.get(id) ?? []).some((proof) => later(proof, position))).map(({ id }) => id));
|
|
17190
|
+
for (const [id, node] of unconfirmed) {
|
|
17191
|
+
if (node.attempts !== 0 || node.environments?.length || !node.kept?.length || unknown.has(id)) continue;
|
|
17192
|
+
if (node.kept.every((ref) => {
|
|
17193
|
+
const key = keyOf(ref.provider, ref.environmentId);
|
|
17194
|
+
const custody = refs.get(id)?.get(key);
|
|
17195
|
+
return custody !== void 0 && discharged(id, key, custody);
|
|
17196
|
+
})) unconfirmed.delete(id);
|
|
17197
|
+
}
|
|
17198
|
+
for (const node of forest.nodes) {
|
|
17199
|
+
const kept = [...refs.get(node.id) ?? []].filter(([key, custody]) => !discharged(node.id, key, custody)).map(([, custody]) => custody.ref);
|
|
17200
|
+
if (kept.length === 0 && !unknown.has(node.id)) continue;
|
|
17201
|
+
const prior = unconfirmed.get(node.id);
|
|
17202
|
+
const covered = new Set([...prior?.kept ?? [], ...prior?.environments ?? []].map((ref) => keyOf(ref.provider, ref.environmentId)));
|
|
17203
|
+
const missing = kept.filter((ref) => !covered.has(keyOf(ref.provider, ref.environmentId)));
|
|
17204
|
+
if (prior !== void 0 && missing.length === 0) continue;
|
|
17205
|
+
unconfirmed.set(node.id, {
|
|
17206
|
+
...prior ?? {
|
|
17207
|
+
id: node.id,
|
|
17208
|
+
label: node.label,
|
|
17209
|
+
runtime: node.runtime,
|
|
17210
|
+
status: node.status,
|
|
17211
|
+
attempts: 0
|
|
17212
|
+
},
|
|
17213
|
+
...(prior?.kept?.length ?? 0) + missing.length > 0 ? { kept: [...prior?.kept ?? [], ...missing] } : {},
|
|
17214
|
+
detail: prior?.detail ?? "Prior admitted execution has no confirmed teardown; source custody remains unverified."
|
|
17215
|
+
});
|
|
17216
|
+
}
|
|
17217
|
+
return [...unconfirmed.values()];
|
|
17218
|
+
}
|
|
17141
17219
|
/**
|
|
17142
17220
|
* A first teardown that failed or answered late is not the provider's last word, and a run that
|
|
17143
17221
|
* settles over it leaves the sandbox running: cancelling 20 Discovery lanes
|
|
@@ -17166,35 +17244,6 @@ async function confirmRetriableTeardowns(join, releasing) {
|
|
|
17166
17244
|
});
|
|
17167
17245
|
}
|
|
17168
17246
|
}
|
|
17169
|
-
/** Retained children a resume restored from the journal but never adopted into the live scope. */
|
|
17170
|
-
function unrecoveredRetainedChildren(scope, resumeFrom) {
|
|
17171
|
-
const adopted = new Set(scope.view.nodes.map((node) => node.id));
|
|
17172
|
-
const unrecovered = [];
|
|
17173
|
-
for (const recovery of resumeFrom?.recoveries ?? []) {
|
|
17174
|
-
if (adopted.has(recovery.spawned.id)) continue;
|
|
17175
|
-
const environments = /* @__PURE__ */ new Map();
|
|
17176
|
-
for (const admission of recovery.admissions) {
|
|
17177
|
-
const environment = admission.phase === "environment" ? admission : admission.phase === "dispatched" ? admission.controlRef : void 0;
|
|
17178
|
-
if (environment === void 0) continue;
|
|
17179
|
-
const ref = {
|
|
17180
|
-
provider: environment.provider,
|
|
17181
|
-
environmentId: environment.environmentId,
|
|
17182
|
-
keptFor: "evidence"
|
|
17183
|
-
};
|
|
17184
|
-
environments.set(JSON.stringify([ref.provider, ref.environmentId]), ref);
|
|
17185
|
-
}
|
|
17186
|
-
unrecovered.push({
|
|
17187
|
-
id: recovery.spawned.id,
|
|
17188
|
-
label: recovery.spawned.label,
|
|
17189
|
-
runtime: recovery.spawned.runtime,
|
|
17190
|
-
status: resumeFrom?.view.nodes.find((node) => node.id === recovery.spawned.id)?.status ?? "pending",
|
|
17191
|
-
...environments.size === 0 ? {} : { kept: [...environments.values()] },
|
|
17192
|
-
attempts: 0,
|
|
17193
|
-
detail: "Retained child was not recovered before settlement; source evidence and teardown remain unverified."
|
|
17194
|
-
});
|
|
17195
|
-
}
|
|
17196
|
-
return unrecovered;
|
|
17197
|
-
}
|
|
17198
17247
|
// src/runtime/supervise/supervisor-run-tree.ts
|
|
17199
17248
|
async function openRunTree(opts, now) {
|
|
17200
17249
|
const rootAttemptId = newExecutionAttemptId(opts.runId);
|
|
@@ -17294,6 +17343,11 @@ function createSupervisor() {
|
|
|
17294
17343
|
const journal = wrapJournalForBreaker(opts.journal, breaker);
|
|
17295
17344
|
const scope = createRootScope(intake, opened, journal, now);
|
|
17296
17345
|
const openScope = scope;
|
|
17346
|
+
const ownerControl = runtimeOwnedScopeOwnerControl(root);
|
|
17347
|
+
if (ownerControl !== void 0) {
|
|
17348
|
+
bindScopeRetainedOwnerProvider(openScope, ownerControl.provider, ownerControl.checkpointCapture);
|
|
17349
|
+
bindScopeRetainedOwnerWorkspaceRetention(openScope, ownerControl.checkpointCapture !== void 0);
|
|
17350
|
+
}
|
|
17297
17351
|
if (rootLease) rootLease.bind({
|
|
17298
17352
|
scope: openScope,
|
|
17299
17353
|
cascadeAbort: (reason) => cascade.abort(new RunCancellationReason("root-handle", reason ?? "root handle aborted")),
|
|
@@ -17449,11 +17503,15 @@ async function executeRoot(root) {
|
|
|
17449
17503
|
let executionAborted = controller.signal.aborted;
|
|
17450
17504
|
let allChildrenDownAtSettle = false;
|
|
17451
17505
|
let parked = false;
|
|
17506
|
+
let rootStarted = false;
|
|
17452
17507
|
try {
|
|
17453
17508
|
await startScopeRecoveries(scope);
|
|
17454
17509
|
actOutcome = {
|
|
17455
17510
|
ok: true,
|
|
17456
|
-
out: await runAbortable(
|
|
17511
|
+
out: await runAbortable(() => {
|
|
17512
|
+
rootStarted = true;
|
|
17513
|
+
return root.run();
|
|
17514
|
+
}, controller.signal, "supervisor aborted")
|
|
17457
17515
|
};
|
|
17458
17516
|
} catch (error) {
|
|
17459
17517
|
if (error instanceof RunParkedError && error.runId === opts.runId) {
|
|
@@ -17480,7 +17538,7 @@ async function executeRoot(root) {
|
|
|
17480
17538
|
error
|
|
17481
17539
|
};
|
|
17482
17540
|
}
|
|
17483
|
-
if (!persistence.failed) try {
|
|
17541
|
+
if (rootStarted && !persistence.failed) try {
|
|
17484
17542
|
await finalizeScopeOwnerMaterialization(scope);
|
|
17485
17543
|
} catch (error) {
|
|
17486
17544
|
if (actOutcome?.ok !== false) actOutcome = {
|
|
@@ -17585,4 +17643,4 @@ async function noWinner(settled, rejection) {
|
|
|
17585
17643
|
}
|
|
17586
17644
|
export { DEFAULT_PEER_MAIL_LIMITS as $, promptModelProfileMaterialization as $t, createSandboxForSpec as A, bridgeModelRouteRefusal as At, createRouterTranscript as B, defaultRunCommand as Bt, createExecutor as C, admitContinuationPolicy as Ct, runAgentRounds as D, failedItems as Dt, createSteerableSandboxSession as E, createContinuationKeeper as Et, codeModeArguments as F, harnessUsageIsEmpty as Ft, LEAF_CONTINUATION_TASK as G, terminateProcessTreeAndConfirm as Gt, createAgentEnvironmentProviderRegistry as H, runWorktreeHarness as Ht, codeModeModelOutput as I, readCodexRolloutSession as It, createInPlaceCliExecutor as J, controlProfileMaterialization as Jt, providerAsSandboxClient as K, assertProfileMaterialization as Kt, createCodeModeTools as L, createPushTraceSource as Lt, acquireSandbox as M, ROUTER_PRICE_SOURCE as Mt, TERMINAL_DECISIONS as N, addHarnessUsage as Nt, assertBoxlessPromptOptions as O, isFiniteNumber as Ot, defaultSelectWinner as P, createCodexRolloutStoreReader as Pt, AUTHORITY_MARKERS as Q, promptControlProfileMaterialization as Qt, runCodeMode as R, bridgeRuntimeAttachmentsKey as Rt, captureReusableExecutorConfig as S, CONTINUATIONS_DIR as St, DEFAULT_SANDBOX_STEERING_MAX_TURNS as T, checkVerdictOf as Tt, resolveAgentEnvironmentProvider as U, LOCAL_HARNESSES as Ut, routerBrain as V, runSettledCommand as Vt, providerAsExecutor as W, harnessInvocation as Wt, createInbox as X, fullProfileMaterialization as Xt, INBOX_RECEIPT_KEY as Y, defineProfileMaterializationContract as Yt, failPendingAfter as Z, profileMaterializationAxes$1 as Zt, withDriverExecutor as _, CheckUnavailableError as _t, assertRunParking as a, projectSandboxOutcome as an, peerMailVerbNames as at, createExecutorRegistry as b, mapExecutorResult as bt, sleepScopeWait as c, HarnessTurnFailedError as ct, runFinalizer as d, isContentFilterRefusal as dt, renderUnsupported as en, PEER_MAIL_WIRE_KEY as et, runTree as f, summarizeDriverAttempts as ft, isDriverSpec as g, preflightPublicCoordination as gt, driverExecutorFactory as h, upstreamUnavailableSignal as ht, RunParkedError as i, worktreeCliProfileMaterialization as in, peerMailTools as it, createSandboxLineage as j, priceTokens as jt, readPromptOptions as k, bridgeAdmissionRefusal as kt, withRunParking as l, abandonablePending as lt, driverChild as m, undispatchedCredentialExit as mt, createSupervisor as n, sandboxProfileMaterialization as nn, createPeerMailbox as nt, bindScopeParkingDrain as o, readSandboxOutcome as on, taskToPrompt$1 as ot, createRootHandle as p, transientFailureKind as pt, createWorktreeCliExecutor as q, assertProfileMaterializes as qt, assertResumeLimits as r, unsupportedProfileDimensions as rn, isPeerMailEnvelope as rt, readRunParking as s, DriverAttemptsExhaustedError as st, DEFAULT_MAX_DEPTH as t, sandboxActProfileMaterialization as tn, claimsAuthority as tt, bestDelivered as u, classifyDriverFailure as ut, InMemoryResultBlobStore as v, gateFactoryOnDeliverable as vt, snapshotExecutorConfig as w, bestComposite as wt, bindReusableExecutorExecutionId as x, verdictFromJudgeScore as xt, InMemorySpawnJournal as y, gateOnDeliverable as yt, toolResultText as z, bridgeStopSignalKey as zt };
|
|
17587
17645
|
|
|
17588
|
-
//# sourceMappingURL=supervisor-
|
|
17646
|
+
//# sourceMappingURL=supervisor-B-bX69uL.js.map
|