mirror of
https://github.com/openai/codex.git
synced 2026-11-21 22:50:37 +00:00
Treat workspace access denials as terminal errors (#60480)
## Why A `403` with `codex_workspace_access_denied` indicates that the account cannot use Codex in the selected workspace. Retrying or falling back to HTTP does not resolve that denial. ## What changed Map `codex_workspace_access_denied` and `invalid_workspace_selected` responses to a shared workspace access denial error, and rename the error variant to reflect its broader scope. Keep workspace denials excluded from compaction model fallback. ## Testing Extend API error mapping tests to cover the new code on `403` and preserve ordinary handling for `503`. Add WebSocket coverage verifying that an explicit workspace access denial does not trigger HTTP fallback. GitOrigin-RevId: e601a22a0fa783a4ce5401a98ff9c8d3d9d1b074
This commit is contained in:
@@ -290,9 +290,10 @@ fn map_api_error_details(err: ApiError) -> CodexErr {
|
||||
});
|
||||
let code = body_code.or(response.identity_error_code.as_deref());
|
||||
match (status, code) {
|
||||
(http::StatusCode::FORBIDDEN, Some("invalid_workspace_selected")) => {
|
||||
CodexErrorDetails::InvalidWorkspaceSelected(response).into()
|
||||
}
|
||||
(
|
||||
http::StatusCode::FORBIDDEN,
|
||||
Some("invalid_workspace_selected" | "codex_workspace_access_denied"),
|
||||
) => CodexErrorDetails::WorkspaceAccessDenied(response).into(),
|
||||
(http::StatusCode::FORBIDDEN, Some("access_program_not_enabled")) => {
|
||||
CodexErrorDetails::AccessProgramNotEnabled(ProviderRejection::Http(
|
||||
response,
|
||||
|
||||
Reference in New Issue
Block a user