Files
PaperClipAI/server
DottaandPaperclip 9c776cdf39 fix(apps): show the selected ChatGPT workspace on permissions (#22023)
## Thinking Path

> - Paperclip helps people manage AI agents and their access to external
accounts.
> - Apps permissions shows the provider account behind a saved AI
connection.
> - One OpenAI email can have both a personal workspace and a business
workspace.
> - The current page shows the email but does not show the selected
ChatGPT workspace.
> - This pull request reads the provider name for the saved workspace ID
through the existing account identity endpoint.
> - People can identify the account that their agents will use before
they change its access.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

The Connected account section on the Apps permissions page for OpenAI
subscription connections.

**Current behavior**

The page shows the saved email. It cannot distinguish two ChatGPT
workspaces that use that email. The account identity endpoint supports
only Anthropic profiles.

**Proposed behavior**

Show the selected ChatGPT workspace name beside the email. Show Personal
workspace when OpenAI returns the personal type without a name. Show an
unavailable state when the provider cannot supply a name.

**Reason and benefit**

People must know which provider workspace an agent will use. Paperclip
personal or shared access does not identify that workspace.

**Breaking changes**

None. The change uses the existing safe identity response and requires
no database migration.

No related open or closed pull request was found with `OpenAI workspace
in:title`. This change improves the existing Connected Apps and AI
Accounts items in ROADMAP.md.

## What Changed

- Add a provider module for OpenAI's Codex accounts endpoint. Match the
saved workspace ID in both supported response formats. Do not choose the
first or default account.
- Use the existing credential audience, company access, audit, timeout,
and response-size controls. Keep provider IDs, bearer tokens, and other
workspace names out of the response.
- Enable the OpenAI subscription account lookup on Permissions. Keep the
saved email and account controls when the lookup fails. Skip API keys
and routed connections.
- Add provider, UI, and authenticated route tests. Update the AI
Connections documentation with the upstream protocol sources.

## Verification

- Linux x64, Node v25.9.0, source checkout. Provider responses use test
fixtures.
- Red: the new provider and UI regression cases failed before the fix.
The page did not show the workspace and the service returned
unsupported.
- Green: `pnpm exec vitest run
server/src/services/ai-account-identity.test.ts
ui/src/components/ai-connections/AiConnectionAccountDetails.test.tsx` —
41 tests passed.
- Green: `pnpm exec vitest run
server/src/__tests__/ai-connections.test.ts -t 'identity only for an
authorized credential'` — 2 tests passed. These tests check both
providers, company and audience denial, invalid grants, agent denial,
provider denial, and revoked credentials.
- `git diff --check` passed.
- `pnpm verify` returned exit 2 because the documentation change
requires broader CI coverage. No full local suite was run.
Final-revision CI passed, as linked below.
- The first preflight could not install because the existing lockfile
omitted the server's PostHog dependency. A local install with
`--no-frozen-lockfile` prepared dependencies. The lockfile was restored
and is not part of this change. The route suite also needed the existing
plugin SDK and Runner TypeScript builds before it could load; it passed
after those builds.
- No live OpenAI account lookup or staging deployment was performed.

- Final head `47b0e10ee5707e6615ca56d518fbd0d03f0fb341`: [PR CI attempt
2](https://github.com/paperclipai/paperclip/actions/runs/44118848278)
passed, including
[typecheck](https://github.com/paperclipai/paperclip/actions/runs/44118848278/job/134175539941),
[build](https://github.com/paperclipai/paperclip/actions/runs/44118848278/job/134175461467),
[browser
CI](https://github.com/paperclipai/paperclip/actions/runs/44118848278/job/134175467287),
and [final
verification](https://github.com/paperclipai/paperclip/actions/runs/44118848278/job/134185142615).
Four jobs interrupted by runner shutdowns passed on retry.
-
[Greptile](https://github.com/paperclipai/paperclip/pull/22023#issuecomment-6953183751)
and [Paperclip
review](https://github.com/paperclipai/paperclip/pull/22023#issuecomment-6953104317):
5/5 on the same head, no findings or open review threads.

## Risks

- The workspace lookup uses the same private provider endpoint as
upstream Codex. Older credentials or provider changes can make names
unavailable. The page keeps the saved email and account controls in that
case.
- The provider protocol stays in the OpenAI identity module. The
connection service only selects the existing credential, and the UI
consumes the existing normalized labels.

## Model Used

OpenAI GPT-6 in Codex, with tool use and code execution.

## 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-11-17 10:48:06 -06:00
..