The Soviets and the Japanese did indeed have a non-aggression pact in place, although the value of such pacts was certainly open to question at the time. Both sides honored their pact committments for the obvious reason that, as noted, they had their hands full elsewhere.
The Pact was not indefinite; it had an expiration date. There is some disagreement over whether the Soviets broke the pact when they declared war on Japan in August 1945. The terms of expiration were open to interpretation in that each side had a time period to declare a non-renewal of the pact, and the Soviets declared war during the non-renewal period. The Japanese would claim the declaration came during the term of the pact. However, given the circumstances of the timing of their declaration of war against the United States, history has not recognized Japan as an aggrieved party for the short Russo-Japanese War of 1945.
As for the visit of Molotov, he is an answer to one of my favorite history trivia questions: Name the only person to shake hands with Stalin, Hitler, Churchill, FDR, DeGaulle and Mao.
Did he not also have a cocktail named after him?
Trivial on the surface, but if you were to explore the circumstances of each greeting you would develop a decidedly untrivial picture of the course of events in the middle of the twentieth century.