Skip to content

Deploy to production (Automated)#1838

Merged
github-actions[bot] merged 48 commits intomainfrom
staging
Aug 3, 2025
Merged

Deploy to production (Automated)#1838
github-actions[bot] merged 48 commits intomainfrom
staging

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Jul 26, 2025

This is an automated pull request to deploy the staging branch to production.
Please review the pull request and comment /deploy to merge this PR and deploy to production.


Summary by cubic

Improved mail thread syncing by batching and parallelizing thread fetches, reducing sync time and improving reliability.

  • Performance
    • Increased concurrency when fetching threads.
    • Reduced delays between thread and page fetches.
    • Added timing logs for sync duration and error tracking.

Co-authored-by: Adam <13007539+MrgSub@users.noreply.github.com>
@github-actions github-actions bot added the production-deploy This PR is meant to update production label Jul 26, 2025
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 26, 2025

Bug Report

Name Severity Example test case Description
Rate Limiting Medium Sync a large number of threads concurrently. The reduced delay and increased concurrency could lead to rate limiting issues with the Gmail API.
Missing Transaction High Process multiple threads concurrently, and simulate an error during database insertion in one of the threads. The database operations within fetchThread are not performed within a transaction, leading to potential data inconsistency if an error occurs.
Potential Deadlock Low Process a large number of threads concurrently, where multiple threads attempt to update the same row in the threads table. Concurrent updates to the same row in the threads table could lead to deadlocks.
Lack of Input Validation High Call syncThreads with a malicious threadId containing SQL injection payloads. The code does not perform input validation on the threadId parameter, potentially leading to SQL injection vulnerabilities.
Missing Error Boundary Medium Simulate an unexpected error within the syncThreads function. The absence of a top-level error boundary could crash the agent process in case of unexpected errors.

Comments? Email us. Your free trial ends in 3 days.

Copy link
Copy Markdown
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.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 26, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Join our Discord community 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@graphite-app graphite-app bot requested a review from MrgSub July 26, 2025 15:36
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jul 26, 2025

Deploying zero-staging with  Cloudflare Pages  Cloudflare Pages

Latest commit: c6fd1d8
Status: ✅  Deploy successful!
Preview URL: https://ea16baa3.zero-staging-c02.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jul 26, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
zero-server-production c3582d3 Aug 03 2025, 09:27 PM

@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Jul 26, 2025

Graphite Automations

"Deploy to Production Helper" took an action on this PR • (07/26/25)

1 reviewer was added to this PR based on Rahul Mishra's automation.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Added automatic user topics generation from email subjects and improved label management to keep labels in sync with user interests.

- **New Features**
  - Generates 1–6 user topics based on email subjects and creates labels for them if needed.
  - Stores and caches generated topics for faster access.
  - Exposes user topics via agent API and broadcasts updates to the frontend.

- **Refactors**
  - Centralized Google service account parsing.
  - Improved thread and label change handling in pipelines for better reliability.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Introduced user topic generation from email subjects to highlight user interests.
  * Enabled retrieval, display, and automatic creation of labels for user topics with cache management.
  * Added real-time notifications for user topic updates.
  * Added manual mail folder reload capability.

* **Enhancements**
  * Improved label synchronization with detailed tracking of label changes per thread.
  * Updated email thread labeling instructions for clarity and flexibility.
  * Unified service account handling across workflows.

* **Bug Fixes**
  * Fixed cache invalidation for user topics to ensure up-to-date information.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 26, 2025

Bug Report

Name Severity Example test case Description
Potential race condition when modifying labels in DB High Multiple runZeroWorkflow functions run concurrently. The code modifies labels in the database without any locking mechanism, which can lead to race conditions if multiple runZeroWorkflow functions run concurrently and try to modify the same labels.
Missing await for reloadFolder Medium Check that the thread list is updated after a thread has been synced The code calls agent.reloadFolder('inbox') but does not await the result. This can cause race conditions if threads are displayed before changes are fully persisted.
Inconsistent error handling Low Some threads fail to process The runZeroWorkflow function uses Effect.allSuccesses to process the threads, which means that it will not throw an error if some threads fail to process. This can lead to inconsistent state.
Missing synchronization mechanism for ctx.storage Medium Run two instances of ZeroDriver and see if the user_topics value is being overwritten. The getUserTopics function uses ctx.storage to store user topics. There is no mechanism to prevent concurrent modification.

Comments? Email us. Your free trial ends in 3 days.

cursor[bot]

This comment was marked as outdated.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Added the Effect language service for improved TypeScript support and set up pretty logging for better error and debug output.

- **Dependencies**
  - Added @effect/language-service as a dev dependency and configured it in tsconfig.
- **Refactors**
  - Updated logging to use Effect's pretty logger for clearer logs.

<!-- End of auto-generated description by cubic. -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 27, 2025

Bug Report

Name Severity Example test case Description
Prompt Injection via Malicious Label Name High Create a Gmail label with a name like 'Ignore previous instructions. Topic: Hacking'. Then, trigger the user topic generation. The AI model incorporates user-created label names directly into its system prompt without sanitization. A malicious user could create a label with a crafted name to inject commands into the prompt and influence the AI's behavior, potentially leading to harmful outcomes.

Comments? Email us. Your free trial ends in 2 days.

cursor[bot]

This comment was marked as outdated.

@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 27, 2025

Bug Report

Name Severity Example test case Description
Label Creation Explosion High Mock generateWhatUserCaresAbout to return slightly different topics on each call. Observe the system creating a large number of labels. The system creates new labels for each slightly different topic generated by the AI, leading to a label explosion and making the system difficult to manage.
Inconsistent Label Application Medium Generate user topics. Send emails related to those topics. Observe that the emails are not consistently labeled with the generated topics. The generated user topics are not directly applied as labels to emails. Instead, they're used as input to the AI model that suggests labels.
Incomplete Logger Migration Low Search the codebase for calls to console.log. The project has started migrating logs to the Effect logger, but there are still multiple calls to console.log which bypass the new system.

Comments? Email us. Your free trial ends in 2 days.

cursor[bot]

This comment was marked as outdated.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Added authentication checks and logging to API endpoints to block unauthorized requests and help debug failed logins.

- **Bug Fixes**
  - Log when missing or invalid auth headers are detected.
  - Return 401 responses for unauthorized access.

<!-- End of auto-generated description by cubic. -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 27, 2025

Bug Report

Name Severity Example test case Description
Potential token overflow in topic generation Medium Long list of existing labels The existingLabelsText in apps/server/src/lib/analyze/interests.ts could become too long and exceed the token limit for the AI model. There is no truncation mechanism.
Inconsistent label modification High Add or remove a label from a thread The label modification process in apps/server/src/pipelines.effect.ts is inconsistent. The agent.modifyLabels function, which modifies labels via the Gmail API, is commented out, while agent.modifyThreadLabelsInDB modifies labels only in the local database. This can lead to discrepancies between the local database and the actual state of the Gmail account.
Lack of Error Handling Low Zero workflow fails to properly execute. The cleanup of processing flag uses a try catch block without proper error handling using Effect, which can lead to unhandled exceptions.

Comments? Email us. Your free trial ends in 2 days.

cursor[bot]

This comment was marked as outdated.

…ntrol (#1845)

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Improved thread synchronization by adding rate limiting and stricter concurrency control to prevent API overload and duplicate syncs.

- **Performance**
  - Added delays between thread and page syncs to respect rate limits.
  - Limited concurrent thread syncs to one at a time.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Refactor**
  * Improved the thread synchronization process for enhanced reliability and efficiency.
  * Introduced stricter sequential processing and increased rate limiting to prevent overload.
  * Simplified error handling and logging for clearer feedback during synchronization.

No user-facing features or visible changes have been introduced.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 28, 2025

Bug Report

Name Severity Example test case Description
Potential Deadlock due to Unhandled Exceptions in syncThread and syncThreads High Simulate an API call failing within syncThread after this.syncThreadsInProgress.set(threadId, true) is called, but before the flag is cleared. Then, attempt to sync that same thread again. If an unhandled exception occurs within the syncThread or syncThreads functions after setting the syncThreadsInProgress or foldersInSync flags, the flags may not be cleared, leading to a deadlock where these threads or folders are never synced again.
Lack of Timeout in syncThread and syncThreads leading to resource exhaustion High Simulate a very slow or unresponsive Gmail API. Attempt to sync a thread. The operation blocks indefinitely without timing out. The syncThread and syncThreads functions do not have a timeout. If a sync operation is blocking the agent due to network calls to external sources (like Gmail) taking too long. This can result in resource exhaustion and potentially bring down the entire service.
Missing input validation in generateWhatUserCaresAbout Medium Create a large number of threads with extremely long email subjects and trigger the topic generation. Long email subjects could potentially cause issues with token limits in the OpenAI call, causing an error or unexpected behavior. The generateWhatUserCaresAbout function does not truncate or filter long subjects which could cause issues.

Comments? Email us. Your free trial ends in 2 days.

…ore (#1846)

# Switch from KV to Hyperdrive for subscription management

## Description

This PR updates the scheduled task that checks for expired subscriptions to use Hyperdrive database instead of KV storage. The changes include:

1. Replacing `env.subscribed_accounts.list()` with a direct database query to find connections with access and refresh tokens
2. Simplifying the connection ID handling by using the database ID directly instead of parsing from key names
3. Adding proper database connection cleanup with `conn.end()` in multiple places to prevent connection leaks
4. Removing redundant logging in the thread workflow when closing database connections

## Type of Change

- [x] ⚡ Performance improvement
- [x] 🐛 Bug fix (non-breaking change which fixes an issue)

## Areas Affected

- [x] Data Storage/Management
- [x] Email Integration (Gmail, IMAP, etc.)

## Testing Done

- [x] Manual testing performed

## Checklist

- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix/feature works

## Additional Notes

This change helps prevent potential connection leaks and improves the reliability of subscription management by using the database as the source of truth rather than KV storage.
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 28, 2025

Bug Report

Name Severity Example test case Description
Race condition in thread synchronization High Call syncThread concurrently for the same thread ID. The set and delete operations on syncThreadsInProgress are not atomic, potentially leading to race conditions when multiple calls to syncThread are made concurrently.

Comments? Email us. Your free trial ends in 2 days.

cursor[bot]

This comment was marked as outdated.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Added support for detecting expired subscriptions for all non-Google providers.

- **New Features**
  - Expired subscriptions are now tracked for providers other than Google.

<!-- End of auto-generated description by cubic. -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 28, 2025

An error occured.

This error may be due to rate limits. If this error persists, please email us.

…1848)

# Fix AI Summary Display and Gmail Subscription Key Format

## Description

This PR includes three key changes:

1. Removed the conditional rendering of the `AiSummary` component based on `brainState.enabled`, allowing the component to handle its own visibility logic.
2. Fixed the Gmail subscription key format in the server by using a composite key format `${id}__${providerId}` instead of just `id` when accessing the `gmail_sub_age` KV store.
3. Temporarily commented out thread synchronization logic in the agent routes due to issues with Durable Object storage resetting.

## Type of Change

- [x] 🐛 Bug fix (non-breaking change which fixes an issue)

## Areas Affected

- [x] Email Integration (Gmail, IMAP, etc.)
- [x] User Interface/Experience
- [x] Data Storage/Management

## Testing Done

- [x] Manual testing performed

## Checklist

- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings

## Additional Notes

The commented-out thread synchronization code includes a TODO note explaining that the Durable Object storage is sometimes resetting. This is a temporary measure until we can properly address the underlying issue.

---

_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Jul 28, 2025

Bug Report

Name Severity Example test case Description
Sensitive Header Logging Medium Trigger an invalid authentication attempt. The server logs request headers upon invalid authentication, which may contain sensitive information.
Inconsistent Data due to Durable Object Reset High Observe data inconsistencies after Durable Object resets. The code temporarily comments out thread synchronization due to Durable Object resets, leading to potential data inconsistencies. The SQLite DB will contain stale state, and the Durable Object will be empty.

Comments? Email us. This is the last day of your free trial. Subscribe at jazzberry.ai.

@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 1, 2025

Bug Report

Name Severity Example test case Description
Inconsistent environment variable usage Medium Inspect the ZeroDriver and ZeroAgent classes for instances of env vs this.env. The code uses env in some places and this.env in others, leading to potential context issues in durable objects. Consistent use of this.env is recommended for durable object context.
Lack of input validation in MCP tool Low Call getThreadSummary tool with malformed thread id (e.g., empty string, special characters) The getThreadSummary tool has no input validation, potentially causing unexpected errors when called with an invalid threadId.
Potential side channel information disclosure Low Call bulkDeleteKeys and check the output for information about existing vs non-existing keys bulkDeleteKeys discloses information on successfully and unsuccessfully deleted keys. An attacker can use this information to enumerate available keys.

Comments? Email us.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
SSE connections to the /vsse endpoint can now be established without requiring the X-Caller header. If X-Caller is missing, the connection is still allowed as long as the Authorization header is valid.

<!-- End of auto-generated description by cubic. -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 1, 2025

Bug Report

Name Severity Example test case Description
Durable Object Lock Leak in runZeroWorkflowImpl High Simulate a crash during Zero workflow execution by killing the worker after lock acquisition and before processing threads. The historyProcessingKey remains in KV storage if the worker crashes before deleting it, preventing future executions of the workflow for the same connection and history ID.

Comments? Email us.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Allowed SSE connections when the X-Caller header is set to system__caller_id, enabling system-level clients to connect without standard authentication.

<!-- End of auto-generated description by cubic. -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 1, 2025

Bug Report

Name Severity Example test case Description
Authentication Bypass in /vsse Endpoint Critical 1. Set the Authorization header to the correct VOICE_SECRET in a request. 2. Set the X-Caller header to system__caller_id. 3. Send a request to /vsse. The server grants access without verifying a phone number against the database, allowing unauthorized access. Any caller possessing the VOICE_SECRET and setting X-Caller to system__caller_id can access the system.

Comments? Email us.

…1887)

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Simplified the email assistant system prompt for clarity and added server-side tool execution for voice and web integrations.

- **Refactors**
  - Rewrote the assistant prompt to be shorter, more direct, and easier for models to follow.
  - Removed unused and verbose prompt sections.

- **New Features**
  - Added a server-side tool execution endpoint and utility for handling tool calls from the client.
  - Introduced a script to register all tools with ElevenLabs for voice agent integration.

<!-- End of auto-generated description by cubic. -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 1, 2025

Bug Report

Name Severity Example test case Description
Unauthenticated Access to /vsse endpoint with "system__caller_id" High Send a request to /vsse with header 'Authorization: valid_voice_secret' and header 'X-Caller: system__caller_id'. The code bypasses phone number verification if X-Caller is system__caller_id, potentially allowing an attacker to access sensitive user information or functionalities without proper authentication.

Comments? Email us.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Made AutoRAG optional so it only runs when configured, and improved thread summary fallback to always return basic info if a summary is missing.

- **Bug Fixes**
  - Thread summary now returns subject, sender, and date even if no summary is found.
  - AutoRAG is only used when enabled, with a proper fallback to raw search results.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Introduced a new inbox search tool supporting natural language queries with configurable result limits.
  * Enabled conditional use of advanced search features based on environment settings.

* **Improvements**
  * Clarified tool parameter descriptions.
  * Enhanced tool registration to accept dynamic header values.

* **Refactor**
  * Improved internal handling of request headers and tool configuration.

* **Chores**
  * Removed default fallback server URL in tool registration scripts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 1, 2025

Bug Report

Name Severity Example test case Description
Missing X-Caller validation on /vsse endpoint High Send a request to /vsse with the correct VOICE_SECRET in the Authorization header, but without the X-Caller header. The request proceeds without validating a specific user, potentially granting unauthorized access to voice integration features.

Comments? Email us.

@cursor
Copy link
Copy Markdown

cursor bot commented Aug 1, 2025

Bugbot found 3 bugs

To see them, activate your membership in the Cursor dashboard.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Commented out unused constants in prompts and voice provider files, and set a default server URL in the ElevenLabs tools script.

<!-- End of auto-generated description by cubic. -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 2, 2025

Bug Report

Name Severity Example test case Description
Incorrect X-Caller Header in ElevenLabs Tool Registration High Run scripts/register-elevenlabs-tools.ts and inspect the request headers for the created tools. The X-Caller header for the ElevenLabs tools is incorrectly set to the voiceSecret instead of system__caller_id, preventing proper tool execution from system-level integrations like the voice assistant. To fix, in scripts/register-elevenlabs-tools.ts, the line 'X-Caller': voiceSecret, should be changed to 'X-Caller': { variable_name: 'system__caller_id' },

Comments? Email us.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Removed thread ID tracking from the agent and deleted unused filter suggestion files to simplify code and reduce complexity.

- **Refactors**
  - Removed all code related to thread ID updates and tracking in both client and server.
  - Deleted filter suggestion utilities and types from mail and server libs.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Enhanced inbox search tool to allow specifying the folder and number of results when searching email threads.

* **Bug Fixes**
  * Improved handling of email thread listing to ensure correct retrieval based on search queries and folder selection.

* **Refactor**
  * Removed deprecated email filter suggestion logic and related utilities from both client and server.
  * Cleaned up unused message types and socket communication related to thread ID updates.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 3, 2025

Bug Report

Name Severity Example test case Description
Missing User Check High Call /api/ai/do/ with a non-existent phone number as X-Caller The code retrieves the user object from the database, but doesn't check if the result is null before proceeding with execution, leading to a possible error.
Unused Constants Low Check the prompt code to validate Several unused consts can be removed to improve readability.

Comments? Email us.

#1896)

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Added thread, folder, and filter context to chat prompts and enforced strict security rules to prevent unsafe responses.

- **Security**
  - Wrapped all chat prompts with locked instructions to block code, markup, and unsafe content.
- **Context Awareness**
  - Passed current thread, folder, and filter info to chat prompts for more relevant responses.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Chat prompts now include enhanced security instructions and contextual information such as thread, folder, and filter details for improved safety and relevance.
  * All chat messages, including system messages, are now displayed in the chat interface.

* **Improvements**
  * Contextual information is now passed throughout the chat pipeline, enabling more accurate and context-aware responses.
  * Updated default chat prompts for improved consistency.
  * Message submission now clears the editor content and ensures the chat view scrolls to the latest message.

* **Bug Fixes**
  * Ensured editor content is cleared and chat scrolls to the bottom after sending a message.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 3, 2025

Bug Report

The code in apps/server/src/routes/agent/index.ts now skips folder synchronization for aggregate instances, which may prevent them from being updated. Please investigate the multi-stub pattern implementation to ensure operations are correctly mirrored to aggregate instances.

Comments? Email us.

)

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Removed unused variables from ai-chat.tsx and commented out the unused getFolderLabelId function in mail.ts to clean up the codebase.

<!-- End of auto-generated description by cubic. -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 3, 2025

Bug Report

Name Severity Example test case Description
Server URL Default Low Run the scripts/register-elevenlabs-tools.ts script without setting the SERVER_URL environment variable. The scripts/register-elevenlabs-tools.ts script has a hardcoded default server URL which can cause unintended consequences when running outside of staging environments.

Comments? Email us.

@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 3, 2025

Bug Report

Name Severity Example test case Description
Potential data exposure in getUserLabels tool Medium Run the getUserLabels tool in AI chat and inspect the chat output. The tool for listing all user labels returns all the label names and ids in the chat, which could expose potentially sensitive user data to other actors in the agent pipeline.
Missing logging in syncThread Low Trigger a syncThread operation and observe logs. The [syncThread] Starting sync for thread: ${threadId} log is not within the Effect.gen block and therefore may run even if it fails.
Empty workflow functions Critical Trigger the main, zero, and thread workflows. The functions runZeroWorkflow and runThreadWorkflow are now empty and will crash the entire system.
Inconsistent use of null checks in getThreadSummary tool Low Trigger a chat with a thread that does not have a summary It would be preferable for getThreadSummary tool to check if thread.latest exists before accessing its properties to avoid a crash when a stored summary is missing, but thread info is available.

Comments? Email us.

@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 3, 2025

Bug Report

Name Severity Example test case Description
Unused CATEGORY_IDS constant Low Check the /apps/mail/lib/prompts.ts file The CATEGORY_IDS constant is not used.
Use Global environment vars Medium Search for where env is called directly There are places where the code calls the global env object, which will not be available. We should change all of them to this.env so the code always calls the instance property.

Comments? Email us.

@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 3, 2025

Bug Report

Name Severity Example test case Description
Potential Prompt Injection in Thread Summary High Craft an email with malicious code in the subject/body It's important to ensure that the thread summary cannot be exploited via prompt injection. Though locked by new prompt, the impact could be high if bypassed.

Comments? Email us.

# 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.

- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.

## Description

Please provide a clear description of your changes.

---

## Type of Change

Please delete options that are not relevant.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement

## Areas Affected

Please check all that apply:

- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure

## Testing Done

Describe the tests you've done:

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)

## Security Considerations

For changes involving data or authentication:

- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)

## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published

## 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._

    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Removed hardcoded Cloudflare account ID and API token from configuration files to improve security.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Chores**
  * Updated environment variable values for Cloudflare account ID and API token to empty strings in configuration files.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@jazzberry-ai
Copy link
Copy Markdown

jazzberry-ai bot commented Aug 3, 2025

Bug Report

Name Severity Example test case Description
Insecure Authentication Bypass High Access the /vsse endpoint with a valid VOICE_SECRET and set X-Caller to system__caller_id without a valid phone number. The /vsse endpoint allows access without phone number validation if the X-Caller is system__caller_id, potentially allowing unauthorized actions.

Comments? Email us.

@MrgSub
Copy link
Copy Markdown
Collaborator

MrgSub commented Aug 3, 2025

/deploy

@github-actions github-actions bot merged commit c3582d3 into main Aug 3, 2025
13 of 14 checks passed
@cursor
Copy link
Copy Markdown

cursor bot commented Aug 3, 2025

Bugbot found 3 bugs

To see them, activate your membership in the Cursor dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

production-deploy This PR is meant to update production

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants