Skip to content

Add settings backup, import review, and recovery points - #26826

Draft
namjun719-glitch wants to merge 19 commits into
stablyai:mainfrom
namjun719-glitch:feature/settings-backup-restore
Draft

namjun719-glitch wants to merge 19 commits into
stablyai:mainfrom
namjun719-glitch:feature/settings-backup-restore

Conversation

@namjun719-glitch

Copy link
Copy Markdown

ELI5

You can now save your Orca settings to a file and load that file on another computer. Before anything changes, Orca shows you what would change and lets you pick. Orca also saves the old values first, so you can undo an import. Passwords, API keys, tokens, and signed-in accounts never go into the file.

What Changed

Before: there was no way to move settings between machines. Users re-entered every preference on each PC, or copied the data folder by hand. That copy also carries machine IDs, local paths, and secrets that can't be decrypted on the other machine.

After: a new desktop-only pane, Settings → Backup & Restore, with three parts:

  • Export: pick setting groups (Appearance, Terminal, Editor, Git, Agents & AI, Browser, Notifications, General, Experimental, and an opt-in This device group) and save a versioned *.orca-settings.json file.
  • Import: choose a file. Orca validates it, then shows a per-setting list of current → incoming values with checkboxes. Only the rows the user keeps checked are applied.
  • Recovery points: before every import or restore, Orca saves the previous values of the keys it is about to change. The last 10 are kept and listed with a Restore button. If applying fails part-way, Orca restores automatically.

How it works:

  • src/shared/settings-backup/settings-backup-catalog.ts classifies every GlobalSettings key as a section, protected (credentials, accounts, consent and capability grants), or internal (migration guards, kill switches, local IDs). It uses satisfies Record<keyof GlobalSettings, …>, so adding a setting fails typecheck until someone decides whether it may leave the machine.
  • Export writes only keys from the chosen sections. It also drops any value that looks like a credential (ghp_…, sk-…, private keys, user:pass@ URLs, and similar) and reports how many were left out. Machine-bound nested fields (the custom notification sound path, muted sources) stay local.
  • Import (src/main/settings-backup/) checks, in order: size cap (5 MB), JSON parse with __proto__/constructor/prototype stripped, format and version, plain-JSON shape, and a SHA-256 digest over the canonical body. Damaged or hand-edited files are refused without touching settings. Unknown, protected, malformed, or secret-like keys are listed as "Not imported" and can never be applied. This device rows from another OS start unchecked.
  • The renderer never sends values back. Apply carries only a one-time preview ID (it expires after 30 minutes) plus the chosen keys. Main applies the values it already validated.
  • The body of the settings:set handler moved unchanged into src/main/ipc/settings-write.ts (applySettingsWrite). Imports and restores therefore go through the same sanitization, normalization, and side effects (proxy, hooks, menu, language, and so on) as a manual change.
  • English and Korean UI strings, plus a user guide covering storage locations, manual-copy caveats, and cross-OS notes: docs/settings-backup-and-restore.md (and .ko.md).

Why

The linked issues ask for export/import first and cloud sync second. A local file covers the main case (new PC, reinstall, work and home PCs) with no account, server, or ongoing cost. It is also the foundation any later sync would need anyway: a format, a key policy, validation, and rollback.

Alternatives considered:

  • Copying orca-data.json / the profile folder: this carries OS-encrypted secrets, machine IDs, and absolute paths, and the profile SQLite database is unsafe to copy while Orca runs.
  • Exporting GlobalSettings wholesale: this would leak cookies and proxy credentials, and would let a file grant permissions such as artifact publishing or plugin consent.
  • An allowlist that defaults new keys to "excluded": this is safe, but new user preferences would silently never be exported. The exhaustive catalog forces an explicit decision instead.

Out of scope here: account or cloud sync, encrypted backups that include secrets, device management, and ~/.orca/keybindings.json (the guide explains how to copy it by hand).

Linked Issue

Fixes #26799

Also addresses the export/import part of #4382.

Visual Proof

Not attached yet. I could not build the Electron app on the machine used for this change (native modules not built). Screenshots of the export, review, and recovery-point states will follow. Behavior is covered by the component test below.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Verified on Windows 11 (no app launch):

  • pnpm tc passes.
  • New tests: catalog exhaustiveness and protected keys; export projection and secret scrubbing; diff and skip reasons; file round-trip, integrity mismatch, newer format, size cap, prototype keys; service export→import, partial apply, automatic rollback, expired or forged preview IDs, recovery-point pruning, no secrets in recovery points; pane export, review, apply, and invalid-file flows.
  • Existing tests still pass: src/main/ipc/settings.test.ts (exercises the moved write path), settings navigation metadata, and the settings sidebar.
  • pnpm run check:code-quality:changed, oxlint on changed files, check:max-lines-ratchet, check:reliability-gates, and verify:localization-catalogs / -extraction / -coverage pass.

AI Disclosure

Implemented with Claude Code (Claude Opus 5.5), reviewed and submitted by me.

Review

Self-reviewed for secret handling: protected keys can't be exported or applied, recovery points never snapshot protected keys, and error messages carry no local paths.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: see the Review section. The integrity digest detects corruption and edits; it is not a signature.
  • Cross-platform: the source platform is recorded in the file, and This device settings from another OS need explicit opt-in. File dialogs use Electron's native pickers.
  • SSH / remote: desktop-only, behind showDesktopOnlySettings; no RPC or wire changes. Per-host overrides and runtime-environment IDs are classified internal and never move.
  • Mobile / web: the pane is hidden on web clients; no changes there.
  • Backwards compatibility: no persisted-format changes to existing data. The backup format carries formatVersion, and files from a newer format are refused with a clear message.
  • Performance: runs only on user action; files are capped at 5 MB.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

namjun719-glitch and others added 2 commits October 9, 2026 17:42
Adds Settings > Backup & Restore so users can move Orca preferences to
another computer (stablyai#26799, stablyai#4382):

- Export chosen setting groups to a versioned .orca-settings.json file
  with a SHA-256 integrity digest. Credentials, accounts, consent/grants
  and machine identity are never exported, and free-form values that look
  like tokens are dropped.
- Import validates the file (size, JSON shape, prototype keys, format
  version, integrity), shows a per-setting diff, and applies only the
  rows the user keeps checked. Device settings from another OS start
  unchecked; protected or unknown keys can never be applied.
- A recovery point of the touched keys is saved before every import or
  restore (last 10 kept); a failed apply rolls back automatically.
- Every GlobalSettings key is classified in one exhaustive catalog, so a
  new setting fails typecheck until its backup policy is decided.
- The settings:set write path moves to settings-write.ts so imports reuse
  the same normalization and side effects as manual edits.
- User guide in docs/settings-backup-and-restore{,.ko}.md with storage
  locations, manual-copy cautions and cross-OS notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
namjun719-glitch and others added 17 commits October 11, 2026 00:54
…settings-backup-restore

Keeps both new en.json groups (BackupRestorePane, SettingsHostScopePicker)
and classifies the new claudeCopiedSystemDefaultNoticeDismissed setting as
internal so the dismissed notice never travels in a backup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…settings-backup-restore

settings:set now lives in settings-write.ts, so carry stablyai#27199 there: the
write path returns store.getSettings() after side effects instead of the
pre-side-effect result. Adds a test covering that. Takes the renamed
default-host error message from stablyai#27286 as-is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep both sides of the en/ko locale conflicts (settings backup dialog
strings and the new agent environment strings).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep both sides of the ko locale conflict (settings backup pane strings
and the new ZCode setup / host scope picker strings). Classify the new
nativeChatPermissionMode setting as protected so a backup file can never
widen what agent chats may do without asking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the tray menu rebuild on language change from the settings:set
handler into applySettingsWrite. Keep the settings backup locale keys and
take upstream's move of the agent environment strings. Classify the new
experimentalWslHosts (experimental) and deprecated newWorkspaceSetupOnly
(internal) settings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep both sides of the ko locale conflict (settings backup pane strings
and the new host move-anyway strings). Classify the new
jiraIssueKeyCasing setting under the git section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the flush-on-write for alwaysForceDeletePreservedBranches from the
settings:set handler into applySettingsWrite, and classify the new
setting under general next to alwaysForceDeleteWorktrees.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow the move of runtime-environment-preference into
runtime-environments/. Drop the removed setupScriptLaunchMode from the
backup catalog and classify the new settings: nativeChatProviders and
claudeAccountSwitchRunningSessions (agents), and the one-shot
sshRemoteCliControlExistingHostsMigrated guard (internal).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Route applySettingsWrite through the new sanitizeNetworkSettings so the
Node download mirror is normalized like the proxy fields. Classify
nodeDistMirrorUrl and agentNativeChatPermissionModes as protected: a
backup file must not redirect where Orca downloads executables from or
widen what agent chats may do without asking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep both sides of the en/ko locale conflicts (Backup & Restore nav
strings and the new remote servers description).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Take upstream's SettingsContentScrollElementProvider wrapper around the
settings sections and keep the Backup & Restore section after Privacy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the agent dashboard telemetry and the shortened comments from the
settings:set handler into applySettingsWrite, and keep the backup bridge
methods in SettingsApi. Classify the new settings: browser link and
profile scope (browser), agent permission default/overrides and
connectors (protected), and the Portuguese migration guard (internal).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the Claude agent view reconcile from the settings:set handler into
applySettingsWrite. Drop the removed agentNativeChatPermissionModes from
the backup catalog and classify the new claudeSubagentNavigationEnabled
(agents) and orchestrationChatErrorEscalationEnabled (protected, so a
backup cannot silence worker failure escalation).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the electron-updater proxy apply from the settings:set handler into
applySettingsWrite. Classify the new orchestration heartbeat settings as
protected, matching upstream keeping them renderer-only so a backup
cannot change worker oversight policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebuild applySettingsWrite from upstream's settings:set body so it picks
up the module moves (persistence store, power, window, updater
lifecycle, worktree creation, Claude agent view) and the new
pluginExternalHostGrants renderer guard. Keep SettingsApi's backup
methods beside the new terminal config import previews, and keep both
sides of the en/ko settings search strings.

Follow upstream's GlobalSettings split into feature modules in the
backup catalog: drop removed keys (experimentalNativeChat, worker error
escalation, heartbeats) and classify the 35 new ones. Plugin trust
(external host grants, replacements, update policy) and cross-account
Codex history sharing are protected; dismissals, kill switches and
host-keyed profile ids are internal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pass getIntlLocale() to the recovery-point and import-review timestamps
so they follow Orca's UI language instead of the OS locale, as the new
renderer-intl-ui-locale rule requires.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Back up and sync Orca settings across multiple PCs

1 participant