Skip to content

Fix a bug in args_pass#155

Merged
hiyuchang merged 1 commit intoagentscope-ai:mainfrom
hiyuchang:feat/fix_args_pass
Aug 1, 2025
Merged

Fix a bug in args_pass#155
hiyuchang merged 1 commit intoagentscope-ai:mainfrom
hiyuchang:feat/fix_args_pass

Conversation

@hiyuchang
Copy link
Collaborator

Description

As the title says. To avoid revising meta.args when splitting tasks.

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 @hiyuchang, 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 a critical bug in the file_reader.py module where task arguments derived from self.meta were being passed by reference. By implementing deep copies of these arguments, the change prevents unintended modifications to the original meta object when tasks are processed or split, thereby ensuring data integrity and predictable behavior.

Highlights

  • Bug Fix: Data Integrity: The primary issue of meta.args being unintentionally modified when tasks are split is resolved by ensuring that arguments passed to new Task objects are independent copies.
  • Dependency Update: The copy module has been imported in trinity/buffer/reader/file_reader.py to enable deep copying functionality.
  • Argument Handling: The read method in file_reader.py now explicitly uses copy.deepcopy() for format_args, rollout_args, workflow_args, and reward_fn_args when constructing Task objects, preventing side effects on the original self.meta object.
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 or fill out our survey to provide feedback.

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.

@hiyuchang
Copy link
Collaborator Author

/unittest-module-explorer

@hiyuchang hiyuchang closed this Jul 31, 2025
@hiyuchang hiyuchang reopened this Jul 31, 2025
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 fixes a critical bug where shared configuration objects (meta.args) were being mutated during task processing, leading to unpredictable behavior. The fix involves creating deep copies of task-specific arguments when instantiating a Task, effectively isolating the state of each task. The change is correct and addresses the root cause. I've added one suggestion for a minor performance optimization by using a mix of shallow and deep copies where appropriate, but the current implementation is safe and clear.

@github-actions
Copy link

Summary

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

Tests

Test Name Status Flaky Duration
tests/explorer/explorer_test.py::BaseExplorerCase::test_explorer 2ms
tests/explorer/explorer_test.py::TestExplorerCountdownEval::test_explorer 98ms
tests/explorer/explorer_test.py::TestExplorerCountdownNoEval::test_explorer 89ms
tests/explorer/explorer_test.py::TestExplorerWithAddStrategy::test_explorer 59ms
tests/explorer/scheduler_test.py::SchedulerTest::test_concurrent_operations 4ms
tests/explorer/scheduler_test.py::SchedulerTest::test_get_results 19ms
tests/explorer/scheduler_test.py::SchedulerTest::test_scheduler_all_methods 14ms
tests/explorer/scheduler_test.py::SchedulerTest::test_scheduler_restart_after_stop 7ms
tests/explorer/scheduler_test.py::SchedulerTest::test_split_tasks 7ms
tests/explorer/scheduler_test.py::SchedulerTest::test_wait_all 7ms
tests/explorer/scheduler_test.py::SchedulerTest::test_wait_all_timeout_with_multi_batch 13ms
tests/explorer/workflow_test.py::WorkflowTest::test_gsm8k_workflow 1ms
tests/explorer/workflow_test.py::WorkflowTest::test_math_boxed_workflow 1ms
tests/explorer/workflow_test.py::WorkflowTest::test_math_complex_workflow 1ms
tests/explorer/workflow_test.py::WorkflowTest::test_math_fraction_workflow 1ms
tests/explorer/workflow_test.py::WorkflowTest::test_math_workflow 1ms
tests/explorer/workflow_test.py::WorkflowTest::test_rm_gallery_workflow 1ms
tests/explorer/workflow_test.py::WorkflowTest::test_workflow_resettable 1ms

Github Test Reporter by CTRF 💚

@hiyuchang hiyuchang merged commit e902313 into agentscope-ai:main Aug 1, 2025
2 checks passed
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