Skip to content

Isolate MCP OAuth settings persistence in agent-server tests #4604

Description

@neubig

The MCP OAuth settings-store tests should keep persistence inside their pytest temporary directory by setting OH_PERSISTENCE_DIR.

Actual Behavior

In tests/agent_server/test_mcp_oauth_store.py, the affected tests create configurations using tmp_path but call get_settings_store() without setting OH_PERSISTENCE_DIR. The settings store therefore falls back to the user default ~/.openhands persistence directory, allowing encrypted MCP OAuth state to be written outside the pytest sandbox.

Reproduce with:

uv run pytest tests/agent_server/test_mcp_oauth_store.py -q

Before this change, the tests did not redirect OH_PERSISTENCE_DIR to tmp_path.

Acceptance Criteria

  • Each affected MCP OAuth settings-store test sets OH_PERSISTENCE_DIR to its pytest tmp_path.
  • The focused test suite passes with uv run pytest tests/agent_server/test_mcp_oauth_store.py -q.
  • Test execution does not write settings or encrypted OAuth state to the user default persistence directory.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmcppriority:mediumFor bugs, a serious source of annoyance, but not blocking a large number of users.ready-for-devIssue meets development readiness criteriasecuritytesting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions