Skip to content

fix(claude-accounts): persist profile model and effort settings across launches (#36850) - #37091

Closed
hrithiksaini99 wants to merge 3 commits into
stablyai:mainfrom
hrithiksaini99:fix/claude-profile-model-effort-persistence
Closed

hrithiksaini99 wants to merge 3 commits into
stablyai:mainfrom
hrithiksaini99:fix/claude-profile-model-effort-persistence

Conversation

@hrithiksaini99

Copy link
Copy Markdown
Contributor

Fixes #36850

Cause

When using a managed Claude account, running /model or changing model reasoning effort (e.g. /effort high) saves modelSettings and/or effortLevel into the managed profile's <profile>/settings.json.
However, copySettings in src/main/claude-accounts/claude-profile-provisioning.ts ran on every session launch and compared ~/.claude/settings.json with <profile>/settings.json ignoring only Orca hooks. Because ~/.claude/settings.json lacked the profile's modelSettings or had different effort levels, copySettings treated the profile as having drifted and blindly copied ~/.claude/settings.json over <profile>/settings.json, discarding the user's /model and effort choices on every launch. In addition, symlinked settings were not treated as user-owned before attempting a copy.

Solution

  1. In claude-profile-settings.ts, updated the settings comparison to exclude profile-managed model/effort settings (modelSettings and effortLevel) alongside Orca's hooks, so that sessions do not needlessly overwrite settings.json on every launch.
  2. In copySettings, when global ~/.claude/settings.json updates (e.g. adding user hooks, permissions, or proxies), preserve and merge the profile's existing modelSettings and effortLevel into the target settings.
  3. Immediately treat symbolic links on <profile>/settings.json as user-owned.
  4. Extracted copySettings into src/main/claude-accounts/claude-profile-settings.ts to keep claude-profile-provisioning.ts well within lint file line limits.
  5. Added unit test verifying that profile modelSettings and effortLevel persist across provisioning runs and merge properly when ~/.claude/settings.json updates.

Verification

  • Ran pnpm vitest run src/main/claude-accounts/claude-profile-provisioning.test.ts (all 16 tests passed).
  • Ran all 22 test files in src/main/claude-accounts/ (all 202 tests passed).
  • Ran pnpm tc:node (passed with 0 errors).
  • Ran pnpm exec oxlint and pnpm exec oxfmt --check (passed with 0 warnings/errors).

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 274ca344-691c-4d8b-a5d1-fb988c54307e
Commits

Reviewing files that changed from the base of the PR and between 59e0b85 and 6a1c6c6.

Files selected for processing: 3
  • src/main/claude-accounts/claude-credential-persistence-ratchet.test.ts
  • src/main/claude-accounts/claude-profile-provisioning.test.ts
  • src/main/claude-accounts/claude-profile-settings.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Walkthrough

The change adds copySettings to the profile settings module and uses it during profile provisioning. The function compares settings while excluding managed hooks and profile-owned model, effort, and model settings. When copying settings, it preserves existing profile choices where possible. Provisioning tests cover unchanged, updated, and absent global settings, source removal, and settings restoration.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 6a1c6

No identified issue currently blocks merging the managed-profile settings change, subject to normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description clearly explains the cause, solution, linked issue, and verification results. However, it omits several template sections, including ELI5, What Changed, Why, Visual Proof or an explici… Add the missing template sections. Include an explicit visual-proof attachment or write N/A with a reason, document why this approach was selected, complete the testing and checklist items, and address AI disclosure, review, notes, and th…
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the primary change: preserving Claude profile model and effort settings across launches.
Linked Issues check Passed Issue #36850 requires model and effort choices to persist for managed Claude accounts. copySettings ignores profile modelSettings and effortLevel during drift checks, preserves them during globa…
Out of Scope Changes check Passed The changes stay within issue #36850. The extracted settings helper and filesystem allowance support the settings-copy behavior. The added tests verify the required model, effort, merge, deletion, and…
Full details: Linked Issues check

Explanation

Issue #36850 requires model and effort choices to persist for managed Claude accounts. copySettings ignores profile modelSettings and effortLevel during drift checks, preserves them during global settings merges, retains them when the global file is absent, and treats a profile settings symlink as user-owned. The implementation tracks inherited global models so global model changes propagate without replacing an explicit profile choice. Tests cover persistence, merge, deletion, model propagation, and symlink behavior.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #36850. The extracted settings helper and filesystem allowance support the settings-copy behavior. The added tests verify the required model, effort, merge, deletion, and symlink cases. No unrelated product behavior is evident.

Full details: Description check

Explanation

The description clearly explains the cause, solution, linked issue, and verification results. However, it omits several template sections, including ELI5, What Changed, Why, Visual Proof or an explicit N/A rationale, AI Disclosure, Review, Notes, Agent skill upstream boundary, and the Checklist.

Resolution

Add the missing template sections. Include an explicit visual-proof attachment or write N/A with a reason, document why this approach was selected, complete the testing and checklist items, and address AI disclosure, review, notes, and the agent skill upstream boundary.

Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. 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 8 functions across 4 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • 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.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e21e41e9-2b6c-4c4b-90b7-e1c6b542e1bb
Commits

Reviewing files that changed from the base of the PR and between dfbaa2f and 6fda016.

Files selected for processing: 3
  • src/main/claude-accounts/claude-profile-provisioning.test.ts
  • src/main/claude-accounts/claude-profile-provisioning.ts
  • src/main/claude-accounts/claude-profile-settings.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0657ba0e-7601-427a-8b60-b05d8e150bb3
Commits

Reviewing files that changed from the base of the PR and between 6fda016 and 59e0b85.

Files selected for processing: 3
  • src/main/claude-accounts/claude-credential-persistence-ratchet.test.ts
  • src/main/claude-accounts/claude-profile-provisioning.test.ts
  • src/main/claude-accounts/claude-profile-settings.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks for digging into this, @hrithiksaini99. #38219 fixed it with a per-key sync record, so model, effort and any other setting Claude saves in an account now survive, and later ~/.claude edits still reach the account. Closing this one in favour of it.

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

Labels

None yet

Projects

None yet

2 participants