Python: Reserve HA session id as reserved for AGUI - #8199
Python: Reserve HA session id as reserved for AGUI#8199westey (westey-m) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The duplicated security-sensitive key needs a cross-package contract test to prevent silent drift.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Protects Foundry hosted-agent sandbox IDs from client-controlled AG-UI state.
Changes:
- Declares Foundry session IDs as server-owned.
- Reserves the key unconditionally in AG-UI.
- Adds security regression tests and guidance.
File summaries
| File | Description |
|---|---|
python/packages/foundry/tests/foundry/test_foundry_agent.py |
Tests Foundry sandbox protections. |
python/packages/foundry/agent_framework_foundry/_agent.py |
Declares and documents the protected key. |
python/packages/ag-ui/tests/ag_ui/test_run.py |
Tests reserved-state filtering. |
python/packages/ag-ui/AGENTS.md |
Documents state-ownership rules. |
python/packages/ag-ui/agent_framework_ag_ui/_agent_run.py |
Unconditionally reserves the Foundry key. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (1 commit(s)): 7280b0df1be6
Model: gpt-5.6-sol-fast
Overview
This PR adds an unconditional AG-UI reservation for the Foundry hosted-agent session key and documents the corresponding Foundry ownership contract. Request state is filtered before the session merge, while tests cover missing wrapper declarations, overwrite attempts, and separation from service_session_id. No Critical, High, or Medium defect introduced by the reviewed range was established.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
|
westey (@westey-m) there's one file conflict, FYI |
Thanks Evan Mattson (@moonbox3), I've merged the conflict |
| # agent_framework_foundry.FOUNDRY_HOSTED_AGENT_SESSION_ID_KEY. Selects the Foundry hosted-agent runtime session, | ||
| # a VM-isolated sandbox with a persistent filesystem, so a client-supplied value would run the server's | ||
| # credentialed call inside another session's sandbox. | ||
| _RESERVED_SERVICE_SESSION_STATE_KEYS: frozenset[str] = frozenset({"foundry_hosted_agent_session_id"}) |
There was a problem hiding this comment.
this is now being defined both here and in FoundryAgent's service_session_state_keys, do we need it in both places?
Motivation & Context
Description & Review Guide
Related Issue
Fixes #
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.