Skip to content

fix: improve swappable filesystem architecture#1314

Merged
MODSetter merged 14 commits intoMODSetter:devfrom
AnishSarkar22:fix/swappable-filesystem
Apr 27, 2026
Merged

fix: improve swappable filesystem architecture#1314
MODSetter merged 14 commits intoMODSetter:devfrom
AnishSarkar22:fix/swappable-filesystem

Conversation

@AnishSarkar22
Copy link
Copy Markdown
Contributor

@AnishSarkar22 AnishSarkar22 commented Apr 27, 2026

Description

  1. Sidebar local-folder UX polish

    • Added clearer tooltip feedback when users hit folder-add limits.
    • Introduced loading skeletons in DocumentsSidebar and LocalFilesystemBrowser.
    • Removed unused drag-and-drop code paths to simplify sidebar behavior.
  2. Local filesystem root handling + performance improvements

    • Standardized root canonicalization and mount resolution across backend/desktop/web flow.
    • Increased supported local roots (up to 10), improved path normalization, and added settings caching.
    • Preserved incremental interaction behavior so local-folder UX stays stable during updates.
  3. Search-space aware filesystem operations

    • Propagated searchSpaceId through desktop IPC/preload, web integration, and typings.
    • Ensures filesystem requests execute against the correct search-space context end-to-end.
  4. Desktop/web code-splitting cleanup

    • Extracted DesktopLocalTabContent from DocumentsSidebar.
    • Reduces web bundle impact by isolating desktop-specific local tab logic.
  5. Backend filesystem capability expansion

    • Added move and list_tree operations in filesystem middleware/local backends.
    • Removed cursor-based pagination and simplified traversal/path normalization behavior.
  6. Real-time local tree sync

    • Added chokidar-based filesystem tree watcher in desktop.
    • Wired events through IPC/preload/web so UI updates when local folder contents change.
  7. File opening + fallback naming consistency

    • Added support for configurable openable local text extensions.
    • Improved folder expansion-state persistence in local browser UI.
    • Standardized text fallback filename behavior to notes.md (removed extension inference).
  8. Source editor defaults refinement

    • Adjusted line number display, disabled folding, and tuned whitespace rendering for a cleaner editing experience.

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR introduces significant architectural improvements to the swappable filesystem feature for local folder mode. The main changes include: adding two new filesystem tools (move_file and list_tree with cursor-based pagination) to the agent middleware, implementing per-search-space filesystem settings isolation in the desktop app, adding a real-time filesystem tree watcher using chokidar with safety polling and debouncing, overhauling the local filesystem browser UI with skeleton loading states, and improving path normalization and mount resolution across the stack. The changes enable better scalability for large directory trees, multi-space support, and a more responsive user experience with live filesystem monitoring.

⏱️ Estimated Review Time: 1-3 hours

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/app/agents/new_chat/middleware/filesystem.py
2 surfsense_backend/app/agents/new_chat/middleware/local_folder_backend.py
3 surfsense_backend/app/agents/new_chat/middleware/multi_root_local_folder_backend.py
4 surfsense_backend/tests/unit/middleware/test_filesystem_backends.py
5 surfsense_backend/tests/unit/middleware/test_multi_root_local_folder_backend.py
6 surfsense_desktop/src/modules/agent-filesystem.ts
7 surfsense_desktop/src/modules/agent-filesystem-tree-watcher.ts
8 surfsense_desktop/src/ipc/channels.ts
9 surfsense_desktop/src/ipc/handlers.ts
10 surfsense_desktop/src/preload.ts
11 surfsense_web/types/window.d.ts
12 surfsense_web/lib/agent-filesystem.ts
13 surfsense_web/components/editor-panel/editor-panel.tsx
14 surfsense_web/components/assistant-ui/markdown-text.tsx
15 surfsense_web/components/layout/ui/sidebar/LocalFilesystemBrowser.tsx
16 surfsense_web/components/layout/ui/sidebar/DesktopLocalTabContent.tsx
17 surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
18 surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx
19 surfsense_web/components/ui/tooltip.tsx
⚠️ Inconsistent Changes Detected
File Path Warning
surfsense_web/components/ui/tooltip.tsx Changes tooltip behavior from mobile detection to hover-capability detection. While this improves UX, it appears to be a general UI enhancement rather than directly related to the filesystem architecture improvements.

Need help? Join our Discord

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2f1a7906-b78a-4ab2-8768-6b6b36881cb2

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.

…rsor-based pagination and enhancing path normalization methods
… standardize fallback filename to 'notes.md'
…nsions and enhance folder expansion persistence in the UI
…e number display, disabling folding, and modifying whitespace rendering options
@AnishSarkar22 AnishSarkar22 marked this pull request as ready for review April 27, 2026 20:24
@MODSetter MODSetter merged commit 19f4668 into MODSetter:dev Apr 27, 2026
13 of 17 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.

2 participants