## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The board UI reports uncaught browser errors to Sentry when a deployment sets a DSN > - A React event handler that throws a string reaches Sentry through `window.onerror` with no stack of its own > - The event then shows only one frame: React's event dispatch (`processDispatchQueue`). It does not show the handler that threw the value, or the kind of the value > - Breadcrumbs and the user agent are not sent by design, so we cannot tell a scripted browser session from a person > - This pull request adds two bounded facts to these reports. It does not copy the thrown value > - The benefit is that the next occurrence tells us if a string or a stackless `Error` was thrown, and if a WebDriver-controlled browser threw it ## Linked Issues or Issue Description **What happened?** One browser event on a hosted Paperclip page reported `Error: 844g8`. The mechanism was `auto.browser.global_handlers.onerror` (unhandled). The only stack frame was React's event dispatch in the main bundle, at the `catch` that reports a listener's throw. The event had no breadcrumbs and no user agent. The source location was a cloud data center region. **Expected behavior** A report that lets a maintainer find what threw the value, or at least identify the class of the throw. **Steps to reproduce** 1. Enable browser Sentry monitoring. 2. Throw a string (for example `throw "844g8"`) from a React event handler, or call `window.onerror` with a string `error` argument. 3. Look at the Sentry event. It shows `Error: 844g8` with one synthetic frame at the reported location, and there is no other attribution. **Paperclip version or commit** The event came from release `506211b9176058ae06622b2bc1150d4bb2ea2e19` (hosted production bundle). This change is based on current `master`. No duplicate or related open pull request touches this path. I searched for the error text, for `onerror`, and for non-`Error` throws. ## What Changed - `ui/src/lib/browser-error-context.ts`: Add `classifyThrownValue()`. It returns `error`, `error_stackless`, or the primitive type. It checks only if an `Error` stack has frames. It does not coerce or copy the value. - `ui/src/lib/browser-error-context.ts`: Add `browser_state.automation` from `navigator.webdriver === true`. A failed read leaves out the field and keeps the other state. - `ui/src/lib/sentry.ts`: In `beforeSend`, tag `window.onerror` reports with `browser_thrown_kind`. Rejections and caught exceptions do not get this tag. - `doc/observability.md`: Document the new tag and field. - Tests use the real `@sentry/browser` SDK for the onerror path, and unit tests for the browser state. ## Verification - `cd ui && npx vitest run src/lib/sentry.test.ts src/lib/browser-error-context.test.ts`: 68 passed. - Red/green: with the source change removed, the two new `sentry.test.ts` tests fail (`browser_thrown_kind` is `undefined`, and `browser_state.automation` is missing). With the change, they pass. - The new real-SDK test throws the string `844g8` through `window.onerror`. The SDK produces the same shape as the production event: exception value `844g8`, mechanism `auto.browser.global_handlers.onerror`. The event now also has `browser_thrown_kind: string`. - `cd ui && node ../scripts/run-tsc.mjs -b`: pass. - `pnpm verify` exited 2 (broader verification required, from global CI inputs). Required CI supplies that coverage. ## Risks - Low risk. The change adds one tag and one boolean to browser Sentry events. It does not drop, group, or suppress any event. - Every read is in a `try` block, so a failed read cannot replace or discard the original error. - `navigator.webdriver` is a standard boolean. It does not identify a person or a tenant. - This is a diagnostic. It does not fix a defect. The root cause needs a future event with these facts. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use and shell execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@paperclipai/ui
Published static assets for the Paperclip board UI.
What gets published
The npm package contains the production build under dist/. It does not ship the UI source tree or workspace-only dependencies.
Storybook
Storybook config, stories, and fixtures live under ui/storybook/.
pnpm --filter @paperclipai/ui storybook
pnpm --filter @paperclipai/ui build-storybook
Typical use
Install the package, then serve or copy the built files from node_modules/@paperclipai/ui/dist.
Editor dependency identity
Keep the root and workspace overrides for @codemirror/state,
@codemirror/view, and @lezer/common aligned. CodeMirror requires shared
extension identity, while Lezer parsers and syntax highlighters require shared
NodeProp IDs. Multiple Lezer copies can crash code-block highlighting with
tags is not iterable. src/lib/codemirror-single-instance.test.ts checks the
installed dependency graph and highlights sample code through the editor's real
language dependencies. GitHub Actions owns regeneration of pnpm-lock.yaml.