Skip to content

test: improve SSE streaming test reliability in CI environment#60

Merged
OhYee merged 1 commit intofix-sandbox-ttl-secondsfrom
fix-sandbox-ttl-seconds-ut
Mar 3, 2026
Merged

test: improve SSE streaming test reliability in CI environment#60
OhYee merged 1 commit intofix-sandbox-ttl-secondsfrom
fix-sandbox-ttl-seconds-ut

Conversation

@OhYee
Copy link
Member

@OhYee OhYee commented Mar 2, 2026

Add real HTTP server support for SSE streaming tests to address CancelledError issues with httpx.ASGITransport in CI environments. Update test fixtures to use uvicorn-based servers instead of ASGI transport for more reliable stream handling during integration tests.

The changes replace httpx.ASGITransport with actual HTTP servers using uvicorn for testing SSE streams, which resolves premature cancellation problems in CI environments where ASGI transport failed to properly handle streaming responses.

这些更改将 httpx.ASGITransport 替换为使用 uvicorn 的实际 HTTP 服务器来测试 SSE 流,
解决了 CI 环境中 ASGI 传输无法正确处理流式响应导致的提前取消问题。

Change-Id: Ie47a62015e7530b2fd7e027e47e440d2fb3ee453

Thank you for creating a pull request to contribute to Serverless Devs agentrun-sdk-python code! Before you open the request please answer the following questions to help it be more easily integrated. Please check the boxes "[ ]" with "[x]" when done too.
Please select one of the PR types below to complete


Fix bugs

Bug detail

The specific manifestation of the bug or the associated issue.

Pull request tasks

  • Add test cases for the changes
  • Passed the CI test

Update docs

Reason for update

Why do you need to update your documentation?

Pull request tasks

  • Update Chinese documentation
  • Update English documentation

Add contributor

Contributed content

  • Code
  • Document

Content detail

if content_type == 'code' || content_type == 'document':
    please tell us `PR url`,like: https://github.com/Serverless-Devs/agentrun-sdk-python/pull/1
else:
    please describe your contribution in detail

Others

Reason for update

Why do you need to update your documentation?

…ng in CI

Migrate test implementations to use astream(stream_mode="updates") instead of astream_events to resolve async generator cancellation issues in CI environments. Also switch from httpx.ASGITransport to real HTTP servers with uvicorn for proper SSE stream handling in tests, addressing flaky streaming behavior in Linux CI environments.

将测试实现从 astream_events 迁移到 astream(stream_mode="updates") 以解决 CI 环境中的异步生成器取消问题。同时从 httpx.ASGITransport 切换到使用 uvicorn 的真实 HTTP 服务器,以正确处理测试中的 SSE 流式传输,解决 Linux CI 环境中的不稳定流式行为。

Change-Id: I4e9f694a80e952a94e240f479bb40fef59c0d649
Signed-off-by: OhYee <oyohyee@oyohyee.com>
@OhYee OhYee force-pushed the fix-sandbox-ttl-seconds-ut branch from a4f4b6c to 61f18a4 Compare March 3, 2026 03:53
@OhYee OhYee merged commit c876b17 into fix-sandbox-ttl-seconds Mar 3, 2026
2 checks passed
@OhYee OhYee deleted the fix-sandbox-ttl-seconds-ut branch March 3, 2026 04:19
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