paperclip/ui/storybook/stories
Dotta e9828f8bf4
fix: reuse saved model connections during agent setup (#13161)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Agent setup connects each agent to a model provider.
> - The organization can already hold subscription logins and API keys.
> - The simplified setup flow did not consistently offer those saved
credentials.
> - This pull request restores reuse and selects a saved connection by
default.
> - Agents keep secret references, so reuse does not copy or rotate
credentials.

## Linked Issues or Issue Description

Related change: #13011. Searched public issues and PRs; no duplicate fix
found.

**What happened?**

Onboarding and new-agent setup could ask for a new API key or sign-in
despite an existing saved connection. A general environment auth signal
could also be mistaken for the owner's saved Claude subscription.

**Expected behavior**

Offer saved credentials from the selected organization. Default to a
saved subscription when one exists. Otherwise select a saved API key.
Keep the option to enter a new key or sign in to another account.

**Steps to reproduce**

1. Save a Claude or OpenAI API key, or complete a supported subscription
login.
2. Add another agent with the same provider.
3. Open the provider connection step.
4. Check whether the saved credential is available and selected.

**Paperclip version or commit**

Reproduced on 5cb4f061d after #13011. This branch is rebased onto
current master.

**Deployment mode**

Built from source. Tested in an isolated local test drive with embedded
storage and board access.

## What Changed

- Add a shared saved-credential lookup and picker for active personal
and organization keys.
- Reuse saved Claude subscriptions and saved Codex account homes. Select
an existing connection by default.
- Preserve secret references through connection tests and agent
creation, including the native Claude and Codex runner setup paths.
- Store newly entered onboarding keys separately. Do not rotate another
agent's key.
- Keep explicit choices during metadata refresh. Prevent refreshes from
remounting an active login panel.
- Add integration tests and production-component Storybook stories.
Document connection reuse.

## Verification

- All 5,628 UI tests passed before rebase.
- Twenty targeted server credential tests passed.
- UI typecheck, UI build, token gates, and diff whitespace checks
passed.
- Browser walkthroughs covered onboarding and new-agent setup, saved
keys, saved subscription fixtures, and new sign-in screens.
- Live Claude and Codex API-key probes succeeded. Created both agents
and confirmed that each retained its saved-secret reference. Both secret
versions remained unchanged. Codex passed after one retry.
- Live subscription authentication was not repeated. Subscription flows
use fixture browser tests and integration tests.
- After rebase and the cache fix, all 109 focused onboarding and
agent-creation tests passed.
- Full repository `pnpm build` and `pnpm -r typecheck` passed.
- The full local test attempt encountered timeouts and embedded
PostgreSQL startup failures under parallel load. All four affected
suites passed in isolation: 20 tests, with no code changes. The complete
CI matrix passed, including all workspace, general server, serialized
server, browser end-to-end, build, typecheck, and canary dry-run checks.
- Greptile reviewed commit d53ddf6b82c101d35894587afc9b0d135a5abc55:
5/5, successful check, no review threads.

## Risks

- The default connection mode changes when saved credentials exist. A
saved subscription takes priority over saved API keys; personal keys
appear before organization keys.
- A listed credential can be expired or unavailable in the selected
environment. The existing connection test still checks it.
- No database migration or API contract change is required.

## Model Used

OpenAI Codex, GPT-6. The exact runtime model identifier and
context-window size are not exposed in this session. Used reasoning,
code execution, repository tools, and browser automation.

## 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

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-09-10 12:57:53 -05:00
..
access-profiles.stories.tsx feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
action-card.stories.tsx
…
activity-feed.stories.tsx feat(apps): improve gateway and workspace connection UX (#12340) 2026-08-29 12:08:32 -05:00
agent-connection-reuse.stories.tsx fix: reuse saved model connections during agent setup (#13161) 2026-09-10 12:57:53 -05:00
agent-detail.stories.tsx
…
agent-management.stories.tsx Remove cheap model profiles (#12683) 2026-09-01 14:57:38 -05:00
agent-settings-redesign.stories.tsx feat: simplify agent onboarding and configuration (#13011) 2026-09-08 14:22:32 -05:00
agent-skill-row.stories.tsx build(deps): bump lucide-react from 0.577.0 to 1.32.0 (#11885) 2026-08-25 10:54:14 -07:00
agent-skills-edge.stories.tsx
…
agents-using-skill.stories.tsx
…
app-activity-lifecycle.stories.tsx
…
apps-connect-discoverability.stories.tsx
…
apps-connect-name.stories.tsx
…
artifacts.stories.tsx feat(work-products): add rich cards and run artifact inventory (#12717) 2026-09-02 15:27:54 -05:00
assigned-backlog-safeguards.stories.tsx
…
blocked-inbox.stories.tsx feat(work-products): add rich cards and run artifact inventory (#12717) 2026-09-02 15:27:54 -05:00
budget-finance.stories.tsx
…
built-in-agents.stories.tsx
…
chat-comments.stories.tsx
…
connection-reviews.stories.tsx feat: review connection actions from tasks (#13063) 2026-09-08 19:37:13 -05:00
control-plane-surfaces.stories.tsx
…
data-viz-misc.stories.tsx Remove the company brand color and per-company attachment limit (#12291) 2026-08-27 12:11:05 -07:00
decision-card.stories.tsx
…
decisions-desk.stories.tsx fix(interactions): authorize resolvers consistently (#11376) 2026-08-16 13:46:50 -05:00
dev-ops-surfaces.stories.tsx
…
dialogs-modals.stories.tsx Remove cheap model profiles (#12683) 2026-09-01 14:57:38 -05:00
document-annotations.stories.tsx feat(work-products): add rich cards and run artifact inventory (#12717) 2026-09-02 15:27:54 -05:00
document-comments.stories.tsx
…
environment-variables-editor.stories.tsx
…
execution-recovery.stories.tsx fix: make task recovery durable and preserve current requests (#13075) 2026-09-09 09:14:25 -05:00
external-objects.stories.tsx
…
file-viewer.stories.tsx feat(work-products): add rich cards and run artifact inventory (#12717) 2026-09-02 15:27:54 -05:00
fork-skill-flow.stories.tsx
…
forms-editors.stories.tsx
…
foundations.stories.tsx
…
frontmatter-panel.stories.tsx
…
gateways-tab.stories.tsx
…
in-feed-connections.stories.tsx feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
interrupt-handoff.stories.tsx
…
issue-blocked-notice.stories.tsx Show ordered live blocker work in task chat (#11487) 2026-08-16 15:10:05 -04:00
issue-management.stories.tsx feat(ui): add task status badges and inline blocker removal (#13097) 2026-09-09 10:06:21 -05:00
issue-plan-decompositions.stories.tsx
…
issue-review-panel.stories.tsx
…
issue-thread-interactions.stories.tsx feat(work-products): add rich cards and run artifact inventory (#12717) 2026-09-02 15:27:54 -05:00
managed-cloud-oauth-handoff.stories.tsx Make managed Cloud OAuth handoffs invisible (#12790) 2026-09-03 16:33:13 -05:00
monitor-surfaces.stories.tsx
…
navigation-layout.stories.tsx fix(ui): remove the Account badge and version line from the account menu (#12818) 2026-09-03 23:26:08 -07:00
new-agent-onboarding.stories.tsx feat: simplify agent onboarding and configuration (#13011) 2026-09-08 14:22:32 -05:00
new-project-repos.stories.tsx feat(projects): select multiple GitHub source repositories (#13010) 2026-09-08 08:21:28 -05:00
notion-connect-flow.stories.tsx feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
onboarding-agent-arc.stories.tsx fix: reuse saved model connections during agent setup (#13161) 2026-09-10 12:57:53 -05:00
onboarding-connect-model.stories.tsx Onboarding: model source tiles, one input canvas, and Storybook coverage for the agent arc (#12613) 2026-09-01 09:57:46 -07:00
overview.stories.tsx
…
permitted-vs-installed.stories.tsx fix(connections): distinguish local setup from provider handoff (#12947) 2026-09-06 17:43:48 -05:00
personal-connection-identity.stories.tsx feat(connections): add durable GitHub identities and webhooks (#12843) 2026-09-04 18:02:52 -05:00
primitives-coverage.stories.tsx feat(apps): consolidate connector management (#12684) 2026-09-01 14:55:35 -05:00
project-execution-workspace-strategy.stories.tsx
…
project-repos-configuration.stories.tsx feat(projects): select multiple GitHub source repositories (#13010) 2026-09-08 08:21:28 -05:00
projects-goals-workspaces.stories.tsx
…
rich-work-product-cards.stories.tsx feat(work-products): add rich cards and run artifact inventory (#12717) 2026-09-02 15:27:54 -05:00
routine-detail-c.stories.tsx
…
routine-secrets.stories.tsx
…
routines-list-groups.stories.tsx
…
scheduled-retry.stories.tsx
…
search.stories.tsx
…
searchable-select.stories.tsx
…
secrets.stories.tsx
…
session-goals.stories.tsx Add end-to-end session goals to Paperclip Runner 2026-09-08 16:18:47 -05:00
skill-policy-surfaces.stories.tsx
…
skills-store-detail.stories.tsx
…
skills-store-discovery.stories.tsx feat(ui): refine streamlined workspace surfaces (#12747) 2026-09-02 23:55:55 -07:00
source-issue-recovery.stories.tsx fix: preserve recovery retries across restarts (#11817) 2026-08-20 17:09:42 -05:00
source-resolved-fold.stories.tsx
…
status-language.stories.tsx
…
sub-issues-workflow.stories.tsx
…
successful-run-handoff.stories.tsx feat(ui): show a calm in-flight notice when a live run is on the issue (#11423) 2026-08-16 13:20:33 -05:00
summary-slot-card.stories.tsx
…
task-execution-controls.stories.tsx feat(ui): add composer Stop and simplify task controls (#13104) 2026-09-09 12:18:56 -05:00
task-watchdog-surfaces.stories.tsx
…
team-catalog.stories.tsx Gate Paperclip Runner setup behind an experimental flag (#12656) 2026-09-01 05:57:40 -05:00
test-tab.stories.tsx feat(apps): consolidate connector management (#12684) 2026-09-01 14:55:35 -05:00
user-secrets.stories.tsx
…
ux-labs.stories.tsx
…
what-needs-me.stories.tsx
…
work-timeline.stories.tsx
…
workspace-file-browser.stories.tsx
…
workspace-runtime-provisioning.stories.tsx
…
workspace-service-control-bar.stories.tsx feat(work-products): add rich cards and run artifact inventory (#12717) 2026-09-02 15:27:54 -05:00