feat: add event ordering and parent-child hierarchy

adds emission sequencing, parent-child event hierarchy with scope management, and integrates both into the event bus. introduces flush() for deterministic handling, resets emission counters for test isolation, and adds chain tracking via previous_event_id/triggered_by_event_id plus context variables populated during emit and listener execution. includes tracing listener typing/sorting improvements, safer tool event pairing with try/finally, additional stack checks and cache-hit formatting, context isolation fixes, cassette regen/decoding, and test updates to handle vcr race conditions and flaky behavior.
This commit is contained in:
Greyson LaLonde
2026-01-21 11:12:10 -05:00
committed by GitHub
parent 741bf12bf4
commit 7a65baeb9c
33 changed files with 4650 additions and 421 deletions

View File

@@ -1204,7 +1204,8 @@ def test_complex_and_or_branching():
# Final should be after both 2a and 2b
assert execution_order[-1] == "final"
# Note: we don't assert final is last because branch_1c has no downstream
# dependencies and can complete after final due to parallel execution
assert execution_order.index("final") > execution_order.index("branch_2a")
assert execution_order.index("final") > execution_order.index("branch_2b")