Skip to content

Foundation: adopt apply_agent_settings_diff in all settings stores #3706

Closed

Description

@simonrosenberg

✅ Status as merged on main (closed 2026-06-15)

  • SDK part — DONE (PR feat(settings): delegate PersistedSettings.update to apply_agent_settings_diff #3712 · in v1.29.0). PersistedSettings.update() delegates to apply_agent_settings_diff (openhands-agent-server/openhands/agent_server/persistence/models.py:217) with intentional RFC-7386 null semantics + 6 parity tests (same-kind nested merge, cross-kind switch from fresh defaults, legacy agent_kind:"llm" → "openhands").
  • OpenHands app-server part — DONE (OpenHands #14677), NOT deferred. openhands/app_server/settings/settings_models.py:218 + enterprise/storage/org_store.py:352 now delegate to apply_agent_settings_diff. #14677 referenced the predecessor feat(settings): add apply_agent_settings_diff and canonicalize the llm tag on read #3534 (which introduced the helper) rather than this issue, which is why the trail wasn't linked here — corrected 2026-06-21. The intentional mcp_config wholesale-replace shell is kept (app_server/utils/jsonpatch_compat.py WHOLESALE_REPLACEMENT_KEYS).
  • Canvas part — no code change currently identified as required (TypeScript clients build diffs and rely on backend merge semantics; settings-service.api.ts forwards agent_settings_diff verbatim).
Original spec

Context

apply_agent_settings_diff() now exists in the SDK as the intended owner for applying sparse agent_settings_diff payloads across the OpenHandsAgentSettings | ACPAgentSettings union.

That helper solves the important union-boundary rule: when agent_kind changes, start from a fresh target variant instead of deep-merging fields from the outgoing variant and producing a mixed OpenHands/ACP payload.

However, settings stores and integrations still have hand-rolled diff logic in places. That creates drift risk for AgentProfiles, where activation/materialization will apply agent settings diffs frequently and must behave identically in local agent-server, OpenHands app-server, and future profile endpoints.

This follows up the closed issue that introduced the helper: #3533.

Goal

Make apply_agent_settings_diff() the shared implementation used by settings stores and profile activation paths, or explicitly document and test any remaining divergence — across OpenHands/software-agent-sdk, OpenHands/OpenHands, and OpenHands/agent-canvas.

Proposed work

  • Audit all agent_settings_diff application paths in this repo; replace hand-rolled dump/deep-merge/validate logic with apply_agent_settings_diff() where behavior should be shared.
  • Audit OpenHands app-server usage and update it to delegate to the SDK helper, or document/test any intentional server-only behavior.
  • Audit Canvas payload construction (agent-kind switch payloads, mcp_config replacement/clearing, ACP settings save helpers, omitted-field-retention assumptions).
  • Link downstream issues/PRs from this SDK issue.
  • Add parity tests (OpenHands→ACP from fresh ACP defaults; ACP→OpenHands from fresh OpenHands defaults; same-kind nested merge; legacy agent_kind:"llm" → "openhands").
  • Verify null/unset semantics for nested maps (mcp_config, acp_env, secret-bearing dicts).
  • Confirm profile activation/materialization can reuse the same helper.

Acceptance criteria

  • One tested SDK-owned behavior for applying agent_settings_diff across kinds.
  • Local agent-server settings updates use it (or have a tested reason not to).
  • OpenHands app-server uses the helper (or has a linked, tested divergence).
  • Canvas audited for payload compatibility; necessary changes linked.
  • Future AgentProfile activation reuses the same path.
  • MCP replacement/clearing + secret-bearing nested maps covered by tests.

Activity

  1. simonrosenberg commented on Jun 15, 2026

    @simonrosenberg
    MemberAuthor

    Tracked as a Phase 0 foundation prerequisite of the Agent Profiles epic #3713.

  2. simonrosenberg commented on Jun 21, 2026

    @simonrosenberg
    MemberAuthor

    Audit note (2026-06-21) — linking the OpenHands portion back to this foundation issue. The SDK part (PersistedSettings.update delegating to apply_agent_settings_diff) shipped in PR #3712 (v1.29.0). The epic and the cloud umbrella #3730 listed the OpenHands app-server adoption as "deferred to Phase 5" — but it is in fact DONE: it landed via OpenHands #14677 (openhands/app_server/settings/settings_models.py:218 + enterprise/storage/org_store.py:352 now delegate to apply_agent_settings_diff). #14677 referenced the predecessor #3534 rather than this issue, which is why the trail wasn't linked. Epic #3713 and #3730 have been updated to reflect this. Only the canvas portion remains, and no canvas code change is currently identified as required (canvas forwards the agent-settings diff verbatim and relies on the backend merge).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

acp

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions