Conversation
Bug Report
Comments? Email us. |
|
Caution Review failedThe pull request is closed. WalkthroughThis update introduces a major refactor of the AI chat assistant's system prompt, focusing on clarity, safety, and streamlined tool usage. It adds new server tools, updates tool management to be dynamic, adjusts dependencies, removes the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Client (Mail App)
participant Server
participant ElevenLabs
User->>Client (Mail App): Sends request (e.g., "Summarize my inbox")
Client->>Server: POST /do/:action with payload and headers
Server->>Server: Load tools dynamically for user connection
Server->>Server: Select tool by action, execute tool
Server-->>Client (Mail App): Return tool result or error
%% Tool registration flow
Client (Script)->>ElevenLabs: Fetch existing tools
Client (Script)->>ElevenLabs: Delete old tools, update agents
Client (Script)->>ElevenLabs: Register new tools with schemas
Client (Script)->>ElevenLabs: Update agent with new tool IDs
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Bugbot found 4 bugsTo see them, activate your membership in the Cursor dashboard. |
There was a problem hiding this comment.
cubic analysis
3 issues found across 12 files • Review in cubic
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.
|
|
||
| async function main() { | ||
| const apiKey = process.env.ELEVENLABS_API_KEY; | ||
| const serverUrl = process.env.SERVER_URL || 'https://staging.0.email'; |
There was a problem hiding this comment.
A hard-coded fallback URL points to the staging environment, yet the code immediately afterwards aborts when SERVER_URL is falsy. Because the fallback makes serverUrl always truthy, this validation can never trigger and the script may silently register tools against the unintended https://staging.0.email host in production. Remove the default or the redundant check to avoid misconfiguration.
Prompt for AI agents
Address the following comment on scripts/register-elevenlabs-tools.ts at line 480:
<comment>A hard-coded fallback URL points to the staging environment, yet the code immediately afterwards aborts when SERVER_URL is falsy. Because the fallback makes serverUrl always truthy, this validation can never trigger and the script may silently register tools against the unintended https://staging.0.email host in production. Remove the default or the redundant check to avoid misconfiguration.</comment>
<file context>
@@ -0,0 +1,630 @@
+#!/usr/bin/env tsx
+
+/**
+ * Bulk-register / update all ai-sdk tools as ElevenLabs tools.
+ * This version:
+ * 1. Lists existing tools
+ * 2. Deletes them all
+ * 3. Creates new ones
+ *
</file context>
| const serverUrl = process.env.SERVER_URL || 'https://staging.0.email'; | |
| const serverUrl = process.env.SERVER_URL; |
| WebSearch = 'webSearch', | ||
| InboxRag = 'inboxRag', | ||
| BuildGmailSearchQuery = 'buildGmailSearchQuery', | ||
| GetCurrentDate = 'getCurrentDate', |
There was a problem hiding this comment.
The new enum member is added only in this server-side Tools enum while the parallel enum in apps/mail/types/tools.ts remains unchanged, causing the two enums to diverge and risking type mismatches between client and server code. (Based on your team's feedback about keeping shared enums synchronized across packages)
Prompt for AI agents
Address the following comment on apps/server/src/types.ts at line 238:
<comment>The new enum member is added only in this server-side Tools enum while the parallel enum in apps/mail/types/tools.ts remains unchanged, causing the two enums to diverge and risking type mismatches between client and server code. (Based on your team's feedback about keeping shared enums synchronized across packages)</comment>
<file context>
@@ -235,6 +235,7 @@ export enum Tools {
WebSearch = 'webSearch',
InboxRag = 'inboxRag',
BuildGmailSearchQuery = 'buildGmailSearchQuery',
+ GetCurrentDate = 'getCurrentDate',
}
</file context>
| const [lastToolCall, setLastToolCall] = useState<string | null>(null); | ||
| const [isOpen, setOpen] = useState(false); | ||
| const [currentContext, setCurrentContext] = useState<any>(null); | ||
| const [, setCurrentContext] = useState<any>(null); |
There was a problem hiding this comment.
State getter is ignored; prefer useRef when only the setter-equivalent is required to avoid extra re-renders.
Prompt for AI agents
Address the following comment on apps/mail/providers/voice-provider.tsx at line 47:
<comment>State getter is ignored; prefer `useRef` when only the setter-equivalent is required to avoid extra re-renders.</comment>
<file context>
@@ -27,7 +44,7 @@ export function VoiceProvider({ children }: { children: ReactNode }) {
const [isInitializing, setIsInitializing] = useState(false);
const [lastToolCall, setLastToolCall] = useState<string | null>(null);
const [isOpen, setOpen] = useState(false);
- const [currentContext, setCurrentContext] = useState<any>(null);
+ const [, setCurrentContext] = useState<any>(null);
const conversation = useConversation({
</file context>

READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
Description
Please provide a clear description of your changes.
Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
Add any other context about the pull request here.
Screenshots/Recordings
Add screenshots or recordings here if applicable.
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.
Summary by cubic
Simplified the email assistant system prompt for clarity and added server-side tool execution for voice and web integrations.
Refactors
New Features
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Chores