openai / openai/codex-security

Linear project import can loop after the first page of issues

Open Beginner friendly
#516 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
10.8k
Forks
801
Avg merge
1d 8h
Merged PRs (30d)
257

Description

Summary

Importing issues from a Linear project can loop indefinitely when the project has more than one page of matching issues.

Root cause

importLinearIssues() fetches the first 50 project issues and then does:

const page = await projects.nodes[0]!.issues({ first: 50, filter });
while (page.pageInfo.hasNextPage) await page.fetchNext();
issues.push(...page.nodes);

The Linear SDK pagination API returns the next connection from fetchNext(); the caller is expected to use that returned connection. The current code discards it and continues checking page.pageInfo.hasNextPage on the original first page.

If that first page reports hasNextPage: true, the loop can repeatedly request the same next page without ever advancing page. Even if an SDK implementation happened to mutate internal state, only the original page's nodes are appended after the loop, so relying on mutation would make the collection semantics ambiguous.

Linear's SDK documentation shows the intended pattern explicitly:

const issues = await linearClient.issues({ first: 10 });
const nextIssues = await issues.fetchNext();

Expected behavior

Accumulate the current page's nodes, assign the result of fetchNext() as the next current page, and stop when that page reports no next page.

Impact

--linear-project intake can hang for projects whose filter matches more than 50 issues, instead of importing the complete project issue set.

Suggested fix

Advance through returned connection objects explicitly and add a mock pagination regression that proves the second page is consumed exactly once.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at importLinearIssues, the pagination loop used by --linear-project, and review the Linear SDK fetchNext pattern described in the issue. Add the mock pagination regression so the returned second page is consumed exactly once and all matching project issues are imported without hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.