Repository navigation
feat(linear): add team-scoped issue adapter (DEV-59) - #8
Conversation
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| if (query.labels?.length) filter.and = query.labels.map(name => ({ labels: { some: { name: { eq: name } } } })); | ||
| const rows: AdapterIssue[] = []; let after: string | null = null; | ||
| while (rows.length < limit) { | ||
| const data = await this.request(`query BallIssues($filter: IssueFilter!, $first: Int!, $after: String) { issues(filter: $filter, first: $first, after: $after) { nodes { ${FIELDS} } ${PAGE} } }`, { filter, first: Math.min(100, limit - rows.length), after }); |
There was a problem hiding this comment.
🔴 기본 Linear 상태·작업 조회 실패
기본 status와 next는 이슈 100개에 각각 라벨 250개를 요청합니다. Linear는 요청한 페이지 크기로 복잡도를 계산하므로, 팀에 이슈가 적어도 첫 요청이 한도를 초과해 두 명령이 실패합니다.
Learn more
상태 명령과 다음 작업 명령은 별도 설정이 없으면 둘 다 이슈 100개를 요청합니다. 공통 이슈 필드는 이슈당 라벨을 최대 250개 요청합니다. Linear의 복잡도 규칙에 따르면 연결의 비용은 요청한 페이지 크기를 곱해 계산하며, 쿼리 하나의 한도는 10,000점입니다. 라벨 객체와 두 필드만 계산해도 100 × 250 × 1.2 = 30,000점입니다. CLI 통합 테스트의 모의 응답은 이 복잡도 제한을 적용하지 않습니다.
Example: 열린 이슈가 하나뿐인 DEV 팀에서 agent-ball status --tracker linear --team DEV를 실행해도 요청의 first는 100이므로 첫 페이지가 거부됩니다.
Recommended fix: 이슈의 페이지 크기를 25개로 낮춰 쿼리당 복잡도를 제한하고, 기존 커서 루프로 요청한 전체 개수를 채우세요. 기본 한도 100개가 여러 페이지에 걸쳐 정상 조회되는 테스트를 추가하세요.
| const data = await this.request(`query BallIssues($filter: IssueFilter!, $first: Int!, $after: String) { issues(filter: $filter, first: $first, after: $after) { nodes { ${FIELDS} } ${PAGE} } }`, { filter, first: Math.min(100, limit - rows.length), after }); | |
| const data = await this.request(`query BallIssues($filter: IssueFilter!, $first: Int!, $after: String) { issues(filter: $filter, first: $first, after: $after) { nodes { ${FIELDS} } ${PAGE} } }`, { filter, first: Math.min(25, limit - rows.length), after }); |
Was this helpful? React with 👍 or 👎 to provide feedback.
| async deleteComment(issue: number, commentId: string): Promise<void> { | ||
| // Only delete a comment observed on this issue, never a cross-team arbitrary UUID. | ||
| if (!(await this.listComments(issue)).some(c => c.id === commentId)) throw new AdapterError('Linear comment is not on the configured issue'); | ||
| const data = await this.request('mutation BallDelete($id: String!) { commentDelete(id: $id) { success } }', { id: commentId }); |
There was a problem hiding this comment.
🔴 인수인계로 댓글 한도에 도달한 Linear 이슈의 조회 불가
댓글이 1,999개인 이슈를 인수인계하면 잠금과 기록이 추가돼 2,001개가 됩니다. 잠금 삭제에도 전체 댓글 조회가 필요해 한도에 막힙니다. 인수인계는 성공을 반환하지만, 댓글을 직접 지우기 전까지 이슈를 읽을 수 없습니다.
Learn more
인수인계 엔진은 잠금 댓글을 먼저 추가하고 이슈를 다시 읽습니다. 기록 저장과 정리는 소유권 변경 후 기록 댓글을 추가하고 마지막에 잠금을 지웁니다. 잠금 삭제도 댓글 전체 조회를 거치므로 댓글이 2,001개가 되는 순간 삭제 API에 도달하지 못합니다. 잠금 해제는 삭제 오류를 무시하므로 인수인계는 성공을 반환합니다. 처음부터 댓글이 2,000개라면 잠금 획득이 잠금 댓글을 추가한 뒤 전체 조회에서 실패하고, 엔진은 해제할 잠금을 받지 못합니다. 두 경우 모두 시간이 지나 잠금이 만료되어도 댓글 수는 줄지 않습니다.
Example: DEV-12에 댓글이 1,999개 있을 때 사람에게서 Codex로 공을 넘기면 소유권과 기록은 저장됩니다. 잠금 댓글을 삭제하지 못해 총 2,001개가 남고, 다음 인수인계는 첫 조회에서 실패합니다.
Recommended fix: 댓글 전체 조회 대신 Linear의 GraphQL comment 쿼리 등으로 삭제할 댓글의 소속 이슈 UUID를 직접 검증하세요. 잠금을 게시하기 전에 2,000개 한도에 이미 도달한 이슈는 변경 없이 거부하고, 잠금 게시 후 전체 조회가 실패하는 경로에서도 해당 잠금을 정리하세요. 1,999개와 2,000개에서 각각 최종 댓글 수와 후속 조회를 검증하는 테스트를 추가하세요.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if (query.includes('mutation BallComment(')) { | ||
| const c = { id: `comment-${++seq}`, body: v.input.body, createdAt: time, user: { name: 'test' }, url: null }; | ||
| comments.push(c); return { commentCreate: { success: true, comment: c } }; |
| async listComments(issue: number): Promise<AdapterComment[]> { | ||
| const raw = await this.rawIssue(issue); | ||
| const rows: AdapterComment[] = []; let after: string | null = null; | ||
| for (let page = 0; page < 20; page++) { | ||
| const data = await this.request(`query BallComments($id: String!, $after: String) { issue(id: $id) { comments(first: 100, after: $after) { nodes { ${COMMENT} } ${PAGE} } } }`, { id: raw.id, after }); |
There was a problem hiding this comment.
📝 Info: 댓글 조회마다 이미 읽은 이슈를 다시 요청
목록을 읽는 엔진은 이슈 메타데이터를 받은 뒤 댓글을 요청합니다. 이슈 100개의 댓글이 각각 한 페이지라면, 목록 요청을 제외하고도 댓글 조회와 중복 이슈 조회에 200번의 호출이 필요합니다.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Verification
Limits
Refs DEV-59. API behavior checked against the official GraphQL guide and current SDK schema. The live Linear handoff acceptance condition still requires an authorized disposable test issue, not an existing work item.