Try RadiusNthSelector(-1) to select the largest radius (of the two <Z edges)
result = result.edges("<Z").edges(cq.selectors.RadiusNthSelector(-1)).fillet(0.5)
Another approach is to sketch the profile and use revolve:
import cadquery as cq
# Parameters
Dlow = 41.8 # Lower diameter
Dup = 37.8 # Upper diameter
Din_m39 = 30.0 # Inner diameter m39 thread
H = 5.0 # Height
D_upper_cylinder = 56.0 # Upper cylinder diameter
D_internal_upper_cylinder = 36.0 # Inner diameter for upper cylinder (M36 thread)
H_upper_cylinder = 6.0 # Height of the upper cylinder
D_top_cylinder = 42.0 # Top cylinder diameter ready for m42x1 thread
H_top_cylinder = 5.0 # Height of the top cylinder
D_hole = 35
pts = [
(D_hole / 2, 0),
(Dlow / 2, 0),
(Dup / 2, H),
(D_upper_cylinder / 2, H),
(D_upper_cylinder / 2, H + H_upper_cylinder),
(D_top_cylinder / 2, H + H_upper_cylinder),
(D_top_cylinder / 2, H + H_upper_cylinder + H_top_cylinder),
(D_hole / 2, H + H_upper_cylinder + H_top_cylinder),
]
sk1 = cq.Sketch().polygon(pts).vertices("<Y").vertices(">X").fillet(0.5)
result = cq.Workplane("XZ").placeSketch(sk1).revolve(360, (0, 0, 0), (0, 1, 0))