Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

add fallbacks for kb configs

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Aug 30, 2025

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

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 30, 2025 4:14am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 30, 2025 4:14am

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.

Greptile Summary

This PR introduces configurable environment variables for Knowledge Base (KB) document processing configuration, replacing hardcoded values throughout the codebase with environment variable lookups that include sensible fallback defaults. The changes affect three key files:

Environment Configuration (apps/sim/lib/env.ts): Adds 9 new KB_CONFIG_* environment variables with default values using Zod schema validation. These include processing duration (300s), retry attempts (3), backoff factor (2), timeout ranges (1-10 seconds), concurrency limits (20), batch sizes (20), and processing delays (50-100ms).

Background Processing (apps/sim/background/knowledge-processing.ts): Updates the Trigger.dev task configuration to use the new environment variables instead of hardcoded values for maxDuration, retry policies, and queue concurrency settings.

Document Service (apps/sim/lib/knowledge/documents/service.ts): Replaces hardcoded configuration values with environment variable lookups across multiple processing configurations including timeouts, concurrency limits, batch sizes, and Redis processing parameters.

This change centralizes KB processing configuration management, making the system more operationally flexible while maintaining backward compatibility. The fallback mechanism ensures the application continues to function properly even when environment variables are not explicitly set, which is particularly important for the multi-tier processing system that includes Trigger.dev background jobs, Redis queue processing, and in-memory processing fallbacks.

Confidence score: 4/5

  • This PR is safe to merge with low risk of breaking existing functionality
  • Score reflects well-structured environment configuration changes with proper fallbacks, though the complexity of multiple processing modes requires attention
  • Pay close attention to apps/sim/lib/knowledge/documents/service.ts for the complex fallback logic and mathematical operations

3 files reviewed, 2 comments

Edit Code Review Bot Settings | Greptile

@waleedlatif1 waleedlatif1 force-pushed the improvement/kb-concurrency branch from 4063eac to 1381489 Compare August 30, 2025 04:07
@vercel vercel bot temporarily deployed to Preview – docs August 30, 2025 04:07 Inactive
@waleedlatif1 waleedlatif1 merged commit f4f8fc0 into staging Aug 30, 2025
3 of 4 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/kb-concurrency branch August 30, 2025 04:09
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
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.

2 participants