Skip to content

Improve Linear API timeout errors#15

Merged
dubscode merged 5 commits intomainfrom
issue-10
May 9, 2026
Merged

Improve Linear API timeout errors#15
dubscode merged 5 commits intomainfrom
issue-10

Conversation

@dubscode
Copy link
Copy Markdown
Contributor

@dubscode dubscode commented May 9, 2026

Adds richer Linear API error normalization so network, timeout, rate-limit, auth, and SDK errors surface stable machine-readable codes and details. Adds a global --timeout option, threads request abort signals through sessions and OAuth token fetches, and makes CLI exits drain output before terminating. Includes focused tests for timeout parsing and core error normalization.

Validation: pnpm verify passed after merging origin/main.

Copilot AI review requested due to automatic review settings May 9, 2026 04:40
@dubscode dubscode marked this pull request as ready for review May 9, 2026 04:41
# Conflicts:
#	packages/cli/src/index.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves how the CLI and core library handle Linear API/network failures by introducing richer, normalized error codes/details and threading configurable request timeouts through auth/session creation.

Changes:

  • Expanded normalizeError in linear-core to map SDK/network/timeout errors into stable LinearCoreError codes with machine-readable details.
  • Added a global --timeout CLI option (seconds) and propagated it into AuthManager.openSession() via abort signals.
  • Updated CLI entrypoint to drain stdout/stderr before exiting to reduce truncated output.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/linear-core/tests/core-error.test.ts Adds unit tests covering new error normalization mappings (SDK errors, abort/timeout, fetch causes).
packages/linear-core/src/errors/core-error.ts Implements richer error normalization and adds new LinearCoreErrorCode values.
packages/linear-core/src/auth/session.ts Adds timeout/signal support to sessions and threads abort signals into token refresh + SDK client creation.
packages/linear-core/src/auth/oauth.ts Threads abort signals through OAuth token exchange/refresh fetch calls.
packages/cli/tests/options.test.ts Extends global options tests to cover --timeout parsing and defaulting.
packages/cli/src/runtime/options.ts Adds timeoutMs to computed global options with a 30s default.
packages/cli/src/index.ts Registers --timeout flag and passes timeout into openSession calls.
packages/cli/src/bin/linear.ts Ensures CLI exits after draining stdout/stderr.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/cli/src/runtime/options.ts Outdated
Comment thread packages/cli/src/index.ts Outdated
Comment thread packages/linear-core/src/errors/core-error.ts Outdated
Comment thread packages/linear-core/src/errors/core-error.ts
Copilot AI review requested due to automatic review settings May 9, 2026 04:54
@dubscode dubscode merged commit 2733dbe into main May 9, 2026
7 checks passed
@dubscode dubscode deleted the issue-10 branch May 9, 2026 04:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Comment thread packages/cli/src/index.ts
Comment on lines 491 to 497
const openSessionForCommand = async (cmd: Command) => {
const globals = getGlobalOptions(cmd);
return authManager.openSession({ profile: globals.profile });
return authManager.openSession({
profile: globals.profile,
timeoutMs: globals.timeoutMs,
});
};
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

🎉 This PR is included in version 1.5.0-alpha.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants