add config to disable AI#9739
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
4 issues found across 20 files
Architecture diagram
sequenceDiagram
participant User as User (Browser)
participant UI as React UI Components
participant ConfigStore as Config State (Jotai)
participant AppChrome as AppChrome / Sidebar / Footer
participant CellEditor as Cell Editor / Actions
participant ErrorHandler as Error / Traceback UI
participant Nav as Cell Navigation
Note over User,Nav: Runtime Flow for AI Feature Visibility
User->>ConfigStore: Update config (ai.enabled = false)
ConfigStore->>ConfigStore: Compute atoms: aiEnabledAtom, aiFeaturesEnabledAtom, aiModelConfiguredAtom
alt ai.enabled = false
ConfigStore-->>AppChrome: aiEnabled = false
AppChrome->>AppChrome: isPanelHidden({panel: type "ai", aiEnabled: false})
AppChrome->>AppChrome: Remove Chat panel from sidebar & dev panel
AppChrome->>AppChrome: Remove AI status icon from footer
AppChrome-->>UI: Renders without AI panels/icon
ConfigStore-->>CellEditor: aiFeaturesEnabled = false
CellEditor->>CellEditor: Hide "Generate with AI" button
CellEditor->>CellEditor: Disable aiCellCompletion shortcut
CellEditor-->>UI: No AI cell actions
ConfigStore-->>ErrorHandler: aiFeaturesEnabled = false
ErrorHandler->>ErrorHandler: Hide "Fix with AI" in traceback
ErrorHandler-->>UI: No AI fix button
ConfigStore-->>Nav: aiFeaturesEnabled = false
Nav->>Nav: Disable cell AI completion shortcut
Nav-->>UI: No AI navigation action
else ai.enabled = true (default)
ConfigStore-->>AppChrome: aiEnabled = true
ConfigStore-->>AppChrome: aiModelConfigured = true/false
alt aiModelConfigured = false
AppChrome->>AppChrome: Show AI status icon with "Assist disabled" tooltip
CellEditor->>CellEditor: Show "Generate with AI" button with tooltip "AI provider not found"
else aiModelConfigured = true
AppChrome->>AppChrome: Show AI status icon with model name
AppChrome->>AppChrome: Show Chat panel in sidebar
CellEditor->>CellEditor: Enable aiCellCompletion shortcut
CellEditor->>CellEditor: Show "Generate with AI" button active
ErrorHandler->>ErrorHandler: Show "Fix with AI" button
Nav->>Nav: Enable cell AI completion shortcut
end
end
Note over UI,CellEditor: Config UI Interaction (User toggles setting)
User->>ConfigStore: Toggle checkbox for "Enable AI features"
ConfigStore->>ConfigStore: Update config value
ConfigStore-->>UI: Reactively hide AI Providers/Models/MCP tabs
ConfigStore-->>UI: Show only "AI Features" tab with enabled toggle
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an ai.enabled user config flag to hide AI-related actions and panels throughout the editor UI (while leaving code-completion and “Pair with an agent” available), addressing issue #4901.
Changes:
- Introduces
ai.enabledin backend config typing/defaults and OpenAPI schema. - Updates the frontend config schema/state and gates AI UI surfaces (sidebar AI panel, footer icon, “Generate with AI”, refactor/fix affordances) behind
ai.enabled. - Adds UI controls/docs/tests for the new setting.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/openapi/src/api.ts | Adds enabled?: boolean to AiConfig and documents the new key in generated TS types. |
| packages/openapi/api.yaml | Adds enabled to the OpenAPI AiConfig schema and description text. |
| marimo/_config/config.py | Adds enabled to AiConfig TypedDict and includes it in default config. |
| frontend/src/core/config/config.ts | Adds atoms/helpers for AI enabled/configured state used across UI. |
| frontend/src/core/config/config-schema.ts | Extends UserConfigSchema.ai with enabled defaulting to true. |
| frontend/src/core/config/tests/config-schema.test.ts | Updates snapshots to include ai.enabled: true by default. |
| frontend/src/components/editor/renderers/cell-array.tsx | Hides “Generate with AI” button (and AI cell UI) when ai.enabled is false. |
| frontend/src/components/editor/output/MarimoTracebackOutput.tsx | Gates AI fix affordance on the new AI feature-enabled state. |
| frontend/src/components/editor/navigation/navigation.ts | Prevents toggling AI completion via shortcut when AI features aren’t enabled. |
| frontend/src/components/editor/navigation/tests/navigation.test.ts | Sets up config so AI completion shortcut tests remain valid with new gating. |
| frontend/src/components/editor/errors/auto-fix.tsx | Wires AI autofix availability to the new AI feature-enabled state. |
| frontend/src/components/editor/chrome/wrapper/sidebar.tsx | Filters out the AI panel from sidebar/dev-panel lists when ai.enabled is false; adds type="button". |
| frontend/src/components/editor/chrome/wrapper/footer-items/ai-status.tsx | Hides the footer AI status icon entirely when ai.enabled is false. |
| frontend/src/components/editor/chrome/wrapper/app-chrome.tsx | Filters out the AI panel from dev panel lists when ai.enabled is false. |
| frontend/src/components/editor/chrome/types.ts | Extends isPanelHidden to consider aiEnabled for the AI panel. |
| frontend/src/components/editor/cell/code/cell-editor.tsx | Disables inline AI tooltip + AI completion toggling unless AI features are enabled. |
| frontend/src/components/editor/actions/useCellActionButton.tsx | Hides “Refactor with AI” cell action unless AI features are enabled. |
| frontend/src/components/chat/chat-panel.tsx | Uses a “model configured” signal to show empty state vs. chat body. |
| frontend/src/components/app-config/ai-config.tsx | Adds a settings checkbox for ai.enabled and hides provider/model/MCP tabs when disabled. |
| docs/guides/editor_features/ai_completion.md | Documents [ai].enabled = false to hide AI UI surfaces. |
Comments suppressed due to low confidence (2)
packages/openapi/api.yaml:102
AiConfig.modeenum includesagent, but the schema description string only documentsask/manual. Please update the description to match the actual enum values (or regenerate this file after fixing the source description).
\ the maximum number of tokens to use in AI completions\n - `mode`: the\
\ mode to use for AI completions. Can be one of: `\"ask\"` or `\"manual\"\
`\n - `inline_tooltip`: if `True`, enable inline AI tooltip suggestions\n\
frontend/src/core/config/config.ts:105
isAiModelConfiguredonly checks whether any model field is set, but it’s used to decide whether AI UI should be considered “configured” (chat panel empty state, footer status, Generate-with-AI gating). As-is, selecting a model without provider credentials will be treated as configured and lead to avoidable runtime errors, and the tooltip text about providers becomes inaccurate.
export function isAiModelConfigured(config: UserConfig) {
return (
Boolean(config.ai?.models?.chat_model) ||
Boolean(config.ai?.models?.edit_model) ||
Boolean(config.ai?.models?.autocomplete_model)
akshayka
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
Fixes #4901. We've heard from a few folks in-person that they would like this.
Adds a config to disable AI which hides it all from the UI but leaves out code-completion & "Pair with an agent".
ai.enabledis the config, although notably, this is a UI impact, we don't disable the endpoints. I consideredai.show_uibut enabled is more genericScreen.Recording.2026-06-01.at.10.53.25.PM.mov
📋 Pre-Review Checklist
✅ Merge Checklist