fix: always accept 'auto' in defaultMode settings schema#599
Conversation
When TRANSCRIPT_CLASSIFIER feature flag is disabled (e.g., in sidecar builds), the SettingsSchema rejects 'auto' as a valid defaultMode value. This causes the entire ~/.claude/settings.json to fail Zod validation and be silently discarded — losing enabledPlugins, hooks, env, and all other user settings. Users who set permissions.defaultMode to 'auto' in the upstream Claude Code CLI (where the feature flag is enabled) then open the same settings.json in a sidecar or desktop build (where the flag may be off) hit "Unknown skill" errors because plugin discovery reads empty enabledPlugins from the failed parse. Fix: always include 'auto' in the defaultMode enum regardless of the TRANSCRIPT_CLASSIFIER feature flag. The schema should accept all valid mode values for settings file compatibility, even if the runtime doesn't activate auto-mode behavior when the flag is off.
PR quality triageChanged areas: area:cli-core CLI core policy: Blocked by policy until a maintainer applies Missing-test policy: Blocked by policy until a maintainer applies Coverage baseline policy: No coverage-baseline policy block detected. CLI core files:
Coverage policy files:
Expected checks:
Test coverage signals:
Risk notes:
Hard merge gates still come from GitHub Actions, not AI review. Dosu handoff: Dosu can be used as the AI reviewer for risk explanation, missing-test prompts, and maintainer Q&A. If it does not comment automatically from the PR template, ask: @dosubot review this PR for changed-area risk, missing tests, docs impact, desktop startup risk, and CLI core impact. |
Summary
SettingsSchemato always accept'auto'as a validpermissions.defaultModevalue, regardless of theTRANSCRIPT_CLASSIFIERfeature flag state.Problem
When
TRANSCRIPT_CLASSIFIERis disabled (sidecar/desktop builds),defaultMode: 'auto'in~/.claude/settings.jsoncauses Zod validation to fail. This silently discards the entire user settings file, resulting in:enabledPluginslost → all plugin skills unavailable → "Unknown skill" errorshooks,env,extraKnownMarketplacesall lost.claude/settings.local.jsonis loadedUsers who configured
"defaultMode": "auto"in the upstream CLI (where the flag is on) cannot use their settings in sidecar builds.Fix
Replace the feature-flag-gated enum:
The schema should accept all valid mode values for file compatibility. Runtime behavior for
automode is separately gated by the feature flag — the schema just needs to not reject the file.Test plan
defaultMode: 'auto'in user settings now correctly loadsenabledPluginsand all plugin skillsSettingsSchema().safeParse()no longer returnssuccess: falsefor files containingdefaultMode: 'auto'