Skip to content

fix(deploy): handle reasoning-only stream chunks - #9881

Open
taking-lying-flat wants to merge 1 commit into
modelscope:mainfrom
taking-lying-flat:agent/fix-deploy-reasoning-stream
Open

fix(deploy): handle reasoning-only stream chunks#9881
taking-lying-flat wants to merge 1 commit into
modelscope:mainfrom
taking-lying-flat:agent/fix-deploy-reasoning-stream

Conversation

@taking-lying-flat

Copy link
Copy Markdown
Contributor

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

What changed

  • Treat a missing streaming delta.content as an empty string when accumulating the deploy response log.
  • Add a unit test covering a reasoning-only stream chunk with content=None and non-empty reasoning_content.

Why

Reasoning parsers can emit chunks that contain only reasoning_content. DeltaMessage.content is optional for these chunks, but SwiftDeploy._post_process() previously attempted str += None, raising TypeError and terminating the stream.

The streamed response is otherwise unchanged, so clients continue receiving the reasoning content while the deploy log only accumulates answer content.

Experiment results

  • python -m pytest tests/deploy/test_deploy.py -q — 1 passed
  • flake8 swift/pipelines/infer/deploy.py tests/deploy/test_deploy.py
  • yapf --diff swift/pipelines/infer/deploy.py tests/deploy/test_deploy.py
  • isort --check-only swift/pipelines/infer/deploy.py tests/deploy/test_deploy.py

@taking-lying-flat
taking-lying-flat marked this pull request as ready for review August 11, 2026 01:57
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