Files
PaperClipAI/doc
812e30d423 fix(ui): drop Firefox for iOS injected-script errors from browser Sentry (#22378)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The browser UI sends unhandled errors to Sentry through
`ui/src/lib/sentry.ts`
> - Firefox for iOS injects its own Reader-mode and helper scripts into
each page. These scripts read a `__firefox__` global
> - When one of these scripts runs before its setup is complete, the
page's `window.onerror` reports an error. Sentry then records it as a
Paperclip error
> - No Paperclip code defines or reads `__firefox__`. These reports are
browser noise and hide real errors
> - This pull request drops errors whose message contains `__firefox__`
with the built-in Sentry `ignoreErrors` option
> - The benefit is fewer false error reports. All other errors from the
same browser still go to Sentry

## Linked Issues or Issue Description

**What happened?**
Hosted browser Sentry recorded two errors from one page load on Firefox
for iOS: `TypeError: undefined is not an object (evaluating
'window.__firefox__.reader')` and `ReferenceError: Can't find variable:
__firefox__`. Both events have the same trace and the same timestamp.
The only stack frame is the page document (line 1, column 19), not a
Paperclip bundle file.

**Steps to reproduce**
1. Open a Paperclip page in Firefox for iOS.
2. Let the browser's Reader-mode script run before its `__firefox__`
setup is complete.
3. See the `__firefox__` error in the browser Sentry project.

**Expected behavior**
Sentry does not record errors that come from scripts the browser
injects.

**Actual behavior**
Sentry records them as unhandled Paperclip errors.

No duplicate or related public PRs were found (searched for
`__firefox__` and "firefox ios sentry").

## What Changed

- `ui/src/lib/sentry.ts`: add `ignoreErrors: ["__firefox__"]` to the
browser Sentry init options. A module comment tells why.
- `ui/src/lib/sentry.test.ts`: add tests that use the real Sentry SDK.
The tests send both `__firefox__` messages and make sure that Sentry
drops them. Each test also sends a normal app error and makes sure that
Sentry keeps it.
- `doc/observability.md`: describe the filter. Correct an old line that
said that the browser adds no `beforeSend` hook.

## Verification

- `cd ui && pnpm exec vitest run src/lib/sentry.test.ts
src/lib/browser-error-context.test.ts`: 55 passed.
- Without the fix (tests kept), the 3 new tests fail.
- `pnpm verify` was not run locally because of a partial dependency
install. CI runs the full suite.

## Risks

- Low risk. The filter drops only messages that contain the string
`__firefox__`. Paperclip code does not use that name. All other errors
are not changed.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and code
execution in an agent harness.

## 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: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 04:25:06 -08:00
..
…
…
…