Skip to content

fix(accounts): a General, Tasks, Sandbox or Docker save no longer deletes accounts (#308) - #309

Merged
simion merged 1 commit into
simion:mainfrom
GabrielDumbrava:fix/settings-save-keeps-accounts
Sep 16, 2026
Merged

simion merged 1 commit into
simion:mainfrom
GabrielDumbrava:fix/settings-save-keeps-accounts

Conversation

@GabrielDumbrava

Copy link
Copy Markdown
Contributor

Closes #308

Problem

0cdfb58 made agents_save carry an agent's account fields across from the stored entry.
settings_save has the same hole and was not covered: it receives the whole Settings, 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_save applies the same by-id carry (keep_disk_account_fields, built on carry_account_fields): accounts, default_account, adopted_account and auto_switch_account come from the stored entry, everything else from the request.
The registry cannot be ignored on this path, because Docker writes docker_env through 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. New a_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 own docker_env and preview_browser edits.
  • 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 a main build 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 clean main build.
  • npm test: 2180 passed.

Manual verification

Exercised by hand in a tauri dev build: added an account, then saved a General setting; the account list stayed.

🤖 Generated with Claude Code

…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 simion left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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.

@simion
simion merged commit 24c82e0 into simion:main Sep 16, 2026
3 checks passed
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.

Saving a General, Tasks, Sandbox or Docker setting deletes an agent's account list

2 participants