Skip to content

feat(linear): add team-scoped issue adapter (DEV-59) - #8

Merged
developjik merged 9 commits into
mainfrom
feat/dev59-linear-adapter
Nov 24, 2026
Merged

developjik merged 9 commits into
mainfrom
feat/dev59-linear-adapter

Conversation

@developjik

@developjik developjik commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add an opt-in Linear tracker implementing the existing IssueAdapter interface.
  • Keep numeric issue IDs scoped to an explicit team key, map completed/canceled to closed, and preserve the GitHub default.
  • Connect CLI status, next, claim, handoff, block and resolve to Linear labels and comment records. Dashboard serve remains GitHub/demo-only.
  • Use fixed-endpoint GraphQL variables, a 15-second deadline, bounded responses and pagination, redacted upstream errors and no automatic write retries.
  • Resolve standalone ball label IDs and use additive/removal fields so unrelated labels survive. Verify writes by readback. No workflow-state or assignee changes.

Verification

  • 178 tests pass, including 15 new adapter/transport/CLI tests.
  • Typecheck, CLI build, web build and diff checks pass on Node 22.18.
  • Local simulated GraphQL acceptance exercises the real CLI, engine, advisory lock, handoff comment, label readback and next output. No live workspace handoff, credentials, package publication or deployment was used.

Limits

  • Pre-create ungrouped, unambiguous ball labels. No automatic label creation or OAuth setup.
  • Issue lists cap at 2,000; comment lock views over 2,000 fail closed; label views/catalogs over 250 fail closed.
  • Advisory comment leases are not CAS. A timed-out write may have landed, so inspect before retrying.

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.


Devin Review

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T15:46:59.274544Z
We couldn’t complete this review. Comment @codex review to try again.
ffc8545 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 4 potential issues.

Devin Review

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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 기본 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개가 여러 페이지에 걸쳐 정상 조회되는 테스트를 추가하세요.

Suggested change
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 });

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +115 to +118
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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 인수인계로 댓글 한도에 도달한 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개에서 각각 최종 댓글 수와 후속 조회를 검증하는 테스트를 추가하세요.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +17 to +19
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 } };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 실제 Linear에서 잠금·기록의 HTML 주석 보존 확인 필요

테스트는 댓글 본문을 그대로 저장해 반환합니다. 실제 Linear에서 댓글을 작성한 뒤 다시 조회해 잠금과 인수인계 기록의 HTML 주석을 파서가 읽을 수 있는지 확인하세요.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +94 to +98
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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: 댓글 조회마다 이미 읽은 이슈를 다시 요청

목록을 읽는 엔진은 이슈 메타데이터를 받은 뒤 댓글을 요청합니다. 이슈 100개의 댓글이 각각 한 페이지라면, 목록 요청을 제외하고도 댓글 조회와 중복 이슈 조회에 200번의 호출이 필요합니다.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@developjik
developjik merged commit 0419ec9 into main Nov 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant