Skip to content

Separate Context attachment resolution from the public API #40

Open

Description

@moonlight16

Goal

Separate context storage from execution provisioning and separate Kubernetes attachment details from the client-facing Context API.

Context Service already creates, lists, reads, and deletes PVC-backed contexts independently from Sandboxes. This issue maps the remaining work to one focused Context Service PR.

Current state

  • A context is identified by its Kubernetes namespace and user-facing name.
  • POST /v1/contexts creates only a PVC. It does not create a Sandbox.
  • Context Service already tracks owners, grants, consumers, revisions, snapshots, clones, and deletion protection.
  • Public Context responses currently expose the backing PVC claim name because contextctl uses it for direct Kubernetes sync.

Scope

  • Keep (namespace, name) as the stable Context identity. Do not add an opaque ID solely for obscurity.
  • Add an authenticated service-to-service operation that resolves a Context into the PVC attachment descriptor MOCA needs.
  • Require the requested subject to have attach permission on the Context.
  • Return the namespace, claim name, backend kind, and storage access mode only from this protected operation.
  • Keep the existing public attachment field temporarily for compatibility with contextctl.
  • Mark that public field as deprecated and remove it only after Add scoped upload and materialization capabilities for managed contexts #45 migrates sync to scoped upload capabilities.
  • Add explicit regression coverage that Context creation creates a PVC and no Sandbox resource.

Acceptance criteria

  • Existing Context CRUD behavior remains compatible.
  • An authenticated MOCA service can resolve an authorized Context attachment.
  • Missing or invalid service credentials are rejected.
  • A subject without attach permission receives the same not-found response used elsewhere for unauthorized Context access.
  • Ordinary clients do not gain a new way to enumerate PVCs.
  • Context creation produces no Sandbox resources.
  • Unit and Kind-compatible tests cover the new behavior.

Related work

Activity

  1. moonlight16 commented on Oct 1, 2026

    @moonlight16
    MemberAuthor

    Agreed implementation sequence, with one issue mapped to one PR:

    1. Add a storage-only Kubernetes context lifecycle API #44 adds a storage-only PVC-backed context lifecycle API while preserving the existing sandbox-pool API.
    2. Add scoped upload and materialization capabilities for managed contexts #45 adds scoped direct upload and atomic materialization, reusing the current local implementation where appropriate.
    3. MOCA issue /workloads: authorize caller-named PVCs per subject, and scope workload names moca#358 moves user/workload authorization and Sandbox provisioning into MOCA.
    4. The MOCA delegation skill migrates to the replacement path and proves the end-to-end flow.
    5. Remove Sandbox provisioning after the MOCA storage migration #46 removes Sandbox provisioning from Context Service only after the replacement path passes.

    The intended ownership boundary is:

    • MOCA owns users, sessions, execution environments, Sandbox selection, and task results.
    • Context Service owns portable context, storage allocation, uploads, revisions, snapshots, clones, backup, and sync.

    Implementation will proceed one issue at a time. Each change remains local and uncommitted until reviewed.

  2. changed the title [-]Explore contextctl sync with Serverless Harness workloads[/-] [+]Explore contextctl sync with MOCA workloads[/+] on Oct 1, 2026
  3. changed the title [-]Explore contextctl sync with MOCA workloads[/-] [+]Add a storage-only Kubernetes context lifecycle API[/+] on Oct 1, 2026
  4. moonlight16 commented on Oct 1, 2026

    @moonlight16
    MemberAuthor

    Roadmap correction: #44 was folded into this issue and closed. This issue now maps directly to the storage-only Context Service PR. #45 follows it, MOCA issue rossoctl/moca#358 tracks the MOCA-side authorization and provisioning change, and #46 is the final Sandbox-provisioning removal.

  5. changed the title [-]Add a storage-only Kubernetes context lifecycle API[/-] [+]Separate Context attachment resolution from the public API[/+] on Oct 1, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions