Skip to content

feat: allow repo sync interval settings to be configured via env vars#1057

Draft
msukkari wants to merge 2 commits intomainfrom
cursor/SOU-818-repo-sync-interval-env-vars-50ee
Draft

feat: allow repo sync interval settings to be configured via env vars#1057
msukkari wants to merge 2 commits intomainfrom
cursor/SOU-818-repo-sync-interval-env-vars-50ee

Conversation

@msukkari
Copy link
Copy Markdown
Contributor

Overview

This PR adds environment variable support for all relevant sync interval settings, making it easier to configure Sourcebot in containerized/cloud environments where env vars are the preferred mechanism.

Changes

Added environment variable support for the following settings:

Env Var Corresponding Setting
REINDEX_INTERVAL_MS reindexIntervalMs
RESYNC_CONNECTION_INTERVAL_MS resyncConnectionIntervalMs
REINDEX_REPO_POLLING_INTERVAL_MS reindexRepoPollingIntervalMs
RESYNC_CONNECTION_POLLING_INTERVAL_MS resyncConnectionPollingIntervalMs

Priority order: env var > config file settings block > hardcoded default

Implementation Details

  • Added new environment variables in packages/shared/src/env.server.ts with Zod validation (z.coerce.number().int().positive().optional())
  • Updated getConfigSettings() in packages/shared/src/utils.ts to apply env var overrides with highest priority
  • Invalid values (non-numeric or <= 0) produce a clear error at startup via Zod validation
  • Added comprehensive tests for the new env var override functionality
  • Updated documentation in both environment-variables.mdx and config-file.mdx

Testing

  • All existing tests pass
  • Added 12 new tests covering:
    • Env var overrides config file settings
    • Env var overrides defaults when no config
    • Multiple env vars set simultaneously
    • Config file values used when env vars not set
    • Defaults used when neither env vars nor config file set

Fixes SOU-818

Linear Issue: SOU-818

Open in Web Open in Cursor 

Add environment variable support for repo sync interval settings:
- REINDEX_INTERVAL_MS
- RESYNC_CONNECTION_INTERVAL_MS
- REINDEX_REPO_POLLING_INTERVAL_MS
- RESYNC_CONNECTION_POLLING_INTERVAL_MS

Priority order: env var > config file settings > hardcoded default.

Invalid values (non-numeric or <= 0) will produce a clear error at
startup via Zod validation.

Fixes SOU-818

Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
@mintlify
Copy link
Copy Markdown

mintlify bot commented Mar 28, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
sourcebot 🟢 Ready View Preview Mar 28, 2026, 6:27 PM

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 90c491c0-eda7-4654-8542-627d5a6fd2bd

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/SOU-818-repo-sync-interval-env-vars-50ee

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
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