It could be anything, but given your story and symptoms my guess would be
the timing chain has jumped a tooth.
Newly rebuilt heads bolted onto a worn out bottom end is frequently a
recipe for trouble. You didn't mention how many miles were on the engine
before the first breakdown, but somehow I'd imagine on a '77 it was a lot.
With the heads already off, how much extra would it have cost to hone the
cylinders, re-ring it and put in new bearings, seals & timing gear &
chain? Perhaps a new cam while we're in there. Probably double the
original job but if you had done so, you would essentially have a brand
new motor except for the carbeurator.
It is also possible the "rebuilt" heads weren't fully rebuilt. Some
rebuilders will simply grind the valves & seats and put it back together
with all the original hardware (valves, springs, lifters, push rods,rocker
arms and keepers). I cannot imagine anyone putting newly rebuilt heads on
and not replacing the springs and lifters, but I'm sure it happens.