Skip to content

Conversation

@m-Just
Copy link
Contributor

@m-Just m-Just commented Dec 30, 2025

What does this PR do?

In ToolAgentLoop._handle_processing_tools_state, apply_chat_template adds a default system message to tool response messages but the system message is redundant and should be removed. This PR removes the redundant system message.

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data, cfg, reward
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

Tested with my own experiment, and it worked as expected.

API and Usage Example

No API change.

Design & Code Changes

Simply removed the system message.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR 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.

Code Review

This pull request aims to fix an issue where a redundant system message was being added when processing tool responses. The change correctly identifies the need to strip this system prompt. However, the implementation of stripping it by slicing token IDs is not fully robust due to the nature of some tokenizers, and could lead to subtle bugs. I've provided a critical review comment with a suggested code change for a more reliable implementation that operates on the string level before tokenization.

@m-Just m-Just changed the title [rollout] fix: redundant system message added in ToolAgentLoop._handle_processing_tools_state [rollout] fix: remove redundant system message added in ToolAgentLoop._handle_processing_tools_state Dec 30, 2025
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.

1 participant