Skip to content

OAuth provider configuration not properly deleted #7886

@sheikhlimon

Description

@sheikhlimon

Summary

When deleting the configuration for an OAuth provider (ChatGPT Codex, GitHub Copilot), the token is removed but the provider still shows as "configured".

Steps to Reproduce

  1. Configure ChatGPT Codex via OAuth (sign in with ChatGPT)
  2. Provider shows as "configured" ✓
  3. Click on ChatGPT Codex card to open configuration modal
  4. Click "Remove Configuration"
  5. Confirm deletion
  6. Provider still shows as "configured" ✗

Expected Behavior

After removing configuration, provider should show as "not configured" and allow reconfiguration.

Actual Behavior

Provider remains showing as "configured" despite the token being deleted.

Root Cause Analysis

The check_provider_configured function in crates/goose-server/src/routes/utils.rs checks for OAuth providers using a configured marker (e.g., chatgpt_codex_configured) instead of checking if the actual token exists:

// Special case: OAuth providers - check for configured marker
let has_oauth_key = metadata.config_keys.iter().any(|key| key.oauth_flow);
if has_oauth_key {
    let configured_marker = format!("{}_configured", metadata.name);
    if matches!(config.get_param::<bool>(&configured_marker), Ok(true)) {
        return true;
    }
}

When deleting configuration:

  1. Token is removed (CHATGPT_CODEX_TOKEN)
  2. Configured marker is NOT removed (chatgpt_codex_configured)
  3. Provider still appears configured

Affected Components

  • ui/desktop/src/components/settings/providers/modal/ProviderConfiguationModal.tsx - Delete handler
  • Backend: Deletion needs to also remove configured marker for OAuth providers

Proposed Fix

Update the delete logic to also remove the configured marker when deleting OAuth provider configuration:

// In handleConfirmDelete
const configuredMarker = `${provider.name}_configured`;
await remove(configuredMarker, false); // Remove the marker

Impact

Affects all OAuth providers:

  • ChatGPT Codex
  • GitHub Copilot
  • Any future OAuth-based providers

Metadata

Metadata

Assignees

No one assigned

    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