fix(sdk): advance Linear pagination connections - #811
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Correct pagination ownership. fetchNext() returns the successor connection, so advancing the connection variable and consuming each page before fetching the next one avoids both the first-page loop and dropped terminal-page nodes. Applying the same traversal to comments is important because incomplete comment evidence can change the security context even when issue enumeration itself is correct. The immutable page fixtures are a good regression because they no longer accidentally mask the bug through in-place mutation.
Fixes #516
Reproduction
When a Linear project has more than one page of matching issues, the first connection reports
pageInfo.hasNextPage: true, butfetchNext()returns the next connection. The current code discards that return value and keeps checking the first page, so the import can loop indefinitely.The same discarded-connection pattern also affected paginated issue comments.
Expected behavior
Advance through each returned Linear connection and import every page exactly once.
Actual behavior
The project import repeatedly fetches from the original first page and never reaches the terminal page when the SDK returns a new connection object.
Root cause
Both pagination loops awaited
fetchNext()without assigning its returned connection, then read only the original connection's nodes.Fix
Consume the current page before assigning the connection returned by
fetchNext(). Apply the same traversal to issue comments so imported evidence is complete.Validation
bun test --timeout 30000 ./tests-ts/cli-skills.test.ts: 30 passedtsc --noEmit: passedgit diff --check origin/main...HEAD: passedThe branch was based on and tested against the latest upstream
mainatf9b686a6.