Repository navigation
fix(accounts): a General, Tasks, Sandbox or Docker save no longer deletes accounts (#308) - #309
Merged
simion merged 1 commit intoSep 16, 2026
Conversation
…etes accounts (simion#308) 0cdfb58 made `agents_save` carry the account fields across from the stored entry. `settings_save` has the same hole: it receives the whole Settings, agent registry included, and General, Tasks, Sandbox and Docker build it as `{ ...settings, field }` from a snapshot taken when the section mounted. An account added after that snapshot was deleted by the next save of an unrelated field. Reproduced end to end: saving the browser in General emptied a three-account list. The registry cannot be ignored on that path, because Docker writes `docker_env` through it, so `settings_save` applies the same by-id carry (`keep_disk_account_fields`). Only the four account fields are protected; the rest of a stale agent entry is still written back. Closes simion#308 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
simion
approved these changes
Sep 16, 2026
simion
left a comment
Owner
There was a problem hiding this comment.
Reviewed with Opus. Correct fix: extends the by-id account-field carry from agents_save (0cdfb58) to settings_save, since General/Tasks/Sandbox/Docker save the whole Settings object from a stale snapshot. Only account fields are protected, docker_env still flows through the registry. Solid non-tautological tests (Rust + e2e) covering the actual bug scenario. Note: a brand-new agent (not just a new account) added after the snapshot could still be dropped by these paths, same structural limit as agents_save — worth a mention in docs/agent-accounts.md, non-blocking.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #308
Problem
0cdfb58 made
agents_savecarry an agent's account fields across from the stored entry.settings_savehas the same hole and was not covered: it receives the wholeSettings, agent registry included, and General, Tasks, Sandbox and Docker build that object as{ ...settings, field }from a snapshot taken when the section mounted.An account added after that snapshot was deleted by the next save of an unrelated field in those sections, taking the default, the adopted account and the auto-switch flag with it.
Fix
settings_saveapplies the same by-id carry (keep_disk_account_fields, built oncarry_account_fields):accounts,default_account,adopted_accountandauto_switch_accountcome from the stored entry, everything else from the request.The registry cannot be ignored on this path, because Docker writes
docker_envthrough it.Only the account fields are protected.
The rest of a stale agent entry is still written back by those sections, which is the general snapshot problem they have; noted in
docs/agent-accounts.md.Tests
cargo test: 1031 passed. Newa_stale_settings_save_keeps_accounts_and_its_own_edits: a whole-settings save from a snapshot without the accounts keeps them, and still lands its owndocker_envandpreview_browseredits.credentials.e2e.ts: 23 passed. New case: open Settings → General, add three accounts, save the browser through the General UI, and the account list and default survive. On amainbuild the same case fails with the list emptied to[]. It sits last in the describe because it clears the account list the earlier cases build on.settings.e2e.ts: 93 passed, 1 failing (shows the whole title, never an ellipsis), which fails the same way on a cleanmainbuild.npm test: 2180 passed.Manual verification
Exercised by hand in a
tauri devbuild: added an account, then saved a General setting; the account list stayed.🤖 Generated with Claude Code