Python: fix(foundry-hosting): root file-based approval storage under durable home directory - #7431
Open
PratikWayase wants to merge 2 commits into
Open
Conversation
PratikWayase
temporarily deployed
to
github-app-auth
July 30, 2026 09:58 — with
GitHub Actions
Inactive
PratikWayase
temporarily deployed
to
github-app-auth
July 30, 2026 09:58 — with
GitHub Actions
Inactive
PratikWayase
temporarily deployed
to
github-app-auth
July 30, 2026 09:58 — with
GitHub Actions
Inactive
PratikWayase
temporarily deployed
to
github-app-auth
July 30, 2026 09:59 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make hosted ResponsesHostServer function-approval persistence durable across compute recreation by moving the approval-requests JSON storage from the ephemeral filesystem root (/.function_approvals/...) to a durable home directory ($HOME/.function_approvals/..., with a safe fallback to /home/session/...).
Changes:
- Adds
_resolve_approval_storage_path(is_hosted)to compute a hosted-durable approval storage path (with guards for invalidHOME). - Updates
ResponsesHostServer.__init__to compute and store_approval_storage_path. - Adds unit tests intended to validate local vs hosted approval storage path behavior under various
HOMEvalues.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py | Adds approval storage path resolution logic and stores the computed value on the server instance. |
| python/packages/foundry_hosting/tests/test_responses.py | Adds/updates tests intended to validate approval storage path resolution behavior. |
Comments suppressed due to low confidence (2)
python/packages/foundry_hosting/tests/test_responses.py:4450
- Similar to the valid-HOME test, this case should also validate the path actually used by the hosted file-based approval store (
_approval_storage._storage_path), not only the computed_approval_storage_pathattribute.
server = ResponsesHostServer(MagicMock(), store=InMemoryResponseProvider())
expected = "/home/session/.function_approvals/approval_requests.json"
assert server._approval_storage_path == expected
python/packages/foundry_hosting/tests/test_responses.py:4462
- This test should validate the fallback path is the one actually used by the hosted approval storage (
_approval_storage._storage_path), otherwise a wiring bug (still writing to/.function_approvals) can slip through even if_approval_storage_pathis correct.
server = ResponsesHostServer(MagicMock(), store=InMemoryResponseProvider())
expected = "/home/session/.function_approvals/approval_requests.json"
assert server._approval_storage_path == expected
assert not server._approval_storage_path.startswith("/.function_approvals")
PratikWayase
temporarily deployed
to
github-app-auth
July 30, 2026 10:53 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
Previously,
ResponsesHostServer.__init__rooted the file-based approval storage at the absolute path/.function_approvals/approval_requests.json(the filesystem root). When a WorkflowAgent session compute was stopped and reached idle, a continuation request would recreate the compute, but the approval requests were not restored. Because the approval storage was written to the ephemeral root path, it was lost, causing function approvals to fail after compute recreation.This is the same class of issue as #7137, which was fixed for checkpoint storage in #7220 by moving from
/.checkpointsto$HOME/.checkpoints.Description & Review Guide
What are the major changes?
_resolve_approval_storage_path(is_hosted)static method: When hosted, this method roots the store at$HOME/.function_approvals/approval_requests.json(reading theHOMEenvironment variable, defaulting to/home/session) instead of/.function_approvals/approval_requests.json.HOMEis not unset, blank, or the filesystem root (e.g.,/). If it is, it falls back to/home/session/.function_approvals/approval_requests.jsonto guarantee the store never lands under the read-only root.__init__: The approval storage path assignment now calls_resolve_approval_storage_path(self.config.is_hosted)instead of using the rawFUNCTION_APPROVAL_STORAGE_PATHconstant.HOME, missingHOME, and unusableHOMEvalues (/, empty, whitespace).What is the impact of these changes?
$HOMEvolume, surviving across requests and compute recreation (idle → active).{cwd}/.function_approvals/approval_requests.json).What do you want reviewers to focus on?
_resolve_approval_storage_pathlogic, specifically theHOME=/guard, which prevents writing to/.function_approvalseven if the environment variable is misconfigured.Related Issue
Fixes #7414
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.