Skip to content

feat: add provider session ID copy actions - #1040

Open
sudo-eugene wants to merge 2 commits into
siteboon:mainfrom
TheWebEng:feat/copy-provider-session-id
Open

feat: add provider session ID copy actions#1040
sudo-eugene wants to merge 2 commits into
siteboon:mainfrom
TheWebEng:feat/copy-provider-session-id

Conversation

@sudo-eugene

@sudo-eugene sudo-eugene commented Jul 18, 2026

Copy link
Copy Markdown

What changed

CloudCLI now lets users copy the provider-native Claude, Codex, Cursor, or OpenCode session ID from a compact session actions menu on mobile and desktop.

Why now

The UI exposed only CloudCLI's internal session identifier, leaving users—especially those working from the mobile PWA—without a practical way to move a conversation into native CLI workflows.

Why

Provider-native IDs remain outside normal session payloads and are fetched only when the user opens the actions menu. This preserves the existing distinction between CloudCLI's stable application ID and the provider's own ID while making the latter available for an explicit copy action.

The copy, rename, and archive/delete actions share the existing action-menu behavior on desktop rather than adding another independent popover. On mobile, the same actions use a bottom sheet with a dedicated vertical entrance so the narrow session row stays uncluttered.

Before and after

Before After
image image
image image

Test plan

  • npm run typecheck
  • Focused ESLint check for the changed frontend and server files (no errors)
  • npx tsx --tsconfig server/tsconfig.json --test server/modules/providers/tests/sessions.service.test.ts
  • npm run build
  • Verified copy confirmation, rename/cancel, and archive confirmation in the browser on desktop
  • Verified copy confirmation and the vertical session-options drawer in a 390 × 844 mobile viewport

Summary by CodeRabbit

  • New Features

    • Added the ability to copy provider-specific session IDs from session options.
    • Added session options menus for desktop and mobile, including rename, archive, and delete actions.
    • Added provider session ID lookup with clear handling for unavailable or invalid sessions.
  • UI Improvements

    • Improved action menus with portal rendering, keyboard support, custom headers, and icon-only triggers.
    • Added smoother bottom-sheet animations and customizable dialog animations.
  • Bug Fixes

    • Improved menu behavior when clicking outside, scrolling, resizing, or selecting actions.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3394ea70-a7d5-427e-bc37-982f1e86d512

📥 Commits

Reviewing files that changed from the base of the PR and between 6c170b8 and 089f7da.

📒 Files selected for processing (2)
  • server/modules/providers/tests/sessions.service.test.ts
  • src/components/sidebar/view/subcomponents/SidebarSessionItem.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • server/modules/providers/tests/sessions.service.test.ts
  • src/components/sidebar/view/subcomponents/SidebarSessionItem.tsx

📝 Walkthrough

Walkthrough

Adds a provider session ID lookup endpoint and service method, connects it to sidebar copy actions on mobile and desktop, and extends shared menu/dialog presentation behavior with portal support and bottom-sheet animation.

Changes

Provider session ID access

Layer / File(s) Summary
Provider session ID endpoint and service
server/modules/providers/provider.routes.ts, server/modules/providers/services/sessions.service.ts, server/modules/providers/tests/sessions.service.test.ts
Adds provider ID lookup, missing-session and unavailable-ID errors, and isolated database tests for successful and pending mappings.
Action menu interaction model
src/shared/view/ui/ActionMenu.tsx
Adds portal positioning, lifecycle callbacks, icon-only triggers, custom menu content, and configurable item closing behavior.
Sidebar session options
src/utils/api.js, src/components/sidebar/view/subcomponents/SidebarSessionItem.tsx
Fetches and copies provider session IDs, with mobile dialog actions and desktop menu actions for copy, rename, and deletion.
Mobile options presentation
src/shared/view/ui/Dialog.tsx, tailwind.config.js
Adds dialog animation overrides and a bottom-sheet content reveal animation.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SidebarSessionItem
  participant api
  participant ProviderRoute
  participant SessionsService
  User->>SidebarSessionItem: Open session options
  SidebarSessionItem->>api: Request provider session ID
  api->>ProviderRoute: GET provider-id endpoint
  ProviderRoute->>SessionsService: Resolve session mapping
  SessionsService-->>SidebarSessionItem: Return provider session ID
  SidebarSessionItem-->>User: Copy ID and update action state
Loading

Suggested reviewers: viper151

Poem

I’m a rabbit with a copied ID,
Through menus where quick actions hide.
The provider path now shines,
Errors mark their proper lines,
And soft sheets gently glide.

🚥 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 clearly matches the main change: adding provider session ID copy actions.
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.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
server/modules/providers/tests/sessions.service.test.ts (1)

40-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the missing-session error contract.

The new service method also promises SESSION_NOT_FOUND with status 404, but these tests only cover success and unavailable provider IDs.

Proposed test
+test('provider session id reports a missing app session', { concurrency: false }, async () => {
+  await withIsolatedDatabase(() => {
+    assert.throws(
+      () => sessionsService.getProviderSessionId('missing-session'),
+      (error: unknown) => {
+        const typedError = error as { code?: string; statusCode?: number };
+        return typedError.code === 'SESSION_NOT_FOUND' && typedError.statusCode === 404;
+      },
+    );
+  });
+});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/modules/providers/tests/sessions.service.test.ts` around lines 40 -
52, Add a test alongside the existing provider session ID tests that calls
sessionsService.getProviderSessionId with a session identifier absent from the
database and asserts the thrown error has code SESSION_NOT_FOUND and statusCode
404. Keep the existing success and PROVIDER_SESSION_ID_NOT_AVAILABLE coverage
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/sidebar/view/subcomponents/SidebarSessionItem.tsx`:
- Around line 98-100: Update the provider-session request flow associated with
providerSessionId and the mobile options state so closing the options
invalidates any in-flight provider-ID request before a subsequent reopen. Track
request sequencing or cancellation, and ignore responses from stale requests so
an older response cannot overwrite the latest success or error state.
- Around line 175-202: Update the copy-state handling in copyProviderSessionId,
handleCopyAction, and copyLabel so clipboard failure is represented separately
from an unavailable providerSessionId. Preserve the loaded session ID after
copyTextToClipboard fails, display a clipboard-copy failure state, and make
subsequent clicks retry copying instead of calling loadProviderSessionId;
reserve the unavailable state for missing or failed session ID loading.

---

Nitpick comments:
In `@server/modules/providers/tests/sessions.service.test.ts`:
- Around line 40-52: Add a test alongside the existing provider session ID tests
that calls sessionsService.getProviderSessionId with a session identifier absent
from the database and asserts the thrown error has code SESSION_NOT_FOUND and
statusCode 404. Keep the existing success and PROVIDER_SESSION_ID_NOT_AVAILABLE
coverage unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 53d9c645-c757-446d-aad4-e88d204dcf51

📥 Commits

Reviewing files that changed from the base of the PR and between 27eaf01 and 6c170b8.

📒 Files selected for processing (8)
  • server/modules/providers/provider.routes.ts
  • server/modules/providers/services/sessions.service.ts
  • server/modules/providers/tests/sessions.service.test.ts
  • src/components/sidebar/view/subcomponents/SidebarSessionItem.tsx
  • src/shared/view/ui/ActionMenu.tsx
  • src/shared/view/ui/Dialog.tsx
  • src/utils/api.js
  • tailwind.config.js

Comment thread src/components/sidebar/view/subcomponents/SidebarSessionItem.tsx
Comment thread src/components/sidebar/view/subcomponents/SidebarSessionItem.tsx
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