Skip to content

Agentic RL support cancel async call#1

Merged
luozirong2025 merged 64 commits into
mainfrom
http
Jun 22, 2026
Merged

Agentic RL support cancel async call#1
luozirong2025 merged 64 commits into
mainfrom
http

Conversation

@luozirong2025

Copy link
Copy Markdown
Owner

Description

[Describe what this PR does and why]

Related Issue: Fixes #[issue_number] or Relates to #[issue_number]

Security Considerations: [Check if API keys or sensitive credentials are exposed in code/logs]

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Model
  • Application
  • Common
  • Documentation
  • Tests
  • CI/CD

Checklist

  • Pre-commit hooks pass
  • Tests pass locally
  • Documentation updated (if needed)
  • Ready for review

Testing

[How to test these changes]

Additional Notes

[Optional: any other context]

zirongluo and others added 30 commits June 8, 2026 12:09
- Add detailed exception logging for sync and async HTTP streaming requests
- Include request context such as url, method, stream, timeout, status code, and request id
- Handle SSE done events consistently across streaming parsers
- Avoid swallowing stream read failures while preserving original exception behavior
- Fix pylint warning by avoiding redefinition of built-in id
Replace per-request aiohttp.ClientSession creation with a shared session
pool (one per event loop) to enable HTTP connection reuse across async API
calls. SSL context is cached and shared across all sessions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Streaming requests were using aiohttp.ClientTimeout(total=...) which kills
the connection after the deadline even if the model is still actively
producing tokens. Switch to ClientTimeout(sock_read=...) for streaming
requests so the timeout only triggers on idle connections (no data between
chunks). Non-streaming requests still use total timeout.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
zhansheng.lzs and others added 29 commits June 15, 2026 17:45
Protect _shared_ssl_context lazy init and _aio_sessions dict access
with an RLock to prevent race conditions in multi-threaded
environments. Use RLock instead of Lock since get_shared_aio_session
calls get_ssl_context while holding the lock.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…e_shared_aio_session

- Add optional `session` parameter to AioHttpRequest.__init__ for injecting
  external aiohttp.ClientSession (aligned with HttpRequest)
- Add should_close lifecycle pattern to async request handlers in both
  AioHttpRequest and HttpRequest (consistent with sync _handle_request)
- Export close_shared_aio_session from dashscope package for explicit
  connection pool cleanup

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
funasr support payload.input and bug fix in transcription
tiktoken's recursive BPE merging overflows the call stack on very
long inputs, causing pyo3_runtime.PanicException: StackOverflow.

Split text into chunks (<= 100k chars) at line boundaries before
encoding. Short text takes the original fast path unchanged.

Fixes dashscope#116
The server currently does not support session.finish event for
qwen3.5-omni-flash-realtime, returning an error instead of
session.finished. Previously end_session() would wait the full
timeout duration (20s) before falling back to ws.close().

Now the method detects server error events immediately and closes
the connection without waiting, reducing wait time from 20s to
<0.1s when the server rejects session.finish.

Related to issue dashscope#140
- Add trust_env=True to base_api.py async task polling (issue dashscope#112)
- Extract user_agent from kwargs in api_request_factory to ensure
  incremental_to_full flag reaches HTTP header (issue dashscope#4)
- Update test to verify user_agent doesn't leak into request body

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The SDK's exception handlers were logging exceptions at error level
before re-raising, causing duplicate logs in user applications.
Following PR dashscope#68 discussion, downgrade to debug level across
audio/asr, audio/qwen_asr, and audio/tts_v2 modules.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Change raise e to bare raise in recognition.py and
  translation_recognizer.py to preserve original tracebacks
- Fix vocabulary.py and enrollment.py catching asyncio/aiohttp
  exceptions despite using sync requests-based BaseApi; switch to
  requests.Timeout and requests.ConnectionError

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
BaseAsyncApi uses sync requests.Session() under the hood (the "Async"
refers to DashScope server-side task polling, not Python async I/O).
Switch from asyncio/aiohttp exceptions to requests.Timeout and
requests.ConnectionError to ensure retry logic actually catches
real network errors.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
fix: downgrade redundant logger.error(e) to debug in audio modules
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@luozirong2025
luozirong2025 merged commit bbf2589 into main Jun 22, 2026
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.

3 participants