Validate the config before any filesystem work and persist the default row
only after the directory swap succeeds; reject oversize uploads before
buffering and stream parts to staging; re-ensure AGENTS.md after a replace.
Consolidate the upload contract in shared, unify the default-config upsert,
single-own the browser directory-upload and restart state, and drop dead code.
Replace direct opencodeServerManager calls with a supervisor that
provides health polling, operation locking, and a 4-step recovery
pipeline (restart, debug capture, rollback, seed default config).
Add archiveBrokenConfig to SettingsService for backup before rollback.
Wire supervisor into all route factories with graceful fallback to
direct manager calls. Add health watch configuration defaults and
env vars.