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
21e7f3f5c134b27d9b52708ecb1f81bebd24c820
Parent: 8a8f7b3
Committed by MakonnenMak <mmakonnen@nextdoor.com> on 4/2/2026, 12:25:54 AM