Skip to content

feat(governance): delegation guard#125

Open
aditik0303 wants to merge 2 commits into
feat/governance-evaluatorfrom
feat/governance-delegation-guard
Open

feat(governance): delegation guard#125
aditik0303 wants to merge 2 commits into
feat/governance-evaluatorfrom
feat/governance-delegation-guard

Conversation

@aditik0303

Copy link
Copy Markdown

Stacked PR 6/7 — part of splitting feat/governance-core into reviewable slices. Base: feat/governance-evaluator. One logical slice (branch is cumulative so CI is green). Merge in order #1#7 and delete each branch on merge so the next PR auto-retargets onto feat/agentic-governance. feat/governance-core kept untouched as backup.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an async-aware delegation depth guard for agents, ensuring delegation depth is enforced consistently across both sync (invoke) and async (ainvoke) call paths while avoiding per-agent ContextVar leaks.

Changes:

  • Implement delegation guard that wraps both invoke and ainvoke, preserving coroutine-ness for async methods.
  • Track delegation depth via a single module-level ContextVar keyed by id(agent) and clean up entries on uninstall.
  • Add comprehensive tests covering sync/async behavior, lifecycle (install/uninstall), env overrides, and leak/regression scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/test_delegation_guard.py Adds test coverage for sync/async delegation depth enforcement, lifecycle semantics, env overrides, and ContextVar leak prevention.
src/uipath/runtime/governance/delegation_guard.py Introduces the delegation guard implementation with async support, shared ContextVar tracking, and uninstall cleanup.

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

Comment thread src/uipath/runtime/governance/delegation_guard.py
Comment thread src/uipath/runtime/governance/delegation_guard.py
@aditik0303 aditik0303 force-pushed the feat/governance-evaluator branch from a019ade to 6af3c9f Compare June 16, 2026 11:03
@aditik0303 aditik0303 force-pushed the feat/governance-delegation-guard branch from aeb0d94 to 0664ff6 Compare June 16, 2026 11:03
@aditik0303 aditik0303 force-pushed the feat/governance-evaluator branch from 6af3c9f to f7cc79e Compare June 17, 2026 06:52
@aditik0303 aditik0303 force-pushed the feat/governance-delegation-guard branch from 0664ff6 to 58c7baf Compare June 17, 2026 06:54
@aditik0303 aditik0303 force-pushed the feat/governance-evaluator branch from f7cc79e to 94cea5b Compare June 17, 2026 08:35
aditik0303 and others added 2 commits June 17, 2026 14:05
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ethod is actually patched; correct _resolve_max_depth docstring (install-time)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aditik0303 aditik0303 force-pushed the feat/governance-delegation-guard branch from 58c7baf to 20fe69c Compare June 17, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants