Skip to content

feat(organizations-test): add the public part - #1399

Merged
fiunchinho merged 7 commits into
mainfrom
organizations-public-part
Dec 2, 2026
Merged

fiunchinho merged 7 commits into
mainfrom
organizations-public-part

Conversation

@fiunchinho

@fiunchinho fiunchinho commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Part of giantswarm/giantswarm#39646

Problem

From agent-platform-operator 0.7 every organization has a public namespace, public-agents-<name>, beside agents-<name>. The organization uses it to share agents and MCP servers with every person on the installation. agent-manager reaches the public namespace with public: true (giantswarm/agent-manager#528, #529), and klaus-gateway starts a public agent from Slack (giantswarm/klaus-gateway#656). agentlab organizations-test did not prove any of this.

Change

organizations-test --part public is a new part. Like the other parts, it runs alone. It uses the proof's organizations and members: alice is a member of agentlab-a and no member of agentlab-b, bob is an editor of agentlab-b. The admin of agentlab-b (the lab's admin) publishes in the public namespace: a model, an agent (create_agent with public: true) and an MCP server. The same MCP server is also in the organization namespace of agentlab-b. The verdicts:

  • Kubernetes: both namespaces exist with the organization's name and UID labels. Only the public namespace has space: public. The public namespace has the operator's agent-platform:everyone binding to agent-platform:platform-user. Access reviews as alice allow list agents and create sessions in the public namespace of agentlab-b, and deny list agents in its organization namespace.

  • An editor cannot publish: bob's create in the public namespace is refused (RBAC 403), and his create_agent with public: true is refused too. The twins are admitted: bob's create in his own organization namespace, and the admin's create (dry runs).

  • list_agents with public: true lists the public agent of agentlab-b, with organization and public: true, and shows its namespace in publicNamespaces. It does not show the empty public namespace of agentlab-a: alice may list that namespace, and it holds no agent and no MCPServer.

  • start_session with organization and public: true starts a Session on the public agent, created by alice. The twin: without public, the organization reads word for word as an organization that does not exist. A turn on the public agent answers.

  • muster: alice sees the public server of agentlab-b, and does not see the same server in its organization namespace. bob sees that one.

  • Toolset: alice's agent in agentlab-a has a toolset that names server:<public namespace of agentlab-b>/agentlab-public-mcp. With that toolset (the X-Muster-Toolset header), alice's catalogue holds the server's tool. The call reaches the server, and muster logs the call under alice's subject. With the toolset that names the private copy, muster refuses the call for alice and answers it for bob. A turn on her agent calls the public server. In the turn's own time window, muster logs her credential and her tool calls.

  • Mode commit, where the lab runs it into one of platform.workspaces.github.proofRepositories. The part writes in no other repository. It runs in this order:

    1. While the content path of agentlab-b (<content prefix>/agentlab-b) has no kustomization file there, a public create_agent in mode commit is refused with conflict, as agent-manager refuses it. No pull request opens and nothing is live.
    2. The part adds the content path's kustomization.yaml through a pull request that it opens and merges with this host's gh login, as the credentials part merges its own. The file lists the path's directories and YAML files and never public.
    3. The same write opens a pull request with all its files under <content path>/public. On its branch, the content path's kustomization file does not list public. The part closes that pull request.

    The file starts with a marker comment, and the next run removes it before it proves the refusal again. A kustomization file that the part did not write stays as it is: step 1 is then a SKIP, and step 3 runs against that file.

  • Slack, where the lab runs klaus-gateway: alice's roster names the public agent agentlab-b · Public. When she selects it, the conversation answers in a Session that she created.

  • The move (agent-manager's move_agent, feat(agents): move an organization's agent between its organization and public namespace agent-manager#531, v4.2.0-rc.9). On an older agent-manager these three verdicts are a SKIP that names the release.

    1. The admin of agentlab-b creates a private agent there, and the admin and bob each start a Session on it. The dry run of move_agent with to: public names the admin's own Session. It counts bob's Session, or states that other people's Sessions go too. The move writes the agent in the public namespace and deletes it from the organization namespace. alice then starts a Session on it with organization and public: true.
    2. The admin moves it back (to: private), and alice cannot start a Session on it. When the HelmRelease and the Agent are gone from the public namespace, her start with public: true must be refused, with whatever code. She must then hold no live Session of the agent, read as she lists her own. The verdict names the code it saw. For a deleted Agent, kagent still answers conflict: ... Agent does not have a ready prepared revision where agent-manager would answer not_found (giantswarm/giantswarm#39727). Without public, her start reads word for word as for an organization that does not exist.
    3. The twin: bob's move is refused by the API server: a forbidden that names him, at whatever step agent-manager meets it (its read of the target as him, as in the live runs, or its dry run). Read right after the call, before the part's cleanup, the HelmRelease is the same object (same UID) and is not being deleted, and the public namespace holds none.

How the part refuses or skips

  • Builds that are too old: the part refuses agent-platform-operator before 0.7.0-rc.1 and agent-manager before 4.2.0-rc.3. It also refuses klaus-gateway before 4.21.0-rc.3 when Slack runs. The refusal names the component, its version and the fix.
  • The lab's default chart does not move: it stays on 4.189.0. AGENTS.md pins config.DefaultChartVersion to a stable release, which Renovate updates. A lab runs the operator's 0.7 line from agent-platform 4.190.0-rc.8. agent-manager 4.2.0-rc.x needs a platform.valuesFiles overlay (gitops.prereleases).
  • muster's outbound guard: from muster 5.68.0-rc.1 (agent-platform 4.190.0-rc.2), muster refuses a plain-http Service of an organization's MCPServer unless muster.outbound.privateHosts lists its host. The lab now renders the host of the fixture's Service there, when platform.organizations is on and the chart is from that release (HACKS.md U53). The part refuses to start, and names the fix, when muster's configuration does not list the host. After agentlab platform, muster restarts once (rolls) on such a lab.
  • SKIPs: the turns and the Slack start are a SKIP on the lab's placeholder model key. Slack is also a SKIP without klaus-gateway. The mode-commit verdicts are a SKIP without the organizations commit mode, or when agent-manager's organizations repository is not a proof repository.

The fixture and the other code changes

  • The MCP server fixture is agentlab's fake pro in a new --anonymous mode, in a container on the kind network. muster gives a server outside its own namespace no identity, so the person's identity is checked at muster. The container needs a static Linux agentlab: on macOS, pass one with the new flag --mcp-fixture-binary.
  • Changes to existing code:
    • organizationStateFrom now reads status.capabilities.agentPlatform.publicNamespace.
    • releaseBefore is extracted from shapeProblem, and githubGrantProblem from the credentials part.
    • The Slack surface's gateway start is extracted into organizationsSlack.start, so the public part reuses it.
    • Every run, the full proof too, removes what the public part wrote in each organization's two namespaces. A failed public part thus leaves nothing that the proof's rosters and muster listings can find.
  • Docs: docs/agents.md "The public part", docs/cli.md, the --part help, AGENTS.md and HACKS.md U53.

Tests

  • New tests in internal/lab/organizationstest_public_test.go:
    • the version floors, the namespaces and their labels, and the everyone binding;
    • the list_agents answer, and the Slack row <organization> · Public;
    • the pull request files that a public write may change, and what a kustomization file lists (resources, bases, components, paths under public);
    • the content path's kustomization.yaml that the part writes (from GitHub's listing of the path, with the marker, never public), and that the part writes only in a proof repository;
    • where the Slack check runs;
    • the move: its version floor, its answer (from and to, moved or dry run), and what its dry run says of the Sessions;
    • the turn's window in muster's log (a regression test for R1-1), and muster's private host.
  • New tests in other files: the public part name, the public namespace in the Organization's status, muster.outbound.privateHosts in the rendered values (only from the chart floor, and only with organizations on), and the anonymous fake.
  • Local checks:
    • The focused tests pass.
    • go test ./... has six failures, the same before and after the fixes. They are in tests that this change does not touch: workspace and coding shell-script tests and TestEnterLabSettlesTheLabHere, which use macOS paths and BSD tools.
    • GOOS=linux make lint (as CI runs it) reports 0 issues.
    • pre-commit passes.
    • For the last commit (the editor's move twin): the focused tests and pre-commit (golangci-lint for Linux) pass.
  • Live runs on a lab (agentlab-orgs) with this branch's build:
    • Versions: agent-platform and connectivity 4.190.0-rc.11, agent-manager 4.2.0-rc.11, agent-platform-operator 0.7.2, muster 5.68.0-rc.1, kagent 1.34.0-rc.5. The host gateway was klaus-gateway 4.21.0-rc.3.
    • The command: KUBECONFIG=<lab>/state/kubeconfig agentlab organizations-test --part public --mcp-fixture-binary <static linux/arm64 agentlab> --gateway-image gsoci.azurecr.io/giantswarm/klaus-gateway:4.21.0-rc.3. KUBECONFIG is set because the lab's aiKey.source names a context of that kubeconfig.
    • Run 2, on chart rc.10, failed at the first verdict. The chart's own copy of the Organization CRD had no status.capabilities.agentPlatform.publicNamespace, so the API server dropped the operator's value. fix(helm): bundle organization-operator v2.3.0's Organization CRD, which keeps the public namespace in the status agent-platform#1573 (chart 4.190.0-rc.11) fixes this.
    • Run 3 and run 4, on chart rc.11, passed every check up to and including the move to public. This covers the namespaces and the everyone binding, both editor refusals, list_agents with public: true, the empty namespace, start_session with public: true and its twin, the public turn, muster's listing, the toolset under alice's subject and the agent's turn that calls the public server. The Slack start passed. Both GitHub checks were a SKIP, because this lab has no commit mode.
    • The move back, under the rule then in force: after the move back, alice's start with public: true is refused and starts no Session, but kagent answers conflict: kagent: a session of agent public-agents-agentlab-b/agentlab-organizations-moved: Agent does not have a ready prepared revision, not not_found. In run 3 that answer came about 2 seconds after the move back. In run 4 every one of 60 starts over 2m1s got it, while the agent's HelmRelease and Agent were already gone, so kagent's answer for a deleted Agent stays wrong for at least 2 minutes. The cause is filed as giantswarm/giantswarm#39727: kagent maps the not-found of a deleted Agent to FailedPrecondition, and agent-manager shows that as conflict. Decision (c): the check now accepts any refusal that starts no Session, while alice holds no live Session of the agent, and the verdict names the code that it saw.
    • Run 5, on this branch at bb1f883 and the same lab and versions:
      • Every check up to and including the move to public passed again. Both GitHub checks were a SKIP, and Slack passed.
      • The move back passed under decision (c). Its refusal code is not in the run's output, because the part prints PASS lines only on a run without a FAIL. In runs 3 and 4 the code was kagent's conflict (giantswarm/giantswarm#39727).
      • The editor's move twin failed on the check's wording, not on the boundary. The API server refused bob (forbidden: get helmrelease public-agents-agentlab-b/agentlab-organizations-moved: ... User "oidc:bob@lab.local" cannot get resource "helmreleases" ... in the namespace "public-agents-agentlab-b") at agent-manager's first read of the target, before any write. The check expected the dry run's words "nothing was written".
      • The new rule for the twin: any forbidden from the API server that names bob, at any step, with the after-state read before the cleanup.
    • Run 6, on this branch with the new twin (now commit 39c7ee2) and the same lab and versions: exit 0, 13 PASS, 2 SKIP, 0 FAIL.
      • Every check up to and including the move to public passed. Both GitHub checks were a SKIP (no commit mode), and Slack passed.
      • The move back passed: alice's start with public: true was refused with conflict (kagent: ... Agent does not have a ready prepared revision, giantswarm/giantswarm#39727), and she held no live Session of the agent. Without public, the answer was not_found, as for an organization that does not exist.
      • The editor's move twin passed: the API server refused bob at agent-manager's read of the target (forbidden: get helmrelease public-agents-agentlab-b/agentlab-organizations-moved: ... User "oidc:bob@lab.local" cannot get resource "helmreleases"). Afterwards the HelmRelease was the same object (same UID) and not being deleted, and public-agents-agentlab-b held none.

Review

Id Severity Outcome Finding
F1 blocking fixed muster's outbound guard refused the fixture's plain-http Service in an organization namespace, so every live run would stop before the publications.
F2 / R1-2 non-blocking / blocking fixed The public part needed a Slack gateway also where the lab runs no klaus-gateway; now that is a SKIP.
R1-1 blocking fixed The turn's attribution could pass on the proof's own start_session and delete_session as alice; the turn now has its own window in muster's log.
R1-3 important fixed The kustomization check missed bases and paths under public.
F4 non-blocking fixed The pull request of the mode-commit write stayed open on two failure paths.
F3 non-blocking fixed The mode-commit verdict stayed a SKIP until a person added the content path's kustomization file; the part now proves the refusal, adds the file in the proof repository and proves the landing (item 1 of #1398, done here).
R2-1 important deferred A kind VM clock ahead of the host can push muster's records of a short call past the window's upper bound: #1398.
R4-1 important deferred The kustomization the part writes lists a plain subdirectory without its own kustomization, which Kustomize refuses: #1398.
R4-2 important deferred gh pr merge --delete-branch fails where the proof repository's base requires a merge queue: #1398.
R4-3 important accepted GitHub lists at most 1,000 entries of a directory: a proof organization's content path never holds that many.
R4-4 important accepted A file added to the content path between the listing and the merge is left out: only this part writes that path during its run, and the next run writes the list again.
R6-1 important deferred A build without move_agent whose image tag cannot tell its version (a digest, a local tag) fails the move checks instead of skipping them: #1398.
R6-2 important accepted, then gone The editor-move check read the cluster on a 15-second context across the MCP call. Since the twin's rewrite, the reads before and after the call each have a context of their own.
R6-3 important accepted The move-back poll can stretch past two minutes by the requests' own time; the verdict states the real time.
R8-1 important accepted A refusal other than not_found that never reached kagent (muster's own) would still be worded as kagent's stale answer; cosmetic, the verdict prints the refusal's own text.

`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
…muster's outbound guard

- The lab lists the fixture's Service in muster.outbound.privateHosts with
  platform.organizations on agent-platform 4.190.0-rc.2 or later, and the
  public part refuses to start, naming the fix, while muster does not list it.
- The Slack check runs where the lab runs klaus-gateway or the run names one;
  elsewhere it is a SKIP.
- The agent's turn is judged in its own window of muster's log, without the
  proof's own start_session and delete_session.
- A kustomization's bases, and paths under public, count as listing public.
- The pull request of the mode-commit write is closed on every path.
@fiunchinho fiunchinho self-assigned this Dec 2, 2026
…blic write needs

The public part's mode-commit verdicts run in order: a public write is
refused (conflict) while agentlab-b's content path in the proof repository
has no kustomization file; the part then adds that kustomization.yaml
through a pull request it merges, listing the path's directories and YAML
files and never public; then the public write lands under
<content path>/public only. The part writes only in a proof repository,
removes the file it wrote in an earlier run first, and leaves a
kustomization file it did not write as it is.
With agent-manager 4.2.0-rc.9 or later (move_agent), else a SKIP:
- agentlab-b's admin moves a private agent to its public namespace; the dry
  run names the admin's own Session and counts or states other people's;
  a person who is no member then starts a Session on it with public: true;
- the admin moves it back: the person's start with public: true starts no
  Session and ends as not_found within two minutes (the refusals before it
  are named as a window), the person holds no live Session of it, and
  without public it reads as for an organization that does not exist;
- an editor's move is refused by the API server, nothing deleted.
… back

After the move back, the person's start with public: true passes as any
refusal that starts no Session, while they hold no live Session of the
agent; the verdict names the code it saw. kagent answers a deleted Agent
with conflict ("Agent does not have a ready prepared revision") for at
least two minutes, where agent-manager would say not_found
(giantswarm/giantswarm#39727).
The editor's twin of the move now passes on any `forbidden` from the API
server that names the editor, at whatever step agent-manager meets it: its
read of the target as the person (seen in the live run) or its dry run.
The words "nothing was written" are no longer required.

The check reads the after-state right after the call, before the part's
cleanup: the private HelmRelease is the same object (same UID) and not
being deleted, and the public namespace holds no copy.
@fiunchinho
fiunchinho marked this pull request as ready for review December 2, 2026 14:19
@fiunchinho
fiunchinho requested a review from a team as a code owner December 2, 2026 14:19
@fiunchinho
fiunchinho removed the request for review from a team December 2, 2026 14:20
@fiunchinho
fiunchinho merged commit 9c71086 into main Dec 2, 2026
9 checks passed
@fiunchinho
fiunchinho deleted the organizations-public-part branch December 2, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant