Skip to content

fix(sdk): use sync shutdown flush fallback#150

Open
abhinav-galileo wants to merge 3 commits intomainfrom
abhi/observability-sync-shutdown-flush
Open

fix(sdk): use sync shutdown flush fallback#150
abhinav-galileo wants to merge 3 commits intomainfrom
abhi/observability-sync-shutdown-flush

Conversation

@abhinav-galileo
Copy link
Collaborator

Summary

  • replace the atexit shutdown fallback that spawned a helper thread and asyncio.run() with a synchronous httpx.Client flush path
  • reuse shared batch request construction for both async and sync send paths and clear the async client reference after fallback shutdown cleanup
  • add regression coverage for the sync fallback path and for a short-lived subprocess that emits an SDK-evaluated observability event and exits without explicit shutdown

Testing

  • make sync
  • make check
  • git push -u origin abhi/observability-sync-shutdown-flush (pre-push hook: lint, typecheck, contrib evaluator checks)

@codecov
Copy link

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 97.64706% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sdks/python/src/agent_control/observability.py 97.64% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

if flush_error is not None:
logger.error("Error during fallback shutdown flush: %s", flush_error)
if attempt >= get_settings().max_retries - 1:
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: break instead of continue. It keeps the same behavior but is less awkward :D

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.

2 participants