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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/datasets/packaged_modules/json/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ def _generate_tables(self, base_files, files_iterables, original_files, allow_fu
for i, training_example in enumerate(training_examples):
if training_example["metadata"]["trace_type"] == "hermes":
timestamp = ujson_loads(lines[i])["started_at"]
milliseconds = timestamp if timestamp <= 10_000_000_000 else timestamp * 1_000
seconds = timestamp if timestamp <= 10_000_000_000 else timestamp / 1_000
sent_at = (
datetime.fromtimestamp(milliseconds, tz=timezone.utc)
datetime.fromtimestamp(seconds, tz=timezone.utc)
.isoformat(timespec="milliseconds")
.replace("+00:00", "Z")
)
Expand Down
12 changes: 12 additions & 0 deletions tests/packaged_modules/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ def assert_agent_traces_output(tmp_path, filename, rows, expected, num_sessions=
],
}

# Same session, but `started_at` expressed in milliseconds (e.g. JS `Date.now()`-style)
# instead of seconds -- the same real-world instant as HERMES_SESSION.
HERMES_SESSION_MS = {**HERMES_SESSION, "started_at": 1_780_665_768_307}


DROID_SESSION = [
{
Expand Down Expand Up @@ -721,6 +725,14 @@ def test_json_generate_tables_with_sorted_columns(file_fixture, config_kwargs, r
[HERMES_SESSION] * 2,
("hermes", "20260605_092247_d018ec", "Run pwd and date.", "2026-06-05T13:22:48.307Z", 1, 1),
),
pytest.param(
"hermes_ms.jsonl",
[HERMES_SESSION_MS],
# Same instant as the seconds-form "hermes" case above -- `started_at` is
# just expressed in milliseconds here.
("hermes", "20260605_092247_d018ec", "Run pwd and date.", "2026-06-05T13:22:48.307Z", 1, 1),
id="hermes-ms",
),
pytest.param(
"droid.jsonl",
DROID_SESSION,
Expand Down