You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(claude-accounts): keep /model and effort choices on managed Claude accounts - #38219
Each saved Claude account in Orca has its own copy of your Claude settings. Orca refreshed that copy from ~/.claude/settings.json before every launch and threw away anything Claude had saved in it, so a model or effort picked with /model or /effort was gone by the next session. Now Orca only brings over the settings you actually changed in ~/.claude, and keeps the rest of the account's copy.
Files
Added
Deleted
Net
Test
3
$\color{#1a7f37}{\Huge{\mathbf{+}}}$59
$\color{#cf222e}{\Huge{\mathbf{−}}}$19
$\color{#1a7f37}{\Huge{\mathbf{+}}}$40
Prod
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$86
$\color{#cf222e}{\Huge{\mathbf{−}}}$29
$\color{#1a7f37}{\Huge{\mathbf{+}}}$57
What Changed
Before: on a managed account, /model opus plus /effort high lasted one session. The next session started at whatever ~/.claude/settings.json said, because the account's settings.json was replaced whenever it differed from ~/.claude's.
After: the choice sticks for that account. Edits to ~/.claude/settings.json still reach every account on the next launch.
Mechanism: Orca keeps a small record, claude-profiles/<id>/settings-sync.json next to profile.json and outside the folder Claude reads. It holds a sha256 digest for each top-level key of ~/.claude/settings.json as of the last sync. On each launch, a key whose digest changed is copied over (or removed if it was deleted). Every other key in the account's copy stays as it is. If there's no record (the first launch after updating, or a new account), ~/.claude wins the whole file, which matches the old behaviour.
Orca's hook entries are compared like any other key, so a hook change in ~/.claude still reaches WSL accounts, which get their hooks only through this copy. On the host, the hook installer runs after the sync, same as before.
If ~/.claude/settings.json can't be read or parsed, that step now fails with a warning and the account's copy stays as it was. Before, the broken bytes were copied in. If the account's own file can't be read (a permissions error or a lock), it is also left alone. An account file that doesn't parse is still replaced.
Why
Keys like model and effortLevel often exist in both files, so merging the two can't tell whether you changed a key in ~/.claude or Claude changed it in the account. That takes a record of the last sync. Per-key digests are the smallest record that works, and storing digests instead of values means proxy keys in env aren't kept in a second file. I chose this over writing Claude's saves back into ~/.claude/settings.json because write-back means Orca editing your real global settings while other Claude sessions may be writing the same file. It would also change every account and System default at once. With this approach, a /model choice applies only to the account it was made in.
N/A. No Orca UI changes. The visible difference is Claude's own startup banner in a terminal, recorded as text under Testing.
Testing
Ran on macOS with the real Claude CLI 2.1.318, using a throwaway HOME, CLAUDE_CONFIG_DIR and default home under /private/tmp, with a fake API key and a dead base URL. No real login and no API calls. The steps: run the real provisionClaudeProfile, then in a TTY run /model opus and /effort high (Claude writes model, modelSettings.claude-opus-5-5.effortLevel: high and keeps effortLevel: medium), provision again, start a new session, then edit ~/.claude/settings.json and provision once more.
after the second provision
new session banner
after editing ~/.claude/settings.json
main
{"effortLevel":"medium"}
◐ medium · /effort
edit arrives, choice still gone
this branch
model, modelSettings and effortLevel kept
Opus 5.5 with high effort, ● high · /effort
edit arrives, choice kept
Focused tests: claude-profile-provisioning, claude-profile-setup, claude-credential-persistence-ratchet, claude-profile-hooks and the rest of src/main/claude-accounts. The changed-file code-quality gate passes. Not run on Linux, Windows or WSL directly. The code there is the same function with posix paths.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
The account-settings regression test fails on main. The WSL hooks test fails if the digest strips Orca's hooks, a mistake an earlier version of this branch made.
Risk
The riskiest part is the merge rule itself. A key changed in both places takes the ~/.claude value. A key you delete from ~/.claude is removed from accounts. A key only the account has stays. If the record goes missing, the next launch falls back to copying the whole file, so the worst case is the old behaviour, not stale proxy settings. Saved data: a new settings-sync.json per account, holding digests only, which goes away when the account is removed. A plain revert works. Accounts would go back to being overwritten on the next launch, and the leftover record files are harmless.
Level: Low
AI Disclosure
Review
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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Security: the record holds digests, not settings values, and is written with mode 0600. The account's copy keeps the source file's mode, as before.
Cross-platform and WSL: the same function runs on the host and inside the WSL guest. The record sits beside the existing profile.json marker.
Remote SSH and mobile: no separate path. Mobile doesn't touch account folders.
Performance: three small JSON reads per launch, and no writes when nothing changed.
Follow-up: .claude.json (copyState) has the same kind of issue for keys that exist in both files. Not changed here.
…nt across launches
Profile settings.json was overwritten from ~/.claude/settings.json on every
launch. Apply only the top-level keys the default home changed since the
last sync, tracked by per-key digests beside the profile marker, and keep
the rest of the profile copy.
Profile provisioning now synchronizes profile settings with default-home settings using a per-key digest record. The sync preserves target values for keys whose defaults have not changed and updates or removes keys when their defaults change. It treats linked settings as user-owned and writes changed settings atomically. Tests cover these outcomes and the settings persistence allowlist.
Severity of issue fixed: Medium
Merge Risk: Low · up to f9fee
A malformed or unreadable sync record can reset saved account settings; handle this case or accept the risk.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title names the fix and its scope: it keeps /model and effort choices on managed Claude accounts. The changeset adds per-key digest-based settings sync (syncClaudeProfileSettings) so account-saved…
Description check
The description follows the repository template closely. It includes ELI5, What Changed (before/after and mechanism), Why (including alternatives considered), Linked Issue (Fixes #36850), Visual Proof…
Linked Issues check
Issue #36850 requires managed Claude account settings to retain account-side /model and effort changes while later changes from ~/.claude/settings.json still propagate. syncClaudeProfileSettings…
Out of Scope Changes check
The changed production code is limited to the settings synchronizer and its integration into managed Claude profile provisioning. The changed tests and filesystem allowlist validate this behavior, inc…
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check
Explanation
The title names the fix and its scope: it keeps /model and effort choices on managed Claude accounts. The changeset adds per-key digest-based settings sync (syncClaudeProfileSettings) so account-saved model and effortLevel values survive the next launch, which matches the title's main point. The title uses the conventional fix(scope) form, is one sentence, and is 79 characters, which is within a reasonable length.
Full details: Description check
Explanation
The description follows the repository template closely. It includes ELI5, What Changed (before/after and mechanism), Why (including alternatives considered), Linked Issue (Fixes #36850), Visual Proof (N/A with a reason), Testing (manual steps, platforms, and checklist items), Risk (level Low, with rollback), Agent skill boundary, Notes, and Checklist. The AI Disclosure and Review sections are empty, which the template allows for the team-member case. The Linked Issue line is 'Fixes #36850', which is complete. The Notes section and Testing section are detailed and specific, so the description is substantially complete.
Full details: Linked Issues check
Explanation
Issue #36850 requires managed Claude account settings to retain account-side /model and effort changes while later changes from ~/.claude/settings.json still propagate. syncClaudeProfileSettings records per-key SHA-256 digests and merges only default-home keys that changed since the last sync. It preserves account-side keys, removes keys deleted from the default settings, and falls back to whole-file replacement without a record. provisionClaudeProfile uses this synchronizer. Tests cover account-side model and effort retention, later default-home edits, hook propagation, linked files, and missing default settings.
Full details: Out of Scope Changes check
Explanation
The changed production code is limited to the settings synchronizer and its integration into managed Claude profile provisioning. The changed tests and filesystem allowlist validate this behavior, including hook propagation and error handling. No unrelated product behavior is changed.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 5 files.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Preserve account settings when the sync record is unavailable.
If settings-sync.json is unreadable or malformed, readClaudeProfileObject(record) returns unavailable. This condition then takes the no-record path and replaces valid account settings with defaults. Saved /model and /effort choices can be lost. Apply whole-file initialization only when the record is absent; report an unavailable record without overwriting the account file. (raw.githubusercontent.com)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Each saved Claude account in Orca has its own copy of your Claude settings. Orca refreshed that copy from
~/.claude/settings.jsonbefore every launch and threw away anything Claude had saved in it, so a model or effort picked with/modelor/effortwas gone by the next session. Now Orca only brings over the settings you actually changed in~/.claude, and keeps the rest of the account's copy.What Changed
/model opusplus/effort highlasted one session. The next session started at whatever~/.claude/settings.jsonsaid, because the account'ssettings.jsonwas replaced whenever it differed from~/.claude's.~/.claude/settings.jsonstill reach every account on the next launch.claude-profiles/<id>/settings-sync.jsonnext toprofile.jsonand outside the folder Claude reads. It holds a sha256 digest for each top-level key of~/.claude/settings.jsonas of the last sync. On each launch, a key whose digest changed is copied over (or removed if it was deleted). Every other key in the account's copy stays as it is. If there's no record (the first launch after updating, or a new account),~/.claudewins the whole file, which matches the old behaviour.~/.claudestill reaches WSL accounts, which get their hooks only through this copy. On the host, the hook installer runs after the sync, same as before.~/.claude/settings.jsoncan't be read or parsed, that step now fails with a warning and the account's copy stays as it was. Before, the broken bytes were copied in. If the account's own file can't be read (a permissions error or a lock), it is also left alone. An account file that doesn't parse is still replaced.Why
Keys like
modelandeffortLeveloften exist in both files, so merging the two can't tell whether you changed a key in~/.claudeor Claude changed it in the account. That takes a record of the last sync. Per-key digests are the smallest record that works, and storing digests instead of values means proxy keys inenvaren't kept in a second file. I chose this over writing Claude's saves back into~/.claude/settings.jsonbecause write-back means Orca editing your real global settings while other Claude sessions may be writing the same file. It would also change every account and System default at once. With this approach, a/modelchoice applies only to the account it was made in.Linked Issue
Fixes #36850
Visual Proof
N/A. No Orca UI changes. The visible difference is Claude's own startup banner in a terminal, recorded as text under Testing.
Testing
Ran on macOS with the real Claude CLI 2.1.318, using a throwaway
HOME,CLAUDE_CONFIG_DIRand default home under/private/tmp, with a fake API key and a dead base URL. No real login and no API calls. The steps: run the realprovisionClaudeProfile, then in a TTY run/model opusand/effort high(Claude writesmodel,modelSettings.claude-opus-5-5.effortLevel: highand keepseffortLevel: medium), provision again, start a new session, then edit~/.claude/settings.jsonand provision once more.~/.claude/settings.json{"effortLevel":"medium"}◐ medium · /effortOpus 5.5 with high effort,● high · /effortFocused tests:
claude-profile-provisioning,claude-profile-setup,claude-credential-persistence-ratchet,claude-profile-hooksand the rest ofsrc/main/claude-accounts. The changed-file code-quality gate passes. Not run on Linux, Windows or WSL directly. The code there is the same function with posix paths.The account-settings regression test fails on main. The WSL hooks test fails if the digest strips Orca's hooks, a mistake an earlier version of this branch made.
Risk
The riskiest part is the merge rule itself. A key changed in both places takes the
~/.claudevalue. A key you delete from~/.claudeis removed from accounts. A key only the account has stays. If the record goes missing, the next launch falls back to copying the whole file, so the worst case is the old behaviour, not stale proxy settings. Saved data: a newsettings-sync.jsonper account, holding digests only, which goes away when the account is removed. A plain revert works. Accounts would go back to being overwritten on the next launch, and the leftover record files are harmless.Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
profile.jsonmarker..claude.json(copyState) has the same kind of issue for keys that exist in both files. Not changed here.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)