From 51d0ddc44d6ee4a4f9b5fbeb98165995cda7d42d Mon Sep 17 00:00:00 2001 From: Jose Armesto Date: Wed, 2 Dec 2026 08:41:35 +0100 Subject: [PATCH 1/6] feat(organizations-test): add the public part `organizations-test --part public` proves an organization's public namespace: both namespaces with their labels and the operator's everyone binding; a person of another organization lists, starts and calls the organization's public agent and MCP server; an editor cannot publish; an empty public namespace is named nowhere; a public write in mode commit lands under the public path; the Slack start of a public agent. Part of giantswarm/giantswarm#39646 --- AGENTS.md | 1 + docs/agents.md | 88 ++ docs/cli.md | 2 +- internal/lab/organizationkind.go | 21 +- internal/lab/organizations.go | 17 +- internal/lab/organizationstest.go | 49 +- internal/lab/organizationstest_cleanup.go | 4 +- .../lab/organizationstest_cleanup_test.go | 3 +- internal/lab/organizationstest_credentials.go | 17 +- internal/lab/organizationstest_public.go | 1342 +++++++++++++++++ internal/lab/organizationstest_public_test.go | 212 +++ internal/lab/organizationstest_slack.go | 69 +- internal/lab/organizationstest_test.go | 33 + internal/lab/profake.go | 17 +- internal/lab/profake_test.go | 27 + main.go | 7 +- 16 files changed, 1856 insertions(+), 53 deletions(-) create mode 100644 internal/lab/organizationstest_public.go create mode 100644 internal/lab/organizationstest_public_test.go diff --git a/AGENTS.md b/AGENTS.md index 2ce7d940..b7129607 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -336,6 +336,7 @@ agentlab roadmap-test # the fake pro (a fixture board) registered with muster agentlab organizations-test # platform.organizations: two Organizations, alice and bob each an editor of one by group: each creates and runs an agent in their own; every surface (Kubernetes, kagent API, Slack; the Dev Portal proven by the browser suite's organizations.spec.ts) gives each the same agents; the negative cross-organization tests per surface and boundary (Kubernetes RBAC, kagent API and A2A, muster, agent-manager's tools by organization name (an organization's namespace as namespace, the other organization, organization with namespace and no cluster: each refused), the other organization's model, in-cluster 443 through the egress gateway); the profile tests (object-count quota, a PolicyException that does not lift the sandbox policies, the credential provider's grants, each component's Secret reads (ate-controller, both credential providers, the connectivity hooks); the cleanup of an Orphaned organization: its delete refused while MissingFromGit, erased once its delete pull request merged; an earlier failed run's fixtures removed first) agentlab organizations-test --part credentials # an organization admin's model without a key through muster (no ModelConfig, no Secret value, a pending operation); input_required, -32042 (url mode, an elicitationId) and a plain result with the link (structuredContent valid against its outputSchema) per MCP client generation; a declined and a dismissed elicitation ending the call with nothing written; completion notifications only to the initiating client; a viewer (agent-platform:user only, a third person) refused by RBAC and their save refused; a Secret another consumer references refused 409; the connector's and the egress policy's confirmations listing their one consumer and the origins; the other admin's save refused 403 after their admin binding is removed (access reviews before and after, nothing written) and the same operation saved at the same ETag once it is back (a SKIP below agent-manager 2.24.0-rc.2); the save through agent-manager's credential API (strong ETag, a missing If-Match 428 and a stale one refused, another person and an anonymous read refused, a cancel; the other admin's own operation a SKIP below agent-manager 2.24.0-rc.2, agent-manager#360) with a second POST and each generation's retry the same receipt as a pull request opened as the person with the Secret SOPS-encrypted; Flux applying and decrypting it (the Secret's SHA-256, the ModelConfig); no value in agent-manager's or muster's logs; a tenant MCP server's sign-in attributed to its key; delete_organization's erasure; each missing prerequisite a SKIP naming its fix agentlab organizations-test --part admins # spec.admins: create_organization writes them and no RoleBinding, the operator binds them to agent-platform:admin and follows update_organization (a replace, an empty list); a binding to agent-platform:admin by anyone else refused at admission; add_organization_member refuses the admin role; create_organization refused to a person without create on Organizations; a switch-off of spec.capabilities.agentPlatform.enabled refused at admission (agent-platform-organization-switch-off, decision D10) +agentlab organizations-test --part public # each organization's public namespace (agent-platform-operator 0.7.0-rc.1 and agent-manager 4.2.0-rc.3 or later, refused by name below them): both namespaces labelled and the operator's agent-platform:everyone binding; an editor of agentlab-b refused a write into its public namespace; alice, no member of agentlab-b, lists its public agent (list_agents with public: true), starts a Session on it (organization and public: true), sees its public MCP server through muster, and her agent whose toolset names that server calls it as her; an empty public namespace named nowhere; in mode commit a public write under /public only; with klaus-gateway 4.21.0-rc.3 or later her Slack start of the public agent; the MCP server fixture runs in a container (--mcp-fixture-binary: a static Linux agentlab on macOS) agentlab coding-test # platform.coding: the coding Harness from the values, agent-manager's guards, a coding agent's sandbox floor (uid split, forwarder paths, a write tool refused, no credentials, DNS canary, egress), a workspace Session's MCP call audited by muster as the person, nothing in the sandbox running between turns, the instruction fixture, suspend/resume, the turn's usage, a share refused, no muster call of the actor accepted after delete_session agentlab coding-test --step egress # one stage of coding-test and the stages it builds on (here create and the sandbox turn); the rest listed as skipped by the step agentlab coding-test --part devctl # platform.devctl: a coding agent opens a pull request as the person, waits for its CI (one pr_wait), merges it (pr_merge) and waits for its release (release_wait) through devctl's MCP server; one pr_wait with a progressToken beside it diff --git a/docs/agents.md b/docs/agents.md index 0ec1f5c6..3e2e3da6 100644 --- a/docs/agents.md +++ b/docs/agents.md @@ -852,6 +852,94 @@ outsider. The verdicts: A successful run deletes both organizations. A failed run keeps them for diagnosis, and the next run deletes them first. +### The public part + +`organizations-test --part public` proves that an organization shares +agents and MCP servers with every person on the installation through its +public namespace (giantswarm/giantswarm#39646, the organization-sharing +plan). agent-platform-operator keeps it beside the organization namespace +from its 0.7 line, reports it in +`status.capabilities.agentPlatform.publicNamespace` and binds the +installation's "everyone" (`tenants.platform.users`, `system:authenticated` +by default) there to `agent-platform:platform-user` (RoleBinding +`agent-platform:everyone`). agent-manager's tools reach it with `public: true` +from 4.2.0-rc.3. The part refuses, by name and version, an +agent-platform-operator before 0.7.0-rc.1 or an agent-manager before +4.2.0-rc.3: agent-platform runs the operator's 0.7 line from 4.190.0-rc.8 +(`agentlab configure --chart-version`), and a `platform.valuesFiles` overlay +admits the agent-manager release candidate (`gitops.prereleases`, or +`components.agent-manager.versionRange`). A dev build or a local build is +left to the run. + +The part keeps the proof's organizations and members: alice is a member of +`agentlab-a` and no member of `agentlab-b`, bob an editor of `agentlab-b`. +`agentlab-b`'s admin (the lab's admin, by `platform-admins` in `spec.admins`) +publishes in its public namespace: the organization's model, the agent +`agentlab-organizations-public` through `create_agent` with `public: true`, +and the MCP server `agentlab-public-mcp`, which is also in `agentlab-b`'s +organization namespace. The server is agentlab's fake pro (a fixed board) in a +container on the `kind` network, answering without a bearer: muster gives a +server outside its own namespace no identity. The container runs the agentlab +binary, which must be a static Linux executable: on macOS build one +(`GOOS=linux CGO_ENABLED=0 go build -o agentlab-linux .`) and pass it with +`--mcp-fixture-binary`. The verdicts: + +- each organization has its organization namespace and its public namespace, + both labelled with the organization's name and UID, and only the public one + with `agent-platform.giantswarm.io/space: public`; the public one has the + operator's `agent-platform:everyone`, to `agent-platform:platform-user` with + at least one subject, and access reviews as alice allow listing agents and + creating sessions in `agentlab-b`'s public namespace and deny listing agents + in its organization namespace; +- bob, an editor of `agentlab-b`, cannot publish: his agent's create in its + public namespace answers 403, while his create in its organization + namespace and the admin's create in the public namespace are admitted (dry + runs); his `create_agent` with `organization: agentlab-b` and `public: true` + is refused with nothing written, while the admin's is admitted (dry runs); +- alice's `list_agents` with `public: true` lists `agentlab-b`'s public agent + with `organization: agentlab-b` and `public: true`, and names its public + namespace under `publicNamespaces`; +- the same listing names `agentlab-a`'s public namespace nowhere: alice may + list agents there, and it holds no agent and no muster `MCPServer`; + `agentlab-b`'s is named; +- alice's `start_session` of the public agent without `public` reads word for + word as for an organization that does not exist (`not_found`); with + `organization: agentlab-b` and `public: true` it answers `public: true` and + a Session on the public agent that alice created, Ready; +- a turn of that Session answers (kagent API); +- muster lists alice `agentlab-b`'s public server and not the same server of + its organization namespace, which bob lists; +- alice's agent `agentlab-organizations-public-tools` in `agentlab-a`, whose + toolset is `server:/agentlab-public-mcp`: + under that toolset (`X-Muster-Toolset`, the header the agent's runtime + sends) alice's catalogue holds the server's `list_issues`, its call reaches + the fixture, and muster logs the call under alice's subject; under the + toolset that names the server of `agentlab-b`'s organization namespace the + call is refused for alice and answered for bob; +- a turn on alice's agent calls the public server: the fixture records the + call, and muster accepts alice's credential and logs the turn's calls under + her subject; +- where agent-manager runs the organizations in mode commit (as for [The + credentials part](#the-credentials-part)), the admin's `create_agent` with + `public: true` in mode commit opens a pull request whose files are all under + `/public`, and the content path's kustomization file on its + branch does not list `public`; nothing is live, and the part closes the pull + request. The proof's organizations are applied live, so their content path + has no kustomization file in git until a person adds one: agent-manager then + refuses the public write (`conflict`), as it must, and the verdict is a + `SKIP` that names the file to add; +- with klaus-gateway (4.21.0-rc.3 or later, refused by name below it), alice's + Slack roster names the public agent's tenant `agentlab-b · Public`, and her + pick of it from the roster answers in a Session she created on it. + +The turns and the Slack start need the model's key: on the lab's placeholder +key they are a `SKIP` that says so. `--skip-slack` leaves Slack out. The part +leaves out the move of an agent back out of the public namespace, which +agent-manager does not have yet. Every run removes what the part wrote in +both namespaces of each organization (the public agent, the server, the +public namespace's model, alice's agent), also the full proof, so a failed +public part leaves nothing for the proof's rosters and listings to find. + `organizations-test --part cleanup` runs the orphan cleanup check alone, creating the proof agents and a member-owned session directly through kagent without a model turn. The default run includes this check after all other organization checks. The former `--part erasure` spelling remains an alias. See the operator's [glossary](https://github.com/giantswarm/agent-platform-operator/blob/main/GLOSSARY.md) for the distinction between organization deletion and cleanup. The report prints one `PASS` or `SKIP` line per verdict, `[surface] diff --git a/docs/cli.md b/docs/cli.md index 7faa1068..261ca93f 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -290,7 +290,7 @@ one helper — see [Agents](agents.md). | `workspaces-measure` | Measures workspaces on the cluster `--kube-context` and `--muster-url` name (with `--organization`, `--provider`, `--small-repos` and `--large-repo`), through its muster as the person `muster auth login` signed in, their token renewed before it expires: a small and a large workspace created and deleted `--runs` times (default 5): the first sync, a no-op and a changed cycle, `authorize_workspace`, with `--agent` and `--agentgateway-url` a Session's directory set up through `start_session` (from the call and from the first turn to the setup's record) and the on-demand fetch in the Session's sandbox after a push, a first checkout, `git status` and a cold build (its download through the module proxy, `--goproxy`, and its compile, two figures) in the Session's clone on the volume and the same on the node's local disk, the session directory's size; the first run also times one online expansion where the StorageClass allows it; the last reads the claim's capacity, the volume's use, each mirror against the provider's size (the factor against 1.5) and whether the headroom max(4 GiB, 50 %) held. Per figure what it measured from and to, median, p90 and max, with the StorageClass and driver, as JSON and a Markdown table in `state/workspaces-measure-