Skip to content

Python: Isolate Foundry Hosting local test state - #8409

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
ryo-whaletech:fix/foundry-hosting-test-state-isolation
Sep 16, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
ryo-whaletech:fix/foundry-hosting-test-state-isolation

Conversation

@ryo-whaletech

Copy link
Copy Markdown
Contributor

Motivation & Context

Foundry Hosting tests exercise local AgentServer-backed persistence. Independent pytest execution contexts can share its JSON state root, allowing one test's write to remove another test's response-chain session.

Description & Review Guide

  • What are the major changes? A package-local function-scoped fixture gives each Foundry Hosting test a state root under its pytest temporary directory and restores the previous environment afterward. A deterministic regression in the existing state-store test file checks the test-local root contract.
  • What is the impact of these changes? Unrelated tests within and across workers no longer share local AgentServer files. Requests within one test still share its root, and tests or child processes can explicitly choose a common root for persistence and restart scenarios. Production code, storage formats, APIs, and errors are unchanged.
  • What do you want reviewers to focus on? The per-test fixture boundary and the ability to opt into a deliberate shared root.

Related Issue

Fixes #8408

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.

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.

🟢 Approval recommended

The fixture provides function-scoped isolation while preserving explicit root overrides and automatic environment restoration.

Pull request overview

Isolates Foundry Hosting test persistence to prevent cross-test and cross-worker state interference.

Changes:

  • Adds an autouse fixture assigning each test a temporary AgentServer state root.
  • Adds a regression test verifying the root is test-scoped.
File summaries
File Description
python/packages/foundry_hosting/tests/conftest.py Configures per-test local state isolation.
python/packages/foundry_hosting/tests/test_state_store.py Verifies the isolated state-root contract.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the complete diff and found no actionable issues. All reported checks for the current head are green.

Merged via the queue into microsoft:main with commit 070ed93 Sep 16, 2026
50 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — dfa28089 Deployed Sep 15, 2026 by ryo-whaletech via team_check #4497
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: Foundry Hosting tests share local AgentServer state

3 participants