Add an option to disable server-managed settings - #926
Conversation
Add an opt-in miscellaneous patch that short-circuits Claude Code's central server-managed-settings eligibility gate. This prevents remote settings loading, cache use, refreshes, and polling while preserving local endpoint-managed policy sources. Register the setting as disabled by default, expose it in the interactive UI, and cover minified and formatted Claude Code 2.1.220 shapes plus idempotency and false-positive behavior.
📝 WalkthroughWalkthroughAdds an opt-in ChangesServer-managed settings control
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Gate the new patch in the pre-apply planner with the same setting used by the patch implementation. Add enabled and disabled coverage so confirmation summaries do not advertise a patch that will be skipped.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/patches/disableServerManagedSettings.ts (1)
1-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the
@/alias for internal imports.
src/patches/disableServerManagedSettings.ts#L1-L2: replace../utilsand./indexwith@/-aliased imports.src/patches/disableServerManagedSettings.test.ts#L2-L2: import the patch via@/patches/disableServerManagedSettings.src/patches/index.ts#L67-L67: import the patch implementation via an@/alias.As per coding guidelines, internal imports must use the
@/alias.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/patches/disableServerManagedSettings.ts` around lines 1 - 2, Replace the relative internal imports in src/patches/disableServerManagedSettings.ts lines 1-2 with the appropriate `@/` aliases; update the patch import in src/patches/disableServerManagedSettings.test.ts line 2 to `@/patches/disableServerManagedSettings`; and update the implementation import in src/patches/index.ts line 67 to use an `@/` alias.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/patches/disableServerManagedSettings.ts`:
- Around line 1-2: Replace the relative internal imports in
src/patches/disableServerManagedSettings.ts lines 1-2 with the appropriate `@/`
aliases; update the patch import in
src/patches/disableServerManagedSettings.test.ts line 2 to
`@/patches/disableServerManagedSettings`; and update the implementation import in
src/patches/index.ts line 67 to use an `@/` alias.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d1644a87-bf3f-4cc6-b6aa-cf5f556c89d4
📒 Files selected for processing (7)
CHANGELOG.mdsrc/defaultSettings.tssrc/patches/disableServerManagedSettings.test.tssrc/patches/disableServerManagedSettings.tssrc/patches/index.tssrc/types.tssrc/ui/components/MiscView.tsx
Why
Claude Code can download enterprise settings from Anthropic or a configured gateway and apply them as a high-precedence policy layer. Users of modified Claude Code installations may need an explicit way to prevent that server-delivered settings path from loading.
The remote-settings subsystem uses one eligibility gate across startup loading, cached settings, authentication refreshes, and periodic polling. Disabling that gate avoids patching individual request sites and keeps the behavior consistent across the full lifecycle.
Closes #725.
What changed
disableServerManagedSettingsmiscellaneous setting and expose it in the interactive settings UI.disable-server-managed-settingspatch, which short-circuits Claude Code's central remote-settings eligibility helper.managed-settings.json, MDM, registry, andpolicyHelpersources.Validation
pnpm testpnpm lintpnpm builddisable-server-managed-settingsto native Claude Code 2.1.220 and verified the repacked bundle withnode --check.--debug-file, opened/permissionsand/status, and exited cleanly./api/claude_code/settingsand/managed/settingsendpoint activity.Summary by CodeRabbit