coder / coder/xum

Add system config layer as admin-managed baseline

Open
#2,728 1 comment 0 reactions 1 assignee Claimed by @ibetitsmike View on GitHub
feature
Dominant language
TypeScript
Stars
2k
Forks
134
Avg merge
14h 57m
Merged PRs (30d)
307

Description

## Summary

Introduce a `config.system.json` file that acts as an admin-managed baseline configuration. User settings in `config.json` override system defaults key-by-key, giving admins control over defaults while preserving user autonomy.

## Motivation

Currently, all configuration lives in `~/.mux/config.json` and is fully user-controlled. There is no mechanism for administrators to provide a baseline configuration (e.g., default providers, approved models, feature flags, runtime settings) that applies across all users in a managed deployment.

A system config layer would allow admins to:
- Set organization-wide defaults (providers, models, feature flags)
- Enforce baseline settings while still allowing user overrides on a per-key basis
- Simplify onboarding by pre-configuring sensible defaults

## Proposed Behavior

1. **Admin provides** a `config.system.json` file (e.g., at `~/.mux/config.system.json` or a system-wide path like `/etc/mux/config.system.json`).
2. **On load**, the `Config` class reads `config.system.json` first as the baseline.
3. **User's `config.json`** is then deep-merged on top, overriding the system config key-by-key.
4. **Writes** continue to go to the user's `config.json` only — the system file is read-only from Mux's perspective.

### Merge semantics

- Shallow or deep merge at the top-level keys (e.g., `featureFlagOverrides`, `taskSettings`, provider defaults).
- User-set keys always win over system keys.
- Keys absent from the user config fall through to the system config.

## Implementation Notes

- The current config loading lives in `src/node/config.ts` in the `Config` class. `loadConfigOrDefault()` reads `~/.mux/config.json` — this is the primary integration point.
- The system config file path could be configurable via an env var (e.g., `MUX_SYSTEM_CONFIG`) with a sensible default.
- The `AppConfigOnDisk` schema in `src/common/config/schemas` should apply to both files.

---

Created on behalf of @ibetitsmike

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.