Skip to content

fix: dedicated http client for governance telemetry dispatcher#1827

Open
radu-mocanu wants to merge 1 commit into
mainfrom
fix/governance-dispatcher-loop-affinity
Open

fix: dedicated http client for governance telemetry dispatcher#1827
radu-mocanu wants to merge 1 commit into
mainfrom
fix/governance-dispatcher-loop-affinity

Conversation

@radu-mocanu

Copy link
Copy Markdown
Collaborator

Summary

  • governance telemetry no longer silently fails or hangs during uipath run / uipath debug: the track-event dispatcher now uses its own http client instead of the one the policy fetch already bound to the CLI's main event loop
  • a single slow governance telemetry call can no longer stall process exit (each dispatched call has a total deadline, and the shutdown drain default drops from 30s to 5s)
  • the first dropped telemetry event is now surfaced in the logs (warning) instead of being swallowed silently

Why

Governance telemetry reused the same httpx AsyncClient that the governance policy fetch had already bound to the CLI's main asyncio loop (UiPath.governance is a cached service), but the dispatcher awaits it on its own background loop. httpx clients are loop-affine, so every event either failed silently or hung, and the stuck calls then dragged out process shutdown. The dispatcher now gets a dedicated service (a fresh client only its loop ever touches), built from the same validated config so it does no extra auth work. Compensation stays on the shared provider because that path is synchronous and has no loop affinity. On top of that, each dispatched call is bounded by a per-call deadline, the exit drain is shortened, the loop-start wait is bounded (fail open), and swallowed failures are surfaced once.

Copilot AI review requested due to automatic review settings July 22, 2026 15:27
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime test:uipath-integrations labels Jul 22, 2026
@radu-mocanu
radu-mocanu force-pushed the fix/governance-dispatcher-loop-affinity branch from 42ba749 to ee528fc Compare July 22, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes governance telemetry dispatch in the uipath CLI by preventing cross-event-loop reuse of an httpx.AsyncClient and by bounding best-effort telemetry so it can’t hang CLI shutdown.

Changes:

  • Create a dedicated UiPathPlatformGovernanceProvider (fresh async client) for the background-loop LiveTrackEventDispatcher, separate from the policy-fetch provider bound to the main loop.
  • Add operational safety to telemetry dispatch: per-call total deadline, bounded loop-start wait, shorter default shutdown drain, and warn-once logging for swallowed dispatch failures.
  • Add/adjust regression tests for provider separation, warn-once logging, per-call deadline behavior, loop-start timeout behavior, and default shutdown timeout; bump package versions.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/uipath/src/uipath/_cli/_governance_bootstrap.py Builds a dedicated governance provider for telemetry dispatch to avoid async-client loop affinity issues.
packages/uipath/tests/cli/test_governance_bootstrap.py Updates provider stubbing and adds a regression test ensuring dispatcher uses a distinct provider from policy fetch.
packages/uipath-platform/src/uipath/platform/governance/_live_track_event_dispatcher.py Adds per-call deadline, bounded loop startup wait, warn-once logging for swallowed failures, and shorter shutdown default timeout.
packages/uipath-platform/tests/services/test_live_track_event_dispatcher.py Extends coverage for warn-once logging, per-call deadline cancellation/release, loop-start timeout behavior, and default shutdown timeout.
packages/uipath/pyproject.toml Bumps uipath version to 2.13.14.
packages/uipath/uv.lock Updates lockfile package versions (uipath 2.13.14, uipath-platform 0.2.13).
packages/uipath-platform/pyproject.toml Bumps uipath-platform version to 0.2.13.
packages/uipath-platform/uv.lock Updates lockfile package version to 0.2.13.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@radu-mocanu
radu-mocanu force-pushed the fix/governance-dispatcher-loop-affinity branch from ee528fc to e4f7cd2 Compare July 22, 2026 15:37
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants