Cannabinoids have the sad characteristic to store in body’s fat tissue. When you have a bodily strain, cannabinoids are to come off the fat tissue.
I myself have been tested positive after seven weeks clean when I was in detox and rehab. the eighth week test was clean.
I., same as you, was a heavy smoker until one day before I went into clinical detox, and on the seventh week test I had a bicycle tour the day before, probably getting some of my fat tissue burned and therefore making my test come up positive for the test.
I have yet to read someone had been positive ffor longer. so I believe ( no actual proof!!) that after the eight weeks/two months mark you should be squeaky clean like freshly washed dishes.
All the best