Skip to content

feat: add real-time collaboration for analysis sessions#973

Open
bhavyajain0810 wants to merge 2 commits into
imDarshanGK:mainfrom
bhavyajain0810:feat/live-collaboration-676
Open

feat: add real-time collaboration for analysis sessions#973
bhavyajain0810 wants to merge 2 commits into
imDarshanGK:mainfrom
bhavyajain0810:feat/live-collaboration-676

Conversation

@bhavyajain0810

Copy link
Copy Markdown

Description

Implemented real-time collaboration support for analysis sessions.

This PR adds a WebSocket-based collaboration layer that allows multiple users to join the same session and work together while reviewing code. It includes live code syncing, collaborator presence, cursor position sharing, live review comments, basic version-based conflict handling, heartbeat support, frontend collaboration controls, and backend test coverage.

Related Issue

Fixes #676

Backend changes

  • Added a new /collaboration/ws/{session_id} WebSocket endpoint.
  • Added in-memory collaboration rooms per session.
  • Added live code synchronization across connected clients.
  • Added active collaborator presence tracking.
  • Added cursor update broadcasting for multi-user editing visibility.
  • Added live comments with author, line number, timestamp, and color metadata.
  • Added lightweight version-based conflict handling using room versions and sync_required.
  • Added heartbeat support through ping / pong.
  • Registered the collaboration router in the FastAPI app.
  • Exposed the collaboration endpoint in system endpoint listings.

Frontend changes

  • Added a live collaboration panel to the code editor.
  • Added session join/leave controls.
  • Added active collaborator badges.
  • Added cursor line/column visibility.
  • Added live review comment input and rendering.
  • Added debounced WebSocket code sync.
  • Added client-side heartbeat handling.
  • Reused the existing API base configuration for WebSocket connection setup.

Tests added

  • Added WebSocket tests for:
    • session join state
    • code update broadcasting
    • stale update conflict handling
    • cursor update broadcasting
    • comment broadcasting
    • heartbeat response

Type of change

  • Bug fix
  • New feature / enhancement
  • Documentation update
  • Test addition
  • Refactor

Checklist

  • I have read CONTRIBUTING.md
  • My branch is up to date with main
  • I have run pytest -v and all tests pass
  • I have not introduced duplicate issues or features
  • My PR title follows the format: feat/fix/docs/test: short description
  • I have added tests for new features (Level 2 and 3 issues)
  • No hardcoded secrets or API keys in my code
  • This PR is linked to a GSSoC 2026 issue

Screenshots (if frontend change)

Live collaboration panel

Added a collaboration panel above the code editor for entering user name, session ID, joining/leaving live sessions, viewing collaboration status, and adding live review comments.

Screenshot 2026-06-09 131241

Active collaboration session

Verified that multiple users can join the same collaboration session and see live collaboration status/presence.

Screenshot 2026-06-09 131441

Adding live review comments

Verified that users can add live review comments inside a collaboration session.

image

Test evidence

pytest -v
405 passed, 2 warnings in 35.27s
The warnings are existing dependency/deprecation warnings and are unrelated to this change.
image

@bhavyajain0810

Copy link
Copy Markdown
Author

Hi @imDarshanGK,

Just following up on this PR whenever you have a chance to review it.

The implementation includes the real-time collaboration WebSocket flow, session presence, live code syncing, cursor updates, review comments, heartbeat handling, conflict/version handling, frontend controls, and backend test coverage.

Current verification:

  • 405 passed, 2 warnings
  • Frontend screenshots and test evidence are included in the PR description
  • The branch has been synced with main
  • The PR is currently awaiting the required code-owner review

Since this is a relatively large feature, I would appreciate any review feedback or requested changes so I can address them promptly.

Thank you!

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.

Add real-time collaboration for live analysis sessions

1 participant