Repository navigation
fix(swe-smith): support native tool calls and thinking - #684
Open
Zhengyang Liu (liuzhengyang699) wants to merge 1 commit into
Open
Zhengyang Liu (liuzhengyang699) wants to merge 1 commit into
Zhengyang Liu (liuzhengyang699) wants to merge 1 commit into
Conversation
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
With thinking enabled in Bash mode, valid fenced commands are rejected when the server returns null reasoning but accepted with empty reasoning, requiring a parsing fix and regression coverage.
1 open issue
What changed in this PR
Adds opt-in native tool calling and thinking to the SWE-Smith coding harness, addressing the Qwen3.5 workflow discussed in #519 without changing the default fenced-Bash mode.
Changes:
- Validates
execute_bashcalls, links tool observations, and preserves reasoning in conversation history. - Adds rollout settings and documents native-template and parser configuration for both coding examples.
- Adds regression tests for tool validation, reasoning handling, error recovery, and legacy behavior.
| File | Description |
|---|---|
tests/examples/test_swe_smith_tools.py |
Adds mocked regression coverage for tools, thinking, and compatibility. |
examples/swe_smith/job-template-openai.yaml |
Adds disabled-by-default tool and thinking settings. |
examples/swe_smith/agents/smith_agent.py |
Implements native tool handling and reasoning-aware conversation history. |
docs/76-example-coding-agent-moe.md |
Links native tool and thinking setup for the MoE example. |
docs/75-example-coding-agent.md |
Documents rollout settings, parser overrides, and deployment updates. |
Review effort: Balanced
| else: | ||
| action = parse_action( | ||
| message.get("content") or "", | ||
| enable_thinking=enable_thinking and "reasoning_content" not in message, |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I found this while reproducing the Coding Agent example with Qwen3.5: the harness cannot consume native tool calls, and every request forces
enable_thinking=False.The loop currently reads only
message.contentand looks for a fenced Bash command. A normal native-tool response can havecontent=nulland anexecute_bashcall intool_calls, so it is treated as a format error and never runs. The harness also drops reasoning from the assistant history, while the example configuration forces the Hermes template/parser instead of Qwen3.5's native format.This adds two opt-in rollout settings,
SMITH_USE_TOOLSandSMITH_ENABLE_THINKING. Native mode advertises oneexecute_bash(command)tool, validates the call, and returns observations with the matching tool-call ID. It retains both reasoning field aliases for compatibility with the pinned vLLM stack and the native Qwen template. The existing command restrictions, submission detection, and turn accounting still apply; the default Bash prompts are preserved.The regression tests also cover unfinished reasoning, invalid arguments, unknown or parallel calls, and recovery after a format error. Calls whose arguments cannot be rendered in the next request end the rollout cleanly instead of repeatedly failing at the server. The documentation explains the rollout Job settings and the native-template/
qwen3_coder/qwen3overrides needed for both coding examples.Related to #519: this addresses the coding harness's tool/thinking workflow, rather than general Qwen3.5 model loading.
Validation
Using Python 3.12 and the locked development dependencies, including
verl-cpu:uv run --locked --no-sync pytest -v --durations=20 tests— 281 passed, 4 skipped.uv run --locked --no-sync pyright— no errors or warnings.uv run --locked --no-sync pre-commit run --all-files --show-diff-on-failure— passed.uv run --locked --no-sync ruff check .anduv run --locked --no-sync ruff format --check .— passed.uv run --locked --no-sync python scripts/check_headers.py— passed.UV_PROJECT_ENVIRONMENT=/tmp/agent-lightning-qwen35-docs uv run --locked --no-sync mkdocs build --strict— passed with the locked docs dependencies in a separate environment.uv build --no-sourcesandgit diff --cached --check— passed.I have not run a live Qwen3.5 inference server, Kubernetes rollout, or GPU training job for this patch. The automated tests use mocked completions; they do not establish training performance.
I used AI assistance to investigate the problem I encountered during reproduction, implement the fix, and write and run the regression tests.