Skip to content

feat(linear): expose agent webhook triggers#126

Merged
khaliqgant merged 2 commits into
mainfrom
codex/linear-agent-webhooks
May 27, 2026
Merged

feat(linear): expose agent webhook triggers#126
khaliqgant merged 2 commits into
mainfrom
codex/linear-agent-webhooks

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • add Linear agent webhook events to supportedEvents() and the generated trigger catalog
  • normalize provider-verbatim AgentSessionEvent/AppUserNotification/PermissionChange/OAuthApp event names
  • add synthetic trigger paths and adapter ingest coverage for Linear agent webhooks

Validation

  • npm test --workspace @relayfile/adapter-linear
  • npm run typecheck --workspace @relayfile/adapter-linear
  • node --import tsx --test packages/core/tests/triggers/catalog-generator.test.ts (with unrelated untracked Granola mapping temporarily moved aside and restored)

Follow-up

  • Release @relayfile/adapter-linear after merge so Cloud can consume the new exports from the registry.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Warning

Review limit reached

@khaliqgant, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 11 minutes and 26 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c14a62e0-4012-40c4-9a3c-c549b9ccc030

📥 Commits

Reviewing files that changed from the base of the PR and between 48e1d5a and c134855.

📒 Files selected for processing (11)
  • packages/core/src/triggers/catalog.generated.json
  • packages/core/src/triggers/catalog.generated.ts
  • packages/core/tests/triggers/catalog-generator.test.ts
  • packages/linear/src/__tests__/linear-adapter.test.ts
  • packages/linear/src/__tests__/path-mapper.test.ts
  • packages/linear/src/__tests__/types.test.ts
  • packages/linear/src/__tests__/webhook-normalizer.test.ts
  • packages/linear/src/linear-adapter.ts
  • packages/linear/src/path-mapper.ts
  • packages/linear/src/types.ts
  • packages/linear/src/webhook-normalizer.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/linear-agent-webhooks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for Linear agent webhook events, including AgentSessionEvent, AppUserNotification, PermissionChange, and OAuthApp. It updates the trigger catalog, webhook normalizer, path mapper, and the Linear adapter to process these events, and adds comprehensive unit tests. The review feedback highlights a potential file/directory conflict in linearAgentWebhookEventPath when objectId is missing, suggesting it should return null instead of the directory root, along with a corresponding test update.

Comment on lines +258 to +269
export function linearAgentWebhookEventPath(eventType: string, objectId?: string | null): string | null {
if (!LINEAR_AGENT_WEBHOOK_EVENTS.includes(eventType as (typeof LINEAR_AGENT_WEBHOOK_EVENTS)[number])) {
return null;
}
const category = linearAgentWebhookCategory(eventType);
if (!category) {
return null;
}
const root = LINEAR_AGENT_WEBHOOK_PATH_ROOTS[category];
const id = objectId?.trim();
return id ? `${root}/${encodeLinearPathSegment(id)}.json` : root;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Returning the directory root (root) when objectId is missing or empty can lead to file/directory conflicts in the virtual file system (VFS) or physical file system. Since other events under the same category will write to paths like ${root}/${id}.json, writing directly to ${root} as a file will fail or prevent subsequent writes to files within that directory.

Instead, we should require a non-empty objectId and return null if it is missing or empty.

Suggested change
export function linearAgentWebhookEventPath(eventType: string, objectId?: string | null): string | null {
if (!LINEAR_AGENT_WEBHOOK_EVENTS.includes(eventType as (typeof LINEAR_AGENT_WEBHOOK_EVENTS)[number])) {
return null;
}
const category = linearAgentWebhookCategory(eventType);
if (!category) {
return null;
}
const root = LINEAR_AGENT_WEBHOOK_PATH_ROOTS[category];
const id = objectId?.trim();
return id ? `${root}/${encodeLinearPathSegment(id)}.json` : root;
}
export function linearAgentWebhookEventPath(eventType: string, objectId?: string | null): string | null {
if (!LINEAR_AGENT_WEBHOOK_EVENTS.includes(eventType as (typeof LINEAR_AGENT_WEBHOOK_EVENTS)[number])) {
return null;
}
const category = linearAgentWebhookCategory(eventType);
if (!category) {
return null;
}
const root = LINEAR_AGENT_WEBHOOK_PATH_ROOTS[category];
const id = objectId?.trim();
return id ? `${root}/${encodeLinearPathSegment(id)}.json` : null;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in c134855: linearAgentWebhookEventPath now returns null when objectId is missing or empty, avoiding root file/directory conflicts.

linearAgentWebhookEventPath('OAuthApp.revoked', 'oauth_client_123'),
'/linear/oauth-app/oauth_client_123.json',
);
assert.equal(linearAgentWebhookEventPath('OAuthApp.revoked'), '/linear/oauth-app');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Update the test to assert that linearAgentWebhookEventPath returns null when objectId is missing, to align with the safety improvement.

Suggested change
assert.equal(linearAgentWebhookEventPath('OAuthApp.revoked'), '/linear/oauth-app');
assert.equal(linearAgentWebhookEventPath('OAuthApp.revoked'), null);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in c134855: updated the test expectation so OAuthApp.revoked without an object id returns null.

@khaliqgant khaliqgant merged commit 8e4d39d into main May 27, 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