Skip to content

Python: [BREAKING] Simplify Python hosting core - #6492

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:feature/python-hostingfrom
eavanvalkenburg:eavan/hosting-core-simplification
Jun 12, 2026
Merged

Python: [BREAKING] Simplify Python hosting core#6492
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:feature/python-hostingfrom
eavanvalkenburg:eavan/hosting-core-simplification

Conversation

@eavanvalkenburg

Copy link
Copy Markdown
Member

Motivation and Context

The Python hosting core accumulated identity linking, multicast delivery, push codecs, durable runners, and continuation concepts in the v1 contract. Those concerns make the base host harder to review, secure, and stabilize.

This change narrows v1 to the actual hosting problem: one host, one target, contributed channel routes/lifecycle, explicit session resolution by ChannelSession.isolation_key, and originating-channel responses.

Description

  • Rewrites ADR-0027 and SPEC-002 around the minimal Python host/channel contract.
  • Adds ADR-0028 as proposed follow-up scope for identity linking, multicast, active-channel routing, background runs, and durable delivery.
  • Removes linking/auth APIs, ResponseTarget, host-level push, durable task runner machinery, and related tests from agent-framework-hosting.
  • Collapses hook ownership into the host via ChannelContext.run(...) and ChannelContext.run_stream(...), including the renamed ChannelStreamUpdateHook.
  • Gates Foundry isolation header lifting to Foundry-hosted environments.
  • Removes agent-framework-hosting-entra and the local identity-link sample from this v1 pass.
  • Updates Responses, Invocations, Telegram, Activity Protocol, and Discord channels and tests for the smaller contract.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Remove linking, multicast, durable delivery, and host push machinery from the v1 hosting core. Keep those scenarios in a proposed follow-up ADR and update channel packages, samples, docs, tests, and workspace metadata around the smaller host/channel contract.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@moonbox3 Evan Mattson (moonbox3) added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Jun 12, 2026
@github-actions github-actions Bot changed the title [BREAKING] Simplify Python hosting core Python: [BREAKING] Simplify Python hosting core Jun 12, 2026

@github-actions github-actions Bot 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.

Automated Code Review

Reviewers: 3 | Confidence: 90%

✓ Correctness

The PR simplifies the hosting contract by removing identity linking, multicast, and durable delivery. The refactoring is largely mechanical and correct. One potential double-send regression exists in the Telegram streaming path where introducing final.text as the primary source of final_text can cause both a placeholder edit AND a fallback _reply_with_result call when no text was streamed but the final response contains text. The simplification is well-executed. One minor typo was introduced in an error message string in _persistence.py where a closing single-quote is missing from the pip install command shown to users.

✓ Security Reliability

Security controls (inbound auth validation, service URL allowlisting, Foundry isolation middleware gating) remain intact. The main issue found is a stale docstring that claims run_hook is still applied to command invocations when it no longer is — a misleading comment rather than a security vulnerability. The changes are well-structured and reduce attack surface. One minor bug: a typo in an error message produces an invalid shell command for users neding to install the disk extra. The Foundry isolation middleware gating to Foundry-hosted environments is intentional per the PR rationale and sound — the middleware was effectively a no-op outside Foundry anyway.

✓ Failure Modes

The structural changes are consistent — all code that produced and consumed the removed state (identities, active channel, runner) is removed together. One minor cosmetic issue: an unbalanced quote in a user-facing pip install error message.

Suggestions

  • Fix the unbalanced single-quote in the pip install instruction inside the ImportError message in _persistence.py:35.

Automated review by eavanvalkenburg's agents

@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) merged commit 36ce095 into microsoft:feature/python-hosting Jun 12, 2026
8 checks passed
Eduard van Valkenburg (eavanvalkenburg) added a commit that referenced this pull request Jun 17, 2026
Remove linking, multicast, durable delivery, and host push machinery from the v1 hosting core. Keep those scenarios in a proposed follow-up ADR and update channel packages, samples, docs, tests, and workspace metadata around the smaller host/channel contract.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) deleted the eavan/hosting-core-simplification branch June 30, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants