mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-17 20:09:05 +02:00
Skip serialized transport for capability-bound computers
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
387f1c7e2e
commit
fc1f2b040f
2 files changed
+11
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { resolveEnvironmentExecutionTarget, resolveEnvironmentExecutionTransport } from "./environment-execution-target.js";
|
||||
import { createComputerEnvironmentDriver } from "./computer-environment-driver.js";
|
||||
|
||||
const state = vi.hoisted(() => {
|
||||
@@ -12,6 +13,13 @@ vi.mock("./environments.js", () => ({ environmentService: () => state }));
|
||||
vi.mock("./instance-settings.js", () => ({ instanceSettingsService: () => ({ getExperimental: async () => ({ enableBoatEnvironments: true }) }) }));
|
||||
|
||||
describe("computer environment probe ownership", () => {
|
||||
it("does not construct a computer owner for legacy transport serialization", async () => {
|
||||
const input = { db: {} as never, companyId: "company", adapterType: "paperclip_runner",
|
||||
environment: { id: "environment", driver: "computer", config: {} }, leaseMetadata: null };
|
||||
await expect(resolveEnvironmentExecutionTransport(input)).resolves.toBeNull();
|
||||
await expect(resolveEnvironmentExecutionTarget(input)).rejects.toThrow("computer_lease_required");
|
||||
});
|
||||
|
||||
it("keeps stable configuration on one session key and fences a changed model", async () => {
|
||||
state.admit.mockClear();
|
||||
const db = { update: () => ({ set: () => ({ where: async () => undefined }) }) };
|
||||
|
||||
@@ -679,5 +679,8 @@ export async function resolveEnvironmentExecutionTarget(input: {
|
||||
export async function resolveEnvironmentExecutionTransport(
|
||||
input: Parameters<typeof resolveEnvironmentExecutionTarget>[0],
|
||||
): Promise<Record<string, unknown> | null> {
|
||||
// Computer execution uses a live owner capability, resolved after workspace
|
||||
// realization. It has no legacy serialized transport to resolve at acquire.
|
||||
if (input.environment.driver === "computer") return null;
|
||||
return adapterExecutionTargetToRemoteSpec(await resolveEnvironmentExecutionTarget(input)) as Record<string, unknown> | null;
|
||||
}
|
||||
Reference in new issue
Block a user