Skip to content

Conversation

@H2Shami
Copy link
Collaborator

@H2Shami H2Shami commented Nov 27, 2025

Ticket

Link to the ticket(s) this pull request addresses.

Component/Service

What part of Helicone does this affect?

  • Web (Frontend)
  • Jawn (Backend)
  • Worker (Proxy)
  • Bifrost (Marketing)
  • AI Gateway
  • Packages
  • Infrastructure/Docker
  • Documentation

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Performance improvement
  • Refactoring

Testing

  • Added/updated unit tests
  • Added/updated integration tests
  • Tested locally
  • Verified in staging environment
  • E2E tests pass (if applicable)

Technical Considerations

  • Database migrations included (if needed)
  • API changes documented
  • Breaking changes noted
  • Performance impact assessed
  • Security implications reviewed

Dependencies

  • No external dependencies added
  • Dependencies added and documented
  • Environment variables added/modified

Deployment Notes

  • No special deployment steps required
  • Database migrations need to run
  • Environment variable changes required
  • Coordination with other teams needed

Context

prevents prompts from getting deleted after 90 days along with requests

Misc. Review Notes

Add S3_PROMPT_BUCKET_NAME="prompt-body-storage" to your jawn env file

@vercel
Copy link

vercel bot commented Nov 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
helicone Skipped Skipped Nov 27, 2025 2:03am
helicone-bifrost Skipped Skipped Nov 27, 2025 2:03am
helicone-eu Skipped Skipped Nov 27, 2025 2:03am

@claude
Copy link
Contributor

claude bot commented Nov 27, 2025

Claude finished @H2Shami's task —— View job


Code Review Complete

Score: 8/10 - Good to merge, minor suggestions for improvement

Suggestions Summary:

  • Add fallback handling for missing environment variables
  • Consider consistent error handling patterns
  • Minor improvement opportunity in minio-setup script

Detailed Review

Todo List:

  • Analyze all changed files for security and quality issues
  • Review environment variable configuration
  • Check S3 bucket separation implementation
  • Verify worker routing logic
  • Assess breaking changes and deployment impact
  • Provide specific improvement suggestions
  • Generate confidence score and final recommendations

Security & Performance Assessment

✅ Strong Points:

  1. Proper S3 Bucket Separation: The new dedicated prompt-body-storage bucket correctly separates prompt data from request/response storage, improving data organization and potential compliance
  2. Consistent Environment Configuration: All environments (dev, staging, production) are properly configured with the new S3_PROMPT_BUCKET_NAME variable
  3. EU Region Support: Correctly includes EU-specific prompt bucket configuration (EU_S3_PROMPT_BUCKET_NAME)
  4. Backward Compatibility: Changes maintain existing functionality while adding new bucket support

✅ Code Quality:

  • Clean separation of concerns between request/response storage and prompt storage
  • Proper environment variable naming conventions
  • Consistent configuration across all deployment environments

Minor Improvement Suggestions

1. Environment Variable Fallback (PromptManager.ts:48)

// Current
S3_PROMPT_BUCKET_NAME: process.env.S3_PROMPT_BUCKET_NAME ?? "",

// Suggested improvement
S3_PROMPT_BUCKET_NAME: process.env.S3_PROMPT_BUCKET_NAME ?? process.env.S3_BUCKET_NAME ?? "",

This provides a fallback to the main bucket if the prompt bucket isn't configured, preventing potential runtime errors.

2. Enhanced Minio Setup (supervisord.conf:83)

# Current setup command only creates request-response-storage bucket
# Suggested: Include prompt bucket creation
command=/bin/sh -c "until curl -f http://localhost:9080/minio/health/live > /dev/null 2>&1; do echo 'Waiting for MinIO...'; sleep 2; done && /usr/local/bin/mc alias set localminio http://localhost:9080 minioadmin minioadmin && /usr/local/bin/mc mb --ignore-existing localminio/request-response-storage && /usr/local/bin/mc mb --ignore-existing localminio/prompt-body-storage && exit 0"

3. Configuration Validation
Consider adding validation in PromptManager constructor to ensure the S3_PROMPT_BUCKET_NAME is properly configured before proceeding with operations.

Breaking Changes Assessment

✅ Well Managed:

  • The PR correctly identifies this as a breaking change
  • Environment variables are properly documented in PR description
  • Deployment notes clearly indicate required environment variable additions
  • All configuration files consistently updated

Infrastructure & Deployment

✅ Comprehensive Configuration:

  • Docker Compose properly creates both buckets (lines 78-79 in docker-compose.yml)
  • Worker routing correctly handles both US and EU regions (worker/src/index.ts:90)
  • All wrangler.toml environments include the new variable

✅ Regional Configuration:
EU region routing properly implemented in worker/src/index.ts:90 setting S3_PROMPT_BUCKET_NAME: env.EU_S3_PROMPT_BUCKET_NAME

Final Assessment

This PR implements a clean separation of prompt storage from request/response storage. The implementation is thorough, consistent across environments, and follows good practices. The breaking change is well-documented and managed appropriately.

The suggested improvements are minor optimizations and don't affect the core functionality. The code is ready for production deployment with proper environment variable configuration.

--- | Branch: add-new-bucket

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 27, 2025

Greptile Overview

Greptile Summary

This PR adds a new dedicated S3 bucket (prompt-body-storage) for storing prompt data, separating it from the existing request/response storage bucket.

  • Updated PromptManager.ts to use S3_PROMPT_BUCKET_NAME instead of S3_BUCKET_NAME
  • Added environment variables and bucket configuration across all environments (local, staging, production)
  • Configured EU region routing to properly use the EU prompt bucket
  • Includes formatting improvements in PromptManager.ts

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward infrastructure updates that properly separate prompt storage from request/response storage. All environment configurations are consistently updated across development, staging, and production environments, including proper EU region support.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
docker/docker-compose.yml 5/5 added prompt-body-storage bucket creation and S3_PROMPT_BUCKET_NAME environment variable for local development
valhalla/jawn/src/managers/prompt/PromptManager.ts 5/5 updated S3Client initialization to use dedicated prompt bucket and applied formatting fixes
worker/src/index.ts 5/5 added S3_PROMPT_BUCKET_NAME routing for EU region requests
worker/wrangler.toml 5/5 added S3_PROMPT_BUCKET_NAME and EU_S3_PROMPT_BUCKET_NAME configuration variables for all environments

Sequence Diagram

sequenceDiagram
    participant Client
    participant Worker
    participant Env Config
    participant PromptManager
    participant S3 Prompt Bucket
    participant S3 Request Bucket

    Note over Client,S3 Request Bucket: New Bucket Routing Flow

    Client->>Worker: Request (EU or US region)
    Worker->>Env Config: Check if EU request
    
    alt EU Request
        Env Config->>Env Config: Set S3_PROMPT_BUCKET_NAME = EU_S3_PROMPT_BUCKET_NAME
        Env Config->>Env Config: Set S3_BUCKET_NAME = EU_S3_BUCKET_NAME
    else US Request
        Env Config->>Env Config: Use default S3_PROMPT_BUCKET_NAME
        Env Config->>Env Config: Use default S3_BUCKET_NAME
    end
    
    Worker->>PromptManager: Initialize with environment
    PromptManager->>PromptManager: Create S3Client(S3_PROMPT_BUCKET_NAME)
    
    Note over PromptManager,S3 Request Bucket: Separate Storage
    
    PromptManager->>S3 Prompt Bucket: Store/Retrieve Prompt Data
    Note right of S3 Prompt Bucket: prompt-body-storage
    
    Worker->>S3 Request Bucket: Store/Retrieve Request/Response Data
    Note right of S3 Request Bucket: request-response-storage
Loading

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

8 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – helicone November 27, 2025 02:03 Inactive
@vercel vercel bot temporarily deployed to Preview – helicone-bifrost November 27, 2025 02:03 Inactive
@vercel vercel bot temporarily deployed to Preview – helicone-eu November 27, 2025 02:03 Inactive
Comment on lines -73 to +82
STRIPE_WEBHOOK_SECRET: string;
HELICONE_ORG_ID: string;
EU_HELICONE_ORG_ID: string;
STRIPE_CLOUD_GATEWAY_TOKEN_USAGE_PRODUCT: string;
UPSTASH_KAFKA_URL: string;
UPSTASH_KAFKA_USERNAME: string;
UPSTASH_KAFKA_PASSWORD: string;
QUEUE_PROVIDER: string;
STRIPE_WEBHOOK_SECRET: string;
HELICONE_ORG_ID: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

why's this change happening? I think its what is causing the worker test to fail

Copy link
Contributor

Choose a reason for hiding this comment

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

you have it in your dev.vars. just comment them out before generating the types plz

Comment on lines 89 to +90
EU_S3_BUCKET_NAME = "request-response-storage"
EU_S3_PROMPT_BUCKET_NAME = "prompt-body-storage"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for this, i just followed the EU_S3_BUCKET_NAME, but shouldn't these have -eu appended to the end?

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think worker doesn't use the prompt bucket? so it doesn't matter

Copy link
Contributor

Choose a reason for hiding this comment

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

if the worker doesnt let's remove these chnages then

Copy link
Collaborator

Choose a reason for hiding this comment

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

agree

networks:
traces:
driver: bridge
driver: bridge
Copy link
Collaborator

Choose a reason for hiding this comment

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

classic hammad linter

Copy link
Collaborator

@connortbot connortbot left a comment

Choose a reason for hiding this comment

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

LGTM but need to move prompt files from bucket first

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.

4 participants