fix: advance log cursor when next_page is null in follow mode#19
Merged
fix: advance log cursor when next_page is null in follow mode#19
Conversation
When `followLogs` polled for logs and the API returned items with `next_page: null` (no more pages available yet), the cursor stayed unchanged. On the next poll iteration the same logs were re-fetched and reprinted. Fix by advancing cursor by the number of items received when next_page is absent. Fixes BUG-1930
Verifies that `job-runs logs --follow` prints each log line exactly once when the API returns items with next_page=null, preventing the re-print regression.
kcheng486
approved these changes
Apr 8, 2026
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
job-runs logs <id> --followreprinted all logs from the current cursor on every poll when the API returnednext_page: null, instead of only printing new lines.followLogsonly advanced the cursor whennext_pagewas present and non-null. When the API had no more pages (null), the cursor stayed unchanged, causing the same logs to be re-fetched and reprinted on the next iteration.next_pageis absent, so subsequent polls start after already-printed lines.Commits
fix: advance log cursor when next_page is null in follow mode— the one-line fix infollowLogstest: add regression test for follow-logs cursor advancement— verifies each log line is printed exactly onceTesting
TestJobsLogsFollowDoesNotReprintWhenNextPageNullcovers the exact scenariomake test)Fixes BUG-1930