Skip to content

Saving Cloud LLM settings can fail with agent_context=None validation error #981

@enyst

Description

@enyst

Problem

Saving a new LLM configuration from Agent Canvas against an OpenHands Cloud backend can break the user's Cloud settings with this backend validation error:

Something went wrong storing settings: 1 validation error for OpenHandsAgentSettings
agent_context
  Input should be a valid dictionary or instance of AgentContext [type=model_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.12/v/model_type

I did not find an existing agent-canvas issue for this exact agent_context=None failure. #911 tracks accepting invalid LLM values, but this is a backend payload/schema compatibility issue while saving Cloud LLM settings.

Likely area to inspect:

  • src/api/cloud/settings-service.api.ts::saveCloudSettings() posts nested agent_settings_diff to /api/v1/settings.
  • Cloud settings responses may include nested agent_settings / SDK settings state that contains agent_context: null.
  • The Cloud backend validates against OpenHandsAgentSettings, where agent_context must be a dict / AgentContext, not None.

Expected behavior

Saving a new LLM/profile from Agent Canvas should not leave Cloud settings in an invalid state.

At minimum, Agent Canvas should avoid sending or preserving agent_context: null in any Cloud settings payload that the backend validates as OpenHandsAgentSettings. If Cloud returns agent_context: null, the frontend should normalize it to {} or omit it before round-tripping, depending on the backend contract.

Acceptance criteria

  • Reproducing the Cloud LLM save flow no longer produces the OpenHandsAgentSettings.agent_context validation error.
  • Agent Canvas does not send agent_context: null in Cloud settings save requests.
  • Existing settings with agent_context: null are repaired or safely normalized on next save.
  • Regression coverage asserts the Cloud settings save payload for a new LLM config cannot include agent_context: null.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    canvas-mvpIssues / bugs required for Canvas MVP

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions