Files
PaperClipAI/ui
fd6e940b35 fix(ui): stop retrying and reporting an active sign-in conflict (#23350)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The agent sign-in panel reads the user's active sign-in session
before it starts a new one
> - When that active session belongs to another computer or AI
connection, the panel throws an error and shows "Another sign-in attempt
is active"
> - This is an expected state that the user must resolve. But the error
has no status, so the query client classifies it as an unknown failure
> - Because of that, the query retries it two times and then sends it to
Sentry as an unexpected error
> - This pull request marks this state as a conflict (409). The query
does not retry it and does not report it. The panel shows the same
message
> - The benefit is that Sentry shows real failures only, and the user
sees the conflict at once, not after about 3 seconds of retries

## Linked Issues or Issue Description

No public issue exists. The issue is below. It follows the bug template.

**What happened?**
A user opened the agent sign-in panel while a different sign-in for the
same owner was active on another computer or AI connection. The panel
showed "Another sign-in attempt is active…". The browser also sent a
handled `Error` to Sentry from the active-session query
(`query_kind=adapter-login-active-session`). This happens in the
displayed-code panel (Codex and similar adapters) and in the Claude
setup-token panel. Both throw the same kind of error.

**Expected behavior**
The panel shows the conflict and the "Cancel previous sign-in and retry"
action. The app does not retry the read. The app does not report the
conflict to Sentry, because it is a known user state and not a failure.

**Steps to reproduce**
1. Start a sign-in for an agent on computer A. Do not complete it.
2. Open the sign-in panel for an agent on computer B, as the same user.
3. The active-session read finds the session for computer A. The query
retries two times, then the panel shows the conflict, and Sentry gets an
event.

**Paperclip version or commit**
`master` at 66a8aa7f7e. Sentry saw it on hosted releases 91e9365d59 and
earlier.

**Relevant logs or output**
`Error: Another sign-in attempt is active. Finish or cancel that attempt
before starting a new sign-in.` (mechanism generic, handled, culprit
`queryFn`). A similar group has the message "Finish or cancel it in its
original account setup before starting this one." from the Claude
setup-token panel.

## What Changed

- `ui/src/lib/query-client.ts`: Add `QueryStateConflictError`. It
carries `status = 409`, so `classifyError` returns `conflict`. Because
of that, `shouldRetryRequest` does not retry it,
`shouldReportQueryError` does not send it to Sentry, and `describeError`
still shows its message.
- `ui/src/components/AgentConfigForm.tsx`: `AdapterLoginConflictError`
(displayed-code panel) now extends `QueryStateConflictError`. The Claude
setup-token panel now throws `QueryStateConflictError` and not a plain
`Error`.
- Tests: A render test for each panel (`codex_local` and `claude_local`)
uses the real `createAppQueryClient`. It checks that the panel shows the
conflict, reads the active session one time, does not start a new
sign-in, and does not report an error. The unit tests in
`query-client.test.ts` check the retry and report rules for the new
error.

## Verification

- Red: With the original `AgentConfigForm.tsx`, both new render tests
fail: `expected "vi.fn()" to be called 1 times, but got 3 times` (two
retries).
- Green: `cd ui && npx vitest run
src/components/AgentConfigForm.render.test.tsx
src/lib/query-client.test.ts src/api/errors
src/components/AgentConfigForm.test src/components/new-agent` passes: 6
files, 118 tests.
- `pnpm verify` selected a broad set because `query-client.ts` is
imported widely. I stopped the local run and used full CI on head
4267d070e7 for broad coverage. CI ran the full suite, and both changed
test files passed there (`AgentConfigForm.render.test.tsx` 8 tests,
`query-client.test.ts` 27 tests).
- `tsc --noEmit -p ui/tsconfig.json` shows no errors in the changed
files.

## Risks

- Low risk. The change touches only the two client-side conflict errors.
API errors and other query errors keep their current classification.
- The panel no longer retries the conflict read. A retry reads the same
server state, so this does not remove a recovery path. The "Cancel
previous sign-in and retry" action refetches the read.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude
Code with tool use (shell, file edit, test runs).

## 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
- [x] All Paperclip CI gates are green
- [x] 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>
2026-12-01 06:36:53 +00:00
..
…

@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.