How does one calculate effects of damage over time if one is taking a long rest?

In a particular adventure, the air in the lower levels is poisoned, causing 1d6 poison dmg every hour.

If a party take a long rest in such an environment, how do you calculate the cumulative effects of the poison air damage over time in combination with the restorative effects of the long rest?

PHB pg 186 At the end of a long rest, a character regains all hit points.

Does this mean, RAW, the characters take 8d6 damage during the long rest, but then ‘wake up’ at full HP? If after the nth hour, they drop to 0HP and start rolling Death Saves, if they save, and make it to 8hr, they wake up full HP?

Seems like it shouldn’t work that way but I can’t find any suggestion in the books it would be otherwise.