Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/hub/src/sidecar/data-root.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
/** Local sidecar state root. Never a launch-specific coding directory. */
import { resolve } from "node:path";

/**
* Local sidecar state root. Never a launch-specific coding directory.
*
* Absolute because sidecars run with `vendor/interchange` as their working
* directory; a relative root would put their state there instead of beside the
* hub's.
*/
export function localSidecarDataRoot(hubDataDir: string): string {
return `${hubDataDir}/local-sidecars`;
return resolve(hubDataDir, "local-sidecars");
}
9 changes: 7 additions & 2 deletions apps/hub/src/sidecar/local-provisioner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,15 @@ export function createLocalProcessSidecarProvisioner({
});
return;
}
manifest = stored;
// The data dir follows the hub's data root, not the manifest: a manifest written when the root was relative
// points the sidecar, which runs from vendor/interchange, at a directory under it.
const restored =
stored.dataDir === dataDir ? stored : { ...stored, dataDir };
if (restored !== stored) await manifests.write(restored);
manifest = restored;
for (const hold of live) holds.set(hold.allocationId, hold);
await manifests.writeHolds(live);
const child = await start(stored);
const child = await start(restored);
log({
level: "info",
msg: "local_sidecar_respawned",
Expand Down