## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Onboarding signs the first agent in to Claude or Codex through a plugin-managed execution environment that is prepared for the agent (#23312) > - Each change to the setup draft, such as switching between Claude and OpenAI, makes Core prepare the environment again before it accepts a sign-in > - The wizard remembered that the environment had been prepared once, so it started the new sign-in during that preparation > - Core refused it with `login_agent_unavailable`, and the sign-in card showed only "Sign-in didn't finish" > - This pull request starts a sign-in only when the draft has settled on the current choice and is prepared, and shows Core's error on the card > - The benefit is that switching the sign-in source works, without an added wait ## Linked Issues or Issue Description Refs #23312 and #23315. **What happened?** In onboarding with a plugin-managed execution environment as the default, a user picked Claude, then switched to OpenAI. Every sign-in start after the switch returned `400 login_agent_unavailable`: Core refused the agent as the sign-in target. The card showed "Sign-in didn't finish. Try signing in again." **What did you expect to happen?** The OpenAI sign-in starts as soon as the environment is prepared for the new choice. **Steps to reproduce** 1. Make a plugin-managed execution environment that prepares an environment per agent the instance default. 2. Start onboarding, name the agent, and choose Claude with a subscription. 3. When the Claude sign-in shows, choose OpenAI. 4. See the sign-in fail with the message above. ## What Changed - The sign-in readiness hook takes `settled` and `holdKey`. A sign-in starts only when the agent has settled on the current choice and the environment is prepared for it. Readiness is held per agent, environment and sign-in source, so a source switch waits for the real preparation, and a sign-in already on screen stays on screen. - Onboarding treats the setup draft as settled when its saved harness (and model, when one is set) matches the selection. Each draft save puts the saved agent in the query cache at once, and readiness polls every 500 ms instead of every second. - The new-agent flow treats its draft as settled when no environment save is in flight, and polls a preparing draft every 500 ms. - Both sign-in panels show Core's start error for any sign-in that targets an agent, not only for one that Core selects automatically. ## Verification - `pnpm typecheck` in `ui/`: no errors. - The sign-in readiness helper and hook suites, the `AgentProviderConnection` suites and the `AgentConfigForm` render suite in `ui/`: 23 tests pass. A new hook test covers a switch from Claude to OpenAI and back while the environment is prepared again. - `PAPERCLIP_PLAYWRIGHT_CHANNEL=chrome npx playwright test --config tests/e2e/playwright.config.ts tests/e2e/onboarding-early-setup.spec.ts tests/e2e/onboarding.spec.ts -g "naming step creates|create-company path"`: 2 tests pass. - I reproduced the failure on a staging instance from the network log. I did not repeat the sign-in on a staging instance with this change. ## Risks - A change to the draft after a sign-in started can still make Core refuse the login lease when it acquires it. The card then shows Core's error and the usual retry. - Readiness polling is now twice as frequent while an environment is prepared. It stops when the environment is ready. - No migration and no API change. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), with extended thinking and tool use (code search, shell, tests, browser network inspection) in Claude Code. ## 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: 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.