Skip to content

Scope AI Workspace project reloads to the selected organization #3454

Description

@coderabbitai

Summary

Update the AI Workspace organization switch flow so that a project reload uses the organization selected by the user.

Rationale

switchOrganization currently updates currentOrganization in the SPA and then reloads projects through GET /projects. The request continues to use the organization claim in the current session or token. A selected organization can therefore differ from the organization that scopes the project response.

Affected areas

  • portals/ai-workspace/src/contexts/AppShellContext.tsx
  • The AI Workspace organization token-exchange or server-side organization-context flow
  • Project retrieval through GET /projects

Required changes

Before reloading projects after an organization selection, update the server-side organization context or exchange the token so its organization claim matches the selected organization. Ensure that project requests use that updated context. Keep the existing protection that ignores results from superseded organization selections.

Acceptance criteria

  • Selecting organization B after organization A updates the request context to organization B before GET /projects.
  • The project response after the switch is scoped to organization B.
  • A slower request from an earlier organization selection cannot overwrite the current project state.
  • The switch flow has automated test coverage.

Backlinks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions