Claude Code 2.1.319, 2.1.322 and 2.1.325 can run the Stop hook before they
write the turn to the transcript. The hook then read the last turn's reply,
logged it a second time, and missed this turn's reply. That made
claude-session.test.mjs row 66 red in most runs.
The hook now reads the transcript again, for up to 2 s, until its last reply
matches last_assistant_message. If it never does, it checks
last_assistant_message alone with an empty entryId, never the last turn
again. (#1873, lane triage-followups)