-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Bug Description
The LinearAdapter.refreshClientCredentialsToken() method hardcodes the OAuth scope to read,write,comments:create,issues:create — it does not include app:mentionable.
Steps to Reproduce
- Create a Linear OAuth app with client credentials enabled and agent session events enabled
- Install the app to a workspace with actor=app and scope=read,write,comments:create,issues:create,app:mentionable
- Confirm the app shows as "Agent" in Linear and appears in @mention autocomplete
- Start your server — the adapter calls refreshClientCredentialsToken() during initialize()
- Check Linear — the app has switched from "Agent" to "App" and is no longer @mentionable
Expected Behavior
The app should remain as "Agent" with app:mentionable capabilities after adapter initialization. The client credentials token request should include all scopes the app was installed with.
Actual Behavior
The adapter requests a client credentials token with only read,write,comments:create,issues:create (hardcoded on https://github.com/vercel/chat/blob/main/packages/adapter-linear/src/index.ts), omitting app:mentionable. This downgrades the app from Agent to App on every server restart/token refresh.
Additionally, AgentSessionEvent webhooks (required for app:mentionable apps) are silently ignored — the adapter only handles Comment and Reaction types.
Code Sample
Workaround — pre-fetch token with correct scopes and bypass the adapter's built-in token request:
const res = await fetch('https://api.linear.app/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: process.env.LINEAR_CLIENT_ID!,
client_secret: process.env.LINEAR_CLIENT_SECRET!,
scope: 'read,write,comments:create,issues:create,app:mentionable',
}),
})
const { access_token } = await res.json()
const bot = new Chat({
adapters: {
linear: createLinearAdapter({ accessToken: access_token }),
},
})Chat SDK Version
4.20.1
Node.js Version
No response
Platform Adapter
Linear
Operating System
macOS
Additional Context
The adapter also silently ignores AgentSessionEvent webhooks (required for app:mentionable apps). First-class support for Linear Agent Sessions (emitting activities via agentActivityCreate) would be valuable.