Skip to content

The first exam for code agents in the physical world: frozen robot tasks from many benchmark suites, each answered with a program and verified in a separate sandbox. Runs on Harbor.

Framework fixes from review F (board 0105): a success is never lost to a sidecar crash; no infra failure published as the agent's 0; CPU caps clamped by run_agent_batch.sh (#189)

Kangrui Wang8aba8e4c6e64
diff --git a/ci_checks/check-unit-tests.sh b/ci_checks/check-unit-tests.sh
index 539a119fe5..fe0b597f27 100755
--- a/ci_checks/check-unit-tests.sh
+++ b/ci_checks/check-unit-tests.sh
@@ -23,7 +23,7 @@ run() { # run <timeout s> <test path under scripts/> [arguments of the test]
for t in robolab/tests/test_grade_standard.py labutopia/tests/test_grade_standard.py labutopia/tests/test_finalize.py \
myosuite/tests/test_standard_grade.py mujoco-playground/tests/test_grade_privileged.py \
robocasa/tests/test_graders.py usage_gateway/tests/test_rawlog.py usage_gateway/tests/test_paths.py \
- tests/test_codex_tools_off.py tests/test_task_seed.py; do
+ tests/test_codex_tools_off.py tests/test_task_seed.py tests/test_runner_results.py; do
run 300 "$t"
done
# RoboDojo's collect hook and standard grader on both of its rules (its tasks pull request adds the test); its privileged
diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md
index ae99510763..a960e10072 100644
--- a/docs/PROTOCOL.md
+++ b/docs/PROTOCOL.md
@@ -58,7 +58,7 @@ Unchanged: the task name prefix `robot-coding-bench/`, the client and tool file
| D5 | Images | One registry (EAI organization), images named `eai-<name>` and versioned in `images/<name>/VERSION`; every image that may be redistributed is public, the rest are `BUILD_ONLY`. One image per **benchmark**, not per simulator: benchmarks on the same simulator may need different versions of it and of its dependencies (e.g. RoboCasa, RoboCasa365 and RoboCasa-GR1 on robosuite), so each may have its own image; an image is shared only where the dependency set is identical. |
| D6 | PR granularity | One benchmark per PR; changes to shared files go in a separate PR reviewed by a maintainer. |
| D7 | World-frame information in instructions | Decided per benchmark, consistent within it, documented in the benchmark's doc. |
-| D8 | Agent time budget (the cutoff) | 3600 s by default, at most 14400 s; longer budgets are justified, uniform within a benchmark unless the cutoff table gives a family or a task an exception (§2.12), and results are grouped by budget. Documented per-benchmark exceptions to the cap (§2.3): RoboTangle 21600 s (owner, 2026-10-08). The numbers live in one table, `scripts/task_cutoffs.toml`, per benchmark and mode with optional exceptions per family and per task, and every instruction states its own in one format, in its last section (§2.12; owner, 2026-10-11 and 2026-10-12). |
+| D8 | Agent time budget (the cutoff) | 3600 s by default, at most 14400 s; longer budgets are justified, uniform within a benchmark unless the cutoff table gives a family or a task an exception (§2.12), and results are grouped by budget. Documented per-benchmark exceptions to the cap (§2.3): RoboTangle 21600 s (owner, 2026-10-08; its tasks' cutoff is 7200 s since 2026-10-12). The numbers live in one table, `scripts/task_cutoffs.toml`, per benchmark and mode with optional exceptions per family and per task, and every instruction states its own in one format, in its last section (§2.12; owner, 2026-10-11 and 2026-10-12). |
| D9 | Shared code | Shared sources are copied into tasks by the generator; nothing at run time imports repository code outside the task directory. |
| D10 | Token budget | Per trial: **100M input tokens, 10M output tokens** by default; exceeding either fails the trial. |
| D11 | Harness | Official results use Harbor's native agents only; no agent adapters, and no gateway that holds credentials or changes requests. The usage gateway (`scripts/usage_gateway/`) is allowed: it forwards model-API requests unchanged, records token usage, and refuses what a trial may not have: a request past the token budget (§5) and, since 2026-10-10, every request that is not a model-API call (§2.11). No tool that runs outside the trial's container is offered to the model (§2.11): official runs turn the harness's web search off (Codex `web_search = "disabled"`, Claude Code `WebSearch` and `WebFetch` disallowed; `scripts/run_agent_batch.sh` `WEB_SEARCH=disabled`, the default) and start the harness without account connectors, apps, plugins, image generation and cloud agents (Codex: with the same switch the runner sets those features to false in the run's `config.toml`, `scripts/codex_tools_off.py`). These run at the model provider, so no egress allowlist stops them (2026-10-02: Codex with a ChatGPT login searched GitHub by default; 2026-10-10: the same login handed the model 238 account connector tools, and 21 trials called them) |
@@ -147,7 +147,8 @@ decision. The decision is recorded here, in `docs/benchmarks/<bench>.md`, and in
number within the cap, §2.12). A standard sidecar's wall
clock (`RCB_WALL_CLOCK_S`, `/spec.budget.wall_clock_s`) equals it, in every benchmark (§2.12) [CI]. That benchmark's results state the budget and are
compared only with results under the same budget (D8). The token budget (D10) is unchanged.
-- **RoboTangle** (owner, 2026-10-08; issue #87): 21600 s (6 h) for every task. The topological puzzles are much
+- **RoboTangle** (owner, 2026-10-08; issue #87): a cap of 21600 s (6 h); its tasks' cutoff, 21600 s at first, is
+ 7200 s since 2026-10-12 (the table, `docs/CUTOFFS.md`). The topological puzzles are much
harder than typical robotics tasks (reference executions take 2–185 min of simulated work), and the benchmark's
owner sets the budget to probe the capability ceiling. Simulator speed-ups add interaction within it; they never
shorten it (`docs/benchmarks/robotangle.md`, added with the tasks in #81).
@@ -343,7 +344,8 @@ An out-of-memory kill by the kernel in a container in scope, at that container's
**A CPU cap above the host's CPU count means the host's count.** Docker refuses to create a container whose `cpus`
exceeds the machine's ("range of CPUs is from 0.01 to N"), so a task whose cap is 12 or 16 does not start on an
8-CPU host although its `min_cpus` is 6 or 8. A runner MUST therefore clamp every CPU cap (`[environment].cpus` and
-each compose service's `cpus`) to the host's CPU count in the copy of the task it runs; the task's files keep their
+each compose service's `cpus`) to the host's CPU count in the copy of the task it runs (`scripts/clamp_cpus.py`, which
+`scripts/run_agent_batch.sh` applies to a job's own copy); the task's files keep their
values (a cap is not lowered for small hosts, and clamping does not change the task: a container can never use more
CPUs than the host has). A host that has `min_cpus` (§2.9) still gives the trial its minimum after clamping, because
`min_cpus` never exceeds the CPU caps of all services together [CI]. Memory and pids caps are never clamped.
diff --git a/docs/RUNNING.md b/docs/RUNNING.md
index 981608b72d..5596fb55c5 100644
--- a/docs/RUNNING.md
+++ b/docs/RUNNING.md
@@ -87,7 +87,9 @@ harbor run -p /tmp/run1/<task> -a <agent> ...
The agent never chooses or sees the list: another seed's instance lives under the privileged task's `tests/seeds/`,
and the copy carries only the drawn one. As of 2026-10-13 every task allows its default seed only, so
-`scripts/run_agent_batch.sh` runs the task directories as they are; it materializes a seed per trial once a
+`scripts/run_agent_batch.sh` runs the task directories as they are (or a copy: with the gateway, the copy whose
+egress is the gateway; with a CPU cap above the host's count, `HOST_CPUS`, the copy with that cap clamped, PROTOCOL
+§2.10); it materializes a seed per trial once a
benchmark allows more than one.
## The agent's time (the cutoff)
diff --git a/images/metaworld/standard/server_mw.py b/images/metaworld/standard/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/images/metaworld/standard/server_mw.py
+++ b/images/metaworld/standard/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/images/robocasa-gr1/standard/server_casa.py b/images/robocasa-gr1/standard/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/images/robocasa-gr1/standard/server_casa.py
+++ b/images/robocasa-gr1/standard/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/images/robocasa/standard/server_casa.py b/images/robocasa/standard/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/images/robocasa/standard/server_casa.py
+++ b/images/robocasa/standard/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/images/robocasa365/standard/server_casa.py b/images/robocasa365/standard/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/images/robocasa365/standard/server_casa.py
+++ b/images/robocasa365/standard/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/scripts/clamp_cpus.py b/scripts/clamp_cpus.py
new file mode 100644
index 0000000000..cb7ccb10a6
--- /dev/null
+++ b/scripts/clamp_cpus.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python3
+"""Clamp the CPU caps of task copies to the host's CPU count (PROTOCOL §2.10: a runner MUST clamp every CPU cap to the
+host's count in the copy of the task it runs; the task's files keep their values).
+
+ python3 scripts/clamp_cpus.py [--cpus N] <task dir> ... # rewrite the copies in place
+ python3 scripts/clamp_cpus.py [--cpus N] --needs <task dir> ... # write nothing; exit 0 if a cap is above N, else 1
+
+Docker refuses a container whose `cpus` exceeds the machine's ("range of CPUs is from 0.01 to 8.00"): a task whose cap is
+12 or 16 does not start on an 8-CPU host, and the trial would end in environment setup. What is clamped: every `cpus = <n>`
+line of task.toml (`[environment]`: Harbor passes it to docker as main's cap; `[verifier.environment]`: the separate
+verifier sandbox's) and every `cpus: <n>` line of the compose files under environment/ (the sidecars). Memory and pids
+caps are never clamped. N defaults to the CPUs this process may use (`nproc`); the pool runner clamps its host copies
+the same way (batch_eval_live prep_host.py CLAMP_CPUS). Never run it on tasks/ itself (scripts/run_agent_batch.sh runs
+it on a job's own copy). Standard library only."""
+from __future__ import annotations
+
+import os
+import re
+import sys
+from pathlib import Path
+
+TOML = re.compile(r"^(cpus[ \t]*=[ \t]*)(\d+(?:\.\d+)?)", re.M)
+COMPOSE = re.compile(r"^([ \t]*cpus:[ \t]*)(\d+(?:\.\d+)?)", re.M)
+COMPOSE_FILES = ("docker-compose.yaml", "docker-compose.yml", "gpu.docker-compose.yaml", "gpu.docker-compose.yml")
+
+
+def host_cpus() -> int:
+ try:
+ return len(os.sched_getaffinity(0))
+ except AttributeError: # not Linux
+ return os.cpu_count() or 1
+
+
+def files(task: Path) -> list[tuple[Path, re.Pattern]]:
+ out = [(task / "task.toml", TOML)]
+ out += [(task / "environment" / f, COMPOSE) for f in COMPOSE_FILES]
+ return [(p, rx) for p, rx in out if p.is_file()]
+
+
+def fmt(n: float) -> str:
+ return str(int(n)) if float(n).is_integer() else f"{n:g}"
+
+
+def clamp(task: Path, n: float, write: bool) -> list[str]:
+ """-> one line per cap above n ("<file>: <old> -> <n>"); with write, the file is rewritten with those caps clamped."""
+ changed = []
+ for p, rx in files(task):
+ s = p.read_text()
+
+ def sub(m: re.Match) -> str:
+ if float(m.group(2)) <= n:
+ return m.group(0)
+ changed.append(f"{p}: cpus {m.group(2)} -> {fmt(n)}")
+ return m.group(1) + fmt(n)
+
+ new = rx.sub(sub, s)
+ if write and new != s:
+ p.write_text(new)
+ return changed
+
+
+def main(argv: list[str]) -> int:
+ needs = "--needs" in argv
+ args = [a for a in argv if a != "--needs"]
+ n: float = host_cpus()
+ if "--cpus" in args:
+ i = args.index("--cpus")
+ try:
+ n = float(args[i + 1])
+ except (IndexError, ValueError):
+ sys.exit("--cpus needs a number")
+ del args[i:i + 2]
+ if n <= 0:
+ sys.exit("--cpus must be positive")
+ if not args:
+ sys.exit(__doc__)
+ repo_tasks = (Path(__file__).resolve().parents[1] / "tasks").resolve()
+ found = []
+ for a in args:
+ t = Path(a)
+ if not (t / "task.toml").is_file():
+ sys.exit(f"{a}: not a task directory (no task.toml)")
+ if not needs and t.resolve().parent == repo_tasks:
+ sys.exit(f"{a}: a task of the repository itself; clamp a copy (PROTOCOL §2.10: the task's files keep their values)")
+ found += clamp(t, n, write=not needs)
+ for line in found:
+ print(line)
+ if needs:
+ return 0 if found else 1
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1:]))
diff --git a/scripts/mujoco-playground/tests/test_standard_2_1_servers.py b/scripts/mujoco-playground/tests/test_standard_2_1_servers.py
index d930cfdfa2..e141f6061c 100644
--- a/scripts/mujoco-playground/tests/test_standard_2_1_servers.py
+++ b/scripts/mujoco-playground/tests/test_standard_2_1_servers.py
@@ -9,7 +9,9 @@ read without a bound); a camera named many times is rendered once, before the fr
another process at start is waited for, not a crash; the agent's clock (meta time_s / time_left_s) is not started by
the service's start or by a probe that only connects to the port, starts at the first request, and is not set back by
a resume (RoboTwin's service has these tests in scripts/robotwin/tests/test_standard_service.py); a camera's reported
-pose is the viewpoint its image is rendered from, not MuJoCo's left-eye camera. server_mj.py's optional reset capability
+pose is the viewpoint its image is rendered from, not MuJoCo's left-eye camera; the step limit cuts a chunk and the
+response says how many of its rows ran; an episode end logged by a call that was lost with a crash is dropped by the
+resume (board 0105: RoboCasa and MetaWorld+ kept it, so the agent lost the episode's rest). server_mj.py's optional reset capability
(PROTOCOL §4.5; DexToolBench standard grants 20): no /reset without a budget; with one, a reset restores the start state,
the budget is enforced (409 after it, after the agent's time), a crash resumes the current episode, and only the last
episode is graded.
@@ -279,6 +281,42 @@ class ServerCase:
self.assertEqual(self.wait_up()["calls"], 2) # the same episode: both observes are counted
+ def chunk(self, rows: list):
+ """A chunk in the service's own action type (server_mj.py: joint_position; the others: the tool's)."""
+ if self.SERVER.name == "server_mj.py":
+ return self.submit(rows)
+ return self.post("/submit", {"dt": 0.02, "actions": rows, "video": "none"})
+
+ def test_the_step_limit_cuts_a_chunk(self):
+ self.ENV = {**self.ENV, "RCB_MAX_CONTROL_STEPS": "5"}
+ self.start(); self.wait_up()
+ w = 12 if self.ENV.get("STUB_CASA") else 2
+ code, m = self.chunk([[0.1] * w] * 3)
+ self.assertEqual((code, m["done"]), (200, False))
+ code, m = self.chunk([[0.2] * w] * 4) # the limit falls on the chunk's second row
+ self.assertEqual((code, m["done"], m["reason"]), (200, True, "step limit"))
+ if self.SERVER.name != "server_mj.py": # server_mj.py reports the chunk's rows (unchanged)
+ self.assertEqual(m["executed_rows"], 2)
+ self.assertEqual(self.wait_up()["control_steps"], 5)
+ self.assertEqual(self.chunk([[0.2] * w])[0], 409)
+
+ def test_an_end_lost_with_its_call_is_dropped_on_resume(self):
+ """A crash inside the call that hit the step limit, after its end was logged and before its checkpoint: the call
+ is lost whole (the state goes back to the last checkpoint), so its end must go too, or the resumed episode is over
+ at a state that never reached the limit (board 0105, RoboCasa / MetaWorld+)."""
+ self.start(); self.wait_up()
+ w = 12 if self.ENV.get("STUB_CASA") else 2
+ self.assertEqual(self.chunk([[0.1] * w] * 3)[0], 200)
+ n = self.wait_up()["control_steps"]
+ self.proc.kill(); self.proc.wait(); self.log.close()
+ with open(self.data / "episode.jsonl", "a") as f: # what that crash leaves: call_begin, then the call's end
+ for e in ({"ev": "call_begin", "path": "/submit", "call": 2},
+ {"ev": "end", "reason": "step limit", "control_steps": n + 4, "journal_rows": n + 4, "ep_start": 0, "resets": 0}):
+ f.write(json.dumps({"ts": time.time(), **e}) + "\n")
+ self.start(); st = self.wait_up()
+ self.assertEqual((st["done"], st["control_steps"]), (False, n))
+ self.assertEqual(self.chunk([[0.2] * w] * 2)[0], 200) # the episode goes on
+
# ---- server_mj.py's reset capability
def post(self, path: str, meta: dict):
req = urllib.request.Request(f"http://127.0.0.1:{self.port}{path}", data=json.dumps(meta).encode())
diff --git a/scripts/robotwin/tests/stub_sim.py b/scripts/robotwin/tests/stub_sim.py
index ebc1483fce..633629c277 100644
--- a/scripts/robotwin/tests/stub_sim.py
+++ b/scripts/robotwin/tests/stub_sim.py
@@ -5,7 +5,10 @@ rcb_live.py), so the service under test is the shipped file, unchanged.
The "scene": 16 driven joints whose positions follow their drive targets at once. The left wrist camera's pose follows
the left arm's first joint. The task succeeds when fl_joint1's target is above 0.5 and RoboTwin's left-gripper-open
clause holds. Failure injection (environment variables): RCB_STUB_HASH_MISMATCH (the instance never rebuilds),
-RCB_STUB_REPLAY_FAIL (the verification replay raises), RCB_STUB_VIDEO_S (render_video sleeps that long)."""
+RCB_STUB_REPLAY_FAIL (the verification replay raises), RCB_STUB_VIDEO_S (render_video sleeps that long),
+RCB_STUB_SUCCESS_AFTER (the task succeeds only from that many physics steps on: objects that settle while the agent
+watches), RCB_STUB_CRASH_ON_SUCCESS_SHA=k (the process dies at the k-th state hash taken while the task succeeds, once
+per data directory: a crash between a successful call's physics and its checkpoint, k=1, or later)."""
from __future__ import annotations
import hashlib
@@ -94,12 +97,14 @@ class Cameras:
class Env:
def __init__(self):
- self.robot = Robot(); self.cameras = Cameras(self.robot)
+ self.robot = Robot(); self.cameras = Cameras(self.robot); self.sim_steps = 0
def _update_render(self): pass
def get_arm_pose(self, side): return [0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0]
def check_success(self):
+ if self.sim_steps < int(os.environ.get("RCB_STUB_SUCCESS_AFTER", "0")):
+ return False
return bool(self.robot.left_arm_joints[0].drive_target > 0.5 and self.robot.is_left_gripper_open())
@@ -115,7 +120,7 @@ class Session:
with open(os.path.join(data, "stub_session.jsonl"), "a") as f:
f.write(json.dumps({"task": task, "gripper_state": gripper_state, "enable_render": enable_render}) + "\n")
self.task, self.seed = task, int(json.load(open(instance))["seed"]) if instance else seed
- self._recording = None
+ self._recording = None; self._success_shas = 0
# rcb_traj.Session's hand-in cap (MAX_T rows; save_trajectory and replay refuse more), small here: RCB_STUB_MAX_T
self.max_rows = int(os.environ["RCB_STUB_MAX_T"]) if os.environ.get("RCB_STUB_MAX_T") else None
self._build()
@@ -137,9 +142,15 @@ class Session:
r.left_gripper_val, r.right_gripper_val = float(row[32]), float(row[33])
if self._recording is not None:
self._recording.append(self._row())
- self._sim_steps += 1
+ self._sim_steps += 1; self.env.sim_steps = self._sim_steps
def state_sha(self):
+ k = os.environ.get("RCB_STUB_CRASH_ON_SUCCESS_SHA")
+ if k and self.env.check_success():
+ self._success_shas += 1
+ marker = os.path.join(os.environ.get("RCB_DATA", "."), "stub_crashed")
+ if self._success_shas == int(k) and not os.path.exists(marker):
+ open(marker, "w").close(); os._exit(1)
return hashlib.sha1(np.ascontiguousarray(self._row()).tobytes()).hexdigest()[:12]
def record_start(self): self._recording = []
diff --git a/scripts/robotwin/tests/test_standard_service.py b/scripts/robotwin/tests/test_standard_service.py
index c2fe1d9517..8b6c3ac66a 100644
--- a/scripts/robotwin/tests/test_standard_service.py
+++ b/scripts/robotwin/tests/test_standard_service.py
@@ -7,7 +7,9 @@ Covers: malformed requests are 400s that leave the episode alive (a zero-row chu
wrong type or not finite; a negative Content-Length, which would be read without a bound); a camera named many times
is rendered once, before the frame budget is counted; a port held by another process is waited for; the calibration in every response is the current one (the wrist camera moves); the agent's
clock starts at its first request; the verdict is written before the videos, survives a restart, and is graded without
-`finalized`; a failed verification replay and an instance that does not rebuild are infra_error, not the agent's 0.
+`finalized`; a failed verification replay and an instance that does not rebuild are infra_error, not the agent's 0; a
+crash around a successful call never turns the success into the agent's 0 (the call is lost whole, or its success ends
+the resumed episode; an end logged past the last checkpoint is dropped by the resume).
"""
from __future__ import annotations
@@ -341,6 +343,71 @@ class Verdicts(ServiceCase):
os.kill(s.proc.pid, signal.SIGUSR1); time.sleep(0.3) # the collect hook's signal changes nothing
self.assertEqual(s.final(), d)
+ def crash(self, s: Service, call) -> None:
+ """`call` makes the service die (RCB_STUB_CRASH_ON_SUCCESS_SHA); compose restarts it."""
+ try:
+ call()
+ except OSError: # the connection dropped with the process
+ pass
+ self.assertEqual(s.proc.wait(timeout=30), 1)
+ self.assertTrue((s.data / "stub_crashed").exists())
+
+ def events(self, s: Service) -> list:
+ return [json.loads(l) for l in (s.data / "episode.jsonl").read_text().splitlines() if l.strip()]
+
+ def test_a_success_while_watching_survives_a_crash_before_its_checkpoint(self):
+ """Board 0105 F-M1: the agent lets go and watches; the objects settle into the goal during /observe and the
+ service dies before that call's checkpoint (e.g. out of memory while saving its evidence). The resume must not
+ come back "done" with the success lost (it did: the end was logged before the checkpoint, so every /submit was
+ a 409 and the replay up to the checkpoint graded 0): the call is lost whole and the agent watches again."""
+ s = self.service(RCB_STUB_SUCCESS_AFTER=100, RCB_STUB_CRASH_ON_SUCCESS_SHA=1)
+ code, m, _ = s.post("/submit", {"type": "joint_position", "dt": 0.02, "video": "none"}, [row(0.6, 1.0)])
+ self.assertEqual((code, m["done"]), (200, False)) # not settled yet (5 physics steps)
+ self.crash(s, lambda: s.post("/observe", {"seconds": 1.0, "video": "none"}))
+ self.assertNotIn("end", [e["ev"] for e in self.events(s)])
+ s.start(); st = s.wait_up()
+ self.assertEqual((st["done"], st["reason"]), (False, None)) # the episode goes on from before the lost call
+ code, m, _ = s.post("/observe", {"seconds": 1.0, "video": "none"})
+ self.assertEqual((code, m["done"], m["reason"]), (200, True, "success"))
+ d = s.wait_final()
+ self.assertEqual((d["success"], d["replay_success"], d["deterministic"]), (True, True, True))
+ out = s.grade()
+ self.assertEqual((out["success"], out["infra_error"]), (1, 0))
+
+ def test_a_success_whose_end_was_not_logged_ends_on_resume(self):
+ """The crash between a successful call's checkpoint and its end: the checkpoint holds the success, so the resumed
+ episode ends with it (an agent going on from there could undo a success it was told nothing about)."""
+ s = self.service(RCB_STUB_CRASH_ON_SUCCESS_SHA=2) # 1: the checkpoint's hash; 2: finalize's
+ self.crash(s, lambda: self.succeed(s))
+ lines = (s.data / "episode.jsonl").read_text().splitlines(keepends=True)
+ self.assertEqual(sum('"ev": "end"' in l for l in lines), 1)
+ (s.data / "episode.jsonl").write_text("".join(l for l in lines if '"ev": "end"' not in l)) # as if it died before the end
+ s.start(); st = s.wait_up()
+ self.assertEqual((st["done"], st["reason"]), (True, "success"))
+ self.assertEqual(s.post("/submit", {"type": "joint_position"}, [row()])[0], 409)
+ self.assertEqual([e.get("on_resume") for e in self.events(s) if e["ev"] == "end"], [True])
+ os.kill(s.proc.pid, signal.SIGUSR1) # the collect hook
+ d = s.wait_final()
+ self.assertEqual((d["success"], d["replay_success"], d["deterministic"], d["reason"]), (True, True, True, "success"))
+ self.assertEqual(s.grade()["success"], 1)
+
+ def test_an_end_past_the_last_checkpoint_is_dropped_on_resume(self):
+ """What a crash in the window used to leave (the reviewer's synthetic case): the lost call's call_begin and an
+ end(success) past the last checkpoint. The resume drops that end with the call."""
+ s = self.service()
+ s.post("/submit", {"type": "joint_position", "dt": 0.02, "video": "none"}, [row(0.1)])
+ n = [e for e in self.events(s) if e["ev"] == "checkpoint"][-1]["rows"]
+ s.stop()
+ with open(s.data / "episode.jsonl", "a") as f:
+ for e in ({"ev": "call_begin", "path": "/observe", "call": 2},
+ {"ev": "end", "reason": "success", "step": 1, "physics_steps": n + 250, "elapsed_s": 1.0, "success": True, "rows": n + 250}):
+ f.write(json.dumps({"ts": time.time(), **e}) + "\n")
+ s.start(); st = s.wait_up()
+ self.assertEqual((st["done"], st["reason"]), (False, None))
+ self.assertEqual(s.post("/submit", {"type": "joint_position", "dt": 0.02, "video": "none"}, [row(0.6, 1.0)])[0], 200)
+ self.assertTrue(s.wait_final()["success"])
+ self.assertEqual(s.grade()["success"], 1)
+
def test_a_failed_verification_replay_is_infra_error(self):
s = self.service(RCB_STUB_REPLAY_FAIL=1)
self.succeed(s)
diff --git a/scripts/run_agent_batch.sh b/scripts/run_agent_batch.sh
index 42c095c0ea..de26987bc6 100755
--- a/scripts/run_agent_batch.sh
+++ b/scripts/run_agent_batch.sh
@@ -36,6 +36,10 @@
# RESULTS a directory OUTSIDE the repository: after each job scripts/write_task_results.py writes the per-task results
# for the results site there, <RESULTS>/<batch>/<task>/<RUN_ID>/ (PROTOCOL D3: no results in the repository);
# default <repo>/../rcb_results; "" = skip
+# HOST_CPUS the host's CPU count (`nproc`): a task's CPU cap above it ([environment] / [verifier.environment] cpus,
+# a compose service's cpus) is clamped to it in the job's own copy of the task ($JOBS/.tasks/<job>/,
+# removed afterwards), as PROTOCOL §2.10 requires of a runner (docker refuses a larger cap); tasks/ keeps its
+# values (scripts/clamp_cpus.py)
# LOG_MIRROR / MEM_GUARD 1 (default) = start the agent-record mirror / the memory guard below if none runs; 0 = not
# GATEWAY 0 (default) = the agent calls its API directly, as Harbor runs it; 1 = route the agent's model API
# calls through scripts/usage_gateway/gateway.py, which forwards
@@ -78,6 +82,8 @@ JOBS="${JOBS:-$R/jobs/agents}"; RESULTS="${RESULTS-$(dirname "$R")/rcb_results}"
LOG_MIRROR="${LOG_MIRROR:-1}"; MEM_GUARD="${MEM_GUARD:-1}"
GATEWAY="${GATEWAY:-0}"; GATEWAY_RAW="${GATEWAY_RAW:-1}"; GATEWAY_BIND="${GATEWAY_BIND:-172.17.0.1}"; GATEWAY_START_WAIT="${GATEWAY_START_WAIT:-10}"
GATEWAY_EGRESS="${GATEWAY_EGRESS:-gateway}"
+HOST_CPUS="${HOST_CPUS:-$(nproc)}"
+[[ "$HOST_CPUS" =~ ^[1-9][0-9]*$ ]] || { echo "HOST_CPUS must be a positive integer (the host's CPU count)" >&2; exit 2; }
case "$GATEWAY_EGRESS" in gateway|task) ;; *) echo "GATEWAY_EGRESS must be gateway or task" >&2; exit 2 ;; esac
# absolute paths: with the gateway on, Harbor is started from the job's own copy of the task (run_job), not from the repository
abspath() { case "$1" in ""|/*) printf '%s' "$1" ;; *) printf '%s/%s' "$PWD" "$1" ;; esac; }
@@ -320,15 +326,46 @@ gateway_copy() { # <dir> <harbor -i args...>: <dir>/tasks/<task> = the task wit
done
}
+plain_copy() { # <dir> <harbor -i args...>: <dir>/tasks/<task> = the task as it is
+ local dir="$1" a; shift
+ rm -rf "$dir" && mkdir -p "$dir/tasks" || return 1
+ while [ $# -gt 0 ]; do
+ a="$1"; shift
+ if [ "$a" = -i ] && [ $# -gt 0 ]; then cp -a "$R/tasks/$1" "$dir/tasks/$1" || return 1; shift; fi
+ done
+}
+
+task_dirs() { # <root> <harbor -i args...>: the task directories the -i arguments name under <root>/tasks
+ local root="$1" a; shift
+ while [ $# -gt 0 ]; do
+ a="$1"; shift
+ if [ "$a" = -i ] && [ $# -gt 0 ]; then printf '%s\n' "$root/tasks/$1"; shift; fi
+ done
+}
+
run_job() { # <job> <concurrency> <harbor -i args...>
local job="$1" n="$2"; shift 2
local envf=(); [ -n "$ENV_FILE" ] && envf=(--env-file "$ENV_FILE")
- local root="$R" f
- if [ "$GATEWAY" = 1 ] && [ "$GATEWAY_EGRESS" = gateway ]; then
+ local root="$R" f dirs=()
+ mapfile -t dirs < <(task_dirs "$R" "$@")
+ # PROTOCOL §2.10: a CPU cap above the host's CPU count is clamped to it in the copy the job runs (docker refuses such a
+ # container: "range of CPUs is from 0.01 to 8.00"), never in tasks/
+ local clamp=0; python3 "$R/scripts/clamp_cpus.py" --cpus "$HOST_CPUS" --needs "${dirs[@]}" >/dev/null && clamp=1
+ if { [ "$GATEWAY" = 1 ] && [ "$GATEWAY_EGRESS" = gateway ]; } || [ "$clamp" = 1 ]; then
[[ "$job" =~ ^[A-Za-z0-9._-]+$ ]] || { log "FAILED $job: not a job name (letters, digits, . _ -); not started"; return 1; }
root="$JOBS/.tasks/$job"
- gateway_copy "$root" "$@" || { log "FAILED $job: could not prepare its task copy (the gateway and the package registries as the only egress) ($root); not started"; rm -rf "$root"; return 1; }
+ if [ "$GATEWAY" = 1 ] && [ "$GATEWAY_EGRESS" = gateway ]; then
+ gateway_copy "$root" "$@" || { log "FAILED $job: could not prepare its task copy (the gateway and the package registries as the only egress) ($root); not started"; rm -rf "$root"; return 1; }
+ else
+ plain_copy "$root" "$@" || { log "FAILED $job: could not prepare its task copy ($root); not started"; rm -rf "$root"; return 1; }
+ fi
for f in .env .env.local; do [ -e "$R/$f" ] && ln -s "$R/$f" "$root/$f"; done # what Harbor would load from the repository
+ if [ "$clamp" = 1 ]; then
+ mapfile -t dirs < <(task_dirs "$root" "$@")
+ python3 "$R/scripts/clamp_cpus.py" --cpus "$HOST_CPUS" "${dirs[@]}" | sed "s#^$root/tasks/#[$job] clamped #" | tee -a "$LOG" >/dev/null \
+ && ! python3 "$R/scripts/clamp_cpus.py" --cpus "$HOST_CPUS" --needs "${dirs[@]}" >/dev/null \
+ || { log "FAILED $job: could not clamp its CPU caps to the host's $HOST_CPUS ($root); not started"; rm -rf "$root"; return 1; }
+ fi
fi
stamp_task_dirs "$root" "$@"
log "start $job: $* (concurrency $n, attempts $K)"
diff --git a/scripts/tests/test_runner_results.py b/scripts/tests/test_runner_results.py
new file mode 100644
index 0000000000..581d37b3cb
--- /dev/null
+++ b/scripts/tests/test_runner_results.py
@@ -0,0 +1,189 @@
+#!/usr/bin/env python3
+"""Runner-side tools of board 0105 (F-M2), standard library and bash only:
+
+- scripts/write_task_results.py publishes a trial the verifier never graded (no reward.json), one Harbor ended with an
+ exception other than the agent's cutoff (AgentTimeoutError), or one stopped by a model-account failure as "not a
+ result", never as the agent's 0; a verdict, the cutoff and the token budget stay results;
+- scripts/clamp_cpus.py clamps every CPU cap of a task copy to the host's count (PROTOCOL §2.10) and nothing else, and
+ refuses the repository's own tasks;
+- scripts/run_agent_batch.sh runs a task whose cap is above HOST_CPUS from a clamped copy (a stand-in `harbor` on PATH
+ records what it was given), runs a task without such a cap from tasks/ as before, and leaves tasks/ unchanged."""
+import json
+import os
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[2]
+CLAMP = [sys.executable, str(ROOT / "scripts/clamp_cpus.py")]
+TASK = "robotwin_2_0_stack_blocks_two-standard" # any task of the repository (write_task_results looks it up)
+BIG = "behavior-boxing-food-after-dinner-i00" # its standard twin's sidecar caps are 12 CPUs
+HB = "humanoidbench-loco-walk-i00-privileged" # [environment] cpus = 16
+SMALL = "robotwin_2_0_stack_blocks_two" # caps of at most 8
+fails = []
+
+
+def check(cond, what):
+ if not cond:
+ fails.append(what)
+ print("FAIL", what)
+
+
+def result_line(td: Path, result: dict, reward=None, gateway=None, codex=None) -> str:
+ jobs = td / "jobs"; job = f"j{len(list(jobs.glob('*'))) if jobs.exists() else 0}"
+ trial = jobs / job / f"{TASK}__abc"
+ trial.mkdir(parents=True)
+ (trial / "result.json").write_text(json.dumps({"task_name": TASK, **result}))
+ if reward is not None:
+ (trial / "verifier").mkdir()
+ (trial / "verifier/reward.json").write_text(reward if isinstance(reward, str) else json.dumps(reward))
+ if gateway is not None:
+ (trial / "gateway").mkdir()
+ (trial / "gateway/totals.json").write_text(json.dumps(gateway))
+ if codex is not None:
+ (trial / "agent").mkdir()
+ (trial / "agent/codex.txt").write_text(codex)
+ out = td / "out" / job
+ r = subprocess.run([sys.executable, str(ROOT / "scripts/write_task_results.py"), str(jobs), job, "codex-x-high", "label",
+ "--out", str(out)], capture_output=True, text=True)
+ check(r.returncode == 0, f"write_task_results.py exited {r.returncode}: {r.stderr[-500:]}")
+ readme = (out / TASK / "codex-x-high" / "README.md").read_text()
+ return next(l for l in readme.splitlines() if l.startswith("| result |"))
+
+
+def test_results():
+ with tempfile.TemporaryDirectory() as td:
+ td = Path(td)
+ timeout = {"exception_info": {"exception_type": "AgentTimeoutError"}}
+ cases = [
+ ("a success", {}, {"success": 1}, None, None, "**1 (success)**"),
+ ("the agent's 0", {}, {"success": 0}, None, None, "**0**"),
+ ("0 at the cutoff", timeout, {"success": 0}, None, None, "**0**"),
+ ("a success at the cutoff", timeout, {"success": 1}, None, None, "**1 (success)**"),
+ ("over the token budget", {}, {"success": 1}, {"over_token_budget": True}, None, "over the token budget"),
+ ("infra_error", {}, {"success": 0, "infra_error": 1}, None, None, "not a result"),
+ ("grader_error", timeout, {"success": 0, "grader_error": 1}, None, None, "not a result"),
+ ("compose up failed, no reward.json",
+ {"exception_info": {"exception_type": "RuntimeError", "exception_message": "docker compose up failed: range of CPUs is from 0.01 to 8.00"}},
+ None, None, None, "not a result"),
+ ("no reward.json, no exception", {}, None, None, None, "not a result"),
+ ("no reward.json at the cutoff", timeout, None, None, None, "not a result"),
+ ("a corrupt reward.json", {}, '{"success": 0, "inf', None, None, "not a result"),
+ ("the verifier timed out after a reward", {"exception_info": {"exception_type": "VerifierTimeoutError"}}, {"success": 0}, None, None, "not a result"),
+ ("the harness died", {"exception_info": {"exception_type": "NonZeroAgentExitCodeError"}}, {"success": 0}, None, None, "not a result"),
+ ("a model-account failure", {}, {"success": 0}, None,
+ '{"type": "turn.failed", "error": {"message": "unexpected status 429 Too Many Requests: usage limit reached"}}\n', "not a result"),
+ ("a success the account check would flag", {}, {"success": 1}, None,
+ '{"type": "turn.failed", "error": {"message": "unexpected status 429 Too Many Requests"}}\n', "**1 (success)**"),
+ ("over the budget without a reward", {}, None, {"over_token_budget": True}, None, "over the token budget"),
+ ("over the budget, infra_error", {}, {"success": 0, "infra_error": 1}, {"over_token_budget": True}, None, "not a result"),
+ ]
+ for name, result, reward, gateway, codex, want in cases:
+ line = result_line(td, result, reward, gateway, codex)
+ check(want in line, f"write_task_results: {name}: {line}")
+ if want != "not a result":
+ check("not a result" not in line, f"write_task_results: {name} is a result: {line}")
+ line = result_line(td, {"exception_info": {"exception_type": "EnvironmentStartTimeoutError"}})
+ check("EnvironmentStartTimeoutError" in line and "no reward.json" in line, f"the reason names Harbor's exception: {line}")
+
+
+def caps(task: Path) -> list[str]:
+ out = re.findall(r"(?m)^cpus\s*=\s*\S+", (task / "task.toml").read_text())
+ for f in sorted((task / "environment").glob("*docker-compose.y*ml")):
+ out += [m.strip() for m in re.findall(r"(?m)^[ \t]*cpus:[ \t]*\S+", f.read_text())]
+ return out
+
+
+def num(cap: str) -> float:
+ return float(re.split(r"[=:]", cap)[1])
+
+
+def test_clamp():
+ with tempfile.TemporaryDirectory() as td:
+ td = Path(td)
+ for t in (f"{BIG}-standard", HB, f"{SMALL}-standard"):
+ shutil.copytree(ROOT / "tasks" / t, td / t, symlinks=True)
+ big, hb, small = td / f"{BIG}-standard", td / HB, td / f"{SMALL}-standard"
+ check(max(num(c) for c in caps(big)) == 12 and max(num(c) for c in caps(hb)) == 16, "the fixtures' caps changed")
+ r = subprocess.run(CLAMP + ["--cpus", "8", "--needs", str(small)], capture_output=True, text=True)
+ check(r.returncode == 1 and not r.stdout, f"--needs on caps <= 8: {r.returncode} {r.stdout}")
+ r = subprocess.run(CLAMP + ["--cpus", "8", "--needs", str(small), str(big)], capture_output=True, text=True)
+ check(r.returncode == 0 and "12 -> 8" in r.stdout, f"--needs on a cap of 12: {r.returncode} {r.stdout}")
+ check(caps(big) == caps(ROOT / "tasks" / f"{BIG}-standard"), "--needs wrote something")
+ before = {t: {p: p.read_bytes() for p in t.rglob("*") if p.is_file()} for t in (big, hb, small)}
+ r = subprocess.run(CLAMP + ["--cpus", "8", str(big), str(hb), str(small)], capture_output=True, text=True)
+ check(r.returncode == 0, f"clamp: {r.returncode} {r.stderr}")
+ for t in (big, hb, small):
+ orig = caps(ROOT / "tasks" / t.name)
+ got = caps(t)
+ check(len(got) == len(orig) and all(num(g) == min(num(o), 8) for g, o in zip(got, orig)), f"{t.name}: {orig} -> {got}")
+ for p, b in before[t].items(): # only the cpus values changed, nothing else in any file
+ a = p.read_bytes()
+ if a != b:
+ strip = lambda x: re.sub(rb"(?m)^([ \t]*cpus[ \t]*[:=][ \t]*)\d+(?:\.\d+)?", rb"\1N", x)
+ check(strip(a) == strip(b), f"{p}: more than a cpus value changed")
+ check(all(p.read_bytes() == b for p, b in before[small].items()), "a task without a cap above the host's was rewritten")
+ check(subprocess.run(CLAMP + ["--cpus", "8", "--needs", str(big), str(hb)], capture_output=True).returncode == 1,
+ "a clamped copy still needs clamping")
+ orig = caps(ROOT / "tasks" / HB)
+ r = subprocess.run(CLAMP + ["--cpus", "8", str(ROOT / "tasks" / HB)], capture_output=True, text=True)
+ check(r.returncode != 0 and "copy" in r.stderr, f"clamping tasks/ itself was not refused: {r.returncode} {r.stderr}")
+ check(caps(ROOT / "tasks" / HB) == orig and max(num(c) for c in orig) == 16, "tasks/ was clamped")
+
+
+FAKE_HARBOR = r'''#!/usr/bin/env python3
+import json, os, re, sys
+a = sys.argv[1:]
+tasks = [a[i + 1] for i, x in enumerate(a) if x == "-i"]
+rec = {"cwd": os.getcwd(), "caps": {}}
+for t in tasks:
+ d = os.path.join(os.getcwd(), a[a.index("-p") + 1], t)
+ c = re.findall(r"(?m)^cpus\s*=\s*(\S+)", open(os.path.join(d, "task.toml")).read())
+ c += re.findall(r"(?m)^[ \t]*cpus:[ \t]*([0-9.]+)", open(os.path.join(d, "environment", "docker-compose.yaml")).read())
+ rec["caps"][t] = [float(x) for x in c]
+with open(os.environ["FAKE_HARBOR_OUT"], "a") as f:
+ f.write(json.dumps(rec) + "\n")
+'''
+
+
+def test_batch_runner():
+ with tempfile.TemporaryDirectory() as td:
+ td = Path(td)
+ (td / "bin").mkdir()
+ (td / "bin/harbor").write_text(FAKE_HARBOR); (td / "bin/harbor").chmod(0o755)
+ rec = td / "harbor.jsonl"
+ orig = {t: caps(ROOT / "tasks" / t) for t in (f"{BIG}-standard", f"{SMALL}-standard")}
+ env = {**os.environ, "PATH": f"{td / 'bin'}:{os.environ['PATH']}", "FAKE_HARBOR_OUT": str(rec), "JOBS": str(td / "jobs"),
+ "RESULTS": "", "LOG_MIRROR": "0", "MEM_GUARD": "0", "GATEWAY": "0", "WEB_SEARCH": "allowed", "MODES": "standard",
+ "HOST_CPUS": "8"}
+ r = subprocess.run(["bash", str(ROOT / "scripts/run_agent_batch.sh"), "clamptest", BIG, SMALL], env=env,
+ capture_output=True, text=True, timeout=300)
+ check(r.returncode == 0, f"run_agent_batch.sh exited {r.returncode}: {r.stderr[-800:]}")
+ runs = [json.loads(l) for l in rec.read_text().splitlines()] if rec.exists() else []
+ check(len(runs) == 2, f"harbor ran {len(runs)} times: {runs}")
+ for run in runs:
+ for t, c in run["caps"].items():
+ check(c and max(c) <= 8, f"{t} ran with caps {c} on an 8-CPU host")
+ if t.startswith(BIG):
+ check(Path(run["cwd"]).resolve() == (td / "jobs/.tasks/clamptest-standard-" f"{BIG}").resolve(),
+ f"the clamped task ran from {run['cwd']}, not its job copy")
+ else:
+ check(Path(run["cwd"]).resolve() == ROOT.resolve(), f"a task without a cap above the host's ran from {run['cwd']}")
+ log = (td / "jobs/clamptest.log").read_text()
+ check("clamped" in log and "12 -> 8" in log, "the clamp is not in the batch log")
+ check(not (td / f"jobs/.tasks/clamptest-standard-{BIG}").exists(), "the job copy was not removed")
+ for t, c in orig.items():
+ check(caps(ROOT / "tasks" / t) == c, f"tasks/{t} was changed")
+
+
+if __name__ == "__main__":
+ test_results()
+ test_clamp()
+ test_batch_runner()
+ if fails:
+ print(f"{len(fails)} failure(s)")
+ sys.exit(1)
+ print("ok: write_task_results not-a-result cases, clamp_cpus, run_agent_batch.sh clamped copies")
diff --git a/scripts/write_task_results.py b/scripts/write_task_results.py
index a4ce95a0c7..1fe3af3d1d 100644
--- a/scripts/write_task_results.py
+++ b/scripts/write_task_results.py
@@ -4,6 +4,7 @@
usage: write_task_results.py <jobs_dir> <job_name> <run-id> "<agent label>" --out <dir> [--analysis <a Python file with ANALYSIS = {family: {"U": text, "L": text}}>]"""
import json, pathlib, shutil, sys, re, glob, datetime as dt, ast
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)); from task_names import base, canonical, mode as mode_of # noqa: E402
+import account_failure_check # noqa: E402
jobs, job, slug, label = pathlib.Path(sys.argv[1]), sys.argv[2], sys.argv[3], sys.argv[4]
root = pathlib.Path(__file__).resolve().parents[1]
if "--out" not in sys.argv: sys.exit("--out <dir> is required: results are published on the results site, not committed (PROTOCOL D3)")
@@ -23,28 +24,55 @@ def last_msgs(trial, k=3):
d = json.load(open(glob.glob(str(trial / "agent/trajectory.json"))[0]))
return [s["message"].strip().replace("\n", " ") for s in d.get("steps", []) if s.get("source") == "agent" and (s.get("message") or "").strip()][-k:]
except Exception: return []
-NOT_A_RESULT = "**not a result** — infrastructure error (`infra_error` / `grader_error` in the verifier line): run it again; it is not the agent's 0"
+NOT_A_RESULT = "**not a result** — infrastructure error ({}): run it again; it is not the agent's 0"
+def not_a_result(trial, r, rw):
+ """Why a trial that is not a success is no result either (PROTOCOL §2.6, §2.12: an infrastructure failure is neither a
+ success nor the agent's 0; only the agent's own end, its deliverable or the cutoff, AgentTimeoutError, is a result),
+ or None. Board 0105 F-M2: a trial whose verifier never ran (no reward.json: `docker compose up` failed, e.g. a CPU
+ cap above the host's; the verifier timed out) was published as the agent's 0."""
+ if rw.get("infra_error") or rw.get("grader_error"):
+ return "`infra_error` / `grader_error` in the verifier line"
+ ex = (r.get("exception_info") or {}).get("exception_type") or ""
+ if not rw:
+ return "the verifier wrote no reward.json" + (f"; Harbor: `{ex}`" if ex else "")
+ if ex and ex != "AgentTimeoutError":
+ return f"Harbor ended the trial with `{ex}`"
+ try:
+ if account_failure_check.check(str(trial)).get("stop"):
+ return "a model-account or configuration failure (scripts/account_failure_check.py)"
+ except Exception:
+ pass
+ return None
+def load_reward(trial):
+ try:
+ d = json.load(open(trial / "verifier/reward.json"))
+ return d if isinstance(d, dict) else {}
+ except (OSError, ValueError):
+ return {}
n = 0
for trial in sorted((jobs / job).glob("*__*")):
if not (trial / "result.json").exists(): continue
r = json.load(open(trial / "result.json")); task = canonical(r["task_name"].split("/")[-1]) # also pre-v1.0 jobs
tdir = root / "tasks" / task
if not tdir.is_dir(): continue
- rw = json.load(open(trial / "verifier/reward.json")) if (trial / "verifier/reward.json").exists() else {}
+ rw = load_reward(trial)
ar = r.get("agent_result") or {}; mode = mode_of(task); limited = mode != "privileged"; fam = base(task).replace("robotwin_2_0_", "")
out = out_root / task / slug; out.mkdir(parents=True, exist_ok=True)
for f in ("replay.mp4", "replay.last.png"):
if (trial / "verifier" / f).exists(): shutil.copy(trial / "verifier" / f, out / f)
gw = json.load(open(trial / "gateway/totals.json")) if (trial / "gateway/totals.json").exists() else {}
over = bool(gw.get("over_token_budget")) # PROTOCOL §5: over the token budget = failed
- # PROTOCOL §2.6: infra_error (or a grader error) = not a result, neither a success nor the agent's 0
+ # PROTOCOL §2.6: infra_error (or a grader error) = not a result, neither a success nor the agent's 0; so is a trial
+ # the verifier never graded, or that Harbor or the model account ended (not_a_result). A verdict of success with no
+ # infrastructure flag stands; over the token budget is the agent's failure unless the verifier flagged infrastructure.
infra = bool(rw.get("infra_error") or rw.get("grader_error"))
ok = rw.get("success") == 1 and not over and not infra
+ why = None if ok or (over and not infra) else not_a_result(trial, r, rw)
an = analysis.get(fam, {}).get("L" if limited else "U", "")
lines = [f"# {label} — {task}\n",
f"Run: Harbor job `{job}`, trial `{trial.name}`, {(r.get('started_at') or '')[:10]}. Mode: **{ {'standard': 'standard (robot as a service)', 'standard-realtime': 'standard-realtime (robot as a service, time does not stop)'}.get(mode, 'privileged')}**.\n",
"| | |", "|---|---|",
- f"| result | {'**1 (success)**' if ok else NOT_A_RESULT if infra else '**0**' + (' — over the token budget' if over else ' — no trajectory handed in' if rw.get('missing_trajectory') else '')} |",
+ f"| result | {'**1 (success)**' if ok else NOT_A_RESULT.format(why) if why else '**0**' + (' — over the token budget' if over else ' — no trajectory handed in' if rw.get('missing_trajectory') else '')} |",
f"| agent time | {span(r.get('agent_execution') or {})} s |",
f"| actions / physics steps | {rw.get('steps') or rw.get('n_actions') or '—'} / {rw.get('sim_steps') or '—'} |",
f"| tokens in / out | {ar.get('n_input_tokens')} / {ar.get('n_output_tokens')} |",
diff --git a/tasks/metaworldplus-assembly-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-assembly-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-assembly-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-assembly-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-basketball-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-basketball-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-basketball-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-basketball-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-bin-picking-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-bin-picking-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-bin-picking-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-bin-picking-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-box-close-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-box-close-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-box-close-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-box-close-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-button-press-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-button-press-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-button-press-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-button-press-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-button-press-topdown-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-button-press-topdown-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-button-press-topdown-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-button-press-topdown-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-button-press-topdown-wall-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-button-press-topdown-wall-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-button-press-topdown-wall-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-button-press-topdown-wall-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-button-press-wall-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-button-press-wall-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-button-press-wall-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-button-press-wall-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-coffee-button-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-coffee-button-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-coffee-button-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-coffee-button-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-coffee-pull-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-coffee-pull-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-coffee-pull-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-coffee-pull-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-coffee-push-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-coffee-push-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-coffee-push-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-coffee-push-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-dial-turn-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-dial-turn-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-dial-turn-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-dial-turn-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-disassemble-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-disassemble-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-disassemble-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-disassemble-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-door-close-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-door-close-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-door-close-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-door-close-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-door-lock-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-door-lock-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-door-lock-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-door-lock-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-door-open-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-door-open-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-door-open-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-door-open-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-door-unlock-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-door-unlock-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-door-unlock-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-door-unlock-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-drawer-close-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-drawer-close-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-drawer-close-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-drawer-close-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-drawer-open-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-drawer-open-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-drawer-open-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-drawer-open-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-faucet-close-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-faucet-close-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-faucet-close-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-faucet-close-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-faucet-open-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-faucet-open-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-faucet-open-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-faucet-open-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-hammer-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-hammer-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-hammer-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-hammer-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-hand-insert-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-hand-insert-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-hand-insert-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-hand-insert-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-handle-press-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-handle-press-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-handle-press-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-handle-press-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-handle-press-side-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-handle-press-side-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-handle-press-side-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-handle-press-side-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-handle-pull-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-handle-pull-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-handle-pull-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-handle-pull-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-handle-pull-side-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-handle-pull-side-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-handle-pull-side-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-handle-pull-side-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-lever-pull-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-lever-pull-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-lever-pull-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-lever-pull-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-peg-insert-side-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-peg-insert-side-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-peg-insert-side-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-peg-insert-side-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-peg-unplug-side-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-peg-unplug-side-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-peg-unplug-side-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-peg-unplug-side-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-pick-out-of-hole-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-pick-out-of-hole-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-pick-out-of-hole-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-pick-out-of-hole-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-pick-place-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-pick-place-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-pick-place-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-pick-place-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-pick-place-wall-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-pick-place-wall-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-pick-place-wall-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-pick-place-wall-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-plate-slide-back-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-plate-slide-back-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-plate-slide-back-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-plate-slide-back-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-plate-slide-back-side-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-plate-slide-back-side-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-plate-slide-back-side-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-plate-slide-back-side-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-plate-slide-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-plate-slide-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-plate-slide-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-plate-slide-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-plate-slide-side-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-plate-slide-side-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-plate-slide-side-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-plate-slide-side-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-push-back-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-push-back-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-push-back-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-push-back-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-push-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-push-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-push-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-push-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-push-wall-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-push-wall-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-push-wall-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-push-wall-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-reach-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-reach-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-reach-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-reach-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-reach-wall-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-reach-wall-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-reach-wall-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-reach-wall-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-shelf-place-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-shelf-place-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-shelf-place-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-shelf-place-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-soccer-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-soccer-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-soccer-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-soccer-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-stick-pull-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-stick-pull-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-stick-pull-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-stick-pull-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-stick-push-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-stick-push-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-stick-push-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-stick-push-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-sweep-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-sweep-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-sweep-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-sweep-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-sweep-into-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-sweep-into-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-sweep-into-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-sweep-into-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-window-close-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-window-close-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-window-close-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-window-close-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/metaworldplus-window-open-i00-standard/environment/sim/server_mw.py b/tasks/metaworldplus-window-open-i00-standard/environment/sim/server_mw.py
index ed8728c96f..6ca20697f6 100644
--- a/tasks/metaworldplus-window-open-i00-standard/environment/sim/server_mw.py
+++ b/tasks/metaworldplus-window-open-i00-standard/environment/sim/server_mw.py
@@ -540,7 +540,9 @@ def do_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A.astype(np.float64):
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -553,13 +555,13 @@ def do_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -835,7 +837,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-arrange-vegetables-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-arrange-vegetables-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-arrange-vegetables-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-arrange-vegetables-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-close-double-door-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-close-double-door-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-close-double-door-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-close-double-door-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-close-drawer-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-close-drawer-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-close-drawer-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-close-drawer-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-close-single-door-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-close-single-door-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-close-single-door-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-close-single-door-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-coffee-press-button-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-coffee-press-button-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-coffee-press-button-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-coffee-press-button-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-coffee-serve-mug-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-coffee-serve-mug-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-coffee-serve-mug-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-coffee-serve-mug-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-coffee-setup-mug-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-coffee-setup-mug-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-coffee-setup-mug-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-coffee-setup-mug-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-bottle-to-cabinet-close-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-bottle-to-cabinet-close-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-bottle-to-cabinet-close-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-bottle-to-cabinet-close-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-can-to-drawer-close-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-can-to-drawer-close-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-can-to-drawer-close-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-can-to-drawer-close-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-cup-to-drawer-close-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-cup-to-drawer-close-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-cup-to-drawer-close-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-cup-to-drawer-close-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-cuttingboard-to-basket-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-cuttingboard-to-basket-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-cuttingboard-to-basket-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-cuttingboard-to-basket-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-cuttingboard-to-cardboardbox-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-cuttingboard-to-cardboardbox-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-cuttingboard-to-cardboardbox-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-cuttingboard-to-cardboardbox-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-cuttingboard-to-pan-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-cuttingboard-to-pan-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-cuttingboard-to-pan-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-cuttingboard-to-pan-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-cuttingboard-to-pot-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-cuttingboard-to-pot-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-cuttingboard-to-pot-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-cuttingboard-to-pot-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-cuttingboard-to-tieredbasket-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-cuttingboard-to-tieredbasket-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-cuttingboard-to-tieredbasket-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-cuttingboard-to-tieredbasket-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-milk-to-microwave-close-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-milk-to-microwave-close-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-milk-to-microwave-close-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-milk-to-microwave-close-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-placemat-to-basket-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-placemat-to-basket-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-placemat-to-basket-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-placemat-to-basket-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-placemat-to-bowl-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-placemat-to-bowl-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-placemat-to-bowl-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-placemat-to-bowl-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-placemat-to-plate-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-placemat-to-plate-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-placemat-to-plate-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-placemat-to-plate-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-placemat-to-tieredshelf-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-placemat-to-tieredshelf-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-placemat-to-tieredshelf-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-placemat-to-tieredshelf-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-plate-to-bowl-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-plate-to-bowl-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-plate-to-bowl-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-plate-to-bowl-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-plate-to-cardboardbox-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-plate-to-cardboardbox-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-plate-to-cardboardbox-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-plate-to-cardboardbox-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-plate-to-pan-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-plate-to-pan-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-plate-to-pan-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-plate-to-pan-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-plate-to-plate-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-plate-to-plate-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-plate-to-plate-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-plate-to-plate-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-potato-to-microwave-close-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-potato-to-microwave-close-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-potato-to-microwave-close-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-potato-to-microwave-close-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-tray-to-cardboardbox-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-tray-to-cardboardbox-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-tray-to-cardboardbox-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-tray-to-cardboardbox-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-tray-to-plate-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-tray-to-plate-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-tray-to-plate-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-tray-to-plate-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-tray-to-pot-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-tray-to-pot-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-tray-to-pot-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-tray-to-pot-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-tray-to-tieredbasket-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-tray-to-tieredbasket-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-tray-to-tieredbasket-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-tray-to-tieredbasket-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-tray-to-tieredshelf-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-tray-to-tieredshelf-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-tray-to-tieredshelf-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-tray-to-tieredshelf-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-gr1-wine-to-cabinet-close-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-gr1-wine-to-cabinet-close-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-gr1-wine-to-cabinet-close-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-gr1-wine-to-cabinet-close-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-microwave-thawing-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-microwave-thawing-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-microwave-thawing-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-microwave-thawing-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-open-double-door-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-open-double-door-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-open-double-door-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-open-double-door-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-open-drawer-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-open-drawer-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-open-drawer-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-open-drawer-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-open-single-door-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-open-single-door-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-open-single-door-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-open-single-door-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pnp-cab-to-counter-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pnp-cab-to-counter-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pnp-cab-to-counter-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pnp-cab-to-counter-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pnp-counter-to-cab-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pnp-counter-to-cab-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pnp-counter-to-cab-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pnp-counter-to-cab-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pnp-counter-to-microwave-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pnp-counter-to-microwave-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pnp-counter-to-microwave-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pnp-counter-to-microwave-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pnp-counter-to-sink-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pnp-counter-to-sink-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pnp-counter-to-sink-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pnp-counter-to-sink-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pnp-counter-to-stove-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pnp-counter-to-stove-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pnp-counter-to-stove-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pnp-counter-to-stove-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pnp-microwave-to-counter-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pnp-microwave-to-counter-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pnp-microwave-to-counter-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pnp-microwave-to-counter-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pnp-sink-to-counter-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pnp-sink-to-counter-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pnp-sink-to-counter-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pnp-sink-to-counter-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pnp-stove-to-counter-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pnp-stove-to-counter-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pnp-stove-to-counter-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pnp-stove-to-counter-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-pre-soak-pan-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-pre-soak-pan-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-pre-soak-pan-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-pre-soak-pan-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-prepare-coffee-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-prepare-coffee-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-prepare-coffee-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-prepare-coffee-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-restock-pantry-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-restock-pantry-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-restock-pantry-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-restock-pantry-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-turn-off-microwave-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-turn-off-microwave-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-turn-off-microwave-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-turn-off-microwave-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-turn-off-sink-faucet-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-turn-off-sink-faucet-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-turn-off-sink-faucet-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-turn-off-sink-faucet-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-turn-off-stove-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-turn-off-stove-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-turn-off-stove-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-turn-off-stove-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-turn-on-microwave-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-turn-on-microwave-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-turn-on-microwave-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-turn-on-microwave-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-turn-on-sink-faucet-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-turn-on-sink-faucet-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-turn-on-sink-faucet-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-turn-on-sink-faucet-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-turn-on-stove-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-turn-on-stove-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-turn-on-stove-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-turn-on-stove-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa-turn-sink-spout-i00-standard/environment/sim/server_casa.py b/tasks/robocasa-turn-sink-spout-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa-turn-sink-spout-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa-turn-sink-spout-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-add-lemon-to-fish-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-add-lemon-to-fish-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-add-lemon-to-fish-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-add-lemon-to-fish-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-assemble-cooking-array-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-assemble-cooking-array-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-assemble-cooking-array-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-assemble-cooking-array-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-beverage-sorting-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-beverage-sorting-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-beverage-sorting-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-beverage-sorting-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-bread-and-cheese-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-bread-and-cheese-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-bread-and-cheese-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-bread-and-cheese-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-candle-cleanup-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-candle-cleanup-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-candle-cleanup-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-candle-cleanup-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-cereal-and-bowl-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-cereal-and-bowl-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-cereal-and-bowl-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-cereal-and-bowl-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-choose-measuring-cup-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-choose-measuring-cup-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-choose-measuring-cup-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-choose-measuring-cup-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-clear-food-waste-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-clear-food-waste-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-clear-food-waste-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-clear-food-waste-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-clear-sink-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-clear-sink-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-clear-sink-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-clear-sink-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-close-drawer-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-close-drawer-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-close-drawer-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-close-drawer-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-close-oven-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-close-oven-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-close-oven-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-close-oven-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-close-stand-mixer-head-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-close-stand-mixer-head-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-close-stand-mixer-head-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-close-stand-mixer-head-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-cookie-dough-prep-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-cookie-dough-prep-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-cookie-dough-prep-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-cookie-dough-prep-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-deliver-brewed-coffee-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-deliver-brewed-coffee-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-deliver-brewed-coffee-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-deliver-brewed-coffee-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-dessert-upgrade-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-dessert-upgrade-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-dessert-upgrade-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-dessert-upgrade-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-display-meat-variety-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-display-meat-variety-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-display-meat-variety-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-display-meat-variety-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-divide-basins-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-divide-basins-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-divide-basins-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-divide-basins-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-drain-veggies-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-drain-veggies-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-drain-veggies-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-drain-veggies-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-drinkware-consolidation-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-drinkware-consolidation-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-drinkware-consolidation-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-drinkware-consolidation-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-make-ice-lemonade-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-make-ice-lemonade-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-make-ice-lemonade-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-make-ice-lemonade-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-make-loaded-potato-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-make-loaded-potato-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-make-loaded-potato-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-make-loaded-potato-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-meal-prep-staging-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-meal-prep-staging-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-meal-prep-staging-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-meal-prep-staging-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-microwave-defrost-meat-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-microwave-defrost-meat-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-microwave-defrost-meat-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-microwave-defrost-meat-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-open-dishwasher-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-open-dishwasher-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-open-dishwasher-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-open-dishwasher-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-organize-coffee-condiments-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-organize-coffee-condiments-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-organize-coffee-condiments-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-organize-coffee-condiments-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-oven-broil-fish-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-oven-broil-fish-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-oven-broil-fish-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-oven-broil-fish-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-pack-dessert-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-pack-dessert-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-pack-dessert-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-pack-dessert-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-pick-place-cabinet-to-counter-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-pick-place-cabinet-to-counter-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-pick-place-cabinet-to-counter-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-pick-place-cabinet-to-counter-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-pick-place-sink-to-counter-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-pick-place-sink-to-counter-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-pick-place-sink-to-counter-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-pick-place-sink-to-counter-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-plate-steak-meal-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-plate-steak-meal-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-plate-steak-meal-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-plate-steak-meal-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-portion-in-tupperware-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-portion-in-tupperware-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-portion-in-tupperware-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-portion-in-tupperware-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-pre-rinse-station-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-pre-rinse-station-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-pre-rinse-station-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-pre-rinse-station-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-prep-for-sanitizing-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-prep-for-sanitizing-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-prep-for-sanitizing-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-prep-for-sanitizing-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-prep-marinating-meat-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-prep-marinating-meat-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-prep-marinating-meat-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-prep-marinating-meat-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-reheat-meal-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-reheat-meal-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-reheat-meal-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-reheat-meal-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-retrieve-meat-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-retrieve-meat-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-retrieve-meat-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-retrieve-meat-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-sanitize-prep-cutting-board-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-sanitize-prep-cutting-board-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-sanitize-prep-cutting-board-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-sanitize-prep-cutting-board-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-scrub-bowl-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-scrub-bowl-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-scrub-bowl-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-scrub-bowl-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-searing-meat-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-searing-meat-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-searing-meat-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-searing-meat-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-seasoning-spice-setup-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-seasoning-spice-setup-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-seasoning-spice-setup-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-seasoning-spice-setup-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-set-up-cutting-station-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-set-up-cutting-station-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-set-up-cutting-station-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-set-up-cutting-station-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-stocking-breakfast-foods-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-stocking-breakfast-foods-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-stocking-breakfast-foods-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-stocking-breakfast-foods-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-sweeten-coffee-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-sweeten-coffee-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-sweeten-coffee-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-sweeten-coffee-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-thaw-in-sink-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-thaw-in-sink-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-thaw-in-sink-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-thaw-in-sink-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-tong-buffet-setup-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-tong-buffet-setup-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-tong-buffet-setup-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-tong-buffet-setup-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-turn-off-microwave-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-turn-off-microwave-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-turn-off-microwave-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-turn-off-microwave-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-turn-on-microwave-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-turn-on-microwave-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-turn-on-microwave-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-turn-on-microwave-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-turn-on-sink-faucet-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-turn-on-sink-faucet-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-turn-on-sink-faucet-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-turn-on-sink-faucet-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-turn-on-stove-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-turn-on-stove-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-turn-on-stove-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-turn-on-stove-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robocasa365-turn-on-toaster-oven-i00-standard/environment/sim/server_casa.py b/tasks/robocasa365-turn-on-toaster-oven-i00-standard/environment/sim/server_casa.py
index 1689c8d64a..5db20e7ea1 100644
--- a/tasks/robocasa365-turn-on-toaster-oven-i00-standard/environment/sim/server_casa.py
+++ b/tasks/robocasa365-turn-on-toaster-oven-i00-standard/environment/sim/server_casa.py
@@ -556,7 +556,9 @@ def run_submit(q: dict):
prev = np.asarray(S.targets, float).copy()
n_clip = 0
done = False
+ executed = 0 # rows begun: fewer than the chunk's when the step limit ends the episode inside it
for row in A:
+ executed += 1
tgt = np.clip(row, S.lower, S.upper)
n_clip += int(np.any(tgt != row))
for j in range(1, k + 1):
@@ -569,13 +571,13 @@ def run_submit(q: dict):
break
rec.tick(force=True)
E["calls"] += 1
- E["rows"] += int(A.shape[0])
+ E["rows"] += executed
RECF.flush()
out = {
**meta_common(),
"chunk_id": E["calls"],
"type": ACTION_NAME,
- "executed_rows": int(A.shape[0]),
+ "executed_rows": executed,
"clipped": n_clip,
"n_clipped_rows": n_clip,
"ok": True,
@@ -880,7 +882,9 @@ def _resume_or_start() -> None:
first = [e for e in ev if e.get("ev") == "first_request"]
if first:
E["t_first"] = float(first[0]["ts"]) # the agent's clock keeps running through a crash, never back to full
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last completed call: an end past it (the step limit hit by the call that was
+ # in flight) was lost with that call, as the call itself
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("control_steps") or 0) <= n]
if ended:
E["done"] = True
E["reason"] = ended[-1].get("reason")
diff --git a/tasks/robotwin_2_0_adjust_bottle-standard/environment/sim/server.py b/tasks/robotwin_2_0_adjust_bottle-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_adjust_bottle-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_adjust_bottle-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_beat_block_hammer-standard/environment/sim/server.py b/tasks/robotwin_2_0_beat_block_hammer-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_beat_block_hammer-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_beat_block_hammer-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_blocks_ranking_rgb-standard/environment/sim/server.py b/tasks/robotwin_2_0_blocks_ranking_rgb-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_blocks_ranking_rgb-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_blocks_ranking_rgb-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_blocks_ranking_size-standard/environment/sim/server.py b/tasks/robotwin_2_0_blocks_ranking_size-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_blocks_ranking_size-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_blocks_ranking_size-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_dump_bin_bigbin-standard/environment/sim/server.py b/tasks/robotwin_2_0_dump_bin_bigbin-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_dump_bin_bigbin-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_dump_bin_bigbin-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_grab_roller-standard/environment/sim/server.py b/tasks/robotwin_2_0_grab_roller-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_grab_roller-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_grab_roller-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_handover_block-standard/environment/sim/server.py b/tasks/robotwin_2_0_handover_block-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_handover_block-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_handover_block-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_handover_mic-standard/environment/sim/server.py b/tasks/robotwin_2_0_handover_mic-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_handover_mic-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_handover_mic-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_hanging_mug-standard/environment/sim/server.py b/tasks/robotwin_2_0_hanging_mug-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_hanging_mug-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_hanging_mug-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_lift_pot-standard/environment/sim/server.py b/tasks/robotwin_2_0_lift_pot-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_lift_pot-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_lift_pot-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_move_can_pot-standard/environment/sim/server.py b/tasks/robotwin_2_0_move_can_pot-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_move_can_pot-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_move_can_pot-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_move_pillbottle_pad-standard/environment/sim/server.py b/tasks/robotwin_2_0_move_pillbottle_pad-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_move_pillbottle_pad-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_move_pillbottle_pad-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_move_playingcard_away-standard/environment/sim/server.py b/tasks/robotwin_2_0_move_playingcard_away-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_move_playingcard_away-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_move_playingcard_away-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_move_stapler_pad-standard/environment/sim/server.py b/tasks/robotwin_2_0_move_stapler_pad-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_move_stapler_pad-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_move_stapler_pad-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_open_laptop-standard/environment/sim/server.py b/tasks/robotwin_2_0_open_laptop-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_open_laptop-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_open_laptop-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_open_microwave-standard/environment/sim/server.py b/tasks/robotwin_2_0_open_microwave-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_open_microwave-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_open_microwave-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_pick_diverse_bottles-standard/environment/sim/server.py b/tasks/robotwin_2_0_pick_diverse_bottles-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_pick_diverse_bottles-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_pick_diverse_bottles-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_pick_dual_bottles-standard/environment/sim/server.py b/tasks/robotwin_2_0_pick_dual_bottles-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_pick_dual_bottles-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_pick_dual_bottles-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_a2b_left-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_a2b_left-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_a2b_left-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_a2b_left-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_a2b_right-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_a2b_right-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_a2b_right-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_a2b_right-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_bread_basket-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_bread_basket-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_bread_basket-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_bread_basket-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_bread_skillet-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_bread_skillet-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_bread_skillet-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_bread_skillet-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_burger_fries-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_burger_fries-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_burger_fries-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_burger_fries-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_can_basket-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_can_basket-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_can_basket-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_can_basket-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_cans_plasticbox-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_cans_plasticbox-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_cans_plasticbox-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_cans_plasticbox-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_container_plate-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_container_plate-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_container_plate-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_container_plate-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_dual_shoes-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_dual_shoes-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_dual_shoes-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_dual_shoes-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_empty_cup-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_empty_cup-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_empty_cup-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_empty_cup-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_fan-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_fan-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_fan-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_fan-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_mouse_pad-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_mouse_pad-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_mouse_pad-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_mouse_pad-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_object_basket-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_object_basket-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_object_basket-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_object_basket-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_object_scale-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_object_scale-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_object_scale-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_object_scale-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_object_stand-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_object_stand-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_object_stand-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_object_stand-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_phone_stand-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_phone_stand-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_phone_stand-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_phone_stand-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_place_shoe-standard/environment/sim/server.py b/tasks/robotwin_2_0_place_shoe-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_place_shoe-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_place_shoe-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_press_stapler-standard/environment/sim/server.py b/tasks/robotwin_2_0_press_stapler-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_press_stapler-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_press_stapler-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_put_bottles_dustbin-standard/environment/sim/server.py b/tasks/robotwin_2_0_put_bottles_dustbin-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_put_bottles_dustbin-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_put_bottles_dustbin-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_rotate_qrcode-standard/environment/sim/server.py b/tasks/robotwin_2_0_rotate_qrcode-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_rotate_qrcode-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_rotate_qrcode-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_scan_object-standard/environment/sim/server.py b/tasks/robotwin_2_0_scan_object-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_scan_object-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_scan_object-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_shake_bottle-standard/environment/sim/server.py b/tasks/robotwin_2_0_shake_bottle-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_shake_bottle-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_shake_bottle-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_shake_bottle_horizontally-standard/environment/sim/server.py b/tasks/robotwin_2_0_shake_bottle_horizontally-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_shake_bottle_horizontally-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_shake_bottle_horizontally-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_stack_blocks_three-standard/environment/sim/server.py b/tasks/robotwin_2_0_stack_blocks_three-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_stack_blocks_three-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_stack_blocks_three-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_stack_blocks_two-standard/environment/sim/server.py b/tasks/robotwin_2_0_stack_blocks_two-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_stack_blocks_two-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_stack_blocks_two-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_stack_bowls_three-standard/environment/sim/server.py b/tasks/robotwin_2_0_stack_bowls_three-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_stack_bowls_three-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_stack_bowls_three-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_stack_bowls_two-standard/environment/sim/server.py b/tasks/robotwin_2_0_stack_bowls_two-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_stack_bowls_two-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_stack_bowls_two-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_stamp_seal-standard/environment/sim/server.py b/tasks/robotwin_2_0_stamp_seal-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_stamp_seal-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_stamp_seal-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()
diff --git a/tasks/robotwin_2_0_turn_switch-standard/environment/sim/server.py b/tasks/robotwin_2_0_turn_switch-standard/environment/sim/server.py
index 26f4f5d81e..d9311e59fb 100644
--- a/tasks/robotwin_2_0_turn_switch-standard/environment/sim/server.py
+++ b/tasks/robotwin_2_0_turn_switch-standard/environment/sim/server.py
@@ -137,7 +137,10 @@ def finish(reason: str) -> None:
if not E["success"]:
try: E["success"] = bool(ENV.check_success())
except Exception: pass
- log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"])})
+ # rows: the journal rows the end belongs to. A resume keeps an end only if its rows are within the last checkpoint: an
+ # end logged by a call that was lost with a crash never happened (as the call itself)
+ log({"ev": "end", "reason": reason, "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1), "success": bool(E["success"]),
+ "rows": len(S._recording or [])})
write_final(); start_finalize()
@@ -539,19 +542,22 @@ def do_observe(meta: dict) -> tuple[dict, list]:
_frame_budget(cams, fps, seconds, depth)
except (TypeError, OverflowError, AttributeError, KeyError) as exc:
raise _bad_request(exc) from None
- rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True)
+ rec = Recorder(cams, fps, depth); before = int(S._sim_steps); rec.tick(force=True); succ = False
if seconds > 0 and not E["done"]:
LIVE.set_label(E["calls"] + 1, f"observe watch {seconds:g}s")
for _ in range(int(seconds * PHYS_HZ)):
S.step(); LIVE.tick(); rec.tick()
rec.tick(force=True); LIVE.end_call()
succ = bool(ENV.check_success()); E["success"] = E["success"] or succ
- if succ: finish("success")
E["calls"] += 1
out = {**meta_common(), "obs_id": E["calls"], "seconds": seconds, "physics_steps_watch": int(S._sim_steps) - before, "ok": True}
log({"ev": "observe", "call": E["calls"], "seconds": seconds, "cameras": cams, "physics_steps": int(S._sim_steps) - before})
if seconds > 0: save_call_evidence(E["calls"], {k: v for k, v in out.items() if k != "cameras"}, rec); flush_traj()
if seconds > 0: log({"ev": "checkpoint", "call": E["calls"], "step": E["step"], "rows": E.get("flushed", 0), "success": E["success"], "state_sha": S.state_sha()})
+ # the episode ends only after the checkpoint (as in do_submit): a crash before it loses the whole call, end included,
+ # and the agent watches again from the state before it; never a "done" whose success the resume cannot see
+ if succ: finish("success")
+ out["done"] = E["done"]; out["reason"] = E["reason"]
return out, rec.parts(video if seconds > 0 else ("frames" if video == "mp4" else video), fps)
@@ -662,9 +668,17 @@ def _resume_or_start() -> None:
E["calls"] = int(last.get("call", 0)); E["step"] = int(last.get("step", 0)); E["success"] = bool(last.get("success")); E["t0"] = float(starts[0]["ts"])
_first = [e for e in ev if e.get("ev") == "first_request"]
if _first: E["t_agent0"] = float(_first[0]["ts"])
- ended = [e for e in ev if e.get("ev") == "end"]
+ # the episode's end, if it is within the last checkpoint: an end past it was logged by a call lost with the crash (an
+ # end before 2026-10-14 carries no rows and is kept, as before)
+ ended = [e for e in ev if e.get("ev") == "end" and int(e.get("rows") or 0) <= n]
if ended: E["done"] = True; E["reason"] = ended[-1].get("reason"); E["t_end"] = float(ended[-1]["ts"]); E["episode_physics_steps"] = int(ended[-1].get("physics_steps") or n)
log({"ev": "resumed", "rows": n, "calls": E["calls"], "state_sha": S.state_sha(), "crashed_in_call": in_call, "downtime_s": round(time.time() - float(ev[-1]["ts"]), 1)})
+ if not E["done"] and E["success"]:
+ # the call that succeeded completed (its checkpoint holds the success) and the crash came before its end was
+ # logged: the episode ends here, as that call would have ended it (a success ends the episode)
+ E["done"] = True; E["reason"] = "success"; E["t_end"] = float(last.get("ts") or time.time()); E["episode_physics_steps"] = int(S._sim_steps)
+ log({"ev": "end", "reason": "success", "step": E["step"], "physics_steps": int(S._sim_steps), "elapsed_s": round(E["t_end"] - E["t0"], 1),
+ "success": True, "rows": n, "on_resume": True})
write_final()