Skip to content

Conversation

@sidneyswift
Copy link
Collaborator

@sidneyswift sidneyswift commented Jan 18, 2026

Summary by CodeRabbit

  • New Features

    • Workspace creation now requires sign-in and uses token-based auth to create workspaces via a centralized API; workspaces are associated with the selected organization.
    • Chat provider now remounts when switching organizations to reflect current org context.
  • Bug Fixes

    • Improved restoration and sync of selected artists to avoid stale or invalid selections; added guardrails to prevent inconsistent state.
  • Chores

    • Legacy local workspace creation endpoint deprecated; responses now include deprecation/sunset notices and proxy to the centralized API.
  • Config

    • Central API base URL can be overridden via environment variable.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
recoup-chat Ready Ready Preview Jan 20, 2026 8:13pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Replaces local workspace creation with a proxied call to an external API: the route now forwards raw request bodies and auth headers to NEW_API_BASE_URL/api/workspaces and returns the external response with deprecation headers; UI components now send organization-scoped requests using Privy tokens or the external API; chat provider remounts per-organization.

Changes

Cohort / File(s) Summary
API proxy / deprecation
app/api/workspace/create/route.ts
Replaced local creation logic with proxy behavior: reads raw body, forwards authorization / x-api-key, proxies to NEW_API_BASE_URL/api/workspaces, and adds deprecation/sunset/Link headers. Removed local validation and DB calls; retained error handling adapted for proxying.
Workspace creation UI
components/CreateWorkspaceModal.tsx
Switched POST target to NEW_API_BASE_URL/api/workspaces; uses usePrivy token and useOrganization selectedOrgId as organization_id; updated headers, auth handling, error messages, and success flow (set selected artist, open settings, refresh).
Chat provider remounting
components/VercelChat/chat.tsx
Added providerKey derived from chat id + selectedOrgId and set it as key on VercelChatProvider to force remount when organization changes.
Artist selection robustness
hooks/useInitialArtists.tsx
Added useMemo-backed validArtistIds Set, stricter guards when restoring/syncing selected artist, expanded effect dependencies, and early returns to avoid invalid state restores.
Config constant
lib/consts.ts
NEW_API_BASE_URL now prefers process.env.NEXT_PUBLIC_NEW_API_BASE_URL and falls back to existing prod/staging URLs.
Manifest
package.json
Minor manifest edits (small lines changed).

Sequence Diagram(s)

mermaid
sequenceDiagram
autonumber
participant User
participant Frontend as CreateWorkspaceModal
participant LocalAPI as /api/workspace/create
participant ExternalAPI as NEW_API_BASE_URL/api/workspaces
participant Auth as Privy
Note over Frontend,Auth: Frontend obtains token via Privy
User->>Frontend: Click "Create workspace" (includes selectedOrgId)
Frontend->>ExternalAPI: POST /api/workspaces (Bearer token, organization_id)
alt Frontend posts to local proxy
Frontend->>LocalAPI: POST /api/workspace/create (raw body + auth headers)
LocalAPI->>ExternalAPI: Forward raw body and auth headers
ExternalAPI-->>LocalAPI: Response (200/4xx/5xx + body)
LocalAPI-->>Frontend: Relay response + deprecation headers
else Direct external call
ExternalAPI-->>Frontend: Response (200/4xx/5xx + body)
end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • sweetmantech

Poem

A modal hums, a token flies, requests now cross new distant skies.
Headers pass and routes retreat, deprecation signs make paths complete.
Org keys turn, providers start—new flows begin, old code departs. 🚀✨

🚥 Pre-merge checks | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Solid & Clean Code ⚠️ Warning PR violates DRY principle by duplicating auth header forwarding logic across multiple files without extracting a reusable utility. Extract repeated auth header logic into a shared utility function and standardize deprecation date implementation across all API endpoints.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50ef0d8793

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

- Update CreateWorkspaceModal to use new Recoup-API endpoint with Bearer token auth
- Pass organization_id to link new workspaces to current org view
- Add org-based key to Chat component to reset state on org switch
- Validate saved artist belongs to current org before restoring
- Deprecate old /api/workspace/create route with proxy to new API
@sidneyswift sidneyswift changed the base branch from main to test January 20, 2026 20:08
@sidneyswift sidneyswift merged commit f06a930 into test Jan 20, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants