Skip to content

[BUG] Auto close files setting cannot be unchecked — always reverts to checked #667

Description

@navedmerchant

Describe the bug

The "Auto close Zoo opened files" checkbox in Settings → UI cannot be unchecked. After unchecking and clicking Save, the setting does not persist — the checkbox always reverts to checked when the settings view is reopened.

Additionally, the autoCloseZooOpenedFilesAfterUserEdited and autoCloseZooOpenedNewFiles settings suffer from the same root cause: they are saved to global state but never sent back to the webview.

To Reproduce

  1. Open Zoo Code Settings → UI section
  2. Uncheck the "Auto close Zoo opened files" checkbox
  3. Click Save
  4. Navigate away from Settings (e.g., back to chat)
  5. Reopen Settings → UI section
  6. Observe the checkbox is checked again

Expected behavior

The "Auto close Zoo opened files" checkbox should remain unchecked after saving and reopening settings. The saved value (false) should persist across sessions.

Root Cause

The three auto-close settings (autoCloseZooOpenedFiles, autoCloseZooOpenedFilesAfterUserEdited, autoCloseZooOpenedNewFiles) are missing from both getState() and getStateToPostToWebview() in ClineProvider.ts. The settings are correctly saved to global state via contextProxy.setValue() in the updateSettings handler, but:

  1. getStateToPostToWebview() never includes these fields in the state posted to the webview, so the webview always receives undefined for them. When the SettingsView re-mounts, cachedState is initialized from extensionState (which has undefined), and the checkbox renders checked={undefined ?? true} → always checked.

  2. getState() never returns these fields, so the DiffViewProvider (which reads saveState?.autoCloseZooOpenedFiles ?? true) always gets undefined and falls back to the default true — meaning the auto-close behavior ignores the user's saved preference entirely.

What version of zoo are you running

Latest (main branch)

Additional context

The fields are properly defined in the ExtensionState type (packages/types/src/vscode-extension-host.ts) and the globalSettingsSchema (packages/types/src/global-settings.ts), and the webview correctly sends them in the updateSettings message. The gap is purely in the backend state serialization — the fields were never added to the getState() and getStateToPostToWebview() return objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions