Skip to content

[ENHANCEMENT] Auto-close edited files should default to off; centralize the default #719

Description

@edelauna

Problem (one or two sentences)

Users upgrading to recent versions find that files Zoo edits no longer stay visible in the editor after the diff is accepted — the edited file's tab is closed immediately by default, so there is nothing to watch in the editor pane. This reversed years of prior behavior without an opt-in and was the top complaint in community feedback (e.g. reports that "the editor in the right frame does not show anymore" and "files being edited no longer show up").

Context (who is affected and when)

Affects every user on stock settings who upgrades — no setting was changed by the user. Most visible with auto-approve enabled and an existing file being modified: the diff renders during the edit, then the file's tab disappears on accept. The setting only became user-toggleable recently (#668 fixed #667, where the checkbox could not be unchecked), so upgraders had no escape hatch until that fix shipped.

Related structural point: the true default for autoCloseZooOpenedFiles is currently hardcoded in four separate places (DiffViewProvider save path, DiffViewProvider revert path, ClineProvider.getStateToPostToWebview, and UISettings checked ?? true). That duplication is what allowed the #667 "saved-but-not-read-back" bug to slip through in the first place.

Desired behavior (conceptual, not technical)

Editing a file should leave that file's tab open by default — the long-standing behavior. Closing the edited tab on accept should remain available as an opt-in preference for users who want to save context tokens (since Zoo does not re-send open files in subsequent requests).

Acceptance criteria

  • Given a fresh install or an upgraded user who has not touched any auto-close setting, when Zoo edits an existing file and the diff is accepted, then the edited file's tab stays open in the editor.
  • The close-on-accept behavior is still available by enabling "Auto-close files Zoo opened."
  • The default value for each auto-close setting is defined in exactly one place, and all consumers read from it.

Proposed approach

  1. Flip the autoCloseZooOpenedFiles default from true to false (opt-in), matching autoCloseZooOpenedNewFiles and autoCloseZooOpenedFilesAfterUserEdited.
  2. Declare the defaults once in the zod schema (packages/types/src/global-settings.ts) via .default(...) instead of z.boolean().optional(), and have the four consumers (DiffViewProvider save + revert, ClineProvider.getStateToPostToWebview, UISettings) source the default from that single definition rather than each carrying a ?? true.

Trade-offs / risks

Users who relied on the token-saving default-close behavior will need to re-enable it once after upgrading. Centralizing the default removes the divergence class that caused #667 and makes any future default change a one-line edit.

Zoo Code Task Links (optional)

N/A — findings from a code review of merged PR #589 (commit 496100f) and its follow-up #668 (commit de8886a) on main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    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