Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@swoh816
Copy link

@swoh816 swoh816 commented Dec 18, 2025

Make models configurable through environment variables. As future work, implement a mechanism to verify that each model is accessible and properly defined in opencode.jsonc.

Summary by CodeRabbit

  • New Features
    • Added environment variable configuration for selecting AI models used in commit analysis and changelog generation, with sensible defaults for standard deployments.

✏️ Tip: You can customize this high-level summary in your review settings.

- add `Model` type and env-based logic for COMMIT_MODEL and CHANGELOG_MODEL with defaults
- export COMMIT_MODEL and CHANGELOG_MODEL for runtime usage
@vercel
Copy link

vercel bot commented Dec 18, 2025

@swoh816 is attempting to deploy a commit to the exon Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Warning

Rate limit exceeded

@swoh816 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 56 seconds before requesting another review.

βŒ› How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 84a0fda and cd2370a.

πŸ“’ Files selected for processing (1)
  • src/lib/opencode.ts (2 hunks)

Walkthrough

Refactored model configuration in src/lib/opencode.ts to support runtime configuration via environment variables. Introduced a generic Model type and made COMMIT_MODEL and CHANGELOG_MODEL derive from environment variables with validated parsing and sensible defaults instead of hard-coded values.

Changes

Cohort / File(s) Change Summary
Model Configuration
src/lib/opencode.ts
Added Model type alias; converted COMMIT_MODEL and CHANGELOG_MODEL from static constants to runtime-configurable exports derived from environment variables (COMMIT_MODEL, CHANGELOG_MODEL) with parsing, validation, and fallback defaults.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Environment variable parsing logic and fallback defaults are straightforward
  • Validation error handling for malformed env vars is localized to one file
  • The semantic shift from hard-coded to environment-driven configuration is minimal in scope

Poem

🐰 "Config hops now wild and free,
Environment variables make models decree,
No more stone-set in code's heart,
Runtime whispers play their part!" 🌿

Pre-merge checks and finishing touches

βœ… Passed checks (3 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title 'feat: make models configurable via env variables' accurately summarizes the main change in the pull request, which is making COMMIT_MODEL and CHANGELOG_MODEL runtime-configurable through environment variables.
Docstring Coverage βœ… Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lib/opencode.ts (1)

25-68: Consider extracting a helper to reduce duplication.

The parsing logic for COMMIT_MODEL and CHANGELOG_MODEL is nearly identical. A helper function would improve maintainability.

πŸ”Ž Example refactor:
function parseModelEnv(
  envVar: string,
  envName: string,
  defaultModel: Model
): Model {
  const value = process.env[envVar];
  if (!value) {
    return defaultModel;
  }
  const [providerID, modelID] = value.split("/");
  if (!providerID || !modelID) {
    throw new Error(
      `${envName} must be in the form 'provider/model', e.g. 'opencode/gpt-5-nano', 'ollama/ministral-3:14b', etc.`
    );
  }
  return { providerID, modelID };
}

export const COMMIT_MODEL = parseModelEnv(
  "COMMIT_MODEL",
  "COMMIT_MODEL",
  { providerID: "opencode", modelID: "gpt-5-nano" }
);

export const CHANGELOG_MODEL = parseModelEnv(
  "CHANGELOG_MODEL",
  "CHANGELOG_MODEL",
  { providerID: "opencode", modelID: "claude-sonnet-4-5" }
);
πŸ“œ Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between df84e16 and 84a0fda.

πŸ“’ Files selected for processing (1)
  • src/lib/opencode.ts (2 hunks)
🧰 Additional context used
πŸͺ› Biome (2.1.2)
src/lib/opencode.ts

[error] 39-39: This code will never be reached ...

... because this statement will throw an exception beforehand

(lint/correctness/noUnreachable)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Vercel Agent Review
πŸ”‡ Additional comments (1)
src/lib/opencode.ts (1)

21-24: LGTM!

The Model type provides a clean abstraction for the provider/model configuration.

- change bitwise OR (|) to logical OR (||) to correct semantics
- drop unreachable exit code
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.

1 participant