Skip to content

bug: importing any provider profile supersedes other sandboxes' provider --wait #5927

Backlog

Description

@matthewgrossman

User Story

I run OpenShell's conformance suite with several tests at once on one shared gateway, the way teams share a gateway. I need provider update --wait on my sandbox to report ready when my update applies, even if someone else imports or deletes an unrelated provider profile at the same time.

Problem Statement

Importing or deleting any provider profile makes every in-flight provider update --wait in the workspace end with superseded (desired_state_changed) and exit 1. The update is not replaced: it still applies a moment later. sandbox provider attach --wait and detach --wait use the same readiness check, so they are likely affected too.

The docs define superseded as "a later change replaced the original request" (provider profiles). An unrelated profile import replaces nothing.

Impact / Why This Matters

  • Any user's profile import or delete breaks every other user's --wait in the same workspace. Scripts that depend on --wait fail at random.
  • The only workaround is to ignore superseded and poll for the effect, which makes --wait pointless.
  • conformance::providers::provider_file_open_update_and_detach fails in about 4 of 5 local runs with 4 workers, and passes alone. It's marked unsupported on every environment with more than one worker until this is fixed (test(e2e): port provider tests from e2e/rust to testkit #5657).

Acceptance Criteria

  • Importing or deleting a profile that a sandbox's providers don't use does not change that sandbox's desired provider state, so a concurrent --wait reports ready.
  • Changing the profile that a provider uses still supersedes that provider's in-flight --wait.
  • The tests/suites/unsupported.yaml entry for provider_file_open_update_and_detach is deleted.

Reproduction Steps

  1. Import a profile files-demo that serves a file:

    id: files-demo
    display_name: Files
    files:
      - path: client.toml
        env_var: ACME_CONFIG_FILE
        content: |
          project = "{{config.project}}"
  2. Create a provider from it and a sandbox that uses it:

    openshell profile import --file files-demo.yaml
    openshell provider create --name files-demo --type files-demo --config project=production
    openshell sandbox create --name sb-demo --provider files-demo --no-tty --detach -- sleep infinity
  3. Update the provider and wait. It reports ready and exits 0:

    openshell provider update files-demo --config project=one --wait --timeout 90
  4. Update it again, and import an unrelated profile while the wait runs:

    openshell provider update files-demo --config project=two --wait --timeout 90 &
    sleep 0.3
    printf 'id: unrelated\ndisplay_name: Unrelated\n' > unrelated.yaml
    openshell profile import --file unrelated.yaml
    wait

    The update reports sb-demo / files-demo: superseded (desired_state_changed) and exits 1. This happened 3 times in 3 trials.

  5. openshell sandbox exec -n sb-demo -- cat /run/openshell/providers/files-demo/client.toml shows project = "two" a moment later.

Environment

  • OpenShell: main at 152c59d
  • OS: macOS, Docker Desktop
  • Runtime, deployment, or integration: Docker gateway from e2e/with-docker-gateway.sh

Agent Investigation

  • A provider's desired identity includes provider_env_revision (compute_provider_env_revision_from_records_and_policy_bindings in crates/openshell-server/src/grpc/policy.rs).
  • That hashes the provider's profile entry through hash_scoped_profile_revision (crates/openshell-server/src/provider_profile_sources.rs), which includes entry.source_revision.
  • For stored profiles, source_revision is profile_snapshot_revision: one hash over every profile in the snapshot. So any profile import or delete changes every provider's revision, and readiness reports superseded for every in-flight wait.
  • Hashing only the provider's own profile entry (which hash_scoped_profile_revision already does through canonical_provider_profile_bytes), without the whole-source revision, would likely fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions