| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Replace the hand-rolled push/pop contextvar stack with _run_context.py: one AgentRun dataclass on a token-reset contextvar, managed by a single agent_run_scope() context manager so pairing no longer relies on manual try/finally in three places. The streaming wrapper's manual scope/span/stack bookkeeping collapses into one ExitStack, which also stops leaking the isolation scope and invoke_agent span when entering the wrapped context manager fails, and the token reset tolerates streaming runs that exit in a different asyncio task. The request hooks deliberately keep pairing chat spans through RunContext.metadata: contextvar pairing can mispair overlapping run_stream context managers in the same task, while the metadata dict is correct per run by construction. Review-driven hardening folded in: hook bodies are wrapped in capture_internal_exceptions so span-data failures cannot abort the user's model request, invoke_agent spans now receive model data from the agent argument instead of the not-yet-pushed contextvar, the model-settings mapping has a single source of truth in _extract.py, and the usage extractor passes record_token_usage kwargs directly.
Codecov Results 📊✅ 112337 passed | ❌ 1 failed | ⏭️ 6755 skipped | Total: 119093 | Pass Rate: 94.33% | Execution Time: 412m 58s 📊 Comparison with Base Branch
➕ New Tests (1)View new tests
❌ Failed Teststest_span_streaming_quart_auth_user_id[42-True]File: tests.integrations.quart.test_quart tests/integrations/quart/test_quart.py:1117: in test_span_streaming_quart_auth_user_id
assert segment["attributes"]["user.id"] == user_id
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E KeyError: 'user.id'
✅ Patch coverage is 96.81%. Project has 2481 uncovered lines.
@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 90.23% 90.23% —%
==========================================
Files 193 195 +2
Lines 25361 25382 +21
Branches 9302 9278 -24
==========================================
+ Hits 22883 22901 +18
- Misses 2478 2481 +3
- Partials 1432 1422 -10Generated by Codecov Action |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
Issues
Reminders
Stack created with GitHub Stacks CLI • Give Feedback 💬