After a marathon of impassioned speeches, behind-the-scenes political maneuvering and an 11th-hour filibuster, Massachusetts legislators were unable Thursday to reach an agreement on gay marriage and shelved the issue for a month.