Files
PaperClipAI/ui
Dotta fd8ad7d5b8 fix(ui): remove environment selector from AI connection setup (#23836)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Users connect AI provider accounts (Claude, OpenAI, Antigravity,
xAI, and GitHub Copilot) through `AiConnectionCredentialStep`
> - AI connections store credentials in Paperclip's secret store and do
not bind the saved connection to an execution environment
> - When a company had more than one active login-capable environment,
the setup form showed a raw environment dropdown (exposing internal
sandbox names and appearing even for API key or hosted OAuth flows)
> - The component already resolves the default login or probe
environment automatically
> - This pull request removes the environment selector dropdowns from
`AiConnectionCredentialStep` while preserving automatic environment
resolution
> - The benefit is a simpler AI connection flow that does not leak
internal execution infrastructure into provider account setup

## Linked Issues or Issue Description

**What existing behavior does this improve?**

The AI provider connection setup screen (`AiConnectionCredentialStep`)
for Anthropic (Claude), OpenAI, Google (Antigravity), xAI (Grok), and
GitHub Copilot.

**Subsystem affected**

`ui/` — React + Vite board UI

**Current behavior**

When a company has more than one active login-capable environment,
`SubscriptionConnectionStep` renders a `Sign-in environment` dropdown
and `ApiKeyConnectionStep` renders a `Copilot execution environment`
dropdown. The dropdown appears even for hosted Google OAuth or when the
user switches to an API key, and it exposes internal sandbox labels such
as `Paperclip Sandbox (Legacy)`.

**Proposed behavior**

Remove both environment dropdowns from `AiConnectionCredentialStep` and
update the GitHub Copilot help text to say verification discovers models
automatically. Continue resolving `environmentId` automatically from the
forced Kubernetes environment, instance default, plugin login target
preferences, or local default environment.

**Reason and benefit**

Saved AI connections are not bound to an execution environment; the
environment is only an internal detail for running a temporary
subscription login PTY or Copilot model probe. Removing the dropdown
eliminates user confusion and keeps internal infrastructure out of the
Apps connect flow.

**Breaking changes**

Users can no longer manually override the temporary login/probe
environment from the standalone AI connection setup form; Paperclip uses
the automatically resolved default environment instead. Agent-scoped
flows that pass `environmentId` explicitly continue to use the supplied
environment.

## What Changed

- Removed the `Sign-in environment` `<Select>` and unused
`chosenEnvironment` state from `SubscriptionConnectionStep` in
`ui/src/components/ai-connections/AiConnectionCredentialStep.tsx`.
- Removed the `Copilot execution environment` `<Select>` and unused
`chosenEnvironment` state from `ApiKeyConnectionStep` in
`ui/src/components/ai-connections/AiConnectionCredentialStep.tsx`, and
updated the Copilot help text to match.
- Added
`ui/src/components/ai-connections/AiConnectionCredentialStep.test.tsx`
to verify that no environment selector renders for Anthropic, OpenAI,
Google, xAI, or GitHub Copilot when multiple environments exist, while
automatic `environmentId` resolution is preserved.

## Verification

- `pnpm --filter @paperclipai/ui exec vitest run
src/components/ai-connections/AiConnectionCredentialStep.test.tsx` — 5/5
tests passed.
- `pnpm --filter @paperclipai/ui typecheck` — passed.
- `pnpm verify` — 270/271 UI test files passed in the combined run (1
unrelated `requestAnimationFrame` timing failure in
`src/components/TaskChatThread.test.tsx`); re-running `pnpm --filter
@paperclipai/ui exec vitest run src/components/TaskChatThread.test.tsx
src/components/ai-connections/AiConnectionCredentialStep.test.tsx`
passed all 444 tests (1 skipped).

## Risks

- Low risk. Self-hosted instances with multiple login-capable
environments now always use the automatically resolved default
environment during standalone AI account sign-in rather than exposing a
per-login override dropdown.

> 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

- Google Gemini (Antigravity agent, medium reasoning effort, with
repository read/edit, terminal, and browser inspection tools).

## 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
2026-12-04 20:46:43 -06: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.