Skip to content

test(settings): reject unversioned persisted shape changes - #4295

Merged
neubig merged 1 commit into
mainfrom
agent/enforce-persisted-settings-version-shape
Jul 28, 2026
Merged

neubig merged 1 commit into
mainfrom
agent/enforce-persisted-settings-version-shape

Conversation

@neubig

@neubig neubig commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

This is a testing-only change, so no human verification is needed.


AGENT:

Why

The persisted-settings compatibility check proved that payloads from older
releases still loaded, but it did not reject removal, relocation, or rewriting
of existing fields when the schema version stayed unchanged. That allowed the
schema-v4 MCP shape to change from mcp_config.mcpServers.<name> to
mcp_config.<name> without a version bump.

Summary

  • Require every path and value emitted by a same-version PyPI baseline to
    survive the current load/dump round-trip.
  • Continue allowing additive mapping fields and shape changes backed by a
    schema-version migration.
  • Add a regression reproducing the legacy wrapped-to-flat MCP rewrite.

Issue Number

N/A

How to Test

OPENHANDS_SUPPRESS_BANNER=1 uv run pytest -q tests/cross/test_check_persisted_settings_compat.py

Result: 13 passed.

OPENHANDS_SUPPRESS_BANNER=1 uv run python .github/scripts/check_persisted_settings_compat.py

Result:

Validated 9 persisted settings fixture(s) under tests/sdk/persisted_settings_baselines
Validated 7 baseline payload(s) from PyPI release openhands-sdk==1.38.0, openhands-agent-server==1.38.0
uv run pre-commit run --files .github/scripts/check_persisted_settings_compat.py tests/cross/test_check_persisted_settings_compat.py

Result: Ruff format/lint, pycodestyle, pyright, import rules, and tool
registration all passed.

Video/Screenshots

Not applicable; this changes a CI compatibility check.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

Additive fields remain compatible. Existing fields may only be removed, moved,
or changed after advancing the relevant schema version and adding a migration.


Agent Server images for this PR

• 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:8cbe162-python

Run

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

All tags pushed for this build

ghcr.io/openhands/agent-server:8cbe162-golang-amd64
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-golang-amd64
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-golang-amd64
ghcr.io/openhands/agent-server:8cbe162-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:8cbe162-golang-arm64
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-golang-arm64
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-golang-arm64
ghcr.io/openhands/agent-server:8cbe162-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:8cbe162-java-amd64
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-java-amd64
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-java-amd64
ghcr.io/openhands/agent-server:8cbe162-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:8cbe162-java-arm64
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-java-arm64
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-java-arm64
ghcr.io/openhands/agent-server:8cbe162-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:8cbe162-python-amd64
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-python-amd64
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-python-amd64
ghcr.io/openhands/agent-server:8cbe162-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-amd64
ghcr.io/openhands/agent-server:8cbe162-python-arm64
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-python-arm64
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-python-arm64
ghcr.io/openhands/agent-server:8cbe162-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-arm64
ghcr.io/openhands/agent-server:8cbe162-golang
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-golang
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-golang
ghcr.io/openhands/agent-server:8cbe162-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:8cbe162-java
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-java
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-java
ghcr.io/openhands/agent-server:8cbe162-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:8cbe162-python
ghcr.io/openhands/agent-server:8cbe162569b6dda50a215f1732a8a51f7665a898-python
ghcr.io/openhands/agent-server:agent-enforce-persisted-settings-version-shape-python
ghcr.io/openhands/agent-server:8cbe162-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim

About Multi-Architecture Support

  • Each variant tag (e.g., 8cbe162-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., 8cbe162-python-amd64) are also available if needed

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

@neubig
neubig marked this pull request as ready for review July 28, 2026 21:21

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ QA Report: PASS

The persisted-settings compatibility checker now rejects same-version persisted shape rewrites while still allowing version-backed migrations and additive fields.

Does this PR achieve its stated goal?

Yes. I reproduced the gap on origin/main: a simulated same-version MCP wrapper-to-flat rewrite was accepted. After applying commit 8cbe162569b6dda50a215f1732a8a51f7665a898, the same compatibility-check path rejected that rewrite with the expected did not preserve persisted field 'mcp_config.mcpServers' without advancing schema_version 1 error, while version-bumped rewrites and additive same-version fields still passed.

Phase Result
Environment Setup ✅ make build completed and installed the uv-managed dev environment.
CI Status 🟡 Latest head checks observed: key checks green including Persisted settings; QA and several agent-server build jobs still in progress at observation time.
Functional Verification ✅ Exercised the actual persisted settings compatibility checker path before and after the PR.
Functional Verification

Test 1: Same-version persisted shape rewrite is rejected after the PR

Step 1 — Reproduce / establish baseline without the fix:
Checked out origin/main, then ran a Python harness through uv run python that imports .github/scripts/check_persisted_settings_compat.py, constructs a realistic PyPI-baseline BaselinePayloadCase containing mcp_config.mcpServers.shttp, and validates it against a loader that rewrites that same-version payload to flat mcp_config.shttp without bumping schema_version.

Output:

HEAD is now at 1f9f0b1a fix(llm): generalize model capability resolution (#4200)
RESULT: accepted same-version shape rewrite

This confirms the bug exists on the base branch: the compatibility path accepted a same-version persisted field relocation.

Step 2 — Apply the PR's changes:
Checked out commit 8cbe162569b6dda50a215f1732a8a51f7665a898.

Step 3 — Re-run with the fix in place:
Ran the same harness against the PR commit.

Output:

HEAD is now at 8cbe1625 test(settings): reject unversioned persisted shape changes
RESULT: rejected same-version shape rewrite
AgentSettings payload from QA simulated PyPI baseline openhands-sdk==1.0.0 (agent_settings/populated) did not preserve persisted field 'mcp_config.mcpServers' without advancing schema_version 1. Bump the schema version and add a migration.

This shows the changed behavior works: the same unversioned shape rewrite now fails with actionable migration guidance.

Test 2: Compatible cases remain allowed

On the PR commit, I ran the same compatibility path for two allowed scenarios: a shape rewrite when the payload starts at an older schema version, and an additive same-version field.

Output:

::notice title=AgentSettings::Migrated QA simulated PyPI baseline openhands-sdk==0.9.0 (agent_settings/populated) from schema_version 0 to 1
RESULT: allowed shape rewrite when schema_version advances
RESULT: allowed additive field on same schema_version

This confirms the new check is not over-blocking the compatibility cases the PR says should remain valid.

Test 3: Real checker entry point still runs against repository fixtures and PyPI baselines

On the PR branch, I ran the actual checker CLI:

OPENHANDS_SUPPRESS_BANNER=1 uv run python .github/scripts/check_persisted_settings_compat.py

Output excerpt:

Validated 9 persisted settings fixture(s) under tests/sdk/persisted_settings_baselines
Validated 7 baseline payload(s) from PyPI release openhands-sdk==1.38.0, openhands-agent-server==1.38.0

This confirms the real CI-facing command still completes successfully with the current fixtures and generated PyPI baseline payloads.

Issues Found

None.

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

@malhotra5 malhotra5 left a comment

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.

LGTM

@neubig
neubig merged commit b3569aa into main Jul 28, 2026
47 of 48 checks passed
@neubig
neubig deleted the agent/enforce-persisted-settings-version-shape branch July 28, 2026 23:41
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.

3 participants