Skip to content

feat: Onedrive connector with sensitive actions using HITL#1027

Merged
MODSetter merged 27 commits intoMODSetter:devfrom
AnishSarkar22:feat/onedrive-connector
Mar 29, 2026
Merged

feat: Onedrive connector with sensitive actions using HITL#1027
MODSetter merged 27 commits intoMODSetter:devfrom
AnishSarkar22:feat/onedrive-connector

Conversation

@AnishSarkar22
Copy link
Copy Markdown
Contributor

@AnishSarkar22 AnishSarkar22 commented Mar 28, 2026

Description

  • New onedrive connector with sensitive actions such as create/delete using Human In The Loop.
  • Some UX improvements.

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 adds a new OneDrive connector with comprehensive functionality including OAuth authentication, file indexing, folder browsing, and Human-in-the-Loop (HITL) sensitive actions for creating and deleting files. The implementation mirrors the existing Google Drive connector architecture with Microsoft Graph API integration for OneDrive access. The backend introduces database migrations for OneDrive document types, a complete OneDrive client with token refresh logic, content extraction pipeline integration, parallel indexing with delta sync support, and HITL-enabled agent tools. The frontend adds a folder/file browser UI, connector configuration management, approval workflows for sensitive operations, and comprehensive documentation. Microsoft OAuth credentials (MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET) are now shared between Teams and OneDrive connectors.

⏱️ Estimated Review Time: 3+ hours

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/app/db.py
2 surfsense_backend/alembic/versions/110_add_onedrive_connector_enums.py
3 surfsense_backend/app/config/__init__.py
4 docker/.env.example
5 surfsense_backend/.env.example
6 surfsense_backend/app/schemas/onedrive_auth_credentials.py
7 surfsense_backend/app/connectors/onedrive/file_types.py
8 surfsense_backend/app/connectors/onedrive/client.py
9 surfsense_backend/app/connectors/onedrive/content_extractor.py
10 surfsense_backend/app/connectors/onedrive/folder_manager.py
11 surfsense_backend/app/connectors/onedrive/__init__.py
12 surfsense_backend/app/routes/onedrive_add_connector_route.py
13 surfsense_backend/app/routes/__init__.py
14 surfsense_backend/app/tasks/connector_indexers/onedrive_indexer.py
15 surfsense_backend/app/tasks/celery_tasks/connector_tasks.py
16 surfsense_backend/app/routes/search_source_connectors_routes.py
17 surfsense_backend/app/agents/new_chat/tools/onedrive/create_file.py
18 surfsense_backend/app/agents/new_chat/tools/onedrive/trash_file.py
19 surfsense_backend/app/agents/new_chat/tools/onedrive/__init__.py
20 surfsense_backend/app/agents/new_chat/tools/registry.py
21 surfsense_backend/app/agents/new_chat/chat_deepagent.py
22 surfsense_backend/app/agents/new_chat/middleware/dedup_tool_calls.py
23 surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
24 surfsense_backend/app/utils/connector_naming.py
25 surfsense_backend/app/routes/teams_add_connector_route.py
26 surfsense_backend/tests/integration/indexing_pipeline/test_onedrive_pipeline.py
27 surfsense_backend/tests/unit/connector_indexers/test_onedrive_parallel.py
28 surfsense_web/contracts/enums/connector.ts
29 surfsense_web/contracts/enums/connectorIcons.tsx
30 surfsense_web/lib/connectors/utils.ts
31 surfsense_web/public/connectors/onedrive.svg
32 surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts
33 surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/onedrive-config.tsx
34 surfsense_web/components/assistant-ui/connector-popup/connector-configs/index.tsx
35 surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
36 surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
37 surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts
38 surfsense_web/components/tool-ui/onedrive/create-file.tsx
39 surfsense_web/components/tool-ui/onedrive/trash-file.tsx
40 surfsense_web/components/tool-ui/onedrive/index.ts
41 surfsense_web/components/tool-ui/index.ts
42 surfsense_web/components/assistant-ui/assistant-message.tsx
43 surfsense_web/components/assistant-ui/thread.tsx
44 surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx
45 surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentTypeIcon.tsx
46 surfsense_web/components/documents/DocumentNode.tsx
47 surfsense_web/lib/apis/connectors-api.service.ts
48 surfsense_web/lib/chat/streaming-state.ts
49 surfsense_web/content/docs/connectors/microsoft-onedrive.mdx
50 surfsense_web/content/docs/connectors/microsoft-teams.mdx
51 surfsense_web/content/docs/connectors/index.mdx
52 surfsense_web/content/docs/connectors/meta.json
53 surfsense_web/content/docs/docker-installation/docker-compose.mdx
54 surfsense_web/content/docs/manual-installation.mdx
55 surfsense_web/app/sitemap.ts

Need help? Join our Discord

Analyze latest changes

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 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.

Copy link
Copy Markdown

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on 947def5..dd6558e

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (50)

docker/.env.example
surfsense_backend/.env.example
surfsense_backend/alembic/versions/110_add_onedrive_connector_enums.py
surfsense_backend/app/agents/new_chat/chat_deepagent.py
surfsense_backend/app/agents/new_chat/middleware/dedup_tool_calls.py
surfsense_backend/app/agents/new_chat/tools/knowledge_base.py
surfsense_backend/app/agents/new_chat/tools/onedrive/__init__.py
surfsense_backend/app/agents/new_chat/tools/onedrive/create_file.py
surfsense_backend/app/agents/new_chat/tools/onedrive/trash_file.py
surfsense_backend/app/agents/new_chat/tools/registry.py
surfsense_backend/app/config/__init__.py
surfsense_backend/app/connectors/onedrive/__init__.py
surfsense_backend/app/connectors/onedrive/client.py
surfsense_backend/app/connectors/onedrive/content_extractor.py
surfsense_backend/app/connectors/onedrive/file_types.py
surfsense_backend/app/connectors/onedrive/folder_manager.py
surfsense_backend/app/db.py
surfsense_backend/app/routes/__init__.py
surfsense_backend/app/routes/onedrive_add_connector_route.py
surfsense_backend/app/routes/search_source_connectors_routes.py
surfsense_backend/app/routes/teams_add_connector_route.py
surfsense_backend/app/schemas/onedrive_auth_credentials.py
surfsense_backend/app/tasks/celery_tasks/connector_tasks.py
surfsense_backend/app/tasks/connector_indexers/onedrive_indexer.py
surfsense_backend/app/utils/connector_naming.py
surfsense_backend/tests/integration/indexing_pipeline/test_onedrive_pipeline.py
surfsense_backend/tests/unit/connector_indexers/test_onedrive_parallel.py
surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentTypeIcon.tsx
surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx
surfsense_web/app/sitemap.ts
surfsense_web/components/assistant-ui/assistant-message.tsx
surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/onedrive-config.tsx
surfsense_web/components/assistant-ui/connector-popup/connector-configs/index.tsx
surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts
surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts
surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
surfsense_web/components/assistant-ui/thread.tsx
surfsense_web/components/documents/DocumentNode.tsx
surfsense_web/components/tool-ui/index.ts
surfsense_web/components/tool-ui/onedrive/create-file.tsx
surfsense_web/components/tool-ui/onedrive/index.ts
surfsense_web/components/tool-ui/onedrive/trash-file.tsx
surfsense_web/content/docs/connectors/index.mdx
surfsense_web/content/docs/connectors/meta.json
surfsense_web/content/docs/connectors/microsoft-onedrive.mdx
surfsense_web/content/docs/connectors/microsoft-teams.mdx
surfsense_web/content/docs/docker-installation/docker-compose.mdx
surfsense_web/content/docs/manual-installation.mdx
surfsense_web/contracts/enums/connector.ts

⏭️ Files skipped (5)
  Locations  
surfsense_web/contracts/enums/connectorIcons.tsx
surfsense_web/lib/apis/connectors-api.service.ts
surfsense_web/lib/chat/streaming-state.ts
surfsense_web/lib/connectors/utils.ts
surfsense_web/public/connectors/onedrive.svg

…ctionality with new API endpoints and UI updates
…ntication issues; add toast notifications for picker errors
…and integrating DriveFolderTree component for improved UI
…ument type enum for improved OneDrive integration
…d enhance mobile experience with vaul drawer
…ormat and updating client to handle byte content
@AnishSarkar22 AnishSarkar22 marked this pull request as ready for review March 28, 2026 23:45
@MODSetter MODSetter merged commit 44fff96 into MODSetter:dev Mar 29, 2026
5 of 9 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