mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-15 18:56:05 +01:00
Reuse retained Runner descriptions during startup (#21004)
This commit is contained in:
1 parent
cf1def0ca6
commit
d68088465c
7 files changed
+41
-24
No files matched your search
@@ -10686,6 +10686,7 @@ async function executePaperclipNativeSessionAttempt(
|
||||
});
|
||||
let retainedTransition: VerifiedWarmTransitionBinding | undefined;
|
||||
let remoteWarmRecovery: RemoteWarmSessionRecovery | undefined;
|
||||
let pluginTaskDescription: Extract<ReturnType<typeof environmentTaskResultSchema.parse>,{kind:"description"}> | undefined;
|
||||
const cachedReleasedOwner = warmNativeSessions.get(nativeSessionScopeKey(input.execution));
|
||||
if (cachedReleasedOwner?.released) {
|
||||
const proof = releasedWarmRunner(readWarmNativeEnvelope(input.execution));
|
||||
@@ -10728,7 +10729,9 @@ async function executePaperclipNativeSessionAttempt(
|
||||
if (taskTarget.transport === "sandbox" && taskTarget.runnerTask && taskTarget.leaseId &&
|
||||
durableIdentityMatchesSession(identity,input.execution) && identity.runId !== input.execution.binding.runId) {
|
||||
// Inspection can replace a stopped retained task before deciding between adoption and checkpoint recovery.
|
||||
await taskTarget.runnerTask({kind:"describe"});
|
||||
const description = environmentTaskResultSchema.parse(await taskTarget.runnerTask({kind:"describe"}));
|
||||
if (description.kind !== "description") throw new Error("Plugin Runner description unavailable");
|
||||
pluginTaskDescription = description;
|
||||
if (taskTarget.sandboxLeaseAcquisition?.outcome !== "resumed") {
|
||||
await recoverPluginRunnerCheckpoint(input, root);
|
||||
}
|
||||
@@ -11709,7 +11712,6 @@ async function executePaperclipNativeSessionAttempt(
|
||||
);
|
||||
let existingWarmSession: NativeSession | undefined;
|
||||
let reusingReleasedRunner = false;
|
||||
let pluginTaskDescription: Extract<ReturnType<typeof environmentTaskResultSchema.parse>,{kind:"description"}> | undefined;
|
||||
let managedCredentialSession: NativeSession | undefined;
|
||||
let githubAccess: NativeGitHubAccess | undefined;
|
||||
let releaseGitHubRun: (() => void) | undefined;
|
||||
@@ -11747,7 +11749,9 @@ async function executePaperclipNativeSessionAttempt(
|
||||
if (entry) entry.preparingRunId = undefined;
|
||||
const taskTarget=input.runnerExecutionTarget;
|
||||
if ((entry?.pluginTaskId || remoteWarmRecovery?.releasedSource) && taskTarget?.kind === "remote" && taskTarget.transport === "sandbox" && taskTarget.runnerTask) {
|
||||
const description=environmentTaskResultSchema.parse(await (executionContext
|
||||
const priorDescription = pluginTaskDescription?.taskId === taskTarget.sandboxLeaseAcquisition?.providerLeaseId
|
||||
? pluginTaskDescription : undefined;
|
||||
const description=priorDescription ?? environmentTaskResultSchema.parse(await (executionContext
|
||||
? executionContext.wait(() => taskTarget.runnerTask!({kind:"describe"}, { executionContext }))
|
||||
: taskTarget.runnerTask({kind:"describe"})));
|
||||
if(description.kind !== "description") throw new Error("Plugin Runner description unavailable");
|
||||
@@ -12058,7 +12062,7 @@ async function executePaperclipNativeSessionAttempt(
|
||||
const description = environmentTaskResultSchema.parse(await (executionContext ? executionContext.wait(inspect) : inspect()));
|
||||
if (description.kind !== "description" || description.taskId === retainedTaskId) return false;
|
||||
existingWarmSession = undefined;
|
||||
pluginTaskDescription = undefined;
|
||||
pluginTaskDescription = description;
|
||||
await finishStartupContextForFallback();
|
||||
persistedWarmSession = loadWarmNativeCheckpoint(input.execution, warmConfigDigest, target.kind);
|
||||
runnerdBackend = await createExecutionBackend();
|
||||
@@ -16013,7 +16017,9 @@ async function createRunnerdBackendWithinSessionClaim(
|
||||
if(stopped.kind!=="status" || stopped.executionStopped!==true) throw new Error("Plugin Runner termination is unconfirmed; reconcile the saved task");
|
||||
await pluginTask({kind:"complete"});
|
||||
}
|
||||
const description = input.pluginTaskDescription ?? environmentTaskResultSchema.parse(await pluginTask({ kind: "describe" }));
|
||||
const priorDescription = input.pluginTaskDescription?.taskId === remoteTarget.sandboxLeaseAcquisition?.providerLeaseId
|
||||
? input.pluginTaskDescription : undefined;
|
||||
const description = priorDescription ?? environmentTaskResultSchema.parse(await pluginTask({ kind: "describe" }));
|
||||
if (description.kind !== "description" || description.launchPreparationVersion !== 1 || description.projectAuthCheckVersion !== 1) throw new Error("Plugin Runner launch preparation v1 unavailable");
|
||||
const saved = durableBinding ? durableIdentity as RunnerdDurableIdentity : undefined;
|
||||
const prior = saved ? {
|
||||
|
||||
Reference in new issue
Block a user