-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix(slack): swapped checkpoint index #5427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR fixes a critical bug in the Slack connector's checkpoint handling that was causing incorrect message retrieval boundaries during incremental indexing. The fix involves two key corrections in the _get_all_doc_ids
method:
- Line 840: Changed
latest = channel_message_ts
tooldest = channel_message_ts
when loading from checkpoint - Line 858: Changed
message_batch[-1]["ts"]
tomessage_batch[0]["ts"]
when determining the new checkpoint timestamp
The root cause was a misunderstanding of Slack's API behavior and checkpoint semantics. Slack's API returns messages from newest to oldest, so when resuming from a checkpoint, the stored timestamp represents the oldest message previously processed. The connector should continue from this point by setting oldest = channel_message_ts
, not latest
. Similarly, when updating the checkpoint for the next run, it should use the timestamp of the first (newest) message in the batch, not the last (oldest).
This bug would have caused either message gaps (missing messages between runs) or duplicates during incremental indexing, which is critical for maintaining search index consistency. The fix aligns the implementation with the documented API behavior and ensures proper checkpoint-based message retrieval.
Confidence score: 5/5
- This PR is extremely safe to merge with virtually no risk of causing issues
- Score reflects a simple but critical bug fix with clear logic and minimal scope of change
- No files require special attention as the changes are straightforward and well-targeted
1 file reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
Description
[Provide a brief description of the changes in this PR]
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.