Fix sentry-triage canvas crash when the sentry package isn't bundled (#2810)

Published awesome-copilot plugins ship extension source only, so the optional
`sentry` npm package the canvas depends on at runtime may be absent. Previously
that made the canvas crash on open instead of guiding the user through setup.

- Load the optional `sentry` package lazily and translate only the top-level
  ERR_MODULE_NOT_FOUND for `sentry` into a package-missing setup state; any other
  import failure (missing transitive dep, entrypoint throwing) is rethrown so a
  real defect isn't masked behind a misleading "reinstall" message.
- Add a dedicated package-missing branch to the connection preflight and a
  matching setup gate, kept distinct from the auth and transient-network gates so
  the user never sees contradictory guidance. The canvas now opens and explains
  what to do rather than crashing.
- Clear `configured` for the package-missing state so the status is no longer the
  contradictory `configured:true` + `setup:'package-missing'`.
- Tell users to sign in with the package-local CLI via `npx sentry auth login`
  run from the extension folder — the only form that resolves after a local
  `npm install`, since a package-local binary isn't on the shell PATH.
- Update the README so the sign-in step and install guidance cover the
  published-plugin layout (`com.github.copilot/extensions/sentry-triage`), not
  just the standalone user/project extension paths.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Liz Tom
2026-08-27 11:14:14 +10:00
committed by GitHub
co-authored by Copilot App
parent 71f7c9b1dc
commit 3c1bebaded
4 changed files with 148 additions and 34 deletions
+38 -8
View File
@@ -42,10 +42,11 @@ that drafts a fix pull request.
- The GitHub Copilot app canvas / UI-extensions experiment enabled.
- A Sentry sign-in. This canvas reads issues through the
[Sentry CLI](https://cli.sentry.dev) in library mode — there is no MCP server
to configure. Sign in once from your terminal:
to configure. After installing the dependency (see **Install** below), sign in
once with the package-local CLI, run from the extension folder:
```sh
sentry auth login
npx sentry auth login
```
This stores an OAuth credential the canvas auto-detects. For non-interactive
@@ -61,10 +62,35 @@ that drafts a fix pull request.
## Install
Drop this folder at `~/.copilot/extensions/sentry-triage/` for user scope, or in
a repository at `.github/extensions/sentry-triage/` for project scope. Then
install dependencies from inside the copied folder (this canvas depends on the
`sentry` npm package at runtime):
Drop this folder at `~/.copilot/extensions/sentry-triage/` for user scope, or in a
repository at `.github/extensions/sentry-triage/` for project scope.
This canvas depends on the [`sentry`](https://cli.sentry.dev) npm package at
runtime, which isn't bundled with the extension source. If it's missing, the canvas
still **opens** and shows a setup gate explaining what to do instead of crashing.
### Let Copilot set it up (recommended)
Because the canvas runs inside GitHub Copilot, the agent can install the dependency
for you. Paste this into Copilot:
> Locate the loaded `sentry-triage` canvas extension folder — the directory that
> contains its `package.json` — run `npm install` there, then reload extensions.
(That folder is `~/.copilot/extensions/sentry-triage/` for user scope,
`.github/extensions/sentry-triage/` for project scope, or, if you installed the
published plugin, `com.github.copilot/extensions/sentry-triage` inside the
installed plugin.)
Then finish the one interactive step yourself — sign in so Copilot never handles a
raw secret. Run this from the same extension folder (`npx` resolves the CLI the
local `npm install` just placed in `node_modules`):
```sh
npx sentry auth login
```
### Or install it manually
```sh
# User scope
@@ -73,11 +99,15 @@ cd ~/.copilot/extensions/sentry-triage
# Or project scope, from the repository root
cd .github/extensions/sentry-triage
# Or, if you installed the published plugin (`copilot plugin install`), the source
# lives inside the installed plugin — cd into its extension folder:
cd <installed-plugin-path>/com.github.copilot/extensions/sentry-triage
npm install
npx sentry auth login
```
Reload extensions in the GitHub Copilot app, then open the `sentry-triage`
canvas.
Reload extensions in the GitHub Copilot app, then open the `sentry-triage` canvas.
## Open the canvas in the correct repository scope