SIGN IN SIGN UP

fix: use parentID matching instead of ID ordering for prompt loop exit and message rendering

When the client clock is ahead of the server, user message IDs (generated
client-side) sort after assistant message IDs (generated server-side).
This broke the prompt loop exit check and the UI message pairing logic.

- Extract shouldExitLoop() into a pure function that uses parentID matching
  instead of relying on ID ordering
- Extract findAssistantMessages() with forward+backward scan to handle
  messages sorted out of expected order due to clock skew
- Remove debug console.log statements added during investigation
- Add tests for both extracted functions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
M
Makonnen committed
abd9e195ace5eea8c52b543743b8ce1605f43fad
Parent: 46361cf
Committed by MakonnenMak <mmakonnen@nextdoor.com> on 2/20/2026, 6:20:10 PM