Skip to content

fix(core):Add the correct reason for the stop agent behavior(#602)#606

Merged
AlbumenJ merged 2 commits intoagentscope-ai:mainfrom
feelshana:develop-1.0
Jan 21, 2026
Merged

fix(core):Add the correct reason for the stop agent behavior(#602)#606
AlbumenJ merged 2 commits intoagentscope-ai:mainfrom
feelshana:develop-1.0

Conversation

@feelshana
Copy link
Contributor

AgentScope-Java Version

main branch

Description

Add the correct reason for the stop agent behavior(#602)

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

@feelshana feelshana requested a review from a team January 20, 2026 04:25
@gemini-code-assist
Copy link

Summary of Changes

Hello @feelshana, 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 fix in the ReActAgent to ensure that when an agent's execution is halted due to a Human-In-The-Loop (HITL) stop request, the Msg object correctly carries the specific reason for termination. This enhancement improves the clarity and traceability of agent execution, making it easier to diagnose and understand agent behavior.

Highlights

  • Corrected Stop Reason Reporting: The ReActAgent now explicitly sets the GenerateReason to REASONING_STOP_REQUESTED or ACTING_STOP_REQUESTED when a Human-In-The-Loop (HITL) stop is triggered during the reasoning or acting phases.
  • Enhanced Debugging and Traceability: This change provides more precise information about why an agent stopped, which is valuable for debugging, logging, and understanding agent behavior in interactive or supervised scenarios.
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.

@cla-assistant
Copy link

cla-assistant bot commented Jan 20, 2026

CLA assistant check
All committers have signed the CLA.

@cla-assistant
Copy link

cla-assistant bot commented Jan 20, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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 correctly addresses the issue of missing reasons for agent stops. The changes in ReActAgent.java now properly set the GenerateReason to REASONING_STOP_REQUESTED and ACTING_STOP_REQUESTED when a stop is requested during the respective phases. This provides better observability into the agent's execution flow. The implementation is clean, uses the existing withGenerateReason method correctly, and aligns with the framework's design. The changes are accurate and improve the overall quality of the code.

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AlbumenJ AlbumenJ merged commit 02a4adb into agentscope-ai:main Jan 21, 2026
5 checks passed
Alexxigang pushed a commit to Alexxigang/agentscope-java that referenced this pull request Jan 25, 2026
…ope-ai#606)

## AgentScope-Java Version
main branch

## Description

Add the correct reason for the stop agent behavior(agentscope-ai#602)

## 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
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