It is a side effect of what the the par builder considers to be valid breakpoints. The current approach is playing very safe but after looking at it Taco and I decided that it can be a more tolerant with respect to end dirs so the next luatex version will have that.
Anyway: You need to code carefully: the space after "TRT" in "\textdir TRT x" is meaningful so in your example you introduce spaces.
Thanks for the explanation. So the space after \textdir TLT is meaningful but the one after \lefttoright isn't. (I guess, I should have used \textdir TLT\relax. I'm going to use the high-level \lefttoright command from now on.) Also, in context don't use \textdir etc directly, just use \lefttoright and
\righttoleft in combination with \setupalign as I will not spend much time on side effects of interfering with these low level dir changers directly.
Great! You partly answered another question I meant to ask: what is the proper way to write \textdir and \pardir in CONTEXT? So \lefttoright and \righttoleft are replacements for \textdir TLT and \textdir TRT. How should I code in \pardir TRT in CONTEXT? I couldn't find anything for that in spac-ali.mkiv. Those low-level LuaTeX directives were part of an attempt to come to the core of a problem I'd run into with numbers at the end of a right-to-left line. The BiDi algorithm correctly gave left-to-right direction to that digit sequence and the result was that the word following the number had gone into the margin. —MHB