Skip to content

fix(web): make changed-files collapse persistence configurable#2260

Open
Marve10s wants to merge 5 commits into
pingdotgg:mainfrom
Marve10s:fix/changed-files-collapse-persistence
Open

fix(web): make changed-files collapse persistence configurable#2260
Marve10s wants to merge 5 commits into
pingdotgg:mainfrom
Marve10s:fix/changed-files-collapse-persistence

Conversation

@Marve10s
Copy link
Copy Markdown
Contributor

@Marve10s Marve10s commented Apr 21, 2026

Summary

This keeps changed-files collapse scoped per turn by default, and adds a settings toggle for people who want collapse state to persist across future turns in the same thread and survive relaunch.

What Changed

  • added a client setting for changed-files collapse persistence in General settings
  • restored per-turn changed-files collapse as the default behavior
  • kept thread-wide collapse persistence available when the new setting is enabled
  • preserved immediate persistence so collapse changes still survive relaunch
  • normalized persisted changed-files state so both legacy per-turn data and the thread-wide shape continue to hydrate correctly
  • added regression coverage for:
    • default per-turn collapse behavior
    • opt-in cross-turn collapse persistence
    • settings hydration
    • browser and desktop client-settings persistence fixtures

Review Feedback Addressed

  • kept the original per-turn UX as the default, per review feedback
  • made cross-turn persistence configurable instead of always-on
  • retained the persistence fix that avoids losing the latest collapse state on relaunch

User Impact

Users who prefer the old per-turn behavior keep it by default. Users who want changed-files blocks to stay collapsed across future prompts can enable the new toggle in Settings.

Validation

  • bun run --cwd apps/web test -- src/uiStateStore.test.ts src/components/chat/MessagesTimeline.test.tsx src/localApi.test.ts
  • bun run --cwd apps/web test:browser -- src/components/chat/MessagesTimeline.browser.tsx
  • bun run --cwd apps/web test:browser -- src/components/settings/SettingsPanels.browser.tsx
  • bun run --cwd apps/desktop test -- src/clientPersistence.test.ts
  • bun fmt
  • bun lint
  • bun typecheck

Note

Make changed-files collapse state configurable per user setting

  • Adds a defaultOpenChangedFiles boolean to ClientSettingsSchema (default true) and exposes a toggle in the General settings panel via SettingsPanels.tsx.
  • Threads the setting from ChatView.tsx down to AssistantChangedFilesSectionInner, where it determines the initial expansion state per assistant turn.
  • Per-turn overrides are stored in uiStateStore relative to the default; toggling back to the default removes the override to keep persisted state minimal.
  • Fixes hydration in uiStateStore.ts so that true per-turn overrides are no longer dropped and legacy thread-wide booleans are ignored on reload.
  • Behavioral Change: setThreadChangedFilesExpanded now requires a defaultExpanded argument, and the store immediately persists project and per-turn changed-files state instead of relying solely on debounced persistence.
📊 Macroscope summarized 3a01b7b. 6 files reviewed, 2 issues evaluated, 0 issues filtered, 1 comment posted

🗂️ Filtered Issues


Note

Medium Risk
Changes UI-state persistence semantics and storage schema for changed-files expand/collapse, which could affect how existing users’ preferences hydrate and persist across sessions.

Overview
Adds a new client setting, defaultOpenChangedFiles (default true), exposed in General settings and plumbed through ChatView into MessagesTimeline to control whether changed-files blocks start expanded or collapsed.

Updates changed-files expand/collapse tracking to be per-turn with a helper (getThreadChangedFilesExpanded) and a revised setThreadChangedFilesExpanded that stores overrides relative to the configured default and prunes them when toggled back to default; legacy persisted thread-wide boolean values are ignored during hydration.

Adjusts uiStateStore persistence so key store actions immediately call persistState (in addition to the debounced subscriber) and updates tests/fixtures across web + desktop to include the new setting and cover the new per-turn/default-aware behavior.

Reviewed by Cursor Bugbot for commit 3a01b7b. Bugbot is set up for automated code reviews on this repo. Configure here.

Closes #2158

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ea035f22-a1b1-45ce-84e5-250b23882bdc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 21, 2026
@Marve10s Marve10s marked this pull request as ready for review April 21, 2026 13:12
Comment thread apps/web/src/uiStateStore.ts
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 21, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 21, 2026

Approvability

Verdict: Needs human review

1 blocking correctness issue found. Unresolved review comments identify a bug: the new defaultOpenChangedFiles setting appears in the 'restore defaults' dialog but isn't actually reset when clicking restore. This user-facing issue should be addressed before merging.

You can customize Macroscope's approvability policy. Learn more.

@Marve10s Marve10s force-pushed the fix/changed-files-collapse-persistence branch from 4d1dffc to bc2b8d9 Compare April 21, 2026 13:18
@macroscopeapp macroscopeapp Bot dismissed their stale review April 21, 2026 13:18

Dismissing prior approval to re-evaluate bc2b8d9

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 21, 2026
@juliusmarminge
Copy link
Copy Markdown
Member

it being turn based is intentional. you might collapse a big block cause it was part of a merge commit, but then still wanting to keep track of future turns

@Marve10s
Copy link
Copy Markdown
Contributor Author

it being turn based is intentional. you might collapse a big block cause it was part of a merge commit, but then still wanting to keep track of future turns

Feels annoying since I do have lots of threads where I need to scroll a lot to see actual output. I can turn it into configuration option in settings so everyone would be able to toggle it. I will leave current version as default

@juliusmarminge
Copy link
Copy Markdown
Member

I can turn it into configuration option in settings so everyone would be able to toggle it. I will leave current version as default

Sounds good!

@macroscopeapp macroscopeapp Bot dismissed their stale review April 21, 2026 16:00

Dismissing prior approval to re-evaluate 68b66b4

@Marve10s Marve10s changed the title fix(web): persist changed-files collapse state across turns and relaunch fix(web): make changed-files collapse persistence configurable Apr 21, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 21, 2026
@Marve10s
Copy link
Copy Markdown
Contributor Author

@juliusmarminge Seems like works fine , added a toggle in settings. Lmk if there any issue
image

Comment thread apps/web/src/uiStateStore.ts Outdated
Comment thread packages/contracts/src/settings.ts
@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Apr 23, 2026
@macroscopeapp macroscopeapp Bot dismissed their stale review April 23, 2026 11:17

Dismissing prior approval to re-evaluate dd4351a

Comment thread apps/desktop/src/main.ts Outdated
Comment thread apps/web/src/routes/__root.tsx Outdated
Comment thread apps/web/src/modelSelection.ts Outdated
Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts Outdated
Comment thread apps/desktop/src/main.ts Outdated
Comment thread apps/web/src/components/GitActionsControl.tsx
Comment thread apps/web/src/components/WebSocketConnectionSurface.tsx Outdated
@Marve10s Marve10s force-pushed the fix/changed-files-collapse-persistence branch from 41af439 to 7c4037b Compare April 23, 2026 12:03
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:XXL 1,000+ changed lines (additions + deletions). labels Apr 23, 2026
@Marve10s Marve10s force-pushed the fix/changed-files-collapse-persistence branch from 7c4037b to d03f177 Compare April 29, 2026 17:39
@Marve10s
Copy link
Copy Markdown
Contributor Author

@juliusmarminge Sorry for tagging you, wanted to ask if you have any plans on reviewing old PRs? I have a couple of them and they are all more than 2 weeks old, so I'm not sure if they would be visible among all the new PRs coming in.

@juliusmarminge
Copy link
Copy Markdown
Member

Yes. Will get back to reviewing stuff, just have some pretty large PRs that will conflict a bunch so will get those in first

@Marve10s
Copy link
Copy Markdown
Contributor Author

Yes. Will get back to reviewing stuff, just have some pretty large PRs that will conflict a bunch so will get those in first

Great, thank you! Let me know if you are looking for any free help, I'd love to help. Can review, test, record demos, etc.

Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
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.

🟠 High

The defaultOpenChangedFiles setting is included in changedSettingLabels (shown as "Changed-files default state") but missing from the updateSettings call in restoreDefaults. After confirming the reset dialog, users see the setting listed as being reset but the value is never actually restored to default.

🤖 Copy this AI Prompt to have your agent fix this:
In file apps/web/src/components/settings/SettingsPanels.tsx around line 461:

The `defaultOpenChangedFiles` setting is included in `changedSettingLabels` (shown as "Changed-files default state") but missing from the `updateSettings` call in `restoreDefaults`. After confirming the reset dialog, users see the setting listed as being reset but the value is never actually restored to default.

Evidence trail:
apps/web/src/components/settings/SettingsPanels.tsx lines 397-399: `defaultOpenChangedFiles` checked in `changedSettingLabels` as 'Changed-files default state'. Lines 463-475: `updateSettings` call in `restoreDefaults` omits `defaultOpenChangedFiles` while including all other settings tracked in `changedSettingLabels`. Verified at REVIEWED_COMMIT.

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3a01b7b. Configure here.

settings.confirmThreadArchive,
settings.confirmThreadDelete,
settings.addProjectBaseDirectory,
settings.defaultOpenChangedFiles,
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.

Restore defaults omits new defaultOpenChangedFiles setting

Medium Severity

The changedSettingLabels memo correctly detects when defaultOpenChangedFiles differs from the default and shows "Changed-files default state" in the restore confirmation dialog. However, the restoreDefaults callback's updateSettings call does not include defaultOpenChangedFiles, so clicking "Restore default settings" tells the user this setting will be reset but never actually resets it.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3a01b7b. Configure here.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add a setting for default changed-files expansion in chat UI

2 participants