Skip to content

Conversation

@mcbodge
Copy link
Contributor

@mcbodge mcbodge commented Jan 16, 2026

Summary

This PR adds OpenCode as a new AI provider option in the ModelSelector component, alongside existing providers (Claude, Cursor, Codex). It also includes significant refactoring to reduce code duplication and improve maintainability.

Changes

Features

  • OpenCode Provider Support: Added OpenCode CLI as a selectable AI provider in the model selector
    • Dynamic model fetching from the OpenCode API
    • Loading, error, and empty states for model list
    • CLI availability detection and warning messages
    • Badge display for model tiers (Premium, Free, Balanced)

Refactoring

Based on code review feedback, the following improvements were made to reduce duplication and improve maintainability:

  1. useProviderModels Custom Hook

    • Extracted duplicate useEffect logic for fetching provider models
    • Reused for both Codex and OpenCode model fetching
  2. transformModels Helper Function

    • Generic function to transform raw provider models to ModelOption format
    • Uses badge mapping objects (CODEX_BADGE_MAP, OPENCODE_BADGE_MAP) instead of if/else chains
  3. DynamicModelList Component

    • Reusable component for displaying dynamic model lists
    • Handles loading, error, empty, and populated states
    • Configurable badge colors and thinking badge display
    • Used for both OpenCode and Codex model lists
  4. DEFAULT_OPENCODE_MODEL Constant

    • Replaced hardcoded 'opencode/big-pickle' magic string with imported constant from @automaker/types

Files Changed

  • apps/ui/src/components/views/board-view/shared/model-selector.tsx

Screenshots

image

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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.

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


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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mcbodge, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the ModelSelector component by integrating OpenCode as a new AI provider, expanding the available model options for users. Concurrently, it undertakes a substantial refactoring effort to streamline the component's architecture, making it more modular and easier to extend or maintain by abstracting common UI patterns and data fetching logic into reusable hooks and components.

Highlights

  • OpenCode Provider Support: Integrated OpenCode as a new AI provider option within the ModelSelector component, allowing users to select OpenCode models. This includes dynamic model fetching, handling loading/error/empty states, CLI availability detection, and displaying model tier badges (Premium, Free, Balanced).
  • Refactoring for Maintainability: Performed significant refactoring to reduce code duplication and improve the maintainability of the ModelSelector. This involved extracting common logic into reusable components and hooks.
  • New useProviderModels Hook: Introduced a custom React hook, useProviderModels, to encapsulate the useEffect logic for fetching provider-specific models, which is now reused for both Codex and OpenCode.
  • New transformModels Helper: Created a generic transformModels helper function to convert raw provider model data into a standardized ModelOption format, utilizing badge mapping objects instead of conditional logic.
  • New DynamicModelList Component: Developed a reusable DynamicModelList component responsible for rendering dynamic model lists, handling various states (loading, error, empty, populated), and configurable badge displays. This component is now used for both OpenCode and Codex model displays.
  • Standardized Default Model: Replaced a hardcoded OpenCode model string with DEFAULT_OPENCODE_MODEL constant imported from @automaker/types for better consistency and maintainability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for OpenCode as a new AI provider and performs a significant and commendable refactoring of the ModelSelector component. The introduction of the useProviderModels hook, transformModels helper, and DynamicModelList component greatly improves code reuse and maintainability.

My review focuses on further enhancing the robustness and reusability of these new abstractions. I've identified a few points:

  • Removing @ts-nocheck to leverage TypeScript's type safety, which would have caught a subtle issue with model properties.
  • Making the transformModels function more robust to handle different property names for similar concepts (hasThinking vs. hasReasoning).
  • Improving the reusability of the DynamicModelList component by decoupling it from specific badge styles.

Overall, this is a high-quality contribution that significantly improves the codebase. Addressing these points will make the new components even more solid and maintainable.

@@ -1,17 +1,201 @@
// @ts-nocheck
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This file has @ts-nocheck at the top, which disables TypeScript type checking. This is generally not recommended as it can hide potential bugs and make the code harder to maintain. For example, the issue with hasThinking vs hasReasoning in transformModels could have been caught by the type checker. I recommend removing @ts-nocheck and fixing any resulting type errors. This will improve the long-term quality and stability of this component.

Comment on lines +46 to +69
function transformModels<
T extends {
id: string;
tier?: string;
hasThinking?: boolean;
name?: string;
label?: string;
description?: string;
},
>(
models: T[],
provider: ModelProvider,
badgeMap: Record<string, string>,
defaultHasThinking = false
): ModelOption[] {
return models.map((model) => ({
id: model.id,
label: model.name || model.label || model.id,
description: model.description || '',
badge: model.tier ? badgeMap[model.tier] : undefined,
provider,
hasThinking: model.hasThinking ?? defaultHasThinking,
}));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The transformModels function is a great refactoring. However, it can be made more robust. The generic type T only considers hasThinking, but ModelDefinition (the type for dynamicOpencodeModels) uses hasReasoning. To correctly handle both codexModels and dynamicOpencodeModels, you should add hasReasoning?: boolean to the type T and use it as a fallback.

function transformModels<
  T extends {
    id: string;
    tier?: string;
    hasThinking?: boolean;
    hasReasoning?: boolean;
    name?: string;
    label?: string;
    description?: string;
  },
>(
  models: T[],
  provider: ModelProvider,
  badgeMap: Record<string, string>,
  defaultHasThinking = false
): ModelOption[] {
  return models.map((model) => ({
    id: model.id,
    label: model.name || model.label || model.id,
    description: model.description || '',
    badge: model.tier ? badgeMap[model.tier] : undefined,
    provider,
    hasThinking: model.hasThinking ?? model.hasReasoning ?? defaultHasThinking,
  }));
}

Comment on lines +181 to +184
: option.badge === 'Free'
? 'border-green-500/50 text-green-600 dark:text-green-400'
: badgeColorClass
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The DynamicModelList component has a hardcoded style for the "Free" badge. This makes the component less reusable as it has specific knowledge about badge types. To improve reusability and separation of concerns, consider passing a map of badge names to CSS classes as a prop (e.g., badgeColorMap?: Record<string, string>). The parent component would then be responsible for providing the styles for specific badges.

@mcbodge mcbodge changed the title Features/add opencode support in modelselector Add OpenCode Support in ModelSelector Jan 16, 2026
@Shironex
Copy link
Collaborator

If u could adress pr comments before i review it

@Shironex Shironex added Enhancement Improvements to existing functionality or UI. Testers-Requested Request for others to test an enhancement or bug fix/etc. Do Not Merge Use this label if something should not be merged. labels Jan 16, 2026
@webdevcody webdevcody deleted the branch AutoMaker-Org:v0.12.0rc January 17, 2026 23:51
@webdevcody webdevcody closed this Jan 17, 2026
@mcbodge
Copy link
Contributor Author

mcbodge commented Jan 18, 2026

Sorry I wasn't able to address everything in time. I was actually doing it w
as soon as I received the comments but I literally dropped my laptop 💀 I'll re-do everything on the latest version asap.

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

Labels

Do Not Merge Use this label if something should not be merged. Enhancement Improvements to existing functionality or UI. Testers-Requested Request for others to test an enhancement or bug fix/etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants