Skip to content

Python: preserve approval context across resume paths - #24

Closed
eavanvalkenburg wants to merge 1 commit into
issue-8079-pr-reviewfrom
approval-resume-stack
Closed

eavanvalkenburg wants to merge 1 commit into
issue-8079-pr-reviewfrom
approval-resume-stack

Conversation

@eavanvalkenburg

Copy link
Copy Markdown
Owner

Motivation & Context

Tool approval resume has two context-sensitive gaps. A sessionless Agent.run(...) silently drops a valid approval when any context provider causes the framework to create a fresh per-run session, while AG-UI adapter-local approval execution loses the documented function_invocation_kwargs runtime context before agent.run(...) begins.

This is the upper layer of a dependent PR chain and depends on microsoft#8428.

Description & Review Guide

  • What are the major changes? Mark framework-created context-provider sessions with the existing run-local ownership marker so they do not become authoritative approval state; preserve caller-supplied and persistent session authority. Thread function_invocation_kwargs through the programmatic AG-UI entry points, and build adapter-local FunctionInvocationContext.kwargs only from that mapping plus options["additional_function_arguments"], with options taking precedence. Add focused core, AG-UI, and combined context-provider resume regressions.
  • What is the impact of these changes? The documented sessionless approval flow now behaves consistently with or without context providers, without weakening fail-closed session-backed binding. Approved AG-UI tools retain runtime identity and policy context without receiving unrelated AG-UI session, tool-list, middleware, or provider-option kwargs.
  • What do you want reviewers to focus on? The framework-owned versus caller-owned session boundary, and the AG-UI runtime-kwargs filtering/precedence at adapter-local execution.

Related Issue

Depends on microsoft#8428.

Fixes microsoft#8410

Fixes microsoft#8132

No other open pull request currently references either issue.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

@eavanvalkenburg

Copy link
Copy Markdown
Owner Author

Superseded by microsoft#8433, which targets the upstream repository as requested.

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.

1 participant