Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ public AgentRunFilesystemSpec maxRetries(int maxRetries) {
return this;
}

@Override
public AgentRunFilesystemSpec snapshotSpec(SandboxSnapshotSpec snapshotSpec) {
super.snapshotSpec(snapshotSpec);
this.snapshotSpec = snapshotSpec;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2024-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.agentscope.extensions.sandbox.agentrun;

import static org.junit.jupiter.api.Assertions.assertSame;

import io.agentscope.harness.agent.sandbox.snapshot.NoopSnapshotSpec;
import io.agentscope.harness.agent.sandbox.snapshot.SandboxSnapshotSpec;
import org.junit.jupiter.api.Test;

class AgentRunFilesystemSpecTest {

@Test
void snapshotSpecPreservesExplicitOverride() {
SandboxSnapshotSpec snapshotSpec = new NoopSnapshotSpec();
AgentRunFilesystemSpec spec = new AgentRunFilesystemSpec();

assertSame(spec, spec.snapshotSpec(snapshotSpec));
assertSame(snapshotSpec, spec.getSnapshotSpecOverride());
assertSame(snapshotSpec, spec.snapshotSpec());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public DaytonaFilesystemSpec workspaceRoot(String workspaceRoot) {
return this;
}

@Override
public DaytonaFilesystemSpec snapshotSpec(SandboxSnapshotSpec snapshotSpec) {
super.snapshotSpec(snapshotSpec);
this.snapshotSpec = snapshotSpec;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2024-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.agentscope.extensions.sandbox.daytona;

import static org.junit.jupiter.api.Assertions.assertSame;

import io.agentscope.harness.agent.sandbox.snapshot.NoopSnapshotSpec;
import io.agentscope.harness.agent.sandbox.snapshot.SandboxSnapshotSpec;
import org.junit.jupiter.api.Test;

class DaytonaFilesystemSpecTest {

@Test
void snapshotSpecPreservesExplicitOverride() {
SandboxSnapshotSpec snapshotSpec = new NoopSnapshotSpec();
DaytonaFilesystemSpec spec = new DaytonaFilesystemSpec();

assertSame(spec, spec.snapshotSpec(snapshotSpec));
assertSame(snapshotSpec, spec.getSnapshotSpecOverride());
assertSame(snapshotSpec, spec.snapshotSpec());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ public E2bFilesystemSpec maxRetries(int maxRetries) {
return this;
}

@Override
public E2bFilesystemSpec snapshotSpec(SandboxSnapshotSpec snapshotSpec) {
super.snapshotSpec(snapshotSpec);
this.snapshotSpec = snapshotSpec;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2024-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.agentscope.extensions.sandbox.e2b;

import static org.junit.jupiter.api.Assertions.assertSame;

import io.agentscope.harness.agent.sandbox.snapshot.NoopSnapshotSpec;
import io.agentscope.harness.agent.sandbox.snapshot.SandboxSnapshotSpec;
import org.junit.jupiter.api.Test;

class E2bFilesystemSpecTest {

@Test
void snapshotSpecPreservesExplicitOverride() {
SandboxSnapshotSpec snapshotSpec = new NoopSnapshotSpec();
E2bFilesystemSpec spec = new E2bFilesystemSpec();

assertSame(spec, spec.snapshotSpec(snapshotSpec));
assertSame(snapshotSpec, spec.getSnapshotSpecOverride());
assertSame(snapshotSpec, spec.snapshotSpec());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public KubernetesFilesystemSpec serverPort(int serverPort) {
return this;
}

@Override
public KubernetesFilesystemSpec snapshotSpec(SandboxSnapshotSpec snapshotSpec) {
super.snapshotSpec(snapshotSpec);
this.snapshotSpec = snapshotSpec;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2024-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.agentscope.extensions.sandbox.kubernetes;

import static org.junit.jupiter.api.Assertions.assertSame;

import io.agentscope.harness.agent.sandbox.snapshot.NoopSnapshotSpec;
import io.agentscope.harness.agent.sandbox.snapshot.SandboxSnapshotSpec;
import org.junit.jupiter.api.Test;

class KubernetesFilesystemSpecTest {

@Test
void snapshotSpecPreservesExplicitOverride() {
SandboxSnapshotSpec snapshotSpec = new NoopSnapshotSpec();
KubernetesFilesystemSpec spec = new KubernetesFilesystemSpec();

assertSame(spec, spec.snapshotSpec(snapshotSpec));
assertSame(snapshotSpec, spec.getSnapshotSpecOverride());
assertSame(snapshotSpec, spec.snapshotSpec());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public DockerFilesystemSpec additionalRunArgs(List<String> additionalRunArgs) {
return this;
}

@Override
public DockerFilesystemSpec snapshotSpec(SandboxSnapshotSpec snapshotSpec) {
super.snapshotSpec(snapshotSpec);
this.snapshotSpec = snapshotSpec;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.agentscope.harness.agent.filesystem.spec.RemoteFilesystemSpec;
import io.agentscope.harness.agent.sandbox.impl.docker.DockerFilesystemSpec;
import io.agentscope.harness.agent.sandbox.snapshot.LocalSnapshotSpec;
import io.agentscope.harness.agent.sandbox.snapshot.NoopSnapshotSpec;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -70,8 +71,14 @@ void sandboxMode_withDistributedSession_builds() {
}

@Test
void sandboxMode_snapshotSpecOnFilesystemSpec() {
void sandboxMode_explicitSnapshotSpecOverridesDistributedStore() {
AgentStateStore distributedSession = mock(AgentStateStore.class);
DistributedStore distributedStore =
DistributedStore.builder()
.agentStateStore(distributedSession)
.baseStore(mock(BaseStore.class))
.sandboxSnapshotSpec(new NoopSnapshotSpec())
.build();
DockerFilesystemSpec spec = new DockerFilesystemSpec();
spec.isolationScope(IsolationScope.AGENT);
spec.snapshotSpec(new LocalSnapshotSpec(workspace.resolve("snapshots")));
Expand All @@ -82,11 +89,12 @@ void sandboxMode_snapshotSpecOnFilesystemSpec() {
.name("agent")
.model(stubModel("ok"))
.workspace(workspace)
.stateStore(distributedSession)
.distributedStore(distributedStore)
.filesystem(spec)
.build());

assertEquals(IsolationScope.AGENT, spec.getIsolationScope());
assertInstanceOf(LocalSnapshotSpec.class, spec.getSnapshotSpecOverride());
assertInstanceOf(LocalSnapshotSpec.class, spec.toSandboxContext().getSnapshotSpec());
}

Expand Down
Loading