Skip to content

test(agent-server): isolate MCP OAuth settings persistence via OH_PERSISTENCE_DIR - #4521

Open
all-hands-bot wants to merge 1 commit into
mainfrom
fix/tests-use-persistence-dir-env
Open

test(agent-server): isolate MCP OAuth settings persistence via OH_PERSISTENCE_DIR#4521
all-hands-bot wants to merge 1 commit into
mainfrom
fix/tests-use-persistence-dir-env

Conversation

@all-hands-bot

@all-hands-bot all-hands-bot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

The three settings-store-backed MCP OAuth tests in tests/agent_server/test_mcp_oauth_store.py build a Config whose conversations_path lives under tmp_path, but they call get_settings_store() without setting OH_PERSISTENCE_DIR.

When OH_PERSISTENCE_DIR is absent, the settings store falls back to the user's ~/.openhands (see _get_profile_persistence_dir), so these tests were writing settings.json — including encrypted MCP OAuth token state — into the host home directory rather than the test sandbox.

Change

Point OH_PERSISTENCE_DIR at the test tmp_path in each of the three affected tests so the settings store stays inside the test sandbox.

Test plan

.venv/bin/python -m pytest tests/agent_server/test_mcp_oauth_store.py -q

4 passed.


This PR was created by an AI agent (OpenHands) on behalf of the user.


🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22-slim Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:84a0a25-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-84a0a25-python \
  ghcr.io/openhands/agent-server:84a0a25-python

All tags pushed for this build

ghcr.io/openhands/agent-server:84a0a25-golang-amd64
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-golang-amd64
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-golang-amd64
ghcr.io/openhands/agent-server:84a0a25-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:84a0a25-golang-arm64
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-golang-arm64
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-golang-arm64
ghcr.io/openhands/agent-server:84a0a25-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:84a0a25-java-amd64
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-java-amd64
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-java-amd64
ghcr.io/openhands/agent-server:84a0a25-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:84a0a25-java-arm64
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-java-arm64
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-java-arm64
ghcr.io/openhands/agent-server:84a0a25-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:84a0a25-python-amd64
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-python-amd64
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-python-amd64
ghcr.io/openhands/agent-server:84a0a25-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-amd64
ghcr.io/openhands/agent-server:84a0a25-python-arm64
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-python-arm64
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-python-arm64
ghcr.io/openhands/agent-server:84a0a25-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-arm64
ghcr.io/openhands/agent-server:84a0a25-golang
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-golang
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-golang
ghcr.io/openhands/agent-server:84a0a25-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:84a0a25-java
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-java
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-java
ghcr.io/openhands/agent-server:84a0a25-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:84a0a25-python
ghcr.io/openhands/agent-server:84a0a253cfd6d8ad2594bfa8abe1c71fde1f2d3a-python
ghcr.io/openhands/agent-server:fix-tests-use-persistence-dir-env-python
ghcr.io/openhands/agent-server:84a0a25-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim

About Multi-Architecture Support

  • Each variant tag (e.g., 84a0a25-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 84a0a25-python-amd64) are also available if needed

…SISTENCE_DIR

The three settings-store-backed MCP OAuth tests build a Config whose
conversations_path lives under tmp_path but call get_settings_store() without
setting OH_PERSISTENCE_DIR. When OH_PERSISTENCE_DIR is absent the settings
store falls back to the user's ~/.openhands, so these tests wrote
settings.json (including OAuth token state) into the host home directory.

Point OH_PERSISTENCE_DIR at the test tmp_path so the settings store stays
inside the test sandbox.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

Copy link
Copy Markdown
Contributor

Python API breakage checks — ✅ PASSED

Result:PASSED

Action log

@github-actions

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result:PASSED

Action log

@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
TOTAL408031719958% 
report-only-changed-files is enabled. No files were changed during this commit :)

@all-hands-bot

Copy link
Copy Markdown
Collaborator Author

👋 This PR needs a couple of things fixed before OpenHands can review it:

  • the PR description's HUMAN: section needs at least 20 characters describing what you tested, not just the template placeholder

Push an update once this is addressed and this check re-runs automatically.

This is an automated check - no AI was used to generate this comment.

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.

2 participants