Skip to content

Commit dddff02

Browse files
feat(a2a-entry-test): prove klaus-gateway refuses an exchanged token too short-lived for a turn (#1396)
1 parent e636f27 commit dddff02

11 files changed

Lines changed: 281 additions & 13 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ agentlab vm-manager-test # the vm-manager pod as the person: 401 anonymous -> to
331331
agentlab klaus-gateway-test # Swarmgeist on the host against the edge, and with platform.klausGateway the in-cluster component: the OBO link store in a Secret across a pod loss
332332
agentlab klaus-gateway-test --part signin # a sign-in a turn needs, decided from Slack (Not now, a typed no, stop, the Sign in click resuming with accept, its retry held in muster's sign-in wait for --hold) and the portal's answer route; an answer to a request the other surface already answered is refused on both
333333
agentlab klaus-gateway-test --part refresh # a real Slack sign-in through muster, then two replicas refreshing the same link at once: the person stays signed in and muster logs no refresh token reuse
334-
agentlab a2a-entry-test # platform.klausGateway.a2aEntry on giantswarm-platform-manager's render: an application's own client_credentials token and an outside user's token, checked and exchanged at the edge; cards, refusals, turns with a tool call through muster, request metadata on tools/call only, follow-ups by contextId and taskId, and the two-organization permission matrix (own, other, guessed, shared, revoked) through the entry and agent-manager (docs/a2a-entry.md)
334+
agentlab a2a-entry-test # platform.klausGateway.a2aEntry on giantswarm-platform-manager's render: an application's own client_credentials token and an outside user's token, checked and exchanged at the edge; cards, refusals, turns with a tool call through muster, request metadata on tools/call only, follow-ups by contextId and taskId, the two-organization permission matrix (own, other, guessed, shared, revoked) through the entry and agent-manager, and klaus-gateway's refusal of an exchanged token too short-lived for a turn, the lab Dex's token lifetime shortened for that stage only (docs/a2a-entry.md)
335335
agentlab decisions-test # klaus-gateway's POST /decisions as a ServiceAccount: answered by click, modal and thread reply, each a muster tool call as the user; a refusal, a close as defaulted
336336
agentlab test # RBAC assertions for every configured user
337337
agentlab backstage-test # headless Backstage sign-in for every user, the portal's Agent Platform and Models pages (--agent kagent/<name>: on an existing agent, no create or delete)

‎docs/a2a-entry.md‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,21 @@ an interrupted earlier run left in them, the share included.
6464
| request metadata | request metadata reaches the MCP server's `tools/call` `_meta` unchanged, never other requests or the tool's arguments; the next request in the conversation carries none; MCP's reserved prefixes are refused with `-32602` on `SendMessage` and `CancelTask` |
6565
| follow-ups | the same `messageId` is one conversation; a follow-up continues by `contextId`; a message for the completed task by its `taskId` alone is refused with `-32004`, as for any task in a terminal state; a `taskId` with another conversation's `contextId` is refused with `-32602` |
6666
| matrix | giantswarm/giantswarm#39574 through the entry and through agent-manager over muster: each application reaches its own organization's agent (card, turn, `list_agents`, `start_session`) and is refused the other's; another application's task, conversation and Session are refused; a share (the application bound as `agent-platform:user` in the other organization) grants every surface and its removal refuses them again within 45 s; the outside issuer's user, whose group carries the connector's prefix, is never a member |
67+
| token lifetime | klaus-gateway refuses a platform token with less than its minimum lifetime left (`a2aServer.minTokenLifetime`, 25m), the reason agentgateway's exchange runs without a cache: the lab Dex issues 10-minute tokens for this stage only, the exchange's token has at most 10 minutes left, and each issuer's token gets 502 on the agent's card and on `GetTask`; with Dex's default lifetime back, the same tokens reach the card again |
6768

6869
Applications are bound as users (`oidc:<application name>`): gpm gives an
6970
application's token no groups. The summary names each stage PASS or FAIL with every
7071
failed row; a failed stage does not stop the later ones. `--ready-timeout` bounds
7172
each fixture agent's boot, `--mcp-binary` names another static agentlab binary for
7273
the stand-in.
7374

74-
Not covered: the minimum lifetime of an exchanged token (it needs the lab Dex's
75-
token expiry changed for the run), and request metadata in the model's requests,
76-
which needs a recorder between the agent and its model.
75+
The token lifetime stage runs last and is the only one with the short tokens:
76+
it renders the lab Dex with `expiry.idTokens` set and renders it again as
77+
`agentlab reload` does once its rows are judged, a pod roll each way. The
78+
restore also runs when the stage fails, at the run's cleanup, and on an
79+
interrupt. A run killed before that leaves Dex issuing short tokens until the
80+
next `a2a-entry-test`, `agentlab reload` or `agentlab platform`, each of which
81+
renders it with the default again.
82+
83+
Not covered: request metadata in the model's requests, which needs a recorder
84+
between the agent and its model.

‎docs/cli.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ one helper — see [Agents](agents.md).
302302
| `coding-test --part reference` | The reference coding scenario (giantswarm/giantswarm#38890) as the admin on the github instance's proof repository: a claude agent writes, tests and builds a hello-world program and opens a draft pull request as the person; a kagent agent reviews it with one comment review; GitHub refuses the reviewer's approval, the pull request still awaits a person's review, and a reviewer Session without a grant is refused. Verified on GitHub and with this host's go test and go build. Prints what the platform does not enforce (#39105). See [The reference part](platform.md#the-reference-part). |
303303
| `skills-test [email]` | The golden boot under Substrate's egress gate: an `AgentTemplate` on the Go ADK Harness with one git skill pinned to a full commit of a public repository (giantswarm/agent-skills), written below the agent chart on purpose; Ready on the Harness, then one turn through the edge as the user that names the skill and answers a fact only its `SKILL.md` has. A failed boot prints the evidence (the Harness conditions and warnings, Substrate's ActorTemplate, actor and worker as the controller reports them, the controller, atenet and worker log lines, the versions) and boots the same template without the skill as the control. A second turn in a new Session has the agent's `bash` tool run `git ls-remote` of the source from the sandbox, without `Authorization` and with kagent's placeholder, to show whether the Session's egress carries the source's credential. `--skill-fixture` boots the skill from the lab's own private git host behind the edge (`skillhost.<domain>`, no GitHub token; a Secret the proof creates and never prints) and prints `golden fetch: credential sent` and `session request: no credential` from the host's record of every request, or `FINDING: session request: credential sent` with the request that carried it. `--skill-repo` and its siblings boot another fixture, `--skill-secret` a private one; there the probe reports the host's exit codes. `--ready-timeout` bounds the boot (default 10m); `--model-config` picks the kagent ModelConfig the agent runs on ([a host model without an Anthropic key](models.md#agent-proofs-without-an-anthropic-key)). See [The skills proof](platform.md#the-skills-proof-the-golden-boot). |
304304
| `a2a-test [email]` | Turns over native gRPC through the edge as Swarmgeist and the portal backend drive them: the `GRPCRoute` and its JWT policy Accepted; no token refused at the edge (`Unauthenticated`; a plain POST gets 401); a forged `x-user-id` beside a valid token replaced; `ListAgents` listing the proof's Agent Ready with its display-name and icon-url annotations; `start_session` idempotent on `requestId`; `SendStreamingMessage` with the HITL extension streaming an answer; a `requireApproval` tool call paused at `input-required` → approved → completed with muster logging the call under the person, rejected → ended without the call; `CancelTask` on a running turn canceled server-side and a following turn answered. `--ready-timeout` bounds the fixture agent's boot (default 4m). See [Turns through the edge](agents.md#turns-through-the-edge-native-grpc-as-the-surfaces-drive-them). |
305-
| `a2a-entry-test` | The A2A entry for outside applications (`platform.klausGateway.a2aEntry`) on the Dex configuration and values giantswarm-platform-manager renders: gpm's render refusal of an application named like an email, cards, refusals, an application's own token and an outside user's token through the edge with a tool call through muster, request metadata reaching `tools/call` only, follow-ups by `contextId` and `taskId`, and the permission matrix of two organizations through the entry and agent-manager. `--ready-timeout` bounds each fixture agent's boot (default 4m). See [The A2A entry](a2a-entry.md). |
305+
| `a2a-entry-test` | The A2A entry for outside applications (`platform.klausGateway.a2aEntry`) on the Dex configuration and values giantswarm-platform-manager renders: gpm's render refusal of an application named like an email, cards, refusals, an application's own token and an outside user's token through the edge with a tool call through muster, request metadata reaching `tools/call` only, follow-ups by `contextId` and `taskId`, the permission matrix of two organizations through the entry and agent-manager, and klaus-gateway's refusal of an exchanged token too short-lived for a turn (the lab Dex's token lifetime shortened for that stage only and put back after it). `--ready-timeout` bounds each fixture agent's boot (default 4m). See [The A2A entry](a2a-entry.md). |
306306
| `substrate-step-test [email] --to <release>` | Agents keep their conversation and durable volume across a Substrate release: the Substrate before the step read off the atelet, the WorkerPool and ate-api-server; an agent on the platform Harness with a conversation of three turns (a codeword, a marker its `bash` tool writes to `/data`, the codeword asked back), suspended; the `substrate` and `substrate-crds` components pinned to `--to` through a values overlay of the run's own and the platform upgraded in place, by default under a drain (from the candidate's `ate-api-server` Ready, every worker pod deleted every 8 s for a minute, the Session's resume issued during it once the release before's `ate-api-server` pods are gone, and the candidate's RPC log read: a `ResumeActor` of the Session's actor must have arrived while the drain ran; `--no-drain` skips it), the workers rolled onto the new worker image; the Session resumed, answering the first turn's codeword and reading the marker back; the template's golden taken again on the new release (in the drain case every golden of the lab, with no terminal error) and a new Session answering. PASS or FAIL with the cause per step (Substrate 1.8.0's refusal of a 1.7 snapshot named as the restore refusal), the agent removed and the lab back on the chart's Substrate (`--stay` leaves it on `--to`). `--step-dev-image <target>=<image>` adds dev images for the step alone, `--ready-timeout` and `--retake-timeout` bound the golden boot and the re-take (default 10m each), `--model-config` the ModelConfig. See [The Substrate step proof](platform.md#the-substrate-step-proof-conversations-across-a-substrate-release). |
307307
| `kagent-step-test [email] --to <kagent release> \| --chart <agent-platform release>` | An agent, its conversation and its durable volume survive a step of the kagent line: the kagent line before the step read off the meta chart, the kagent HelmRelease and the controller; an agent on the platform Harness with a conversation of two turns (a codeword, a known file written to its durable volume), suspended; the `kagent` and `kagent-crds` components pinned to `--to` through a values overlay of the run's own, the meta chart moved to the candidate `--chart` (a chart-only candidate that keeps kagent included), or both, and the platform upgraded in place; the Session resumed, a turn answering the codeword and reading the file back unchanged, a suspend and a resume more, the Session and the agent deleted. PASS per step, or FAIL naming the stage that failed (`step`, `resume`, `turn`, `suspend`, `delete`) with the cause; the lab back on its own configuration (`--stay` leaves it on the step). `--step-dev-image <target>=<image>` adds dev images for the step alone, `--ready-timeout` bounds the golden boot, `--model-config` the ModelConfig. See [The kagent step proof](platform.md#the-kagent-step-proof-conversations-across-a-kagent-step). |
308308
| `harness-matrix-test` | What each Harness does with a Shared subagent binding (`tools[].subAgent`) and, on `claude`, with a Claude-format package's subagents and commands. Per Harness (`--harness`, default `kagent`, `claude`, `codex`, `omp`) and case (`--case`, default all): `shared-prompt` (a child with a prompt and a model), `shared-skill` (the child selects the example package's `migrate-agent-plugin`), `shared-mcp` (the child binds kagent's `kagent-api` server), `shared-nested` (the child binds a child) and, on `claude` only, `plugin-parts` (`anthropics/claude-code` `plugins/feature-dev` at the lab's pinned commit: the agent lists its plugin commands and subagents and invokes `code-explorer`). Each cell records the controller's refusal (the Agent's condition) or one turn, judged by a codeword that only the child's system prompt holds, so a reply carrying it shows the child ran. Every cell is an observation, not a pass or fail; the table is printed and written to `state/harness-matrix.txt`. On `codex` without `--codex-model-config` the `shared-prompt` turn runs on the mockllm, whose script spawns the child with `spawn_agent`, waits for it, and answers the child's own request with the codeword its developer instructions carry; the other codex cells boot and take no turn. `--mockllm-binary` names the static linux agentlab its container runs; `--ready-timeout` bounds each golden boot of a parent (default 10m); a boot kagent reports crashed and starts over gets the timeout again, so a Harness whose every boot crashes reads REFUSED with kagent's `ActorTemplateFailed` once its retry budget is spent. The agents are removed on every exit path. See [The harness matrix](platform.md#the-harness-matrix). |

‎internal/lab/a2aentry_test.go‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,22 @@ type dexConfigDoc struct {
4545
TrustedPeers []string `yaml:"trustedPeers"`
4646
AllowedConnectors []string `yaml:"allowedConnectors"`
4747
} `yaml:"staticClients"`
48+
Expiry struct {
49+
IDTokens string `yaml:"idTokens"`
50+
} `yaml:"expiry"`
4851
}
4952

5053
// configOf decodes the config.yaml of the named Secret in a rendered stream.
5154
func configOf(t *testing.T, rendered []byte, secret string) dexConfigDoc {
55+
t.Helper()
56+
raw := rawConfigOf(t, rendered, secret)
57+
var cfg dexConfigDoc
58+
require.NoError(t, yaml.Unmarshal([]byte(raw), &cfg), raw)
59+
return cfg
60+
}
61+
62+
// rawConfigOf is the config.yaml of the named Secret in a rendered stream.
63+
func rawConfigOf(t *testing.T, rendered []byte, secret string) string {
5264
t.Helper()
5365
for _, doc := range splitYAMLDocs(t, rendered) {
5466
var obj struct {
@@ -62,12 +74,10 @@ func configOf(t *testing.T, rendered []byte, secret string) dexConfigDoc {
6274
if obj.Kind != kindSecret || obj.Metadata.Name != secret {
6375
continue
6476
}
65-
var cfg dexConfigDoc
66-
require.NoError(t, yaml.Unmarshal([]byte(obj.StringData["config.yaml"]), &cfg), obj.StringData["config.yaml"])
67-
return cfg
77+
return obj.StringData["config.yaml"]
6878
}
6979
t.Fatalf("no Secret %s in the render", secret)
70-
return dexConfigDoc{}
80+
return ""
7181
}
7282

7383
func splitYAMLDocs(t *testing.T, rendered []byte) [][]byte {

0 commit comments

Comments
 (0)