C172 flight instructor reported pattern traffic failed to follow clearance which resulted in an NMAC.
Synopsis
C172 flight instructor reported pattern traffic failed to follow clearance which resulted in an NMAC.
Narrative
Student and I were in the traffic pattern as I was teaching him landings. On our last loop in the traffic pattern; a student solo from a flight school in Aircraft Y. Aircraft Y (which will be referred to Aircraft Y) was cleared for takeoff to follow behind us in the left closed traffic. Student pilot read back instructions correctly from the Tower.Around XA:50; I noticed on 6DB's Garmin 375 (GPS/Transponder; also displays traffic) that Aircraft Y had started their turn potentially early. I gave it a quick minute to see if Aircraft Y was actually going to turn ahead of us. A second later the 375 reported that Aircraft Y was at our same altitude; and was turning towards us.At XA:51 several things happened at the same time; I took the controls from the student; executed a 360 degree turn. In the turn I spotted Aircraft Y within roughly a 100 feet at the same altitude; and the 375 alerted for traffic. I alerted the Tower that we were executing a 360 for spacing; and followed behind Aircraft Y. Tower apologized because it had appeared to him that Aircraft Y was going to follow us; and he sneezed at the wrong time. We requested a full stop landing at mid field; due to my lesson almost being completed.Student in Aircraft Y did a full stop; and we followed in behind them. On their full-stop; clear of Runway XX; they requested to taxi back to the ramp. The Tower cleared them '[Taxiway] 1; 2 to the ramp'. We kept a good distance away from Aircraft Y; and they pulled up to [Taxiway] 2; holding short of Runway XX. The Tower Controller asked Aircraft Y if they read back to taxi to the ramp. The student in Aircraft Y confirmed they read back to the ramp. Tower asked if they could make a 180 and return to the ramp. Student said 'unable; trying to complete three full landings and taxi backs for my solo'. Tower sighed and cleared them to takeoff again due to no one else in the pattern.The controller and I have a friendship; afterwards I messaged them and they mentioned they would not have let them takeoff if someone else had been inbound; or in the pattern.Upon shutdown; I noticed the flight school Instructor watching the student. My student went inside to fill out the book; and I approached the instructor to inform him what had happened. Instructor was apologetic; and very thankful I had told him what happened. He felt incredibly bad; mentioned he was lucky I was watching the situation and was thankful it was not worse. He said he would do more training with his student in Aircraft Y before letting them solo again.I believe that the student in Aircraft Y was very good at reading back instructions; however; did not fully know what they meant. He did not have us in sight before turning and almost caused a midair collision. The instructor should not have soloed the student.Sadly; there is not much I think I could have done to prevent this from occurring. I think I did the necessary steps to avoid a collision with Aircraft Y and I am happy with my reaction skills. Potentially I could have radioed and asked Aircraft Y their intentions; but I like how I accomplished things. Aviate; navigate; communicate.
Source: NASA Aviation Safety Reporting System (public domain). Reports are voluntary submissions and are not verified by NASA.