Skip to content

Conversation

@ralfschimmel
Copy link

Summary

Fix crash when transforming issues that contain comments with user: null.

Problem

When running linearis issues update (or read) on an issue that has comments created by Linear's Agent Protocol, the CLI crashes with:

Cannot read properties of null (reading 'id')

Stack trace:

TypeError: Cannot read properties of null (reading 'id')
    at GraphQLIssuesService.doTransformIssueData (graphql-issues-service.js:577:38)

Root Cause

Linear's Agent Protocol creates system comments (e.g., "This thread is for an agent session with bobbin.") where user is null. The transform code at line 889-892 assumes comment.user always exists:

user: {
  id: comment.user.id,      // Fails when comment.user is null
  name: comment.user.name,
},

Example Data That Fails

From the raw API response, these comments have user: null:

{
  "id": "ec4c235a-f2f3-4650-abfa-587bb51610ef",
  "body": "This thread is for an agent session with bobbin.",
  "createdAt": "2025-12-28T12:13:47.400Z",
  "updatedAt": "2025-12-28T12:18:06.594Z",
  "user": null
}

Fix

  1. Made user optional in LinearComment interface (user?: instead of user:)
  2. Added null-check in transform, following the same pattern used for assignee:
user: comment.user
  ? {
      id: comment.user.id,
      name: comment.user.name,
    }
  : undefined,

Testing

After the fix, issues with agent protocol comments are processed correctly. Comments with null users simply omit the user field in the output.

🤖 Generated with Claude Code

Ralf Schimmel and others added 3 commits December 15, 2025 09:50
Add support for managing issue relationships through a new `issues relations`
subcommand group. This enables tracking dependencies between issues, which is
essential for AI agents that need to understand task ordering and blockers.

New commands:
- `issues relations list <issueId>` - List all relations for an issue
- `issues relations add <issueId> --blocks|--related|--duplicate|--similar <ids>`
- `issues relations remove <relationId>` - Remove a relation by UUID

Features:
- Support for all Linear relation types: blocks, related, duplicate, similar
- Comma-separated IDs for adding multiple relations at once
- Human-friendly ID resolution (TEAM-123 format)
- Relations included in `issues read` output
- Both outgoing and inverse relations combined in output

Technical details:
- Optimized GraphQL queries with new ISSUE_RELATIONS_FRAGMENT
- Proper validation for null/undefined nested relation data
- UUID validation for relation removal
- Partial success reporting when batch relation creation fails
- Comprehensive unit tests (23 tests) and integration tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add read, create, update, and archive commands to the projects CLI:
- projects list: Migrated from SDK to GraphQL with --include-archived option
- projects read: Get project details including milestones and issues
- projects create: Create project with required team and optional fields
- projects update: Update any project field with --clear-* flags for nullables
- projects archive: Soft-delete a project

Implementation follows existing patterns from project-milestones.ts:
- GraphQL queries with fragments for optimization
- Name-based ID resolution with multiple match handling
- Type definitions for command options
- Integration tests for all commands

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Linear's agent protocol can create system comments with user: null.
Add null-check to prevent "Cannot read properties of null" error
when transforming issues with such comments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@ralfschimmel
Copy link
Author

Closing - will resubmit with only the bugfix commit (accidentally included unrelated feature commits)

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