feat(stream): return StreamResult from stream helpers; fix _compat SyntaxError#46
feat(stream): return StreamResult from stream helpers; fix _compat SyntaxError#46windsornguyen wants to merge 3 commits intonextfrom
Conversation
Stainless regen (2026-02-07) added `by_alias=by_alias` but a manually added `by_alias=True` from Nov 2025 was still present. Duplicate keyword arguments are a SyntaxError on Python 3.9.
stream_async and stream_sync now accumulate content and tool-call deltas into a StreamResult dataclass and return it. The accumulation logic is extracted into a shared accumulate_tool_call() function that DedalusRunner.core also delegates to (DRY). Exports StreamResult and accumulate_tool_call from dedalus_labs.utils.stream. Adds tests covering content, tool-call reassembly, thought_signature, parallel calls, empty streams, and result independence.
Standardise hand-written test files (test_encryption, test_mcp_wire, test_mcp_wire_connections, test__bug_report) to match the module-level function style used in test_local_scheduler. Replaces class wrappers and multi-line banners with single-line section comments.
PR SummaryMedium Risk Overview Tool-call delta reassembly was extracted into shared Written by Cursor Bugbot for commit 57dc181. This will update automatically on new commits. Configure here. |
Pull Request
Linear Issue
N/A
Summary
What:
stream_asyncandstream_syncnow accumulate content and tool-call deltas into aStreamResultdataclass and return it instead ofNone. A sharedaccumulate_tool_call()function is extracted so both the stream helpers andDedalusRunneruse the same logic. Also fixes a duplicateby_aliaskeyword argSyntaxErrorin_compat.pythat broke Python 3.9.Why:
Streaming callers previously had no way to programmatically access accumulated content or tool calls after a stream completed — the helpers were fire-and-forget printers. The
_compat.pybug blocked all test execution on Python 3.9.Lines added: ~0 net (+774 / −778 — mostly test style normalization)
Test Plan
uv run pytest tests/test_stream_helpers.py— 14 tests covering content accumulation, incremental tool-call reassembly (includingthought_signature, parallel calls), empty streams, and result independence.uv run pytest tests/test_encryption.py tests/test_mcp_wire.py tests/test_mcp_wire_connections.py tests/test__bug_report.py tests/test_local_scheduler.py— 85 existing hand-written tests still pass after style refactor.Repro / Showcase
N/A — no UI change. The
_compat.pyfix is verified by successfully importingdedalus_labson Python 3.9.Tests Added
Documentation
docs/): N/Aapps/docs/): N/AReviewers
Notes for Reviewers
Three commits:
fix(_compat)— one-line deletion of duplicateby_alias=Truefeat(stream)—StreamResult,accumulate_tool_call, updated helpers, DRY refactor ofDedalusRunner, new testsstyle(tests)— flatten class-based tests to module-level functions across 4 filesThe feature commit changes the return type of
stream_async/stream_syncfromNonetoStreamResult. Callers that were ignoring the return value are unaffected.Changelog
[2025-02-10]
Feedback received:
Changes made: