mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-13 04:02:28 +02:00
fix: validate persisted warm origin run identity
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
cfa2b81539
commit
ce107d4710
2 files changed
+4
-1
No files matched your search
@@ -13459,6 +13459,7 @@ describe("runnerd provider runtime wiring", () => {
|
||||
{ condition: "workspace-coordinate", expected: "verified" },
|
||||
{ condition: "warm-origin", expected: "verified" },
|
||||
{ condition: "origin-other-session", expected: "scope_mismatch" },
|
||||
{ condition: "origin-wrong-profile-run", expected: "scope_mismatch" },
|
||||
{ condition: "origin-other-owner", expected: "scope_mismatch" },
|
||||
{ condition: "origin-newer-generation", expected: "scope_mismatch" },
|
||||
{ condition: "origin-active", expected: "scope_mismatch" },
|
||||
@@ -13487,7 +13488,7 @@ describe("runnerd provider runtime wiring", () => {
|
||||
const originDescriptor = { ...descriptor, leaseId: "origin-lease",
|
||||
providerLeaseId: condition === "origin-other-owner" ? "other-owner" : owner.ownerId,
|
||||
ownerGeneration: condition === "origin-newer-generation" ? 3 : 1 };
|
||||
const originRow = { status: condition === "origin-active" ? "running" : "succeeded",
|
||||
const originRow = { id: condition === "origin-wrong-profile-run" ? "other-run" : originExecution.binding.runId, status: condition === "origin-active" ? "running" : "succeeded",
|
||||
runnerProfileJson: { nativeExecutionInput: originExecution, nativeComputerWorkspace: originDescriptor } };
|
||||
const workspaceCoordinate = ["workspace-coordinate", "wrong-workspace-run"].includes(condition);
|
||||
const db = { select: () => ({ from: (table: unknown) => ({ where: (query: SQL) => { if (table === environmentLeases) leaseQuery = query; return ({ limit: async (limit: number) =>
|
||||
|
||||
@@ -4397,6 +4397,7 @@ export async function verifyPriorRunnerdStateForSessionScope(input: {
|
||||
// workspace coordinate. Resolve that recorded origin, never an arbitrary
|
||||
// run ID, before checking the physical lease and latest retirement.
|
||||
const origins = await input.db.select({
|
||||
id: heartbeatRuns.id,
|
||||
status: heartbeatRuns.status,
|
||||
runnerProfileJson: heartbeatRuns.runnerProfileJson,
|
||||
}).from(heartbeatRuns).where(and(
|
||||
@@ -4412,6 +4413,7 @@ export async function verifyPriorRunnerdStateForSessionScope(input: {
|
||||
const originExecution = parseNativeExecutionInput(originProfile.nativeExecutionInput);
|
||||
const originWorkspace = readNativeComputerWorkspaceReference(originProfile.nativeComputerWorkspace);
|
||||
if (!TERMINAL_HEARTBEAT_RUN_STATUSES.has(origin.status) ||
|
||||
originExecution.binding.runId !== origin.id ||
|
||||
originExecution.binding.executionWorkspaceId !== input.identity.environmentLeaseId ||
|
||||
nativeSessionScopeKey(originExecution) !== nativeSessionScopeKey(priorExecution) ||
|
||||
!originWorkspace || originWorkspace.remoteCwd !== priorWorkspace.remoteCwd ||
|
||||
|
||||
Reference in new issue
Block a user