[PR #50] [MERGED] fix: raise an error when streamed events have already been consumed #74

Closed
opened 2026-02-16 02:16:29 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/workflows-py/pull/50
Author: @masci
Created: 8/6/2025
Status: Merged
Merged: 8/6/2025
Merged by: @logan-markewich

Base: mainHead: massi/49


📝 Commits (1)

  • 19fd31c fix: raise an error when streamed events have already been consumed

📊 Changes

3 files changed (+81 additions, -1 deletions)

View changed files

📝 src/workflows/handler.py (+47 -1)
📝 tests/test_handler.py (+16 -0)
📝 tests/test_streaming.py (+18 -0)

📄 Description

Fixes #49

Initially I tried to check for the length of the queue along with the ctx.is_running flag, but this was dependent on the status of the async loop, making the check unreliable for simple workflows where consuming all the events was faster than shutting down the workflow runtime properly.

I then added a flag to the handler instance to be set the first (and last, at this point) time the StopEvent is streamed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/workflows-py/pull/50 **Author:** [@masci](https://github.com/masci) **Created:** 8/6/2025 **Status:** ✅ Merged **Merged:** 8/6/2025 **Merged by:** [@logan-markewich](https://github.com/logan-markewich) **Base:** `main` ← **Head:** `massi/49` --- ### 📝 Commits (1) - [`19fd31c`](https://github.com/run-llama/workflows-py/commit/19fd31c0c5e3f865bba541c406416cf38f632475) fix: raise an error when streamed events have already been consumed ### 📊 Changes **3 files changed** (+81 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/workflows/handler.py` (+47 -1) 📝 `tests/test_handler.py` (+16 -0) 📝 `tests/test_streaming.py` (+18 -0) </details> ### 📄 Description Fixes #49 Initially I tried to check for the length of the queue along with the `ctx.is_running` flag, but this was dependent on the status of the async loop, making the check unreliable for simple workflows where consuming all the events was faster than shutting down the workflow runtime properly. I then added a flag to the handler instance to be set the first (and last, at this point) time the StopEvent is streamed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 02:16:29 -05:00
yindo closed this issue 2026-02-16 02:16:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/workflows-py#74