Not aggression, but necessary defense
Today, even professional historians prefer not to recall that in September 1939, even the most stubborn anti-communist Winston Churchill did not protest against the Liberation Campaign of the Red Army in ex-eastern Poland. Moreover, Soviet and Polish troops actually jointly defended Lviv from German units!

Such precedents for a joint struggle against the Nazis were, of course, rare, although the common enemy, as you know, unites. Now no one remembers that Poland and the USSR even before the start of not only the Liberation Campaign, but also the German invasion, nevertheless discussed the question of how the Red Army should enter the war, if it comes to it.
It was planned that Poland would have to provide corridors for the passage of red troops to the front line, including through the territory of the Vilno district and in the vicinity of Lviv. It is clear that after the pact that the USSR and Germany managed to conclude, the issue of the “pass” was removed by itself. It is also clear that no one would have given any orders from the very top to fight against the Germans to either the Poles or the Soviet troops.
However, the largest joint military operation, which is slightly lower, was successfully carried out near the walls of Lviv by failed allies. The Russians fought side by side with the Poles, already knowing that the authorities of the Pansky Poland did not just emigrate to Romania, but they themselves had already “written off” Lviv and its environs to the zone of Soviet military-political responsibility.

Nevertheless, already in September 1939 in the former eastern Poland, the leadership of the German Reich planned to create a whole series of puppet "states". It was about independent Galicia and Volhynia, and even some Transcarpathian Slavic autonomy. Moreover, the calculation in the traditionally controversial region was clearly made for their expansion during the future war with the USSR.
It seems that one can rightfully agree with the assessment of the Belarusian president Alexander Lukashenko of the events of eighty years ago. He expressed it ten years ago, on 17 of September 2009:
“On 17 of September 1939, the Red Army launched a campaign of liberation, the purpose of which was to protect the Belarusian and Ukrainian population left to their fate in Poland under German invasion and the outbreak of World War II. This not only strengthened the security of the USSR, but also became an important contribution to the struggle against fascist aggression. "
Since then, the position of Belarus, despite all the somersaults of the current political situation, has not changed at all. But one cannot help but recall that the point of view of the British Prime Minister Churchill, expressed as early as the beginning of December 1939, was much more specific:
“Russia pursues a cold policy of protecting its own interests. Therefore, to protect Russia from the Nazi threat, it was clearly necessary for the Russian armies to stand on the line that arose. ”

Regarding the concrete real British actions in September 1939, Churchill noted:
“... On September 4, the British Air Force (10 bombers) raided Kiel, in which half of our planes were lost, had no results. ... Then they confined themselves to scattering leaflets calling for German morality. The repeated requests by the Poles for specific military assistance remained unanswered, and in some cases they were simply misinformed. ”

Drawing borders
The active actions taken by the USSR on 17 of September were also due to the fact that, as it became known, on 12 of September 1939, at a meeting in Hitler's train, short-term and medium-term prospects for Poland were discussed. It was also about the fate of the Ukrainian population and, in general, about a new line of German-Soviet contact.
It was noted that on the border with the USSR, with the expectation of an inevitable future conflict with this power, it is necessary to create a loyal Reich "laying state": first Ukraine (in the beginning on the territory of ex-Polish Galicia and Volhynia), and then "Polish" "Quasi-state. Along with the implementation of these projects, Germany planned to strengthen its dependence on Germany, not only Lithuania, but also two neighboring Baltic states - Latvia and Estonia.
Moreover, it was clearly recognized that Lviv will be a political stronghold in the phased implementation of these plans through, first of all, the OUN (see, for example, "Martin Broszat's Nationalsozialistische Polenpolitik 1939 — 1945", Stuttgart, 1961). Obviously, such projects, due to geography, directly concerned the security and integrity of the USSR.

Residents of Lviv, the Soviet "occupation" is clearly not upset
Regarding Lviv, the situation, according to Soviet and Polish documents of that period, developed as follows: around 6: 30 in the morning of 19 September, the commander of the Polish garrison in Lvov, Colonel of the General Staff, arrived at the commander of the 24 brigade, Colonel P. Fomchenkov (his headquarters at the eastern outskirts of Lviv) B. Rakovsky, with him two colonels and three majors.
The brigade commander proposed to surrender the city of Lviv to Soviet troops. The chief of staff of the garrison asked to wait, as he should receive an order from above. All this was given 2 hours. The commander of the 24th brigade (ltbr) also demanded that Tankslocated in the city and on the outskirts, continued to remain in their places. But, in view of the data of Soviet military intelligence, he allowed the Poles to occupy points in the city to observe the German positions, which were half-ring adjacent to the city.
Such a decision by Fomchenkov was one hundred percent justified. For already in 8: 30. on the same day, the Germans, who came to Lvov on the 16 of September, unexpectedly launched an attack on the city districts occupied not only by Polish, but also by Soviet troops. By that time, it was the latter that controlled already up to 70% of its territory. The Polish troops took the battle, and the Soviet tanks and armored vehicles of the 24 ltbr reconnaissance battalion were first between the warring parties.
By order of the brigade command, agreed with Moscow, Soviet tankmen opened fire on the Germans, joining the Poles. By the evening of September 19, the German attack was repelled. The losses of the 24 Brigade were two armored vehicles and one tank, three were killed and four people were injured. In addition, on the battlefield at the location of the brigade there were two German tanks wrecked by the Poles.

Similar excesses of a smaller scale were in the Grodno region, near the town of Kolomyia in southern Galicia west of Lutsk. After that, the Polish troops there, who repelled the German attacks together with the Soviet units, were captured by the Red Army (south of the neighboring Romanian Kolomyia - and Romanian). Although the German military insisted on their transfer to German captivity.
It is possible that the events mentioned, especially in Lviv, were a deliberate German provocation in order to seize the whole of Galicia and, possibly, even then start a war with the USSR. Obviously, they were no longer afraid of a stab in the back from France and England in Berlin.
It is noteworthy that it was in its Lviv region that there were large oil reserves, on the basis of which local oil refining worked, which clearly attracted the Germans. But to prevent the German invasion, which, by the way, contradicted the notorious Ribbentrop-Molotov pact, Soviet and Polish troops were able to work together.