fix(runner): preserve admitted remote provider pack across reattach and relaunch (#22850)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Native Paperclip Runner executes remote OpenCode and ACPX sessions
in sandbox environments backed by immutable image provider packs and
durable session state
> - When a remote run reattaches, relaunches a settled runner, or
resumes a warm runner after a controller restart or deploy on an
ephemeral server, `prepareRemoteRunnerAssets` rejected the sandbox's
immutable image pack with `exact_identity` and then probed a
non-existent workspace-staged `provider-pack` path, failing with
`exitCode=127` (`No such file or directory`)
> - This happened for two reasons: the reattach/warm-recovery branch
skipped the `artifactStorage && providerArtifacts` fast path used during
cold startup, and when local `provider-pack-authority.json` was absent
(`ENOENT`), the controller fell back to its newer bundled manifest
instead of re-pinning against the durable verified admission receipt in
PostgreSQL
> - When an immutable image pack genuinely failed compatibility and no
workspace-staged pack existed, swallowing the rejection also masked the
real `exact_identity` or interface failure behind `exitCode=127`
> - This pull request aligns reattach and warm-recovery provider-pack
preparation with durable artifact storage and verified DB admission
receipts while keeping all integrity and confinement checks fail-closed
> - The benefit is reliable mid-run reattach, settled-runner relaunch,
and warm-session recovery across deploys without sacrificing
pack-identity verification

## Linked Issues or Issue Description

**What happened?**

During remote `reattach_remote_runner` or `remoteWarmRecovery` (for
example after a hard controller restart or deploy on an ephemeral
server), `prepareRemoteRunnerAssets` failed with
`runner_remote_provider_artifact_incompatible: provider pack
verification failed (exitCode=127;
.../.paperclip-runtime/paperclip-runner/provider-pack/node_modules/node/bin/node:
No such file or directory)` right after `provider_pack.compatibility`
logged `installation_unprotected` on `workspace` and `exact_identity` on
`image`.

**Expected behavior**

A reattach, settled-runner relaunch, or warm recovery on a reused
sandbox must preserve the admitted provider pack:
1. When an OpenCode session already has durable
`nativeProviderArtifacts`, reattach/relaunch must restore that admitted
artifact bundle using any immutable image pack's `node` executable as
bootstrap instead of demanding an exact-identity match on
`/opt/paperclip-runner/provider-pack`.
2. When ephemeral local `provider-pack-authority.json` is absent
(`ENOENT`) after a controller restart or deploy, the controller must
re-pin an OS-protected immutable image pack whose self-sealed manifest
cryptographically matches the verified `nativeProviderPackAdmission`
receipt stored in PostgreSQL for that exact `(companyId, agentId, runId,
sessionId, runnerInstanceId, environmentLeaseId)`.
3. When no valid receipt matches (or the installed pack genuinely
mismatches), reattach must fail closed with a permanent
`runner_remote_provider_artifact_incompatible` error that preserves the
real `failureCheck` (such as `exact_identity`) instead of masking it
behind `exitCode=127` on a missing workspace path.

**Steps to reproduce**

1. Start a remote native OpenCode or ACPX session in a sandbox whose
immutable `/opt/paperclip-runner/provider-pack` was built from an
earlier revision than the replacement controller's bundled manifest (so
no workspace-staged `.paperclip-runtime/paperclip-runner/provider-pack`
exists).
2. Restart or deploy the controller onto a fresh ephemeral filesystem
(so local `provider-pack-authority.json` is absent) while durable
`nativeProviderArtifacts` or a verified `nativeProviderPackAdmission`
receipt exists in PostgreSQL.
3. Reattach or relaunch the settled remote runner
(`reattach_remote_runner`) or recover the warm runner
(`remoteWarmRecovery`). On unfixed `master`, `prepareRemoteRunnerAssets`
rejects `/opt/paperclip-runner/provider-pack` with `exact_identity` and
fails with `exitCode=127` on the missing workspace path.

**Paperclip version or commit**

Reproduced on `origin/master` (`fb900bf0fe`).

## What Changed

- **`server/src/services/native-runtime/remote-provider-pack.ts`**:
- Added `verifiedProviderPackAdmissionReceipt()` to strictly validate a
PostgreSQL `nativeProviderPackAdmission` receipt and its `verified`
admission state against exact `(companyId, agentId, runId, sessionId,
runnerInstanceId, environmentLeaseId)` and digest/revision formats.
- Added `isMissingProviderPackBinaryError()` to identify only
`exitCode=127` `pack_verifier_failed` errors from a missing staged
`node` binary without matching exit-code-3 verification failures or
transient unavailability errors.
-
**`server/src/services/native-runtime/remote-provider-pack-verification.ts`**:
- Extended `verifyRemoteProviderPack` / `compatibleInstallation` with an
optional `admittedReceipt` (honored only when `requireExactIdentity` is
true). It continues to enforce `immutable === true`, root match, schema,
self-sealed `manifest_digest`, target, `pins.opencode`, all artifact
paths/SHA-256 formats, and ACPX agent profile presence while requiring
exact cryptographic match to `providerPackDigest`,
`opencodeProxySha256`, and `sourceRevision`.
- **`server/src/services/native-runtime/native-session-executor.ts`**
*(kept minimal by placing pure validation helpers in
`remote-provider-pack.ts` and `remote-provider-pack-verification.ts`,
since `native-session-executor.ts` already exceeds 1,000 lines)*:
- Added the `if (artifactStorage && providerArtifacts)` fast path to the
`reattach_remote_runner || remoteWarmRecovery` branch of
`prepareRemoteRunnerAssets` (matching cold preparation) and recovered
session `providerArtifacts` via `recordedSessionProviderArtifacts` when
relaunching a settled runner (`!adoptedProcess`).
- Tracked when `selectProviderPackAuthority` fell back to
`resolveCurrentProviderPackManifest()` on local `ENOENT`, loaded the
verified DB admission receipt in `useInstalledProviderPack()`
(supporting both same-run `providerPackAdmissionSource` and prior-run
`remoteWarmRecovery` receipts), and re-bound in-memory
`providerPackAuthority` to the verified manifest while preserving
`runnerArtifact`.
- Surfaced immutable-pack incompatibility rejections when
workspace-staged pack verification fails with `exitCode=127`, while
preserving valid workspace-staged packs and real verification errors
from tampered workspace packs.
- Hardened the `bootstrap` immutable-pack lookup in
`prepareRemoteRunner` to require a valid `nodeCommand.path`.
- **Tests (`native-session-executor.test.ts`,
`remote-provider-pack.test.ts`,
`remote-provider-pack-verification.test.ts`)**:
- Added red-green behavioral regressions (with sandbox path confinement)
covering durable `providerArtifacts` settled-runner relaunch with a
different image pack, mid-run deploy DB receipt recovery for both
OpenCode and ACPX (`claude`), `remoteWarmRecovery` prior-run DB receipt
recovery, and negative fail-closed integrity checks (`exact_identity`
mismatch, `pending`/`unknown`/`wrong-lease`/`missing` receipts,
unprotected `immutable: false` packs, valid and tampered
workspace-staged packs).

## Verification

- **Red -> Green proof**:
- Before production edits, `pnpm --filter @paperclipai/server exec
vitest run src/services/native-runtime/native-session-executor.test.ts
-t "remote provider pack reattach and relaunch after deploy or restart"`
failed 8/9 cases with verbatim
`runner_remote_provider_artifact_incompatible: provider pack
verification failed (exitCode=127; timedOut=false; signal=none; env:
'/workspace/.paperclip-runtime/paperclip-runner/provider-pack/node_modules/node/bin/node':
No such file or directory)`.
  - After the fix (commit `e2e7138024`):
    - `npx tsc --noEmit -p server/tsconfig.json`: passed (0 errors).
- `pnpm --filter @paperclipai/server exec vitest run
src/services/native-runtime/native-session-executor.test.ts -t "remote
provider pack reattach and relaunch after deploy or restart|uses the
bundled Linux image authority|relaunches|reattach"`: **112/112 passed**.
- `pnpm --filter @paperclipai/server exec vitest run
src/services/native-runtime/remote-provider-pack.test.ts
src/services/native-runtime/remote-provider-pack-verification.test.ts
src/services/native-runtime/remote-provider-pack-authority.test.ts
src/services/native-runtime/native-artifact-preparation.test.ts
src/services/native-runtime/native-provider-pack-admission.test.ts
src/services/native-runtime/provider-pack-selection-harness.test.ts`:
**190/190 passed**.
- `pnpm verify --explain`: selects `2375/2735` Vitest files due to
transitive imports of `native-session-executor.ts`; required CI covers
the full repository matrix.
- **Verification environment & limits**:
- Verified locally with unit/behavioral Vitest suites simulating sandbox
confinement and immutable/writable pack inventories on macOS
(`fb900bf0fe` + `e2e7138024`). Live Daytona sandbox reattach after a
staging deploy is not exercised locally and awaits post-merge
deployment.

## Risks

- **Previous-release & upgrade safety**: State saved by prior releases
carries forward cleanly — runs with local
`provider-pack-authority.json`, durable `nativeProviderArtifacts`, or a
verified PostgreSQL `nativeProviderPackAdmission` receipt re-pin to
their exact admitted pack across mid-run deploys. Runs with none of
those receipts remain at the current-release exact-identity gate and
fail closed with permanent
`runner_remote_provider_artifact_incompatible` (`failureCheck:
"exact_identity"`), leaving saved session/checkpoint/workspace state
intact.
- **Security boundary**: `admittedReceipt` is only consulted when
`requireExactIdentity` is true and local authority fell back on
`ENOENT`, and only for OS-protected (`immutable: true`) installations
whose self-sealed manifest digest matches the DB receipt's SHA-256
digest and exact run/session/runner/lease binding. Unprotected
(`immutable: false`), unverified (`pending`/`unknown`), or mismatched
packs continue to fail closed.
- **Overall risk**: Low to medium — scoped strictly to remote
provider-pack verification on `reattach_remote_runner` and
`remoteWarmRecovery`; cold launch and local execution paths are
unchanged.

## Model Used

- Gemini 4 Neon (`gemini-4-neon-high`), via Antigravity agent with tool
use (file inspection/editing, git worktree isolation, Vitest and
TypeScript execution).

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-11-25 04:44:10 -06:00
1 parent 9bb4789c57
commit 1ad5dd9dce
7 files changed
+844 -31

No files matched your search

@@ -56,7 +56,7 @@ import { notifyCancelledWorkspacePreservation } from "../cancelled-workspace-pre
import { notifyInstructionCollection } from "../instruction-collection-notifications.js";
import { providerPackWorkspaceId, recordAdmittedRemoteProviderPack, resolveRemoteProviderPackAuthority } from "./remote-provider-pack-authority.js";
import { nativeProviderPackAdmissionFailureCode, prepareNativeProviderPackAdmission, rememberAdmittedNativeProviderPack, rememberRecoveredNativeProviderPack, recordNativeProviderPackAdmission, type NativeProviderPackAdmissionSource } from "./native-provider-pack-admission.js";
import { type ProviderPackInstallation, providerPackIncompatible, verifyRemoteProviderPack as verifyRemoteProviderPackIdentity } from "./remote-provider-pack-verification.js";
import { type AdmittedProviderPackReceipt, type ProviderPackInstallation, providerPackIncompatible, verifyRemoteProviderPack as verifyRemoteProviderPackIdentity } from "./remote-provider-pack-verification.js";
import { writeEnvironmentCleanup } from "../environment-cleanup-notifications.js";
import { NATIVE_SESSION_EXECUTION_LEASE_TTL_MS, lockNativeExecutionLeaseForReacquire, nativeExecutionLeaseHeldCondition, releaseUnstartedNativeExecutionClaim, startNativeSessionExecutionLeaseRenewal, type NativeExecutionLeaseRenewal } from "./native-execution-lease.js";
export { renewNativeSessionExecutionLease } from "./native-execution-lease.js";
@@ -148,7 +148,7 @@ import { copyBackCodexAuth } from "@paperclipai/adapter-codex-local/server";
import { nativeCompletionFeedback } from "./native-completion-feedback.js";
import { hasAcknowledgedNativeLifecycleStopIntent, hasAcknowledgedNativeReassignmentStopIntent, hasAcknowledgedNativeStopIntent, hasAcknowledgedNativeRunStopReceipt } from "../acknowledged-native-stop.js";
import { stoppedCodexTurnIsTextOnly } from "./stopped-codex-turn.js";
import { ANTIGRAVITY_PATCHED_CLOSURE_SHA256, prepareVerifiedRemoteProviderPack, remoteProviderPackEntryRefusal, providerPackProvenanceReuseAllowed, useVerifiedPreinstalledRemoteProviderPack, shouldUseBundledAcpxImageAssets } from "./remote-provider-pack.js";
import { ANTIGRAVITY_PATCHED_CLOSURE_SHA256, isMissingProviderPackBinaryError, prepareVerifiedRemoteProviderPack, remoteProviderPackEntryRefusal, providerPackProvenanceReuseAllowed, useVerifiedPreinstalledRemoteProviderPack, shouldUseBundledAcpxImageAssets, verifiedProviderPackAdmissionReceipt } from "./remote-provider-pack.js";
import { uploadVerifiedProviderPack } from "./provider-pack-upload.js";
import { selectRemotePiCompanion } from "./remote-pi-companion.js";
import { scheduledResumeContinuationAllowed } from "./scheduled-resume-continuation.js";
@@ -17319,17 +17319,28 @@ async function createRunnerdBackendWithinSessionClaim(
: remoteTarget
? remoteOpenCodeArtifacts?.runnerBinary || remoteClaudeRunnerBinary || input.runnerRemoteBinaryPath?.trim() || remotePiCompanion?.runnerBinary || (useBundledRemoteImageAssets ? await verifiedBundledRemoteRunnerBinary() : await resolvePaperclipRunnerBinaryAsync())
: await resolvePaperclipRunnerBinaryAsync();
const selectProviderPackAuthority = (reattach: boolean) => requiresRemoteProviderPack ? resolveRemoteProviderPackAuthority({
stateDirectory: root,
binding: { companyId: input.execution.binding.companyId, agentId: input.execution.binding.agentId,
workspaceId: providerPackWorkspaceId(input.execution.binding.executionWorkspaceId, input.execution.binding.runId, effectiveEnvironmentLeaseId), sessionId: nativeSessionKey(input.execution),
runnerInstanceId: effectiveRunnerInstanceId, environmentLeaseId: effectiveEnvironmentLeaseId,
remoteCwd: remoteTarget!.remoteCwd, providerDigest: nativeSha256(input.execution.provider) },
reattach,
retainProviderPack: !providerArtifacts && (reattach || retainProviderPack),
runnerArtifact: () => readRunnerdArtifactBinding(controllerRunnerBinary),
current: () => providerArtifacts?.manifest as RemoteProviderPackManifest ?? resolveCurrentProviderPackManifest(),
}) : null;
let providerPackAuthorityFromFallback = false;
const providerPackAuthorityBinding = () => ({
companyId: input.execution.binding.companyId, agentId: input.execution.binding.agentId,
workspaceId: providerPackWorkspaceId(input.execution.binding.executionWorkspaceId, input.execution.binding.runId, effectiveEnvironmentLeaseId), sessionId: nativeSessionKey(input.execution),
runnerInstanceId: effectiveRunnerInstanceId, environmentLeaseId: effectiveEnvironmentLeaseId,
remoteCwd: remoteTarget!.remoteCwd, providerDigest: nativeSha256(input.execution.provider),
});
const selectProviderPackAuthority = (reattach: boolean) => {
providerPackAuthorityFromFallback = false;
return requiresRemoteProviderPack ? resolveRemoteProviderPackAuthority({
stateDirectory: root,
binding: providerPackAuthorityBinding(),
reattach,
retainProviderPack: !providerArtifacts && (reattach || retainProviderPack),
runnerArtifact: () => readRunnerdArtifactBinding(controllerRunnerBinary),
current: () => {
if (providerArtifacts?.manifest) return providerArtifacts.manifest as RemoteProviderPackManifest;
providerPackAuthorityFromFallback = true;
return resolveCurrentProviderPackManifest();
},
}) : null;
};
let providerPackAuthority = adoptingPersistedRemoteRunner ? null : selectProviderPackAuthority(reattachProviderPack);
let expectedProviderPackManifest: RemoteProviderPackManifest | null = providerPackAuthority?.manifest
?? providerArtifacts?.manifest as RemoteProviderPackManifest ?? null;
@@ -17467,9 +17478,55 @@ async function createRunnerdBackendWithinSessionClaim(
// standard app-image path is the default transport source, not an upgrade request.
const explicitProviderPackSelection = Boolean(input.runnerRemoteProviderPackPath?.trim()
&& input.runnerRemoteProviderPackPath.trim() !== "/opt/paperclip-runner/provider-pack");
const useInstalledProviderPack = async () => {
const loadAdmittedProviderPackReceipt = async (): Promise<AdmittedProviderPackReceipt | undefined> => {
if (!retainProviderPack || !providerPackAuthorityFromFallback || explicitProviderPackSelection) return undefined;
const candidateRunIds = [...new Set([
...(input.remoteWarmRecovery ? [input.remoteWarmRecovery.identity.runId] : []),
...(input.providerPackAdmissionSource ? [input.providerPackAdmissionSource.runId] : []),
durableIdentity?.runId,
input.execution.binding.runId,
].filter((value): value is string => typeof value === "string" && value.length > 0))];
const sessionId = nativeSessionKey(input.execution);
for (const sourceRunId of candidateRunIds) {
let source: { receipt?: unknown; state?: unknown } | undefined =
input.providerPackAdmissionSource?.runId === sourceRunId ? input.providerPackAdmissionSource : undefined;
if (!source && input.db && typeof input.db.select === "function") {
try {
source = (await input.db.select({
receipt: sql<unknown>`${heartbeatRuns.runnerProfileJson}->'nativeProviderPackAdmission'`,
state: sql<unknown>`${heartbeatRuns.runnerProfileJson}->'nativeProviderPackAdmissionState'`,
}).from(heartbeatRuns).where(and(
eq(heartbeatRuns.id, sourceRunId),
eq(heartbeatRuns.companyId, input.execution.binding.companyId),
eq(heartbeatRuns.agentId, input.execution.binding.agentId),
eq(heartbeatRuns.runtimeMode, "native"),
)).limit(1))[0];
} catch {
source = undefined;
}
}
const verified = verifiedProviderPackAdmissionReceipt({
receipt: source?.receipt,
state: source?.state,
companyId: input.execution.binding.companyId,
agentId: input.execution.binding.agentId,
runId: sourceRunId,
sessionId,
runnerInstanceId: sourceRunId === input.remoteWarmRecovery?.identity.runId
? input.remoteWarmRecovery.identity.runnerInstanceId
: effectiveRunnerInstanceId,
environmentLeaseId: sourceRunId === input.remoteWarmRecovery?.identity.runId
? input.remoteWarmRecovery.identity.environmentLeaseId
: effectiveEnvironmentLeaseId,
});
if (verified) return verified;
}
return undefined;
};
const useInstalledProviderPack = async (onImmutableRejected?: (error: unknown) => void) => {
const expected = expectedProviderPackManifest;
if (!expected || !remoteTarget || !remoteCommandRunner) return false;
const admittedReceipt = await loadAdmittedProviderPackReceipt();
for (const installation of remoteNativeArtifacts?.providerPackInventory() ?? []) {
try {
const manifest = await measureNativeRunnerSpan(input.trace, "provider_pack.compatibility", () => verifyRemoteProviderPackIdentity({
@@ -17479,14 +17536,29 @@ async function createRunnerdBackendWithinSessionClaim(
requireExactIdentity: retainProviderPack || explicitProviderPackSelection,
requireCurrentOpenCodeProxy: !retainProviderPack
&& runnerEnvironment?.PAPERCLIP_OPENCODE_PERFORMANCE_DIAGNOSTICS === "1",
...(admittedReceipt ? { admittedReceipt } : {}),
}), { attributes: { target: installation.root === stagedRemoteProviderPackRoot ? "workspace" : "image" } });
if (!retainProviderPack) providerPackAuthority!.select(manifest);
if (!retainProviderPack) {
providerPackAuthority!.select(manifest);
} else if (admittedReceipt && providerPackAuthority && manifest.digest !== providerPackAuthority.manifest.digest) {
const preservedRunner = providerPackAuthority.runnerArtifact;
providerPackAuthority = resolveRemoteProviderPackAuthority({
stateDirectory: root,
binding: providerPackAuthorityBinding(),
reattach: false,
retainProviderPack: false,
runnerArtifact: () => preservedRunner,
current: () => manifest,
});
providerPackAuthorityFromFallback = false;
}
expectedProviderPackManifest = manifest;
activeRemoteProviderPackRoot = installation.root;
providerPackVerified = true;
return true;
} catch (error) {
if (error instanceof Error && error.name === "AbortError") throw error;
if (installation.immutable) onImmutableRejected?.(error);
}
}
return false;
@@ -17509,13 +17581,30 @@ async function createRunnerdBackendWithinSessionClaim(
return;
}
await remoteNativeArtifacts?.verifyRemoteRunner(requiredMode, undefined, true);
if (requiresRemoteProviderPack && await useInstalledProviderPack()) {
if (artifactStorage && providerArtifacts) {
providerPackVerified = true;
remotePrepared = true;
return;
}
if (requiresRemoteProviderPack && stagedRemoteProviderPackRoot) {
await verifyRemoteProviderPack(stagedRemoteProviderPackRoot);
activeRemoteProviderPackRoot = stagedRemoteProviderPackRoot;
if (requiresRemoteProviderPack) {
let immutableRejection: unknown = null;
if (await useInstalledProviderPack(error => { immutableRejection ??= error; })) {
remotePrepared = true;
return;
}
if (stagedRemoteProviderPackRoot) {
try {
await verifyRemoteProviderPack(stagedRemoteProviderPackRoot);
} catch (error) {
if (immutableRejection && isMissingProviderPackBinaryError(error)) {
throw immutableRejection;
}
throw error;
}
activeRemoteProviderPackRoot = stagedRemoteProviderPackRoot;
} else if (immutableRejection) {
throw immutableRejection;
}
}
remotePrepared = true;
return;
@@ -17571,7 +17660,8 @@ async function createRunnerdBackendWithinSessionClaim(
signal: providerArtifactsSignal() });
const bootstrap = activeRemoteProviderPackRoot
? { root: activeRemoteProviderPackRoot, manifest: expectedProviderPackManifest }
: remoteNativeArtifacts?.providerPackInventory().find(pack => pack.immutable);
: remoteNativeArtifacts?.providerPackInventory().find(pack =>
pack.immutable && typeof (pack.manifest as RemoteProviderPackManifest | null)?.payload?.artifacts?.nodeCommand?.path === "string");
if (!bootstrap) throw new Error("native_provider_artifacts_bootstrap_unavailable");
const bootstrapManifest = bootstrap.manifest as RemoteProviderPackManifest;
openCodeLaunchArtifacts = await prepareRemoteOpenCodeArtifacts({ runner: remoteCommandRunner,
@@ -18763,12 +18853,20 @@ async function createRunnerdBackendWithinSessionClaim(
signalVerifiedRecoveryProcess(localRecoveryProcess, signal),
}
: undefined;
if (adoptingPersistedRemoteRunner && !adoptedProcess && requiresRemoteProviderPack) {
if (input.restartRecovery?.kind === "reattach_remote_runner" && !adoptedProcess && requiresRemoteProviderPack) {
// Bind the relaunch to the pack this session was admitted with (the saved
// authority, verified as an exact installed identity), never a newer one.
relaunchesSettledRemoteRunner = true;
providerPackAuthority = selectProviderPackAuthority(true);
expectedProviderPackManifest = providerPackAuthority?.manifest ?? expectedProviderPackManifest;
if (artifactStorage && !providerArtifacts && durableBinding !== null && durableIdentityMatchesSession(durableIdentity, input.execution)) {
providerArtifacts = await recordedSessionProviderArtifacts(input.db, input.execution, durableIdentity.runId);
if (providerArtifacts) legacyProviderContinuity = false;
}
if (adoptingPersistedRemoteRunner || providerArtifacts) {
providerPackAuthority = selectProviderPackAuthority(true);
expectedProviderPackManifest = providerPackAuthority?.manifest
?? providerArtifacts?.manifest as RemoteProviderPackManifest
?? expectedProviderPackManifest;
}
}
if (adoptedProcess && remoteTarget) {
const markSpawned = resolveRemoteRunnerProcessSpawned as (() => void) | null;