Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

📝 docs(integrations): add GitHub and Linear integration guides (#21199)

Rdmclin2a29809c69b3c
diff --git a/docs/usage/integrations/github.mdx b/docs/usage/integrations/github.mdx
new file mode 100644
index 00000000000..de1d394544e
--- /dev/null
+++ b/docs/usage/integrations/github.mdx
@@ -0,0 +1,103 @@
+---
+title: GitHub Integration
+description: >-
+ Connect the LobeHub GitHub App so pull requests opened by your Agents are
+ tracked, merges accept their deliveries, and failing checks or review
+ feedback go back to the Agent that opened the pull request.
+tags:
+ - LobeHub
+ - Integration
+ - GitHub
+ - Pull Request
+ - CI
+ - Code Review
+---
+
+# GitHub Integration
+
+**The GitHub Integration connects your Agents' pull requests to what happens on GitHub.** Once the LobeHub GitHub App is installed on your account or organization, LobeHub follows the pull requests your Agents open:
+
+- **Merge** → the linked acceptance is accepted and its task is completed.
+- **Failing checks** → the Agent that opened the pull request receives the failing checks, plus the job log when available, and can fix them.
+- **Review feedback** → requested changes and review comments reach that Agent in its conversation.
+
+> \[!NOTE]
+>
+> Integrations is an Alpha feature. Turn it on in **Settings → Labs → Integrations** first; **Integrations** then appears in Settings.
+
+## Connect GitHub
+
+1. Open **Settings → Integrations → GitHub**.
+2. Click **Connect account**. GitHub opens the LobeHub app installation page.
+3. Choose the personal account or organization to install on, then choose **All repositories** or only the repositories you select.
+4. Confirm the installation. GitHub returns you to LobeHub, which shows **GitHub connected: \<account>**.
+
+The connected account then appears under **Connections** with its status and repository scope. To add or remove repositories, or to uninstall, choose **Manage on GitHub** from the menu next to the account.
+
+If you started the installation on github.com instead of from LobeHub, LobeHub asks you to confirm which account the installation belongs to. Click **Connect** to finish.
+
+In a Workspace, the installation belongs to that Workspace, and the info bar shows who enabled it. Only Workspace members who can edit can connect GitHub.
+
+## Which pull requests are tracked
+
+LobeHub links a pull request to your records when any of these is true:
+
+- An Agent opened it from a LobeHub conversation, for example with `gh pr create` in a sandbox or on a device.
+- Its description contains a LobeHub acceptance link (`…/acceptance/<id>`).
+- An acceptance round recorded the pull request URL.
+
+Pull requests without a link are still recorded but do not trigger any automation. If the GitHub account that opened the pull request is linked to a LobeHub user, LobeHub acts for that user, who needs write access to the Workspace; otherwise automation is skipped. If the account is not linked, or a bot opened the pull request, LobeHub uses the account that installed the app instead.
+
+## Automation
+
+These switches decide what LobeHub does on its own when GitHub reports activity. All three are on by default.
+
+| Switch | What happens |
+| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| **Accept deliveries on merge** | When a linked pull request is merged, its acceptance is accepted and the task is completed. With stacked pull requests, every linked open pull request must be merged or closed first. |
+| **Notify agents on CI failure** | When a check fails, the Agent that opened the pull request is woken with the failing checks and, for GitHub Actions jobs, the log tail when available. At most three times per pull request; draft pull requests never wake an Agent. |
+| **Notify agents on review feedback** | When a reviewer requests changes or comments, the feedback is delivered to that Agent. |
+
+Only feedback from repository owners, members, and collaborators, plus the Codex code review bot (`chatgpt-codex-connector[bot]`), wakes an Agent. Comments from anyone else stay on GitHub and never become instructions for an Agent. The pull request author's own comments are ignored.
+
+## Comments in GitHub
+
+LobeHub can leave one comment on a linked pull request with links back to its acceptance and conversation, and update it as the work moves.
+
+- **Private repositories**: on by default.
+- **Public repositories**: off by default, because a public thread is not the place for links into your Workspace.
+
+The switches under **Automation** and **Comments in GitHub** follow the settings of the account that installed the app.
+
+## Troubleshooting
+
+| Message | What to do |
+| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
+| **Not configured on this deployment** | The server has no GitHub App configured. See [Self-hosted deployments](#self-hosted-deployments). |
+| **This GitHub account is already linked to another LobeHub user.** | Sign in to that LobeHub account, or connect with a different GitHub account. |
+| **Only workspace members can connect GitHub here.** | Ask a Workspace owner or admin for a member role, or connect from your personal account. |
+| **GitHub did not accept the authorization code.** | Click **Connect account** again. |
+| An Agent did not react to a failed check | Check that the pull request is linked, is not a draft, and has not used its three wakes, and that the switch is on. |
+
+## Self-hosted deployments
+
+A self-hosted deployment needs its own GitHub App and Redis (`REDIS_URL`), which holds the short-lived connection request; without Redis, **Connect account** fails. Set these environment variables on the server:
+
+| Variable | Required | Value |
+| --------------------------- | -------- | ------------------------------------------------------- |
+| `GITHUB_APP_ID` | Yes | Numeric App ID from the GitHub App settings page |
+| `GITHUB_APP_SLUG` | Yes | The app's URL slug (`github.com/apps/<slug>`) |
+| `GITHUB_APP_PRIVATE_KEY` | Yes | The app's private key, as raw PEM or base64-encoded PEM |
+| `GITHUB_APP_WEBHOOK_SECRET` | Yes | The secret GitHub signs webhook deliveries with |
+| `GITHUB_APP_CLIENT_ID` | Yes | The app's client ID |
+| `GITHUB_APP_CLIENT_SECRET` | Yes | The app's client secret |
+
+Set the client ID and secret. LobeHub uses them to confirm that the person connecting can access the installation; without them that check is skipped.
+
+In the GitHub App settings, use these URLs (replace `<APP_URL>` with your LobeHub address):
+
+- **Webhook URL**: `<APP_URL>/api/webhooks/github`
+- **Setup URL**: `<APP_URL>/api/webhooks/github/setup`
+- **Callback URL**: `<APP_URL>/api/webhooks/github/oauth/callback`, with **Request user authorization (OAuth) during installation** enabled
+
+Grant these repository permissions: **Pull requests** (read and write), **Checks** (read), **Commit statuses** (read), **Actions** (read), **Contents** (read). Subscribe to the **Pull request**, **Pull request review**, **Pull request review comment**, **Check run**, and **Status** events.
diff --git a/docs/usage/integrations/github.zh-CN.mdx b/docs/usage/integrations/github.zh-CN.mdx
new file mode 100644
index 00000000000..6b483d27a8b
--- /dev/null
+++ b/docs/usage/integrations/github.zh-CN.mdx
@@ -0,0 +1,102 @@
+---
+title: GitHub 集成
+description: >-
+ 连接 LobeHub GitHub App,跟踪 Agent 发起的 Pull Request:合并即验收通过,CI
+ 失败和评审意见会回到发起这个 Pull Request 的 Agent。
+tags:
+ - LobeHub
+ - 集成
+ - GitHub
+ - Pull Request
+ - CI
+ - 代码评审
+---
+
+# GitHub 集成
+
+**GitHub 集成把 Agent 发起的 Pull Request 和 GitHub 上发生的事接起来。** 在你的个人账号或组织上安装 LobeHub GitHub App 后,LobeHub 会跟踪 Agent 发起的 Pull Request:
+
+- **合并** → 关联的验收标为已接受,对应任务完成。
+- **检查失败** → 发起这个 Pull Request 的 Agent 收到失败的检查(能获取时附带 job 日志),接着修复。
+- **评审反馈** → 要求修改和评审评论会送到该 Agent 的会话里。
+
+> \[!NOTE]
+>
+> 集成目前是 Alpha 功能。先在 **设置 → 实验室 → 集成** 中开启,设置里才会出现 **集成**。
+
+## 连接 GitHub
+
+1. 打开 **设置 → 集成 → GitHub**。
+2. 点击 **连接账号**,GitHub 会打开 LobeHub 应用的安装页面。
+3. 选择要安装到的个人账号或组织,再选择 **所有仓库** 或只选部分仓库。
+4. 确认安装。GitHub 会带你回到 LobeHub,页面提示 **GitHub 已连接:\<账号>**。
+
+连接后的账号会出现在 **连接** 中,显示状态和仓库范围。要增减仓库或卸载,在账号右侧的菜单中选择 **在 GitHub 上管理**。
+
+如果你是在 github.com 上直接安装的,而不是从 LobeHub 发起,LobeHub 会请你确认这个安装属于哪个账号,点击 **连接** 即可完成。
+
+在工作区中,安装属于该工作区,信息栏会显示是谁启用的。只有具备编辑权限的工作区成员才能连接 GitHub。
+
+## 哪些 Pull Request 会被跟踪
+
+满足下面任一条件,LobeHub 就会把 Pull Request 关联到你的记录:
+
+- 由 Agent 在 LobeHub 会话中发起,例如在沙箱或设备上执行 `gh pr create`。
+- 描述中包含 LobeHub 验收链接(`…/acceptance/<id>`)。
+- 某轮验收记录了这个 Pull Request 的地址。
+
+没有关联的 Pull Request 仍会被记录,但不会触发任何自动化。如果发起 Pull Request 的 GitHub 账号已关联 LobeHub 用户,LobeHub 会以该用户身份处理,此用户需要有工作区的写权限,否则自动化会被跳过。如果账号未关联,或 Pull Request 由机器人发起,LobeHub 会改用安装应用的账号。
+
+## 自动化
+
+这些开关决定 GitHub 上有动静时 LobeHub 自动做什么,三个开关默认都开启。
+
+| 开关 | 效果 |
+| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
+| **合并即验收通过** | 关联的 Pull Request 被合并时,验收标为已接受,任务完成。堆叠的 Pull Request 需要所有关联且未关闭的 Pull Request 都已合并或关闭。 |
+| **CI 失败时通知智能体** | 检查失败时,带着失败的检查(GitHub Actions job 在能获取时附带日志末尾)唤醒发起这个 Pull Request 的 Agent。每个 Pull Request 最多三次;草稿 Pull Request 不会唤醒 Agent。 |
+| **评审反馈时通知智能体** | 评审者要求修改或留下评论时,把意见送到该 Agent。 |
+
+只有仓库的 owner、member、collaborator,以及 Codex 代码评审机器人(`chatgpt-codex-connector[bot]`)的反馈会唤醒 Agent。其他人的评论只留在 GitHub 上,不会变成给 Agent 的指令。Pull Request 作者自己的评论会被忽略。
+
+## 在 GitHub 上评论
+
+LobeHub 可以在关联的 Pull Request 下留一条评论,附上对应验收和会话的链接,并随进展更新。
+
+- **私有仓库**:默认开启。
+- **公开仓库**:默认关闭,公开讨论区不适合放指向你工作区的链接。
+
+**自动化** 和 **在 GitHub 上评论** 中的开关以安装应用的账号的设置为准。
+
+## 常见问题
+
+| 提示 | 处理方式 |
+| ------------------------------------ | ------------------------------------------- |
+| **当前部署未配置** | 服务端没有配置 GitHub App,见 [自托管部署](#自托管部署)。 |
+| **这个 GitHub 账号已经关联到另一个 LobeHub 用户。** | 登录那个 LobeHub 账号,或换一个 GitHub 账号连接。 |
+| **只有工作区成员才能在这里连接 GitHub。** | 请工作区所有者或管理员给你成员角色,或在个人账号下连接。 |
+| **GitHub 没有接受授权码,请重新连接。** | 再次点击 **连接账号**。 |
+| CI 失败后 Agent 没有反应 | 确认 Pull Request 已关联、不是草稿、三次唤醒还没用完,且对应开关已开启。 |
+
+## 自托管部署
+
+自托管部署需要创建自己的 GitHub App,并配置 Redis(`REDIS_URL`)来保存短期的连接请求;没有 Redis 时 **连接账号** 会失败。在服务端设置以下环境变量:
+
+| 变量 | 必填 | 说明 |
+| --------------------------- | -- | -------------------------------------- |
+| `GITHUB_APP_ID` | 是 | GitHub App 设置页中的数字 App ID |
+| `GITHUB_APP_SLUG` | 是 | 应用的 URL slug(`github.com/apps/<slug>`) |
+| `GITHUB_APP_PRIVATE_KEY` | 是 | 应用私钥,原始 PEM 或 base64 编码后的 PEM |
+| `GITHUB_APP_WEBHOOK_SECRET` | 是 | GitHub 签名 Webhook 时使用的密钥 |
+| `GITHUB_APP_CLIENT_ID` | 是 | 应用的 Client ID |
+| `GITHUB_APP_CLIENT_SECRET` | 是 | 应用的 Client Secret |
+
+请务必设置 Client ID 和 Secret。LobeHub 用它们确认发起连接的人确实能访问这个安装;不设置时会跳过这一校验。
+
+在 GitHub App 设置中填写以下地址(把 `<APP_URL>` 换成你的 LobeHub 地址):
+
+- **Webhook URL**:`<APP_URL>/api/webhooks/github`
+- **Setup URL**:`<APP_URL>/api/webhooks/github/setup`
+- **Callback URL**:`<APP_URL>/api/webhooks/github/oauth/callback`,并开启 **Request user authorization (OAuth) during installation**
+
+授予以下仓库权限:**Pull requests**(读写)、**Checks**(只读)、**Commit statuses**(只读)、**Actions**(只读)、**Contents**(只读)。订阅 **Pull request**、**Pull request review**、**Pull request review comment**、**Check run** 和 **Status** 事件。
diff --git a/docs/usage/integrations/linear.mdx b/docs/usage/integrations/linear.mdx
new file mode 100644
index 00000000000..ffe6b11c48c
--- /dev/null
+++ b/docs/usage/integrations/linear.mdx
@@ -0,0 +1,59 @@
+---
+title: Linear Integration
+description: >-
+ Connect a Linear workspace to LobeHub with OAuth, review who connected it,
+ and disconnect it when you no longer need access.
+tags:
+ - LobeHub
+ - Integration
+ - Linear
+ - OAuth
+---
+
+# Linear Integration
+
+**The Linear Integration connects a Linear workspace to LobeHub.** You authorize LobeHub once with Linear OAuth, and the connection is kept with your account or Workspace.
+
+LobeHub requests **read-only** access. The connection identifies your Linear workspace and the user who authorized it; it cannot create or change issues.
+
+> \[!NOTE]
+>
+> Integrations is an Alpha feature. Turn it on in **Settings → Labs → Integrations** first; **Integrations** then appears in Settings.
+>
+> To let an Agent search and update Linear issues inside a conversation, use the Linear connector instead. See [Connectors](/docs/usage/agent/connectors).
+
+## Connect Linear
+
+1. Open **Settings → Integrations → Linear**.
+2. Click **Connect workspace**. Linear opens its authorization page.
+3. Choose the Linear workspace to connect, then approve the request.
+4. Linear returns you to LobeHub, which shows **Linear connected: \<workspace>**.
+
+The workspace then appears under **Connections**, with who connected it and when. To go to that workspace, choose **Open in Linear** from the menu next to it.
+
+In a Workspace, the connection belongs to that Workspace. Only Workspace members who can edit can connect or disconnect Linear.
+
+## Disconnect Linear
+
+1. In **Connections**, open the menu next to the workspace and choose **Disconnect**.
+2. Confirm. LobeHub asks Linear to revoke its access token and removes the workspace from **Connections**.
+
+Revocation is best-effort: if Linear cannot be reached, the workspace is still removed but the token may stay valid. To make sure access ends, also revoke LobeHub in your Linear settings under authorized applications.
+
+## Troubleshooting
+
+| Message | What to do |
+| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
+| **Authorization was cancelled on Linear.** | Click **Connect workspace** again and approve the request. |
+| **The connection request expired.** | Start again from **Connect workspace**; each request can be used only once. |
+| **Linear authorized the connection, but LobeHub could not save it.** | Click **Connect workspace** again. |
+| **Only workspace members can connect Linear here.** | Ask a Workspace owner or admin for a member role, or connect from your personal account. |
+| **This deployment has no Linear application configured** | See [Self-hosted deployments](#self-hosted-deployments). |
+
+## Self-hosted deployments
+
+A self-hosted deployment needs Redis (`REDIS_URL`), which holds the short-lived connection request; without it, **Connect workspace** fails. It also needs its own Linear OAuth application:
+
+1. In Linear, go to **Settings → API → OAuth applications** and create an application.
+2. Set the callback URL to `<APP_URL>/api/webhooks/linear/oauth/callback`, where `<APP_URL>` is your LobeHub address. It must match `APP_URL` exactly.
+3. Set `LINEAR_CLIENT_ID` and `LINEAR_CLIENT_SECRET` on the server to the application's client ID and secret, then restart LobeHub.
diff --git a/docs/usage/integrations/linear.zh-CN.mdx b/docs/usage/integrations/linear.zh-CN.mdx
new file mode 100644
index 00000000000..334031777cd
--- /dev/null
+++ b/docs/usage/integrations/linear.zh-CN.mdx
@@ -0,0 +1,57 @@
+---
+title: Linear 集成
+description: 通过 OAuth 把 Linear 工作区连接到 LobeHub,查看是谁连接的,不再需要时断开连接。
+tags:
+ - LobeHub
+ - 集成
+ - Linear
+ - OAuth
+---
+
+# Linear 集成
+
+**Linear 集成把一个 Linear 工作区连接到 LobeHub。** 你通过 Linear OAuth 授权一次,连接就会保存在你的账号或工作区下。
+
+LobeHub 只申请 **只读** 权限。这个连接用来识别你的 Linear 工作区和授权的用户,不能创建或修改 issue。
+
+> \[!NOTE]
+>
+> 集成目前是 Alpha 功能。先在 **设置 → 实验室 → 集成** 中开启,设置里才会出现 **集成**。
+>
+> 想让 Agent 在会话中查找和更新 Linear issue,请使用 Linear 连接器,见 [连接器](/docs/usage/agent/connectors)。
+
+## 连接 Linear
+
+1. 打开 **设置 → 集成 → Linear**。
+2. 点击 **连接工作区**,Linear 会打开授权页面。
+3. 选择要连接的 Linear 工作区,然后批准授权。
+4. Linear 会带你回到 LobeHub,页面提示 **已连接 Linear:\<工作区>**。
+
+连接后的工作区会出现在 **连接** 中,显示是谁、在什么时候连接的。要前往该工作区,在右侧菜单中选择 **在 Linear 中打开**。
+
+在 LobeHub 工作区中,连接属于该工作区。只有具备编辑权限的工作区成员才能连接或断开 Linear。
+
+## 断开 Linear
+
+1. 在 **连接** 中打开工作区右侧的菜单,选择 **断开连接**。
+2. 确认后,LobeHub 会请求 Linear 撤销访问令牌,并把该工作区从 **连接** 中移除。
+
+撤销是尽力而为的:如果 Linear 暂时无法访问,工作区仍会被移除,但令牌可能仍然有效。要确保访问已终止,请同时在 Linear 设置的已授权应用中撤销 LobeHub。
+
+## 常见问题
+
+| 提示 | 处理方式 |
+| --------------------------------- | ---------------------------- |
+| **已在 Linear 上取消授权。** | 再次点击 **连接工作区** 并批准授权。 |
+| **连接请求已过期** | 从 **连接工作区** 重新开始,每次请求只能使用一次。 |
+| **Linear 已授权,但 LobeHub 未能保存此次连接** | 再次点击 **连接工作区**。 |
+| **只有工作区成员可以在此连接 Linear。** | 请工作区所有者或管理员给你成员角色,或在个人账号下连接。 |
+| **当前部署未配置 Linear 应用** | 见 [自托管部署](#自托管部署)。 |
+
+## 自托管部署
+
+自托管部署需要配置 Redis(`REDIS_URL`)来保存短期的连接请求,没有 Redis 时 **连接工作区** 会失败。此外还需要创建自己的 Linear OAuth 应用:
+
+1. 在 Linear 中进入 **Settings → API → OAuth applications**,创建一个应用。
+2. 把回调地址设为 `<APP_URL>/api/webhooks/linear/oauth/callback`,`<APP_URL>` 是你的 LobeHub 地址,必须与 `APP_URL` 完全一致。
+3. 在服务端设置 `LINEAR_CLIENT_ID` 和 `LINEAR_CLIENT_SECRET` 为该应用的 Client ID 和 Secret,然后重启 LobeHub。