Skip to content

fix(copilot): context filtering#1160

Merged
Sg312 merged 5 commits intostagingfrom
fix/copilot-context-filter
Aug 28, 2025
Merged

fix(copilot): context filtering#1160
Sg312 merged 5 commits intostagingfrom
fix/copilot-context-filter

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Aug 28, 2025

Summary

Scope copilot context to workflows/kbs/chats from the workspace

Type of Change

  • Bug fix

Testing

Manual

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Aug 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 28, 2025 6:02am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 28, 2025 6:02am

@vercel vercel bot temporarily deployed to Preview – docs August 28, 2025 05:49 Inactive
@vercel vercel bot temporarily deployed to Preview – docs August 28, 2025 05:50 Inactive
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR implements workspace-based context filtering for the copilot feature by scoping the @ mention functionality to only show chats, workflows, and knowledge bases from the current workspace. The changes are made to the user-input.tsx component within the copilot panel.

The implementation adds workspace scoping through several key changes:

  1. Workspace ID extraction: Uses Next.js useParams hook to extract workspaceId from the URL parameters
  2. Chat filtering: Filters chats based on workspace workflows, requiring workflows to be loaded first since chats are associated with workflows rather than directly with workspaces
  3. Workflow filtering: Directly filters workflows by workspaceId
  4. Knowledge base filtering: Adds workspaceId as a query parameter to the knowledge base API calls

This change integrates well with the existing codebase architecture, as the workflows and knowledge APIs already support workspace-based filtering. The copilot component now follows the same patterns used throughout the application for workspace scoping, ensuring consistent behavior and proper data isolation between workspaces. The implementation maintains the existing user experience while preventing cross-workspace data leakage in the mention suggestions.

Confidence score: 4/5

  • This PR addresses a clear security and UX concern with minimal risk of breaking existing functionality
  • Score reflects solid implementation following established patterns, though the chat filtering dependency on workflows loading could potentially cause edge cases
  • Pay close attention to the chat filtering logic which depends on workflows being loaded before chats can be properly filtered

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – docs August 28, 2025 05:53 Inactive
@Sg312 Sg312 merged commit 104d34c into staging Aug 28, 2025
4 of 5 checks passed
aadamgough pushed a commit that referenced this pull request Aug 28, 2025
* Add filter

* Scope kb and chats

* Lint

* Remove comments

* Lint
@waleedlatif1 waleedlatif1 deleted the fix/copilot-context-filter branch August 29, 2025 05:01
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
* Add filter

* Scope kb and chats

* Lint

* Remove comments

* Lint
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.

1 participant