refactor: defer adapter launcher imports during workspace snapshots (#16492)

Defer adapter launcher imports until a directory merge resolves its lock root. Snapshot-only workers retain the same hashes, modes, exclusions, and ownership checks.

Verification: 63 focused cases; full typecheck/build; exact-head full CI/E2E/security; Apex 5/5. Local native Daytona replies: 66.939s cold and 26.485s warm. Hosted staging and the cold latency target remain unverified.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-10-15 16:03:47 -05:00
1 parent f1d925b726
commit 61831ba7b8
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -542,7 +542,9 @@ private manifest before handing it to the controller; ordinary snapshot disposal
removes that worker's temporary directory. A failed capture removes its temporary
state before releasing its worker slot. This scheduling boundary does not replace
source authorization, warm-stamp validation, Git identity checks or restore
conflict detection. Legacy adapter snapshots remain inline.
conflict detection. Legacy adapter snapshots remain inline. Snapshot-only workers
do not load the adapter process-launch helpers. The directory merge loads those
helpers when it resolves its instance-scoped lock root.
### Remote Codex model compatibility
@@ -5,7 +5,6 @@ import path from "node:path";
import { DatabaseSync } from "node:sqlite";
import { createWorkspaceManifest, WorkspaceManifestMap, workspacePathMatcher, type PathManifest, type WorkspacePaths, type WorkspaceManifestWriter } from "./workspace-manifest.js";
import { shouldExcludePath } from "./exclude-patterns.js";
import { resolvePaperclipInstanceRootForAdapter } from "./server-utils.js";
import { runSnapshotThread } from "./workspace-snapshot-thread.js";
import type { WorkspaceRestoreDiagnostic } from "./workspace-restore-diagnostics.js";
@@ -493,6 +492,7 @@ function nonEmpty(value: string | undefined): string | null {
* would follow the symlink) before any caller treats it as the lock root.
*/
async function resolveDirectoryMergeLockRoot(env: NodeJS.ProcessEnv = process.env): Promise<string> {
const { resolvePaperclipInstanceRootForAdapter } = await import("./server-utils.js");
const instanceRoot = resolvePaperclipInstanceRootForAdapter({
homeDir: nonEmpty(env.PAPERCLIP_HOME) ?? undefined,
instanceId: nonEmpty(env.PAPERCLIP_INSTANCE_ID) ?? undefined,