mirror of
https://github.com/openai/codex.git
synced 2026-10-28 18:58:46 +00:00
Add experimental ChatGPT workspace switching to app-server (#57514)
## What changed - Add `accountSession/list` and `accountSession/switch` for the active managed ChatGPT login, with optional workspace membership refresh. - Validate membership and workspace policy, pause new turns, and unload running threads before switching credentials. Notify clients with `thread/closed` and `account/updated`; selecting the current workspace leaves threads running. - Support browser sign-in for SSO through `allowBrowserLogin`, binding the callback to the requesting login and workspace. Require a separate sign-in for government workspaces. - Preserve the selected workspace across token refresh and conditionally restore the previous workspace if routing validation fails. Guard credential writes against concurrent login or logout changes. ## Testing Add app-server and auth tests covering workspace switching, credential preservation, policy and identity rejection, conditional rollback, stale sessions, and SSO callback validation. GitOrigin-RevId: 1234abc33b71e69b66318da3e201fccc08867906
This commit is contained in:
committed by
copyberry
parent
27ace641fe
commit
d257beb16a
@@ -52,6 +52,11 @@ class AccountRoutingOverride(Enum):
|
||||
us_cr = "us_cr"
|
||||
|
||||
|
||||
class AccountSessionWorkspaceKind(Enum):
|
||||
personal = "personal"
|
||||
workspace = "workspace"
|
||||
|
||||
|
||||
class AccountTokenUsageDailyBucket(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@@ -6892,6 +6897,16 @@ class AccountLoginCompletedNotification(BaseModel):
|
||||
success: bool
|
||||
|
||||
|
||||
class AccountSessionWorkspace(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
)
|
||||
account_id: Annotated[str, Field(alias="accountId")]
|
||||
image_url: Annotated[str | None, Field(alias="imageUrl")] = None
|
||||
kind: AccountSessionWorkspaceKind | None = None
|
||||
name: str | None = None
|
||||
|
||||
|
||||
class AccountUpdatedNotification(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@@ -10893,6 +10908,23 @@ class AccountRateLimitsUpdatedNotification(BaseModel):
|
||||
rate_limits: Annotated[RateLimitSnapshot, Field(alias="rateLimits")]
|
||||
|
||||
|
||||
class AccountSession(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
)
|
||||
display_name: Annotated[str | None, Field(alias="displayName")] = None
|
||||
email: str | None = None
|
||||
image_url: Annotated[str | None, Field(alias="imageUrl")] = None
|
||||
is_active: Annotated[bool, Field(alias="isActive")]
|
||||
last_used_at: Annotated[int, Field(alias="lastUsedAt")]
|
||||
selected_workspace_account_id: Annotated[
|
||||
str | None, Field(alias="selectedWorkspaceAccountId")
|
||||
] = None
|
||||
session_id: Annotated[str, Field(alias="sessionId")]
|
||||
user_id: Annotated[str | None, Field(alias="userId")] = None
|
||||
workspaces: list[AccountSessionWorkspace]
|
||||
|
||||
|
||||
class AppInfo(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
|
||||
Reference in New Issue
Block a user