Skip to content

docs(agent-identity): catch up the design with slice 3 and ToolHive v0.60.0 - #2657

Merged
ChrisJBurns merged 4 commits into
mainfrom
docs/agent-identity-catchup-2026-11-02
Nov 3, 2026
Merged

ChrisJBurns merged 4 commits into
mainfrom
docs/agent-identity-catchup-2026-11-02

Conversation

@ChrisJBurns

@ChrisJBurns ChrisJBurns commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Brings the agent identity design up to date with work merged since the last catch-up. The design describes the final state, so this removes interim wording and leaves shortcuts to the tickets that remove them. It also records two decisions taken during the slice 3 audit.

Decisions recorded

Final-state wording

  • "once replay-revoke lands" removed from step (3) and the implementation tests. The design states the final behaviour; the gap is the toolhive#6973 row of the ToolHive work list, and Sign-out and revocation #2568.
  • "today" and "currently" removed from README.md, implementation.md, the nomenclature table, and audit.md. The undecided loading of non-global definitions in audit.md becomes an Open. item.

Matching what merged

ToolHive work list

  • API-audience exchange: "Yes from v0.60.0", with the remaining gap in toolhive#7026.
  • Refresh tokens from token exchange: "Yes from v0.60.0" (toolhive#6897).
  • Subject-token reasons: "Partly" (toolhive#7003 shipped; toolhive#7007 open).
  • Rejecting tokens whose upstream records were deleted: "Yes from v0.56.0" (toolhive#6846).
  • offline_access check: linked to toolhive#7029.
  • New row: every failed client-assertion check returns 401 invalid_client (toolhive#7028).

Merged behaviour now in the design

API compatibility

Design documentation only. No code, protobuf, or wire behaviour changes.

@ChrisJBurns
ChrisJBurns requested review from jhrozek and a balanced review from Copilot November 2, 2026 23:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Allowing clock-skew tolerance between requested and echoed expires_at values can raise replacement caps and repeatedly extend a session, violating the stated no-extension requirement.

1 open issue
What changed in this PR

Updates the agent-identity design to reflect slice 3 decisions and ToolHive v0.60.0 capabilities. This is documentation-only; no runtime or wire behavior changes.

Changes:

  • Records clock-skew handling, revocation during session-open conversion, and client error codes.
  • Updates the ToolHive capability ledger and links remaining gaps.
  • Replaces interim wording with final-state requirements and marks unresolved definition loading as open.
File Description
docs/​drafts/​agent-identity/​README.md Makes deployment-boundary wording conditional rather than time-specific.
docs/​drafts/​agent-identity/​implementation.md Updates verification requirements and ToolHive capability status.
docs/​drafts/​agent-identity/​credentials-and-lifecycle.md Revises token checks, expiry handling, revocation, and error mappings.
docs/​drafts/​agent-identity/​audit.md Clarifies audit requirements and the open definition-loading question.

Review effort: Balanced

`expires_in` is illustrative; the hard expiry is not selected. `RT-A42` is opaque to the broker. Its meaning lives in an AS-1 record, a [grant](#example-nomenclature), that binds it to client `mecatl` and to Alice as `u-alice-91`, with a hard expiry. Every ID-JAG issued from it names that subject.

The broker checks that the echoed entry has the type and `issuable_token_types` it sent, and an `expires_at` no later than the one it requested, if any; an echo without `expires_at` does not match. It then stores `RT-A42` under `A42` with the verified owner and the echoed expiry, in its shared session storage, so any replica can use it and run the [run-owner check](#6-per-operation-authorization) without asking AS-1. If the echo does not match, or the response cannot be decoded, the broker revokes `RT-A42` (RFC 7009, or in process while AS-1 is a broker module), which closes `A42`, and fails the open. The existing broker session record under `A42` keeps the workload and host-session binding; the human authority lives in `RT-A42`, not in a broker-local human record.
The broker checks that the echoed entry has the type and `issuable_token_types` it sent, and an `expires_at` no later than the one it requested, if any, allowing the clock skew; an echo without `expires_at` does not match. It then stores `RT-A42` under `A42` with the verified owner and the echoed expiry, in its shared session storage, so any replica can use it and run the [run-owner check](#6-per-operation-authorization) without asking AS-1. If the echo does not match, or the response cannot be decoded, the broker revokes `RT-A42` (RFC 7009, or in process while AS-1 is a broker module), which closes `A42`, and fails the open. The existing broker session record under `A42` keeps the workload and host-session binding; the human authority lives in `RT-A42`, not in a broker-local human record.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Please drop "allowing the clock skew" here and keep step (6) check 2. See the review.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 488c9b1. After rebasing onto #2653, step (3) says the echo comparison is exact, since both values are absolute times from the broker's request. It also keeps step (6) check 2: the hard expiry counts as reached one skew early, which fails closed.

@ChrisJBurns

Copy link
Copy Markdown
Contributor Author

@jhrozek, while checking the phase 1 and phase 2 tickets against the design I found three places where the design disagrees with itself. These lines are not in this PR's diff. If you tell me which side is right, I'll fix them here or in a follow-up.

  1. Does the embedded AS-2 trust AS-1 as its sign-in provider?
  2. Who checks that the acting instance is registered to the session? agent-definitions.md line 16 says AS-1 does. credentials-and-lifecycle.md step (4), check 8 (line 380) says the broker does: AS-1 checks only that the instance's session is owned by the grant's user, because it doesn't know sessions. Proposal: line 16 says the broker checks registration, and AS-1 checks ownership.
  3. Which fields bind a vMCP session? mcp-gateway-modes.md line 80 lists iss, sub, and act.sub. "Sessions at the vMCP" in credentials-and-lifecycle.md lists more, and vMCP: bind sessions to the client, acting agent, and delegated-access marker, not just the user toolhive#6888 also binds client_id, act.iss, and the delegated-access marker. Proposal: line 80 points to "Sessions at the vMCP" for the field list instead of repeating it.

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch-up. The final-state wording is a good call, and I checked most of the claims against the code and the ToolHive release. These are right: the v0.60.0 contents (the grants stack except the Derive child exchange grants from refresh tokens PR), the identity_broker_session_refused code, the sign-in metadata member, the AS-1 rate limits in cmd/mecak8s/serve.go, and the work-list row that still tracks replay-revoke. Two things need changing, and two are small.

1. The echo check should not allow clock skew (line 309). I agree with Copilot's comment. The requested and echoed expires_at are absolute timestamps, and AS-1 echoes the smaller of the requested time and its cap, so a later echo cannot be legitimate. Allowing one lets each reopen extend the session by up to the skew, because the echo becomes the next cap. This also contradicts the Clock paragraph of "Register the broker client at AS-1 and point the broker at it" (#2607), which says the checks take no allowance because it "would only let the broker present a grant AS-1 may already have expired". Note that "Authorization server: allow clock skew on private_key_jwt client assertions" (toolhive#6954) is a different skew. It's about AS-1 accepting client assertions, and nothing tracks an allowance here. Keep the echo comparison exact. The new step (6) check 2 (line 496) is right and should stay: treating the stored expiry as expired one skew early fails closed.

2. The API-audience row should say "Partly", not "Yes from v0.60.0" (implementation.md line 142). "Configured delegate client with api_audience can exchange for API access tokens" (toolhive#7026) shows the broker can mint Mecatl API access tokens. The design requires that it never can. Please don't name api_audience in the row. The setting is being reworked on the ToolHive side, so say "the API audience setting".

3. The alg claim (line 197): "a fixed allowlist of asymmetric algorithms (RS, PS, and ES families)", citing #2497. I could not find that check in authn/oidc, the adapters or the broker. Which file has it?

4. Nit (audit.md line 27): "AuditEvent profile; These are listed in..." has a semicolon before a capital. Suggest: "...the AuditEvent profile. The ToolHive work list has the rows."

No change requested on the offline_access row. Linking toolhive#7029 is fine. The reason string it will return is not settled yet, and I'll follow up on that issue.

| --- | --- | --- | --- |
| Exchange of a self-issued access token presented by another confidential client (the Mecatl-API-audience exception) | Mostly; the requested `aud` must be a subset of the subject token's `aud` | Small to medium | Identity work |
| Refresh token in a token-exchange response: a grant bound to the client and user, with an exchange-grant `authorization_details` entry that fixes its one output and its capped expiry, echoed with the granted expiry; one grant per source `jti` | No; exchange issues access tokens only; in progress ([#6897](https://github.com/stacklok/toolhive/issues/6897)) | Medium to large | Identity work |
| Exchange of a self-issued access token presented by another confidential client (the Mecatl-API-audience exception) | Yes from v0.60.0, for a configured delegate client with `api_audience`; but listing the API audience also lets the delegate exchange for API access tokens ([#7026](https://github.com/stacklok/toolhive/issues/7026)) | Small | Identity work |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Partly", and refer to "the API audience setting" without the field name. See the review.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: "Partly". The row now says "the API audience setting" instead of naming the field, and links toolhive#7026.

**Checks, at mecak8s** (RFC 9068 §4):

1. The header `typ` is `at+jwt` or `application/at+jwt`, and `alg` is on the configured allowlist, which excludes `none` and every symmetric algorithm.
1. The header `typ` is `at+jwt` or `application/at+jwt`, and `alg` is on a fixed allowlist of asymmetric algorithms (RS, PS, and ES families), which excludes `none` and every symmetric algorithm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this allowlist enforced? I couldn't find it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's enforced in toolhive-core rather than mecatl. The allowlist is authn/validate.go lines 105–107 in toolhive-core v0.0.58 (RS/PS/ES 256–512), and line 308 applies it again through jwt.WithValidMethods. mecak8s validates AS-1 tokens with authn.NewValidator (authn/oidc/oidc.go:158). I added "enforced by the token validator (toolhive-core authn)" to the line.

Comment thread docs/drafts/agent-identity/audit.md Outdated
| Observed result and provider correlation | The response received by the recording component and safe provider references, when available | A broker-observed MCP response is not independent proof of provider-side effects. |

AS-1 and AS-2 must produce the records above, following the [AuditEvent profile](#auditevent-profile); ToolHive's authorization server records no audit events today, so this is new work.
AS-1 and AS-2 must produce the records above, following the [AuditEvent profile](#auditevent-profile); These are listed in the [ToolHive work list](implementation.md#toolhive-work-list).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest: "...following the AuditEvent profile. The ToolHive work list has the rows."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, using your wording.

@jhrozek

jhrozek commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@ChrisJBurns, my answers, in order:

  1. AS-2 and AS-1. No: AS-2 doesn't trust AS-1 as its sign-in provider. We settled that both sign users in through the same company IdP, and AS-1 is an ID-JAG issuer only. Your rewording of lines 51 and 76 is right.
  2. Who checks that the instance is registered to the session. The broker does. AS-1 knows no sessions. It calls the actor validator with the grant's sub and sub_id, and Mecatl's validator, which lives in the broker, checks that the instance's session belongs to that user. Please word line 16 that way, not "AS-1 checks ownership", so nobody expects AS-1 to hold session state.
  3. vMCP session binding fields. Point line 80 to "Sessions at the vMCP". One list is better than two. Please do it in this PR or a follow-up, whichever is easier.

ChrisJBurns and others added 4 commits November 3, 2026 14:01
…0.60.0

Record the clock-skew rule for the echo and hard-expiry checks and the
revoke on a session closed during conversion, remove interim wording,
name the 403 client code, and refresh the ToolHive work list.

Co-authored-by: Mecatl <[email protected]>
…status, design consistency

Keep the echo comparison exact and the early hard-expiry check; mark the
API-audience exchange as partly supported; say where the alg allowlist
is enforced; resolve three contradictions the review settled.

Co-authored-by: Mecatl <[email protected]>
@ChrisJBurns
ChrisJBurns force-pushed the docs/agent-identity-catchup-2026-11-02 branch from 1291ebe to 488c9b1 Compare November 3, 2026 14:02
@ChrisJBurns

Copy link
Copy Markdown
Contributor Author

Thanks. All three are fixed in 488c9b1:

  1. mcp-gateway-modes.md lines 51 and 76 now say AS-2 trusts AS-1 as an ID-JAG issuer, and the two resolve the user through the company IdP they share.
  2. agent-definitions.md line 16 says the broker checks registration. AS-1 knows no sessions: it calls Mecatl's actor-token validator, which runs in the broker, with the grant's sub and sub_id, and the validator checks that the instance's session belongs to that user.
  3. mcp-gateway-modes.md line 80 now points to "Sessions at the vMCP" for the field list.

The branch is rebased onto #2653.

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 488c9b1. All four points from my earlier review are resolved:

  • The echo check is exact, and step (6) check 2 keeps the skew margin on the hard expiry.
  • The API-audience row says "Partly" and no longer names the setting.
  • I checked the alg allowlist you cited: toolhive-core v0.0.58 authn/validate.go lines 105 to 107 and 308 match, and Mecatl pins that version.
  • The audit.md sentence is fixed.

Your three answers on the design are applied as agreed, and the checks are green.

One non-blocking follow-up: the Clock paragraph of "Register the broker client at AS-1 and point the broker at it" (#2607) says the hard-expiry check takes no clock-skew allowance. The design now treats the hard expiry as reached one skew early (which fails closed). Please align the ticket text: the echo is exact, and the hard expiry gets the early margin.

I still owe a follow-up on the offline_access reason string on toolhive#7029.

@ChrisJBurns
ChrisJBurns merged commit 5e48c93 into main Nov 3, 2026
32 checks passed
@ChrisJBurns
ChrisJBurns deleted the docs/agent-identity-catchup-2026-11-02 branch November 3, 2026 14:44
@ChrisJBurns

Copy link
Copy Markdown
Contributor Author

Thanks for the approval. On the follow-up: #2607's Clock paragraph now says the echo check is exact and the hard expiry gets the early margin. The code change is #2658: expireLocked now counts the hard expiry one clock skew early, with a boundary test.

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.

3 participants