Skip to content

fix: make the maxSubtasks parameter of PlanNotebook effective #645

Merged
AlbumenJ merged 1 commit intoagentscope-ai:mainfrom
tcsp:feat/complete_plan_maxSubtasks_limit1
Jan 26, 2026
Merged

fix: make the maxSubtasks parameter of PlanNotebook effective #645
AlbumenJ merged 1 commit intoagentscope-ai:mainfrom
tcsp:feat/complete_plan_maxSubtasks_limit1

Conversation

@tcsp
Copy link
Contributor

@tcsp tcsp commented Jan 23, 2026

AgentScope-Java Version

[The version of AgentScope-Java you are working on, e.g. 1.0.7, check your pom.xml dependency version or run mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]

Description

make the maxSubtasks parameter of PlanNotebook effective.

Checklist

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

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@tcsp tcsp requested a review from a team January 23, 2026 04:59
@gemini-code-assist
Copy link

Summary of Changes

Hello @tcsp, 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 refactors the hint generation mechanism within the PlanNotebook system to properly incorporate the maxSubtasks configuration. By passing the entire PlanNotebook object to the hint generator, it enables dynamic inclusion of subtask limits in the generated hints, ensuring that agents adhere to the specified constraints. This change improves the flexibility and effectiveness of plan guidance by providing more comprehensive contextual information to the agent.

Highlights

  • Refactored Hint Generation: The generateHint method in PlanToHint and DefaultPlanToHint has been updated to accept a PlanNotebook object instead of a boolean needUserConfirm. This change centralizes access to plan configuration parameters like maxSubtasks and needUserConfirm.
  • Implemented maxSubtasks Functionality: The maxSubtasks parameter of PlanNotebook is now effectively utilized in hint generation. A new rule, RULE_SUBTASK_LIMIT, is added to the generated hints when maxSubtasks is configured, providing agents with explicit guidance on subtask limits.
  • Added getMaxSubtasks() Method: A new public getter method, getMaxSubtasks(), has been added to the PlanNotebook class, allowing external components to retrieve the configured maximum number of subtasks.
  • Updated Unit Tests: Existing unit tests for hint generation in DefaultPlanToHintTest have been updated to reflect the new generateHint method signature. Additionally, a new test case (testNoPlanHint_WithMaxSubtasks) was added to specifically verify that the maxSubtasks hint is correctly included when applicable.
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

@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 effectively implements the maxSubtasks parameter by updating the hint generation logic. The changes are well-structured, using the 'Introduce Parameter Object' refactoring pattern by passing the PlanNotebook instance instead of a boolean, which improves extensibility. The new logic in DefaultPlanToHint correctly adds the subtask limit rule to the hint when no plan exists. The related tests have been updated accordingly, and a new test has been added to cover the new functionality. I have one suggestion to make the new test more specific.

assertNotNull(hint);
assertTrue(hint.startsWith("<system-hint>"));
assertTrue(hint.endsWith("</system-hint>"));
assertTrue(hint.contains("Subtask Limit"));

Choose a reason for hiding this comment

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

medium

This assertion is a bit generic. To make the test more robust and verify that the maxSubtasks value is correctly interpolated into the hint string, it's better to check for the specific text including the value. This ensures that the {max_subtasks} placeholder is correctly replaced.

Suggested change
assertTrue(hint.contains("Subtask Limit"));
assertTrue(hint.contains("no more than 5 subtasks"));

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AlbumenJ
Copy link
Collaborator

@LearningGp PTAL

@AlbumenJ AlbumenJ merged commit 7a5c3c6 into agentscope-ai:main Jan 26, 2026
5 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