fix: use cursor-based tracking in wait to catch pre-existing messages - #2
Merged
Conversation
baby-joel
approved these changes
Mar 10, 2026
baby-joel
left a comment
Contributor
There was a problem hiding this comment.
Looks great! Clean implementation of the cursor-based approach. The edge case handling is solid:
- cursor=0 (new agent) → start from current position, avoids dumping entire history
- cursor>total (truncated) → reset to current
One note: the poll loop still compares against $cursor (the initial value), not a refreshed cursor. That's fine since cursor only changes on exit here, but worth noting for future readers.
Our PRs overlap on the @mention grep removal — yours drops it in the poll loop, mine drops it everywhere + makes --for optional. We'll need to coordinate the merge. I'd suggest merging yours first since it's the more fundamental fix, then I'll rebase mine on top.
Approved! 🤝
4 tasks
wait previously snapshot line count at invocation, missing messages sent between the last read and the start of wait. Now uses the agent's cursor (last-read position) so unread messages are delivered immediately. Also removes @-mention filtering from the poll loop — any new message wakes the wait. Edge cases handled: - cursor=0 (first wait): start from current position, don't dump history - cursor > total (truncated chat): reset to current position
zeke-ricon
force-pushed
the
fix/wait-cursor
branch
from
March 10, 2026 16:40
cb91acf to
a75477b
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
waitpreviously snapshot the current line count at invocation, so messages sent between the lastreadand the start ofwaitwere invisible — the core "missed messages" bugchat_get_cursor) so unread messages are delivered immediately without entering the poll loop@agentmention filtering from the poll loop — any new message wakes the wait (complements fix: use cursor-based tracking in wait to catch pre-existing messages #2 /fix/wait-without-mention)chat_set_cursorso messages aren't re-deliveredEdge cases
wait, never read): starts from current position, doesn't dump historyTest plan
waitstarts → should be delivered immediately onwaitwaitpoll loop → should wake and deliverwaitdoesn't re-deliver the same messagesAll four scenarios tested locally ✅
🌀 Magic applied with Wibey CLI 🪄 (https://wibey.walmart.com/cli)