Repository navigation
test(settings): reject unversioned persisted shape changes - #4295
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ 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.pyOutput 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.
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>tomcp_config.<name>without a version bump.Summary
survive the current load/dump round-trip.
schema-version migration.
Issue Number
N/A
How to Test
Result:
13 passed.Result:
Result: Ruff format/lint, pycodestyle, pyright, import rules, and tool
registration all passed.
Video/Screenshots
Not applicable; this changes a CI compatibility check.
Type
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
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22-slimgolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:8cbe162-pythonRun
All tags pushed for this build
About Multi-Architecture Support
8cbe162-python) is a multi-arch manifest supporting both amd64 and arm648cbe162-python-amd64) are also available if needed