Skip to content

Conversation

@chenyushuo
Copy link
Collaborator

@chenyushuo chenyushuo commented Aug 18, 2025

Description

As the title says.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

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.

Summary of Changes

Hello @chenyushuo, 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 addresses several issues related to plugin loading and environment variable propagation within the Trinity framework, particularly concerning its interaction with Ray. It centralizes the plugin loading mechanism, enhances the handling of multiple plugin directories, and ensures that necessary environment variables are correctly passed to Ray's runtime environment, along with a specific bug fix in the explorer module.

Highlights

  • Centralized Plugin Loading: The load_plugins() function is now called directly from trinity/__init__.py, ensuring that all plugins are loaded automatically upon package import, simplifying the startup process and removing redundant calls.
  • Improved Plugin Directory Management: The load_plugins utility has been refactored to support loading plugins from multiple specified directories, including those defined in the PLUGIN_DIRS environment variable, and includes logic to prevent redundant loading of already processed directories.
  • Enhanced Ray Environment Propagation: Environment variables, including those related to plugin directories, are now properly captured and passed to Ray's runtime_env during ray.init() and setup_ray_cluster calls, ensuring that distributed Ray actors have access to the correct environment for plugin discovery.
  • Explorer Module Bug Fix: A conditional check (self.config.mode != "bench") was added to the Explorer initialization to prevent an assertion error related to the experience buffer when collect_experiences is enabled in "bench" mode, ensuring correct behavior in different operational configurations.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 refactors the plugin loading mechanism by moving it to the package's __init__.py, ensuring plugins are loaded on import. It also updates Ray worker configurations to inherit environment variables, which is a good improvement for propagating settings like PLUGIN_DIRS. However, I've found a critical bug in trinity/cli/launcher.py that can cause a TypeError when constructing the PLUGIN_DIRS environment variable. I've also identified an incorrect type hint in trinity/utils/plugin_loader.py that could lead to unexpected behavior. My review includes specific code suggestions to address these issues.

@chenyushuo
Copy link
Collaborator Author

/unittest-module-utils

@github-actions
Copy link

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
4 4 0 0 0 0 7ms

Tests

Test Name Status Flaky Duration
tests/utils/eval_utils_test.py::TestMathEvalUtils::test_extract_answer 1ms
tests/utils/eval_utils_test.py::TestMathEvalUtils::test_verify_math_answer 1ms
tests/utils/eval_utils_test.py::TestEvalUtils::test_is_equiv 1ms
tests/utils/plugin_test.py::TestPluginLoader::test_load_plugins 4ms

Github Test Reporter by CTRF 💚

Copy link
Collaborator

@pan-x-c pan-x-c left a comment

Choose a reason for hiding this comment

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

LGTM

@pan-x-c pan-x-c merged commit 2e53336 into modelscope:main Aug 18, 2025
1 check passed
@pan-x-c
Copy link
Collaborator

pan-x-c commented Aug 19, 2025

/unittest-module-trainer

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