@@ -34,7 +34,8 @@ def normalize_step(step: dict[str, Any]) -> dict[str, Any]:
3434 normalized = copy .deepcopy (step )
3535
3636 # Remove timestamp as it's non-deterministic
37- normalized .pop ("timestamp_ms" , None )
37+ normalized .pop ("timestamp_ms_before" , None )
38+ normalized .pop ("timestamp_ms_after" , None )
3839
3940 # Remove log_path from start_run function arguments as it's non-deterministic
4041 if "function" in normalized and normalized ["function" ]["name" ] == "start_run" :
@@ -127,16 +128,19 @@ def replay_logs(self, request, tmp_path_factory) -> tuple[Path, Path, Path]:
127128 else :
128129 call_args = function_call ["arguments" ]
129130
130- # Call the function and get the new state
131- current_state = client .send_message (function_call ["name" ], call_args )
132-
133- # Create Python log entry (use original arguments, not modified ones)
131+ # Create Python log entry
134132 log_entry = {
135- "timestamp_ms" : int (time .time_ns () // 1_000_000 ),
136133 "function" : function_call ,
134+ "timestamp_ms_before" : int (time .time_ns () // 1_000_000 ),
137135 "game_state_before" : game_state_before ,
138- "game_state_after" : current_state ,
139136 }
137+
138+ current_state = client .send_message (function_call ["name" ], call_args )
139+
140+ # Update the log entry with after function call info
141+ log_entry ["timestamp_ms_after" ] = int (time .time_ns () // 1_000_000 )
142+ log_entry ["game_state_after" ] = current_state
143+
140144 python_log_entries .append (log_entry )
141145
142146 # Write Python log file
0 commit comments