Skip to content

[Agent Profile] Fail closed when a scoped launch profile cannot be resolved #759

Closed

Description

@simonrosenberg

Cloud profile resolution must fail closed at conversation start. Ordinary settings reads may remain best-effort, but a requested scoped profile must never become an unrestricted launch.

On current main and #364, SaasSettingsStore._resolve_active_agent_profile catches all resolver exceptions and returns None. load(resolve_agent_profile=True) then keeps the composed global/member settings and clears effective profile provenance. This explicitly discards a profile's tools, MCP and secret policy. The current test TestPersistedVsResolvedSettingsView.test_resolver_crash_falls_back_to_composed_settings pins that behavior, including expansion from one MCP server to all three.

Reproduction against the real resolver on #364 rebased onto main c60de1f:

  • Stored typed profile secret_refs: [], mcp_server_refs: [missing-server], a valid Default LLM profile.
  • _resolve_active_agent_profile logs MCP server ref(s) not present ... missing-server and returns None.
  • No resolution result carries secret_refs; feat(app-server): enforce an agent profile's secret_refs scope #364's filter receives None and passes every assembled secret through.
    This reproduction uses real SDK/store models and resolver, without mocking the resolver, but is not a deployed Cloud API test. The existing PostgreSQL-backed fallback test also passes; it confirms the load boundary deliberately widens the settings.

An explicit unknown/removed profile id takes the same fallback. Envelope entries that a pod cannot parse are hidden by best-effort loading and may also trigger it. A profile edit or MCP deletion is therefore enough to change a restricted launch into an unrestricted one, without a client asking for that change.

Required work:

  • Separate best-effort settings/editor reads from strict conversation-start resolution.
  • For explicit ids and effective ambient profiles, return a structured recoverable error on missing/unreadable profiles or dangling LLM/MCP/meta refs. Do not launch composed settings instead.
  • Resolve once and thread one immutable snapshot of settings + id/revision + secret scope into construction and provenance. This also closes Agent Profiles cloud follow-ups: first-caller seed capture, zero-profiles semantics, override double-resolve #51 item 3.
  • Keep no-profile behavior explicit; define intentional reset/default behavior rather than conflating it with a failed profile.
  • Check both OpenHands and ACP and all creation surfaces (web, API, integration/automation). A hidden editor control is not server enforcement.
  • Scope raw/request additions after policy resolution; failure cannot drop the scope.

Acceptance: a profile with tools: [], mcp_server_refs: [] or secret_refs: [] either launches with exactly its policy or fails before any sandbox conversation is created. Removed refs, store/decryption errors, stale ids and unsupported schema versions never widen it. Ordinary settings remain readable for repair. A concurrency test verifies launched behavior and stamped revision/scope belong to the same snapshot.

Related: #344 / #364, #51, #59, software-agent-sdk#5398. This is broader than a small filter patch; keep #364 draft until this launch failure policy is resolved or its narrower guarantees are explicitly accepted.

Cloud launch pipeline follow-up from software-agent-sdk#5398

The SDK/Agent Server pipeline is merged in OpenHands/software-agent-sdk#5406, #5408 and #5409. Cloud still needs to adopt it; closing the SDK tracker does not mean Cloud parity is complete.

  • Resolve the selected or ambient profile once in the Cloud control plane using the canonical SDK launch resolver and store adapters. Carry one snapshot of reference-free settings, profile id/revision, and secret scope through request construction and provenance.
  • Forward reference-free settings over the authenticated control-plane/runtime boundary and let the sandbox Agent Server finalize with its own browser/tool availability and ACP skill sourcing. Do not build a launch agent in Cloud and then overwrite its profile fields.
  • Keep host/integration suffixes, credentials, and other serving additions additive and scope them against that same snapshot. Preserve explicit empty tool/MCP/secret selections.
  • Verify preview versus launch and stored/default-copy/inline/override paths across local, Docker, and Cloud. Missing refs and store failures must fail before sandbox conversation creation. Pin compatibility to a released SDK and matching sandbox image.

Context/tool preservation remains in #59 / PR #368 and #758 / PR #453; secret enforcement remains in #344 / PR #364. Coordinate these rather than adding a second field-by-field launch implementation. The first-caller seed and zero-profile product decisions in #51 remain separate. Canvas default-profile migration and global-setting preservation are tracked in OpenHands/OpenHands#17991.

Activity

  1. added
    oss-ohe-parity
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    oss-ohe-parity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions