diff --git a/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/vm/UpdateLocalsCommand.java b/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/vm/UpdateLocalsCommand.java
index 75eed75fd2..75762b4a67 100644
--- a/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/vm/UpdateLocalsCommand.java
+++ b/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/vm/UpdateLocalsCommand.java
@@ -29,11 +29,12 @@
import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
/**
* Takes the input, interpolates its values and sets the result
- * as the current frame's local variables.
+ * to all root frame's local variables.
*
* Optionally takes a list of threads which root frames should be
* updated with provided variables.
@@ -86,8 +87,13 @@ public void eval(Runtime runtime, State state, ThreadId threadId) {
Map m = ee.evalAsMap(ecf.scope(ctx), input);
for (ThreadId tid : threads) {
- Frame root = VMUtils.assertNearestRoot(state, tid);
- VMUtils.putLocals(root, m);
+ List frames = state.getFrames(tid);
+
+ for (Frame f : frames) {
+ if (f.getType() == FrameType.ROOT) {
+ VMUtils.putLocals(f, m);
+ }
+ }
}
}
}
diff --git a/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/MainTest.java b/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/MainTest.java
index 2dea429329..b804e05c10 100644
--- a/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/MainTest.java
+++ b/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/MainTest.java
@@ -184,6 +184,37 @@ public void tearDown() throws IOException {
LoggingConfigurator.reset();
}
+ @Test
+ public void testVariablesAfterResume() throws Exception {
+ deploy("variablesAfterResume");
+
+ save(ProcessConfiguration.builder()
+ .build());
+
+ byte[] log = run();
+ assertLog(log, ".*workDir1: " + workDir.toAbsolutePath() + ".*");
+ assertLog(log, ".*workDir3: " + workDir.toAbsolutePath() + ".*");
+
+ List