Skip to content

Add shared chat management controls - #25

Merged
TraderSamwise merged 1 commit into
masterfrom
feat/multi-user-chat-management
May 24, 2026
Merged

Add shared chat management controls#25
TraderSamwise merged 1 commit into
masterfrom
feat/multi-user-chat-management

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • add owner-scoped relay share management routes for share lookup, guest leave, and owner participant removal
  • add app API wrappers for share listing, lookup, leave, and participant removal
  • expand the chat share panel to show participants/pending invites, remove guests, and let guests leave shared chats

Verification

  • yarn vitest run relay/src/sharing.test.ts
  • yarn --cwd app vitest run lib/api.test.ts
  • yarn --cwd app lint
  • yarn --cwd app test
  • yarn --cwd app typecheck
  • yarn typecheck
  • yarn build

Summary by CodeRabbit

  • New Features

    • Shared chat collaboration now supports leaving active shared sessions
    • View and manage participants in shared chats with remove functionality
    • Enhanced share panel displaying active members and pending invitations
  • Tests

    • Added test coverage for share management endpoints and relay-based routing

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a0d649fd-5ed6-4483-9572-c07071c4ce54

📥 Commits

Reviewing files that changed from the base of the PR and between 79d120c and 618a870.

📒 Files selected for processing (5)
  • app/app/(main)/(tabs)/(dashboard)/agent/[sessionId]/chat.tsx
  • app/lib/api.test.ts
  • app/lib/api.ts
  • relay/src/index.ts
  • relay/src/relay-object.ts

📝 Walkthrough

Walkthrough

This PR extends shared-chat collaboration with full participant lifecycle management. It adds API contracts and client functions to fetch and manage shares, implements relay HTTP endpoints with authorization checks, and integrates share state tracking and participant removal/leave handlers into the chat UI.

Changes

Shared Chat Lifecycle Management

Layer / File(s) Summary
Share API contracts and client functions
app/lib/api.ts, app/lib/api.test.ts
ShareResponse and SharesResponse types define relay share summaries. New exports: listShares, getShare, leaveShare, removeShareParticipant. Relay URL construction is centralized via relayHttpUrl() helper. createShareInvite and acceptShareInvite are updated to use the helper. Test validates owner-scoped routes, URL encoding, HTTP methods, and bearer authentication headers.
Relay share routing and HTTP handlers
relay/src/index.ts, relay/src/relay-object.ts
index.ts derives ownerUserId from invite-accept or owner-scoped /shares/{owner...} routes and conditionally sets X-Aimux-Share-Owner-Id header. relay-object.ts adds getShare, leaveShare, removeShareParticipant handlers that parse paths, validate actor context/authorization, load sharing state, apply mutations via imported sharing helpers, and return JSON. Local helpers parseOwnerSharePath, parseParticipantPath, and canReadShare centralize URL parsing and read-permission logic.
Chat UI share state and lifecycle handlers
app/app/(main)/(tabs)/(dashboard)/agent/[sessionId]/chat.tsx
Chat component adds shareSummary and shareAction state; reads activeShare from atom. New useEffect refreshes shareSummary when share panel opens via getShare (if activeShare matches) or filtered listShares. handleSendInvite updates shareSummary from response. handleRemoveParticipant and handleLeaveShare guard on auth/share state, manage shareAction, update shared state, and surface errors in inviteStatus. Share panel renders active-share header with Leave button or invite form; when shareSummary exists, shows participants list with per-participant Remove buttons and pending-invites section.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • TraderSamwise/aimux#23: Modifies the shared-chat invite panel flow in chat.tsx by wiring UI state to relay share operations; PR #25 builds on that foundation to add participant removal and share-leaving lifecycle.
  • TraderSamwise/aimux#18: Establishes the shared-relay foundation with sharing state primitives, auth gating, and participant lifecycle that PR #25 extends with new client/relay endpoints for listing, fetching, leaving, and removing participants.
  • TraderSamwise/aimux#20: Both PRs update shared-chat relay routing in relay/src/index.ts to compute ownerUserId for /shares and set X-Aimux-Share-Owner-Id header accordingly.

🐰 A shared chat blossoms bright,
Participants join, then make their flight—
Remove and leave with graceful ease,
Your relay hops through all these fees! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add shared chat management controls' directly and specifically describes the main objective of the PR, which is to add controls for managing shared chats (leave, remove participants, list/lookup shares).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/multi-user-chat-management

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

app/app/(main)/(tabs)/(dashboard)/agent/[sessionId]/chat.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

app/lib/api.test.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

app/lib/api.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.


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

@TraderSamwise
TraderSamwise merged commit e420233 into master May 24, 2026
1 check passed
@TraderSamwise
TraderSamwise deleted the feat/multi-user-chat-management branch May 24, 2026 11:02
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