Skip to content

fix(sdk): buffer async generator outputs in control decorator#153

Open
abhinav-galileo wants to merge 8 commits intomainfrom
abhi/fix-control-buffered-asyncgen
Open

fix(sdk): buffer async generator outputs in control decorator#153
abhinav-galileo wants to merge 8 commits intomainfrom
abhi/fix-control-buffered-asyncgen

Conversation

@abhinav-galileo
Copy link
Copy Markdown
Collaborator

@abhinav-galileo abhinav-galileo commented Mar 30, 2026

Summary

  • add buffered async-generator support to @control() so decorated async generators stay protected
  • normalize structured streamed chunks into JSON-safe post-check payloads instead of relying on lossy str(chunk)
  • add SDK coverage for buffered replay, structured chunks, post-check blocking before replay, and stream failures

Behavior

  • async generators are buffered before replay so post-stage deny/steer remains fail-closed
  • this intentionally preserves safety semantics instead of real-time token streaming latency
  • real-time streaming semantics remain follow-up work and should be tracked separately

Partial fix for #113

Testing

  • uv run pytest sdks/python/tests/test_control_decorators.py
  • make check

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 90.15544% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...dks/python/src/agent_control/control_decorators.py 90.05% 19 Missing ⚠️

📢 Thoughts on this report? Let us know!

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