The obligation that does not end
Almost no other country taxes its citizens on worldwide income by citizenship. The United States does. So the question is never whether you still file in the US — you do, every year, forever. The only question is whether you also file locally and how the two interact.
Add foreign account reporting if your overseas balances cross the thresholds, and whatever the country you live in requires.
What Article 18 decides
Income tax treaties allocate taxing rights between two countries. Pensions and social security usually sit in Article 18. Three patterns appear.
Residence country only. You live there, they tax it.
Both may tax, with relief. Portugal and Spain follow this pattern for social security: the residence state gives relief for what was paid to the other.
Exempt in both. Rare. The treaties with Israel and Romania do this for social security benefits.
The 183-day line
Most countries treat 183 days in a calendar year as the point at which you become tax resident. Some count on a rolling twelve months, and some have secondary tests — a permanent home available to you, a centre of main interests — that can make you resident sooner.
The complication: residence permits often require you to be physically present for a similar period. Spain wants 183 days to renew. You cannot hold the permit without crossing the tax line.
Totalization agreements are a different thing
These govern social security contributions, not income tax. They stop you paying into two systems for the same work and let you combine credits. If you are retired rather than working, they mostly do not affect you — and conflating them with tax treaties is the most common mistake in this subject.