feat(settings): guided MCP onboarding + reset app data#52
Conversation
When the agentic-readiness step finds no MCP server configured, show a short human explainer plus "Set up MCP servers" (deep-links to Settings > Engine) and "Skip for now" actions, replacing the old blank dead end. Enrich the Settings MCP empty-state with the same optional-tool framing. A one-shot SettingsDeepLink lets the wizard open the Settings window on the MCP section. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a destructive "Reset app data" danger zone at the foot of the Engine panel: a two-step confirm that wipes all local codescribe data and, when opted in, the Keychain API keys. The wipe logic lives in the Rust bridge as reset_app_data(include_keys), removing the config/logs/transcription tree and the Application Support store via the existing path helpers (honoring CODESCRIBE_DATA_DIR, never hardcoding ~), plus the Keychain bundle. Swift clears the UserDefaults domain and relaunches so the app comes up fresh (onboarding from the top). TCC grants are left untouched. Unit test asserts the reset scope follows CODESCRIBE_DATA_DIR and is idempotent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 384ce9a16c
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if !model.mcpSetupDismissed { | ||
| mcpSetupPrompt |
There was a problem hiding this comment.
Show the MCP setup prompt for the no-config row
When mcp_status() runs with no mcp.json, it still returns a non-empty neutral row (probe_mcp_status_at reports no mcp.json), so after the readiness refresh model.mcpStatus satisfies the preceding if let mcp..., !mcp.rows.isEmpty and this new else never renders. In the fresh-install/no-MCP scenario the user only sees the status card, not the new setup/skip actions, so the onboarding route added here is effectively unreachable.
Useful? React with 👍 / 👎.
| })?; | ||
| } | ||
| if include_keys { | ||
| for account in KEYCHAIN_ACCOUNTS { |
There was a problem hiding this comment.
Clear account-login tokens during reset
When a user has signed in with ChatGPT and then chooses Reset app data with key removal, this loop only deletes KEYCHAIN_ACCOUNTS. Provider account tokens are stored in the same Keychain bundle under LLM_OPENAI_ACCOUNT_TOKENS via account_auth::store_account_tokens, and that account is not in KEYCHAIN_ACCOUNTS, so the relaunched “fresh” app can still report the provider account as signed in and retain OAuth tokens after the privacy reset.
Useful? React with 👍 / 👎.
| if !NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil) { | ||
| // Older selector name kept as a defensive fallback. | ||
| _ = NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil) |
There was a problem hiding this comment.
Use the supported Settings opener
For the setup button path, this relies on the private showSettingsWindow:/old showPreferencesWindow: responder chain. The tray settings entry in this repo was already moved to @Environment(\.openSettings) because that selector stopped working on newer macOS; in those environments clicking “Set up MCP servers” merely sets pendingSection and neither action opens the window, leaving the onboarding user with no route to the MCP editor.
Useful? React with 👍 / 👎.
| let config_dir = Config::config_dir(); | ||
| let settings_dir = codescribe_core::config::UserSettings::settings_dir(); |
There was a problem hiding this comment.
Include the actual MCP config path in reset scope
When CODESCRIBE_DATA_DIR is set, these are the only reset targets, but the MCP management/probe path still comes from default_mcp_config_path() as $HOME/.codescribe/mcp.json. In that supported override context, Reset app data leaves the configured MCP servers file behind, so the relaunched app is not fresh and still shows the old MCP configuration despite the confirmation saying MCP configuration is deleted.
Useful? React with 👍 / 👎.
| /// UserDefaults (window frames / SwiftUI scene restoration) is a CFPreferences | ||
| /// domain with no core helper; the Swift caller clears it before relaunch. | ||
| pub fn reset_app_data(&self, include_keys: bool) -> Result<(), CsError> { | ||
| for dir in app_data_dirs() { |
There was a problem hiding this comment.
Avoid wiping files before Keychain can fail
When includeKeys is enabled and any Keychain delete returns an error (for example the user denies Keychain access), this removes both data directories first and then returns without relaunching or clearing defaults. That leaves the running app in a partially reset state even though SettingsViewModel.resetAppData treats failures as “nothing is relaunched”; deleting the Keychain entries before the filesystem wipe would avoid losing app data on a later Keychain failure.
Useful? React with 👍 / 👎.
What
Two UX/product cuts around first-run experience and user data control:
1. Guided MCP setup instead of a dead end (
72f3f23)mcp.jsonpreviously hit a bare "MCP not configured" wall in onboarding with no path forward.2. Reset app data (
384ce9a)CodescribeConfig.reset_app_data(include_keys): paths derive fromConfig::config_dir()/UserSettings::settings_dir()(honorsCODESCRIBE_DATA_DIR, no hardcoded home), removal is tolerant to already-missing dirs, TCC grants are never touched. Swift clears the UserDefaults domain and relaunches into a fresh onboarding.Gates
cargo fmt --check/clippy -D warningsclean ·cargo test -p codescribe-ffi42 passed ·cargo test -p codescribe -p codescribe-coreall suites 0 failed ·make app PROFILE=debugand release build both BUILD SUCCEEDED.Notes for review
showSettingsWindow:is a private-but-stable selector (macOS 14+), used with ashowPreferencesWindow:fallback.🤖 Generated with Claude Code