Merge branch 'codex/work-folders-staging-hardening-refresh' into codex/work-folders-remote-recovery-refresh

* codex/work-folders-staging-hardening-refresh:
  test(daytona): preserve reusable work after stop failure
This commit is contained in:
Dotta 2026-09-11 17:21:47 -05:00
commit 76c5041ff7
1 changed files with 4 additions and 5 deletions

View File

@ -1330,16 +1330,16 @@ describe("Daytona sandbox provider plugin", () => {
expect(sandbox.stop).toHaveBeenCalled();
});
it("does not acknowledge termination when both provider stop and delete fail", async () => {
it("does not acknowledge termination or delete a reusable sandbox when stopping fails", async () => {
process.env.DAYTONA_API_KEY = "host-key";
const sandbox = createMockSandbox({ id: "sandbox-failed-stop", state: "started" });
sandbox.stop.mockRejectedValueOnce(new Error("stop failed"));
sandbox.delete.mockRejectedValueOnce(new Error("delete failed"));
mockGet.mockResolvedValue(sandbox);
await expect(plugin.definition.onEnvironmentReleaseLease?.({
driverKey: "daytona", companyId: "company-1", environmentId: "env-1",
providerLeaseId: sandbox.id, config: { reuseLease: true },
})).rejects.toThrow("delete failed");
})).rejects.toThrow("stop failed");
expect(sandbox.delete).not.toHaveBeenCalled();
});
it("stops reusable leases and deletes ephemeral leases on release", async () => {
@ -1707,8 +1707,7 @@ describe("Daytona sandbox provider plugin", () => {
it("deletes the session at destroy even when the sandbox delete throws", async () => {
process.env.DAYTONA_API_KEY = "host-key";
const sandbox = createMockSandbox();
sandbox.delete.mockRejectedValueOnce(new Error("delete failed"));
mockGet.mockResolvedValue(sandbox);
mockGet.mockResolvedValue(sandbox);
await plugin.definition.onEnvironmentExecute?.(sessionExecParams());
const sessionId = sandbox.process.createSession.mock.calls[0]![0] as string;