From 88cca0b48ef3fc5121581f7814ccd63a91776b9b Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 11:20:45 +0100 Subject: [PATCH 1/8] docs: add running a lab in governed mode --- docs/platform.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/docs/platform.md b/docs/platform.md index b9a7087f..94420cc7 100644 --- a/docs/platform.md +++ b/docs/platform.md @@ -347,6 +347,45 @@ not a dev image is configured; `agentlab status` names it on its `registry` line, and it goes with `agentlab down`. Removing the overlay and re-running `agentlab platform` puts the released chart back. +## Running a lab in governed mode + +The agent-platform chart's `governance.mode` (`trusted`, the default, or +`governed`) decides whether muster also asks a person before an agent runs a +write on the platform's own servers (see [Governing tool +calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). +The lab sets it with a `platform.valuesFiles` overlay, like any other chart +value: + +```yaml +# governed.yaml +governance: + mode: governed +``` + +```yaml +platform: + valuesFiles: + - /path/to/governed.yaml +``` + +Then `agentlab platform`; `agentlab status` names the overlay and the mode it +sets. muster reads the mode once at start, so the run rolls muster. Removing +the entry and running `agentlab platform` again puts the lab back on trusted. + +Until the tool-approval releases exist the chart's release floors are unset, +and the chart refuses `governed` at render: the boot stops before the install, +naming the guard. A released chart that carries tool approval needs no more +than the overlay. Before that, use a dev chart whose floors name the dev builds +of muster and the managers: point `platform.chartPath` at the checkout (see +[Installing an unreleased chart](#installing-an-unreleased-chart)), push the +dev muster chart and agent-manager chart into the lab registry and name them +with `components..versionRange` in the same overlay (see [An unreleased +component chart](#an-unreleased-component-chart)), and set the checkout's +floors to those versions. Approving a call also needs the OAuth server and +`muster.muster.oauth.mcpClient.publicUrl` on the lab's edge, which the chart +renders in the lab; a portal on another port than 443 needs +`backstage.publicPort` (8443 on the default edge). + ## Dev images To run a component from a build of your own, build the image, and name it From 5e5a2675179ed408e6b1f529e7cb894dad417baa Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 11:26:27 +0100 Subject: [PATCH 2/8] docs: describe governed mode with the chart's value and link the concept page as optional reading --- docs/platform.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/platform.md b/docs/platform.md index 94420cc7..9e49d44d 100644 --- a/docs/platform.md +++ b/docs/platform.md @@ -349,17 +349,17 @@ puts the released chart back. ## Running a lab in governed mode -The agent-platform chart's `governance.mode` (`trusted`, the default, or +The agent-platform chart's `governance` value (`trusted`, the default, or `governed`) decides whether muster also asks a person before an agent runs a -write on the platform's own servers (see [Governing tool +write on the platform's own servers; the chart's README describes it (further +reading, optional: [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). The lab sets it with a `platform.valuesFiles` overlay, like any other chart value: ```yaml # governed.yaml -governance: - mode: governed +governance: governed ``` ```yaml @@ -372,7 +372,8 @@ Then `agentlab platform`; `agentlab status` names the overlay and the mode it sets. muster reads the mode once at start, so the run rolls muster. Removing the entry and running `agentlab platform` again puts the lab back on trusted. -Until the tool-approval releases exist the chart's release floors are unset, +Until muster and agent-manager releases with tool approval exist, the chart's +release floors are unset, and the chart refuses `governed` at render: the boot stops before the install, naming the guard. A released chart that carries tool approval needs no more than the overlay. Before that, use a dev chart whose floors name the dev builds From 535bb76fa53a5bbb838164eb0c64159cfa609114 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 11:43:07 +0100 Subject: [PATCH 3/8] docs: governance is a map in the agent-platform chart, governance.mode sets the mode --- docs/platform.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/platform.md b/docs/platform.md index 9e49d44d..22099c79 100644 --- a/docs/platform.md +++ b/docs/platform.md @@ -349,8 +349,8 @@ puts the released chart back. ## Running a lab in governed mode -The agent-platform chart's `governance` value (`trusted`, the default, or -`governed`) decides whether muster also asks a person before an agent runs a +The agent-platform chart's `governance.mode` value (`trusted`, the default, +or `governed`) decides whether muster also asks a person before an agent runs a write on the platform's own servers; the chart's README describes it (further reading, optional: [Governing tool calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). @@ -359,7 +359,8 @@ value: ```yaml # governed.yaml -governance: governed +governance: + mode: governed ``` ```yaml From 0e627e45778a0c2a889d4b843ce832ff68cc5980 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 18:51:56 +0100 Subject: [PATCH 4/8] feat(identity): give the portal its own Dex client for muster's sign-in handoff The portal signed in with agent-platform, the client every CLI helper and proof shares, so muster could not trust the portal for the one-time sign-in handoff without trusting them all. The lab Dex now registers agent-platform-portal with the portal's callbacks only; agent-platform, kubernetes and dex-k8s-authenticator list it under trustedPeers, so its tokens keep every audience consumers accept. Where the platform chart takes backstage.oidcClientId the lab sets it, which makes the chart list that client in muster's approval.handoffClients. The secret is the key portal-dex-client-secret of agent-platform-secrets (added to an existing Secret), and portal dev passes it as AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET. --- docs/identity.md | 24 +++++++++- internal/config/config.go | 7 +++ internal/lab/backstagedev.go | 5 +++ internal/lab/platform.go | 13 +++++- internal/lab/portalclient.go | 29 ++++++++++++ internal/lab/portalclient_test.go | 44 +++++++++++++++++++ internal/lab/render.go | 12 ++++- .../templates/agent-platform-values.yaml.tmpl | 9 ++++ internal/lab/templates/dex.yaml.tmpl | 22 ++++++++++ 9 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 internal/lab/portalclient.go create mode 100644 internal/lab/portalclient_test.go diff --git a/docs/identity.md b/docs/identity.md index f02ea8a3..42cc4912 100644 --- a/docs/identity.md +++ b/docs/identity.md @@ -302,7 +302,29 @@ redirect URIs: https://muster.127.0.0.1.nip.io/oauth/callback The Backstage redirect path carries the **provider name** from the app-config, not the literal word `oidc` — Backstage serves each provider at `/api/auth//handler/frame`, and the chart names it -`oidc-agent-platform`. More clients means editing the Dex template +`oidc-agent-platform`. + +### The portal's own client + +With an agent-platform chart that takes `backstage.oidcClientId`, the portal +signs in with a client of its own, `agent-platform-portal` (secret +`agent-platform-portal-lab-secret`, key `portal-dex-client-secret` of +`agent-platform/agent-platform-secrets`; `agentlab portal dev` passes it as +`AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET`). Its only redirect URIs are the +portal's (in-cluster and `portal dev`), so no CLI helper or proof can sign in +with it, and muster trusts it alone for the sign-in handoff +(`approval.handoffClients`): a click on *Open* on an approval or connector +sign-in prompt in portal chat opens muster's page signed in. The portal +requests the `agent-platform`, `dex-k8s-authenticator` and `kubernetes` +audiences, so `agent-platform`, `dex-k8s-authenticator` and `kubernetes` list +`agent-platform-portal` under `trustedPeers`, and every consumer accepts its +tokens as before; their `azp` is `agent-platform-portal`. The portal's +callbacks stay on `agent-platform` too, for a chart without the key. muster +keys a person's sessions by the token's client as well, so the portal's +connector sign-ins are not those of a password-grant token of +`agent-platform`, except subject-scoped ones. + +More clients means editing the Dex template (`internal/lab/templates/dex.yaml.tmpl`), rebuilding and `agentlab reload`. ### `trustedPeers` points the other way round diff --git a/internal/config/config.go b/internal/config/config.go index b7f9e9d7..8accb52c 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -90,6 +90,13 @@ const ( // so a token minted for either carries an audience the other trusts. AgentPlatformClientID = "agent-platform" AgentPlatformClientSecret = "agent-platform-lab-secret" // #nosec G101 -- static throwaway lab credential, by design + // The portal's own client (the chart's backstage.oidcClientId): only the + // portal signs in with it, so muster may trust it for the sign-in handoff + // (approval.handoffClients) without trusting the shared client every CLI + // helper and proof logs in with. Its tokens carry agent-platform's + // audience (cross-client scope), so every consumer accepts them as before. + PortalClientID = "agent-platform-portal" + PortalClientSecret = "agent-platform-portal-lab-secret" // #nosec G101 -- static throwaway lab credential, by design // An audience-only client: Giant Swarm apiservers trust its id, and it // trusts agent-platform to request its audience. It never runs a flow. DexK8sAuthenticatorClientID = "dex-k8s-authenticator" diff --git a/internal/lab/backstagedev.go b/internal/lab/backstagedev.go index f4cf912a..2848ea24 100644 --- a/internal/lab/backstagedev.go +++ b/internal/lab/backstagedev.go @@ -286,6 +286,11 @@ func backstageDevInputs(ctx context.Context, cfg *config.Config) ([]devFile, []s } env = append(env, name+"="+string(value)) } + // The portal's own client's secret, which the chart's app-config names + // while backstage.oidcClientId is set (a chart without it never reads it). + if value := secrets.Data[portalClientSecretKey]; len(value) > 0 { + env = append(env, "AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET="+string(value)) + } return files, env, nil } diff --git a/internal/lab/platform.go b/internal/lab/platform.go index 8ff9b57c..1fc8f0aa 100644 --- a/internal/lab/platform.go +++ b/internal/lab/platform.go @@ -68,10 +68,13 @@ const labCASecret = "dex-ca" // The platform's generated secrets (platformSecretsName): created once and // then left alone — regenerating the encryption key on every run would // invalidate every issued token. dex-client-secret must match the -// `agent-platform` staticClient in the Dex config. +// `agent-platform` staticClient in the Dex config, portal-dex-client-secret +// the portal's own (config.PortalClientID; the chart's backstage.oidcClientId +// reads it under this key). const ( platformSecretsName = "agent-platform-secrets" backstageSessionSecretKey = "backstage-session-secret" + portalClientSecretKey = "portal-dex-client-secret" // #nosec G101 -- a Secret key name, not a credential ) // The CoreDNS Deployment the Corefile rewrite rolls, in kube-system. @@ -1230,6 +1233,7 @@ func ensurePlatformSecrets(ctx context.Context) error { "oauth-encryption-key": []byte(randBase64(32)), "valkey-password": []byte(randHex(16)), backstageSessionSecretKey: []byte(randBase64(32)), + portalClientSecretKey: []byte(config.PortalClientSecret), }); err != nil { return err } @@ -1244,6 +1248,13 @@ func ensurePlatformSecrets(ctx context.Context) error { } note("added %s to %s", backstageSessionSecretKey, platformSecretsName) } + if !secretHasKey(platformNamespace, platformSecretsName, portalClientSecretKey) { + patch := fmt.Sprintf(`{"stringData":{%q:%q}}`, portalClientSecretKey, config.PortalClientSecret) + if err := patchObject(ctx, gvrSecrets, platformNamespace, platformSecretsName, types.MergePatchType, []byte(patch)); err != nil { + return err + } + note("added %s to %s", portalClientSecretKey, platformSecretsName) + } return nil } diff --git a/internal/lab/portalclient.go b/internal/lab/portalclient.go new file mode 100644 index 00000000..0d25696e --- /dev/null +++ b/internal/lab/portalclient.go @@ -0,0 +1,29 @@ +package lab + +import "github.com/giantswarm/agentlab/internal/config" + +// valuesBackstage and valuesOIDCClientID are the meta chart's key of the +// portal's own OAuth client, backstage.oidcClientId. +const ( + valuesBackstage = "backstage" + valuesOIDCClientID = "oidcClientId" +) + +// portalClientChartCarries reports whether the configured meta chart takes +// backstage.oidcClientId, so the portal signs in with its own Dex client +// (config.PortalClientID) instead of the shared agent-platform one. An older +// chart forwards an unknown backstage key to the backstage chart, whose +// schema refuses it, so the lab sets the key only where the chart carries +// it. A chart that cannot be read is a note and the shared client. +func portalClientChartCarries(cfg *config.Config) bool { + if !cfg.Platform.Enabled || !cfg.Backstage.Enabled { + return false + } + chart := platformChartFor(cfg) + v, err := platformChartValuesOf(chart) + if err != nil { + note("the platform chart %s could not be read for the portal's own client (%v): the portal signs in with %s", chart, err, config.AgentPlatformClientID) + return false + } + return v.carries(valuesBackstage, valuesOIDCClientID) +} diff --git a/internal/lab/portalclient_test.go b/internal/lab/portalclient_test.go new file mode 100644 index 00000000..edcb5ef2 --- /dev/null +++ b/internal/lab/portalclient_test.go @@ -0,0 +1,44 @@ +package lab + +import ( + "strings" + "testing" + + "github.com/giantswarm/agentlab/internal/config" +) + +// TestDexTemplateRegistersThePortalClient: the portal's own client carries +// only the portal's callbacks, and every client whose audience the portal +// requests (agent-platform, kubernetes, dex-k8s-authenticator) lists it under +// trustedPeers. +func TestDexTemplateRegistersThePortalClient(t *testing.T) { + raw, err := renderTemplate(config.Default(), "dex.yaml.tmpl", nil) + if err != nil { + t.Fatalf("render: %v", err) + } + out := string(raw) + start := strings.Index(out, "- id: "+config.PortalClientID) + if start < 0 { + t.Fatalf("rendered Dex has no client %s:\n%s", config.PortalClientID, out) + } + client := out[start:] + if end := strings.Index(client, "\n - id: "); end >= 0 { + client = client[:end] + } + if !strings.Contains(client, "secret: "+config.PortalClientSecret) { + t.Errorf("the portal client carries no secret %s:\n%s", config.PortalClientSecret, client) + } + for _, line := range strings.Split(client, "\n") { + line = strings.TrimSpace(line) + if strings.HasPrefix(line, "- http") && !strings.HasSuffix(line, "/api/auth/oidc-agent-platform/handler/frame") { + t.Errorf("the portal client admits a redirect URI that is not the portal's: %s", line) + } + } + if got := strings.Count(out, "trustedPeers:\n - agent-platform\n - "+config.PortalClientID); got != 2 { + t.Errorf("kubernetes and dex-k8s-authenticator must both trust agent-platform and %s, got %d:\n%s", config.PortalClientID, got, out) + } + if !strings.Contains(out, "/oauth/proxy/callback\n # The portal requests this client's audience") || + !strings.Contains(out, "trustedPeers:\n - "+config.PortalClientID+"\n # The portal's own client") { + t.Errorf("agent-platform must trust %s for its audience:\n%s", config.PortalClientID, out) + } +} diff --git a/internal/lab/render.go b/internal/lab/render.go index 090b2b1d..7b4af8e6 100644 --- a/internal/lab/render.go +++ b/internal/lab/render.go @@ -45,7 +45,9 @@ type tmplData struct { KubernetesClientID, KubernetesClientSecret, AgentPlatformClientID, - AgentPlatformClientSecret string + AgentPlatformClientSecret, + PortalClientID, + PortalClientSecret string // ModelManagerEnabled mirrors cfg.ModelManagerEnabled(); Backends is // platform.modelManager.backends (the first is model-manager's default // backend) and Endpoints the URL model-manager dials for each of them @@ -78,6 +80,11 @@ type tmplData struct { // registers the family-less mcp-kubernetes (the 3.x line, an upgrade // seed's 4.x line), whose mcp-kubernetes chart refuses mcpServer. FamilylessChart bool + // PortalClient is whether the meta chart takes backstage.oidcClientId + // (portalClientChartCarries): the portal then signs in with its own Dex + // client (config.PortalClientID) and muster trusts that one for the + // sign-in handoff. + PortalClient bool // ExtraModels is what extra-models.yaml.tmpl renders: the // platform.extraModels entries. ExtraModels []config.ExtraModel @@ -353,6 +360,7 @@ func newTmplData(cfg *config.Config) (*tmplData, error) { ModelManagerEnabled: cfg.ModelManagerEnabled() || cfg.Platform.ManagerGitHubProof, LegacyChart: cfg.LegacyChart(), FamilylessChart: cfg.FamilylessChart(), + PortalClient: portalClientChartCarries(cfg), ModelManagerBackends: cfg.ChartBackends(), ModelManagerEndpoints: endpoints, ExtraModels: cfg.Platform.ExtraModels, @@ -406,6 +414,8 @@ func newTmplData(cfg *config.Config) (*tmplData, error) { KubernetesClientSecret: config.KubernetesClientSecret, AgentPlatformClientID: config.AgentPlatformClientID, AgentPlatformClientSecret: config.AgentPlatformClientSecret, + PortalClientID: config.PortalClientID, + PortalClientSecret: config.PortalClientSecret, }, nil } diff --git a/internal/lab/templates/agent-platform-values.yaml.tmpl b/internal/lab/templates/agent-platform-values.yaml.tmpl index cc411863..6031c029 100644 --- a/internal/lab/templates/agent-platform-values.yaml.tmpl +++ b/internal/lab/templates/agent-platform-values.yaml.tmpl @@ -1442,6 +1442,15 @@ backstage: - federated:id - audience:server:client_id:dex-k8s-authenticator - audience:server:client_id:kubernetes +{{- if .PortalClient }} + # The portal's own Dex client (dex.yaml.tmpl): its secret is the key + # portal-dex-client-secret of agent-platform-secrets, the chart adds the + # agent-platform audience to the scopes above, and muster lists it alone in + # approval.handoffClients, so a click on Open in portal chat opens muster's + # approval page signed in. The lab's CLI helpers and proofs keep signing in + # with agent-platform, which muster never trusts for the handoff. + oidcClientId: {{ .PortalClientID }} +{{- end }} # The vanilla UI hides the portal's HelmRelease pages, but the create # flow's scaffolder result links straight to # /deployments//helmrelease// — without these the diff --git a/internal/lab/templates/dex.yaml.tmpl b/internal/lab/templates/dex.yaml.tmpl index 55056897..7668f9ef 100644 --- a/internal/lab/templates/dex.yaml.tmpl +++ b/internal/lab/templates/dex.yaml.tmpl @@ -118,6 +118,7 @@ stringData: - http://localhost:{{ .BrowserCallbackPort }}/callback trustedPeers: - agent-platform + - {{ .PortalClientID }} # The ONE platform client, the chart's global.identity convention: # muster (an OAuth *client* of Dex and an OAuth *server* towards MCP # clients like Claude Code) and Backstage both authenticate with it, so @@ -133,6 +134,9 @@ stringData: redirectURIs: - {{ .MusterBaseURL }}/oauth/callback - {{ .GatewayURL "mcp-kubernetes" }}/oauth/callback + # The portal's callbacks stay here for a chart without + # backstage.oidcClientId (the portal then signs in with this client); + # with it the portal uses its own client below. - {{ .BackstageBaseURL }}/api/auth/oidc-agent-platform/handler/frame {{- with .BackstageLocalDevURL }} # A Backstage run with hot reload from a checkout on this machine @@ -147,6 +151,23 @@ stringData: # exactly, no DNS lookups -- unlike muster's own authorization # server, whose SSRF guards reject every lab hostname. - {{ .MusterBaseURL }}/oauth/proxy/callback + # The portal requests this client's audience (the chart adds + # audience:server:client_id:agent-platform for a dedicated portal + # client), so muster and the managers accept its tokens as before. + trustedPeers: + - {{ .PortalClientID }} + # The portal's own client (the chart's backstage.oidcClientId): only + # the portal's callbacks, so no CLI or proof can sign in with it, and + # muster trusts it alone for the sign-in handoff + # (muster.approval.handoffClients). + - id: {{ .PortalClientID }} + name: Agent Platform portal + secret: {{ .PortalClientSecret }} + redirectURIs: + - {{ .BackstageBaseURL }}/api/auth/oidc-agent-platform/handler/frame + {{- with .BackstageLocalDevURL }} + - {{ . }}/api/auth/oidc-agent-platform/handler/frame + {{- end }} # Cross-client audience target. Backstage's GS auth provider requests # the scope audience:server:client_id:dex-k8s-authenticator by default # (components.backstage.extraScopes); Dex only honors that when the @@ -157,6 +178,7 @@ stringData: secret: {{ .KubernetesClientSecret }} trustedPeers: - agent-platform + - {{ .PortalClientID }} --- # Kubernetes storage needs its own identity: Dex creates its CRDs on first # boot and then CRUDs its resources (keys, auth codes, sessions) through the From 5ff5c115fc814a94cf0397bdc4fbab60ab6196a4 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 22:04:58 +0100 Subject: [PATCH 5/8] feat(portal-dev): admit the hot-reload portal's /sessions on muster's return allowlist While backstage.localDevPort is set the lab renders muster.oauth.mcpClient.postLoginRedirectAllowlist with http://localhost:3000/sessions, so the approval page returns the browser to agentlab portal dev instead of showing its own answer page. Lab only. --- docs/dev-environment.md | 12 ++++++ internal/config/backstage_test.go | 14 +++++++ internal/config/config.go | 12 ++++++ internal/lab/backstagedev.go | 1 + internal/lab/portalclient_test.go | 38 +++++++++++++++++++ .../templates/agent-platform-values.yaml.tmpl | 11 ++++++ 6 files changed, 88 insertions(+) diff --git a/docs/dev-environment.md b/docs/dev-environment.md index 2311dab5..1d268815 100644 --- a/docs/dev-environment.md +++ b/docs/dev-environment.md @@ -95,6 +95,18 @@ runs reuse it. It cannot be `backstage.port` (7007), which kind publishes for the in-cluster Backstage. Removing the key and running `agentlab reload` unregisters it. +**Returning from muster's approval page.** A tool approval opened from the +portal's chat sends the browser back to the page it came from, but muster only +returns to origins on `oauth.mcpClient.postLoginRedirectAllowlist`; the meta +chart lists the edge portal (`https://portal.:/sessions`), +not `http://localhost:3000`. While `backstage.localDevPort` is set the lab adds +`http://localhost:3000/sessions` (the frontend's fixed port) to muster's own +list, which the chart keeps next to its derived entry. Lab only. It is part of +the platform values, so after the first `portal dev` (or after removing the +key) run `agentlab platform` once; Dex alone is re-applied by `portal dev`. Without it muster logs +`Ignoring a return not in oauth.mcpClient.postLoginRedirectAllowlist` and shows +its own "answer recorded" page. + **Limits.** - The database is in memory, so every backend restart starts it empty: the diff --git a/internal/config/backstage_test.go b/internal/config/backstage_test.go index a61ce622..a91015fd 100644 --- a/internal/config/backstage_test.go +++ b/internal/config/backstage_test.go @@ -35,3 +35,17 @@ func TestBackstageLocalDevPort(t *testing.T) { } } } + +// TestBackstageLocalDevFrontendURL: the frontend origin of a hot-reload run +// (muster's return allowlist) follows localDevPort being set, and names the +// frontend's port, not the backend's. +func TestBackstageLocalDevFrontendURL(t *testing.T) { + c := Default() + if got := c.BackstageLocalDevFrontendURL(); got != "" { + t.Errorf("default BackstageLocalDevFrontendURL = %q, want none", got) + } + c.Backstage.LocalDevPort = 7099 + if got, want := c.BackstageLocalDevFrontendURL(), "http://localhost:3000"; got != want { + t.Errorf("BackstageLocalDevFrontendURL = %q, want %q", got, want) + } +} diff --git a/internal/config/config.go b/internal/config/config.go index 8accb52c..7ef8cdab 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -3329,6 +3329,18 @@ func (c *Config) BackstageLocalDevURL() string { return fmt.Sprintf("http://localhost:%d", c.Backstage.LocalDevPort) } +// BackstageLocalDevFrontendURL is where the hot-reload run's frontend serves +// (the page a person's browser is on), "" when no hot-reload run is +// configured (backstage.localDevPort unset). muster's approval page may only +// return the browser to a page on its post-login return allowlist, so the +// lab lists this origin's /sessions there. +func (c *Config) BackstageLocalDevFrontendURL() string { + if c.Backstage.LocalDevPort == 0 { + return "" + } + return fmt.Sprintf("http://localhost:%d", BackstageFrontendPort) +} + func (c *Config) KagentUIBaseURL() string { return fmt.Sprintf("http://localhost:%d", c.Platform.AgentsPort) } diff --git a/internal/lab/backstagedev.go b/internal/lab/backstagedev.go index 2848ea24..b3f22caf 100644 --- a/internal/lab/backstagedev.go +++ b/internal/lab/backstagedev.go @@ -99,6 +99,7 @@ func BackstageDev(cfg *config.Config, checkout string, port int) error { if err := cfg.Save(); err != nil { return err } + note("muster's approval page returns to this portal only after `agentlab platform` re-renders the platform values (the return allowlist carries %s/sessions)", backstageFrontendURL) } // Always: a recorded localDevPort does not prove Dex was rendered with it // (a hand-edited agentlab.yaml never was). The apply is checksummed, so a diff --git a/internal/lab/portalclient_test.go b/internal/lab/portalclient_test.go index edcb5ef2..230daf8c 100644 --- a/internal/lab/portalclient_test.go +++ b/internal/lab/portalclient_test.go @@ -1,9 +1,12 @@ package lab import ( + "reflect" "strings" "testing" + "gopkg.in/yaml.v3" + "github.com/giantswarm/agentlab/internal/config" ) @@ -42,3 +45,38 @@ func TestDexTemplateRegistersThePortalClient(t *testing.T) { t.Errorf("agent-platform must trust %s for its audience:\n%s", config.PortalClientID, out) } } + +// TestPlatformValuesAdmitHotReloadPortalReturn: while a hot-reload run is +// configured (backstage.localDevPort) muster's own return allowlist carries +// the frontend's /sessions, so the approval page can return the browser to +// `agentlab portal dev`; otherwise the lab sets no list of its own. +func TestPlatformValuesAdmitHotReloadPortalReturn(t *testing.T) { + allowlist := func(cfg *config.Config) any { + raw, err := renderTemplate(cfg, "agent-platform-values.yaml.tmpl", nil) + if err != nil { + t.Fatal(err) + } + var values map[string]any + if err := yaml.Unmarshal(raw, &values); err != nil { + t.Fatalf("%v\n%s", err, raw) + } + var cur any = values + for _, key := range []string{"muster", "muster", "oauth", "mcpClient", "postLoginRedirectAllowlist"} { + m, ok := cur.(map[string]any) + if !ok { + return nil + } + cur = m[key] + } + return cur + } + cfg := config.Default() + if got := allowlist(cfg); got != nil { + t.Errorf("no hot-reload run: postLoginRedirectAllowlist = %v, want unset", got) + } + cfg.Backstage.LocalDevPort = config.DefaultBackstageLocalDevPort + got, want := allowlist(cfg), []any{"http://localhost:3000/sessions"} + if !reflect.DeepEqual(got, want) { + t.Errorf("hot-reload run: postLoginRedirectAllowlist = %v, want %v", got, want) + } +} diff --git a/internal/lab/templates/agent-platform-values.yaml.tmpl b/internal/lab/templates/agent-platform-values.yaml.tmpl index 6031c029..f44941a3 100644 --- a/internal/lab/templates/agent-platform-values.yaml.tmpl +++ b/internal/lab/templates/agent-platform-values.yaml.tmpl @@ -572,6 +572,17 @@ muster: mcpClient: enabled: true publicUrl: "{{ .MusterBaseURL }}" +{{- with .BackstageLocalDevFrontendURL }} + # Lab only: a Backstage run with hot reload (`agentlab portal dev`, + # backstage.localDevPort) serves the frontend on http://localhost, not + # on the edge, so muster's approval page would refuse to return the + # browser to it ("Ignoring a return not in ...postLoginRedirectAllowlist") + # and the chat would not continue. The meta chart keeps an own list's + # entries and adds the portal's edge /sessions (backstage.publicPort) + # to it. + postLoginRedirectAllowlist: + - {{ . }}/sessions +{{- end }} server: enabled: true # The public URL through the edge: what Claude Code dials, and what From 5e619037b955ddb2181b3aa9f9f743fa8b8ba6e0 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Thu, 26 Nov 2026 23:27:36 +0100 Subject: [PATCH 6/8] feat(portal-dev): mint the lab portal's workload token for muster's inline approval muster takes the portal's inline approval decisions and sign-in handoff requests only with the portal backend's own ServiceAccount token (audience muster) beside the person's. The hot-reload portal has no projected token, so every `agentlab portal dev` mints one for the lab portal's ServiceAccount (agent-platform/backstage, TokenRequest, 12h), writes it to state/backstage-dev/muster-workload-token (0600) and points the backend's muster.workloadTokenFile at it. Without that ServiceAccount it says so and approvals open muster's own pages. --- docs/dev-environment.md | 14 +++++ docs/identity.md | 10 ++-- internal/lab/backstagedev.go | 88 ++++++++++++++++++++++++++----- internal/lab/backstagedev_test.go | 45 +++++++++++++++- 4 files changed, 140 insertions(+), 17 deletions(-) diff --git a/docs/dev-environment.md b/docs/dev-environment.md index 1d268815..099fdc23 100644 --- a/docs/dev-environment.md +++ b/docs/dev-environment.md @@ -107,6 +107,20 @@ key) run `agentlab platform` once; Dex alone is re-applied by `portal dev`. With `Ignoring a return not in oauth.mcpClient.postLoginRedirectAllowlist` and shows its own "answer recorded" page. +**Deciding approvals inline.** muster takes the portal's inline approval +decisions and sign-in handoff requests only with the portal backend's own +workload token beside the person's: the in-cluster portal's projected +ServiceAccount token (audience `muster`), which muster reviews for verb +`decide` on `toolapprovals` (the chart binds the portal's ServiceAccount to +`muster-approval-decider`). The local backend has no projected token, so every +`portal dev` mints one for the lab portal's ServiceAccount +(`agent-platform/backstage`, TokenRequest, audience `muster`, 12 hours), writes +it to `state/backstage-dev/muster-workload-token` (mode 0600) and points the +backend's `muster.workloadTokenFile` at it. Lab only: it uses the lab's admin +kubeconfig and stands in for the lab's own portal. Without that ServiceAccount +(no portal in the lab) it says so and approvals open muster's own pages. +Restart `portal dev` after 12 hours. + **Limits.** - The database is in memory, so every backend restart starts it empty: the diff --git a/docs/identity.md b/docs/identity.md index 42cc4912..d30c6bed 100644 --- a/docs/identity.md +++ b/docs/identity.md @@ -312,9 +312,13 @@ signs in with a client of its own, `agent-platform-portal` (secret `agent-platform/agent-platform-secrets`; `agentlab portal dev` passes it as `AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET`). Its only redirect URIs are the portal's (in-cluster and `portal dev`), so no CLI helper or proof can sign in -with it, and muster trusts it alone for the sign-in handoff -(`approval.handoffClients`): a click on *Open* on an approval or connector -sign-in prompt in portal chat opens muster's page signed in. The portal +with it, and muster trusts it alone for the sign-in handoff and inline +decisions (`approval.trustedClients`, formerly `approval.handoffClients`), +together with the portal backend's own ServiceAccount token (audience +`muster`; `agentlab portal dev` mints one for the lab portal's ServiceAccount, +see [dev-environment.md](dev-environment.md)): a click on *Open* on a +connector sign-in prompt in portal chat opens muster's page signed in, after +muster's own *Connect as ?* confirmation. The portal requests the `agent-platform`, `dex-k8s-authenticator` and `kubernetes` audiences, so `agent-platform`, `dex-k8s-authenticator` and `kubernetes` list `agent-platform-portal` under `trustedPeers`, and every consumer accepts its diff --git a/internal/lab/backstagedev.go b/internal/lab/backstagedev.go index b3f22caf..68a65cf7 100644 --- a/internal/lab/backstagedev.go +++ b/internal/lab/backstagedev.go @@ -16,7 +16,10 @@ import ( "time" "gopkg.in/yaml.v3" + authenticationv1 "k8s.io/api/authentication/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" "github.com/giantswarm/agentlab/internal/config" ) @@ -46,8 +49,19 @@ const ( // urlKey and dbClientKey are app-config keys of the generated overlay. urlKey = "url" dbClientKey = "client" + // portalServiceAccount is the in-cluster portal's ServiceAccount (the + // backstage chart's name), which the platform binds to muster's + // muster-approval-decider; musterWorkloadTokenFile is where the local + // run keeps a token of it for audience muster. + portalServiceAccount = "backstage" + musterWorkloadTokenFile = "muster-workload-token" + musterWorkloadAudience = musterValues ) +// musterWorkloadTokenTTL is how long the local portal's workload token for +// muster lasts: a working day; every `agentlab portal dev` mints a new one. +const musterWorkloadTokenTTL = 12 * time.Hour + // backstageFrontendURL is where `yarn start` serves the frontend, on the port // backstage.localDevPort validation holds free (config.BackstageFrontendPort). var backstageFrontendURL = fmt.Sprintf("http://localhost:%d", config.BackstageFrontendPort) @@ -270,7 +284,27 @@ func backstageDevInputs(ctx context.Context, cfg *config.Config) ([]devFile, []s if len(caData) == 0 { return nil, nil, fmt.Errorf("%s carries no cluster CA: the generated app-config cannot pin the apiserver", labKubeconfig()) } - overlay, err := backstageDevOverlay(cfg, k.cfg.Host, caData, users) + // muster takes the portal's inline approval decisions and sign-in + // handoff requests only with the portal backend's own workload token + // beside the person's (muster-approval-decider). The local run stands in + // for the lab's in-cluster portal, so it gets a token of that portal's + // ServiceAccount, minted here (lab only: the lab's admin kubeconfig). + workloadToken := "" + token, err := mintPortalWorkloadToken(ctx, k.clientset) + switch { + case err != nil: + return nil, nil, err + case token == nil: + note("the lab has no ServiceAccount %s/%s: the local portal sends muster no workload token, so approvals open muster's own pages", platformNamespace, portalServiceAccount) + default: + path, err := filepath.Abs(filepath.Join(StateDir, backstageDevDir, musterWorkloadTokenFile)) + if err != nil { + return nil, nil, err + } + files = append(files, devFile{name: musterWorkloadTokenFile, data: token}) + workloadToken = path + } + overlay, err := backstageDevOverlay(cfg, k.cfg.Host, caData, users, workloadToken) if err != nil { return nil, nil, err } @@ -295,11 +329,31 @@ func backstageDevInputs(ctx context.Context, cfg *config.Config) ([]devFile, []s return files, env, nil } +// mintPortalWorkloadToken asks the lab for a token of the in-cluster portal's +// ServiceAccount for audience muster (TokenRequest), nil when the lab has no +// such ServiceAccount. +func mintPortalWorkloadToken(ctx context.Context, cs kubernetes.Interface) ([]byte, error) { + ttl := int64(musterWorkloadTokenTTL.Seconds()) + got, err := cs.CoreV1().ServiceAccounts(platformNamespace).CreateToken(ctx, portalServiceAccount, &authenticationv1.TokenRequest{ + Spec: authenticationv1.TokenRequestSpec{Audiences: []string{musterWorkloadAudience}, ExpirationSeconds: &ttl}, + }, metav1.CreateOptions{}) + switch { + case apierrors.IsNotFound(err): + return nil, nil + case err != nil: + return nil, fmt.Errorf("minting the portal's workload token for muster (%s/%s): %w", platformNamespace, portalServiceAccount, err) + case got.Status.Token == "": + return nil, fmt.Errorf("minting the portal's workload token for muster (%s/%s): the API server answered no token", platformNamespace, portalServiceAccount) + } + return []byte(got.Status.Token), nil +} + // backstageDevOverlay is the app-config the local run layers last: the local -// URLs, and every in-cluster address of the chart's app-config swapped for -// the one this machine reaches — the apiserver on its published port, muster -// and the kagent API through the edge. -func backstageDevOverlay(cfg *config.Config, apiserver string, caData []byte, usersFile string) ([]byte, error) { +// URLs, every in-cluster address of the chart's app-config swapped for the +// one this machine reaches — the apiserver on its published port, muster and +// the kagent API through the edge — and, when one was minted, the file of +// the portal's workload token for muster (muster.workloadTokenFile). +func backstageDevOverlay(cfg *config.Config, apiserver string, caData []byte, usersFile, workloadTokenFile string) ([]byte, error) { backend := cfg.BackstageLocalDevURL() overlay := map[string]any{ "app": map[string]any{"baseUrl": backstageFrontendURL}, @@ -335,13 +389,7 @@ func backstageDevOverlay(cfg *config.Config, apiserver string, caData []byte, us }}, }}, }, - musterValues: map[string]any{ - "installations": []any{map[string]any{ - nameKey: platformNamespace, - urlKey: cfg.MusterBaseURL() + "/mcp", - "authProvider": "oidc-agent-platform", - }}, - }, + musterValues: musterOverlay(cfg, workloadTokenFile), "agentPlatform": map[string]any{ "kagent": map[string]any{ "installations": map[string]any{ @@ -357,6 +405,22 @@ func backstageDevOverlay(cfg *config.Config, apiserver string, caData []byte, us return append([]byte("# Generated by `agentlab portal dev` on every start.\n"), raw...), nil } +// musterOverlay is the local portal's muster block: the lab's muster through +// the edge, and the workload token file when there is one. +func musterOverlay(cfg *config.Config, workloadTokenFile string) map[string]any { + muster := map[string]any{ + "installations": []any{map[string]any{ + nameKey: platformNamespace, + urlKey: cfg.MusterBaseURL() + "/mcp", + "authProvider": "oidc-agent-platform", + }}, + } + if workloadTokenFile != "" { + muster["workloadTokenFile"] = workloadTokenFile + } + return muster +} + // BackstageBuild builds the checkout's image as its CI does, records it as // platform.devImages.backstage and, unless noApply, rolls it into the lab. // Every build gets its own tag: kind's containerd keeps running the old bits diff --git a/internal/lab/backstagedev_test.go b/internal/lab/backstagedev_test.go index 194e561e..6139c865 100644 --- a/internal/lab/backstagedev_test.go +++ b/internal/lab/backstagedev_test.go @@ -1,12 +1,19 @@ package lab import ( + "context" "slices" "strings" "testing" "time" "gopkg.in/yaml.v3" + authenticationv1 "k8s.io/api/authentication/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + kubefake "k8s.io/client-go/kubernetes/fake" + k8stesting "k8s.io/client-go/testing" "github.com/giantswarm/agentlab/internal/config" ) @@ -18,7 +25,7 @@ func TestBackstageDevOverlay(t *testing.T) { cfg := config.Default() cfg.Platform.GatewayPort = 8443 cfg.Backstage.LocalDevPort = 7017 - raw, err := backstageDevOverlay(cfg, "https://127.0.0.1:6443", []byte("ca"), "/lab/state/backstage-dev/users.yaml") + raw, err := backstageDevOverlay(cfg, "https://127.0.0.1:6443", []byte("ca"), "/lab/state/backstage-dev/users.yaml", "/lab/state/backstage-dev/muster-workload-token") if err != nil { t.Fatal(err) } @@ -43,7 +50,8 @@ func TestBackstageDevOverlay(t *testing.T) { } `yaml:"clusterLocatorMethods"` } Muster struct { - Installations []struct{ URL string } + Installations []struct{ URL string } + WorkloadTokenFile string `yaml:"workloadTokenFile"` } AgentPlatform struct { Kagent struct { @@ -64,6 +72,7 @@ func TestBackstageDevOverlay(t *testing.T) { "apiserver": {got.Kubernetes.ClusterLocatorMethods[0].Clusters[0].URL, "https://127.0.0.1:6443"}, "apiserver caData": {got.Kubernetes.ClusterLocatorMethods[0].Clusters[0].CAData, "Y2E="}, "muster url": {got.Muster.Installations[0].URL, "https://muster.127.0.0.1.nip.io:8443/mcp"}, + "muster workload": {got.Muster.WorkloadTokenFile, "/lab/state/backstage-dev/muster-workload-token"}, "kagent api": {got.AgentPlatform.Kagent.Installations[platformNamespace].APIBaseURL, "https://agentgateway.127.0.0.1.nip.io:8443"}, } for name, c := range checks { @@ -171,3 +180,35 @@ func TestBackstageImageBuild(t *testing.T) { t.Errorf("podman build = %s, want it unlabelled", got) } } + +// TestMintPortalWorkloadToken pins the local portal's workload token for +// muster: a TokenRequest for the in-cluster portal's ServiceAccount, audience +// muster, a working day; none (and no error) where the lab has no portal. +func TestMintPortalWorkloadToken(t *testing.T) { + cs := kubefake.NewClientset(&corev1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Namespace: platformNamespace, Name: portalServiceAccount}}) + var asked *authenticationv1.TokenRequest + cs.PrependReactor("create", "serviceaccounts", func(action k8stesting.Action) (bool, runtime.Object, error) { + if action.GetSubresource() != "token" { + return false, nil, nil + } + asked = action.(k8stesting.CreateAction).GetObject().(*authenticationv1.TokenRequest) + answer := asked.DeepCopy() + answer.Status.Token = "lab-portal-token" + return true, answer, nil + }) + token, err := mintPortalWorkloadToken(context.Background(), cs) + if err != nil { + t.Fatal(err) + } + if string(token) != "lab-portal-token" { + t.Errorf("token = %q", token) + } + if asked == nil || !slices.Equal(asked.Spec.Audiences, []string{musterWorkloadAudience}) || asked.Spec.ExpirationSeconds == nil || *asked.Spec.ExpirationSeconds != 12*3600 { + t.Errorf("asked %+v, want audience muster for 12h", asked) + } + + none, err := mintPortalWorkloadToken(context.Background(), kubefake.NewClientset()) + if err != nil || none != nil { + t.Errorf("without the portal's ServiceAccount: token %q, err %v; want none and no error", none, err) + } +} From 77b47c71d08016709f38f578a7a7e1b91e92fa86 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Fri, 27 Nov 2026 00:13:11 +0100 Subject: [PATCH 7/8] docs: condense tool approval docs --- docs/dev-environment.md | 42 +++++++++++++++++------------------------ docs/identity.md | 34 ++++++++++++++------------------- docs/platform.md | 41 ++++++++++++++++------------------------ 3 files changed, 47 insertions(+), 70 deletions(-) diff --git a/docs/dev-environment.md b/docs/dev-environment.md index 099fdc23..8894884a 100644 --- a/docs/dev-environment.md +++ b/docs/dev-environment.md @@ -95,31 +95,23 @@ runs reuse it. It cannot be `backstage.port` (7007), which kind publishes for the in-cluster Backstage. Removing the key and running `agentlab reload` unregisters it. -**Returning from muster's approval page.** A tool approval opened from the -portal's chat sends the browser back to the page it came from, but muster only -returns to origins on `oauth.mcpClient.postLoginRedirectAllowlist`; the meta -chart lists the edge portal (`https://portal.:/sessions`), -not `http://localhost:3000`. While `backstage.localDevPort` is set the lab adds -`http://localhost:3000/sessions` (the frontend's fixed port) to muster's own -list, which the chart keeps next to its derived entry. Lab only. It is part of -the platform values, so after the first `portal dev` (or after removing the -key) run `agentlab platform` once; Dex alone is re-applied by `portal dev`. Without it muster logs -`Ignoring a return not in oauth.mcpClient.postLoginRedirectAllowlist` and shows -its own "answer recorded" page. - -**Deciding approvals inline.** muster takes the portal's inline approval -decisions and sign-in handoff requests only with the portal backend's own -workload token beside the person's: the in-cluster portal's projected -ServiceAccount token (audience `muster`), which muster reviews for verb -`decide` on `toolapprovals` (the chart binds the portal's ServiceAccount to -`muster-approval-decider`). The local backend has no projected token, so every -`portal dev` mints one for the lab portal's ServiceAccount -(`agent-platform/backstage`, TokenRequest, audience `muster`, 12 hours), writes -it to `state/backstage-dev/muster-workload-token` (mode 0600) and points the -backend's `muster.workloadTokenFile` at it. Lab only: it uses the lab's admin -kubeconfig and stands in for the lab's own portal. Without that ServiceAccount -(no portal in the lab) it says so and approvals open muster's own pages. -Restart `portal dev` after 12 hours. +**Approving tool calls from `portal dev`.** Lab only. + +- *Return from muster's approval page:* muster returns only to origins on + `oauth.mcpClient.postLoginRedirectAllowlist`. While `backstage.localDevPort` + is set the lab adds `http://localhost:3000/sessions` to muster's list. It is + part of the platform values: run `agentlab platform` once after the first + `portal dev` (or after removing the key). Without it muster logs `Ignoring a + return not in oauth.mcpClient.postLoginRedirectAllowlist` and shows its own + page. +- *Inline decisions:* muster takes them only with the portal backend's workload + token beside the person's (audience `muster`, reviewed for verb `decide` on + `toolapprovals`). Every `portal dev` mints one for the lab portal's + ServiceAccount (`agent-platform/backstage`, 12 hours) with the lab's admin + kubeconfig, writes it to `state/backstage-dev/muster-workload-token` (0600) + and points `muster.workloadTokenFile` at it. Without that ServiceAccount (no + portal in the lab) approvals open muster's own pages. Restart `portal dev` + after 12 hours. **Limits.** diff --git a/docs/identity.md b/docs/identity.md index d30c6bed..f831e75b 100644 --- a/docs/identity.md +++ b/docs/identity.md @@ -307,26 +307,20 @@ not the literal word `oidc` — Backstage serves each provider at ### The portal's own client With an agent-platform chart that takes `backstage.oidcClientId`, the portal -signs in with a client of its own, `agent-platform-portal` (secret -`agent-platform-portal-lab-secret`, key `portal-dex-client-secret` of -`agent-platform/agent-platform-secrets`; `agentlab portal dev` passes it as -`AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET`). Its only redirect URIs are the -portal's (in-cluster and `portal dev`), so no CLI helper or proof can sign in -with it, and muster trusts it alone for the sign-in handoff and inline -decisions (`approval.trustedClients`, formerly `approval.handoffClients`), -together with the portal backend's own ServiceAccount token (audience -`muster`; `agentlab portal dev` mints one for the lab portal's ServiceAccount, -see [dev-environment.md](dev-environment.md)): a click on *Open* on a -connector sign-in prompt in portal chat opens muster's page signed in, after -muster's own *Connect as ?* confirmation. The portal -requests the `agent-platform`, `dex-k8s-authenticator` and `kubernetes` -audiences, so `agent-platform`, `dex-k8s-authenticator` and `kubernetes` list -`agent-platform-portal` under `trustedPeers`, and every consumer accepts its -tokens as before; their `azp` is `agent-platform-portal`. The portal's -callbacks stay on `agent-platform` too, for a chart without the key. muster -keys a person's sessions by the token's client as well, so the portal's -connector sign-ins are not those of a password-grant token of -`agent-platform`, except subject-scoped ones. +signs in with its own client, `agent-platform-portal` (secret key +`portal-dex-client-secret` of `agent-platform/agent-platform-secrets`; +`agentlab portal dev` passes it as `AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET`). + +- Its only redirect URIs are the portal's, so no CLI helper or proof can sign in + with it. +- muster trusts it alone for the sign-in handoff and inline decisions + (`approval.trustedClients`), together with the portal backend's ServiceAccount + token (see [dev-environment.md](dev-environment.md)). +- `agent-platform`, `dex-k8s-authenticator` and `kubernetes` list it under + `trustedPeers`, so their consumers accept its tokens (`azp` is + `agent-platform-portal`). +- muster keys a person's sessions by client too: the portal's connector sign-ins + are not those of an `agent-platform` password-grant token. More clients means editing the Dex template (`internal/lab/templates/dex.yaml.tmpl`), rebuilding and `agentlab reload`. diff --git a/docs/platform.md b/docs/platform.md index 22099c79..4e35171e 100644 --- a/docs/platform.md +++ b/docs/platform.md @@ -349,13 +349,9 @@ puts the released chart back. ## Running a lab in governed mode -The agent-platform chart's `governance.mode` value (`trusted`, the default, -or `governed`) decides whether muster also asks a person before an agent runs a -write on the platform's own servers; the chart's README describes it (further -reading, optional: [Governing tool -calls](https://docs.giantswarm.io/overview/agent-platform/governing-tool-calls/)). -The lab sets it with a `platform.valuesFiles` overlay, like any other chart -value: +The chart's `governance.mode` (`trusted`, the default, or `governed`) decides +whether muster asks a person before an agent runs a write on the platform's own +servers (see the chart's README). Set it with a `platform.valuesFiles` overlay: ```yaml # governed.yaml @@ -369,24 +365,19 @@ platform: - /path/to/governed.yaml ``` -Then `agentlab platform`; `agentlab status` names the overlay and the mode it -sets. muster reads the mode once at start, so the run rolls muster. Removing -the entry and running `agentlab platform` again puts the lab back on trusted. - -Until muster and agent-manager releases with tool approval exist, the chart's -release floors are unset, -and the chart refuses `governed` at render: the boot stops before the install, -naming the guard. A released chart that carries tool approval needs no more -than the overlay. Before that, use a dev chart whose floors name the dev builds -of muster and the managers: point `platform.chartPath` at the checkout (see -[Installing an unreleased chart](#installing-an-unreleased-chart)), push the -dev muster chart and agent-manager chart into the lab registry and name them -with `components..versionRange` in the same overlay (see [An unreleased -component chart](#an-unreleased-component-chart)), and set the checkout's -floors to those versions. Approving a call also needs the OAuth server and -`muster.muster.oauth.mcpClient.publicUrl` on the lab's edge, which the chart -renders in the lab; a portal on another port than 443 needs -`backstage.publicPort` (8443 on the default edge). +Then `agentlab platform`; it rolls muster, which reads the mode once at start. +`agentlab status` names the overlay and mode. Removing the entry and re-running +returns the lab to trusted. + +- A released chart with tool approval needs only the overlay. Until then the chart + refuses `governed` at render (release floors unset): use a dev chart whose + floors name dev builds ([Installing an unreleased + chart](#installing-an-unreleased-chart)), push the dev muster and + agent-manager charts into the lab registry and name them with + `components..versionRange` in the overlay ([An unreleased component + chart](#an-unreleased-component-chart)). +- A portal on another port than 443 needs `backstage.publicPort` (8443 on the + default edge). ## Dev images From a2ce1be902dc7ae157a15259d48aa89f1f2963f8 Mon Sep 17 00:00:00 2001 From: Dominik Schmidle Date: Fri, 27 Nov 2026 00:53:18 +0100 Subject: [PATCH 8/8] test(lab): avoid the repeated muster literal that goconst flags --- internal/lab/portalclient_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/lab/portalclient_test.go b/internal/lab/portalclient_test.go index 230daf8c..a2508949 100644 --- a/internal/lab/portalclient_test.go +++ b/internal/lab/portalclient_test.go @@ -61,7 +61,7 @@ func TestPlatformValuesAdmitHotReloadPortalReturn(t *testing.T) { t.Fatalf("%v\n%s", err, raw) } var cur any = values - for _, key := range []string{"muster", "muster", "oauth", "mcpClient", "postLoginRedirectAllowlist"} { + for _, key := range strings.Split("muster.muster.oauth.mcpClient.postLoginRedirectAllowlist", ".") { m, ok := cur.(map[string]any) if !ok { return nil