Skip to content

[Phase 3] Run mecak8s with the identity broker on more than one replica #2805

Open
0 of 2 issues completed

Description

@ChrisJBurns

Depends on: #2563 (durable broker state), #2568 (sign-out and revocation); "Handle multi-pod refresh token rotation race condition" (stacklok/toolhive#4122) (refresh serialized across replicas, including storage an embedder passes in); and the ToolHive set for "Sign-out and revocation" (#2568): the "to file" rows in "Phase 3, Track: ToolHive — The remaining ToolHive changes for audit, sign-out, and schedules" (#2570) for disconnecting a provider and for AS-1's revocation notice

Problem

With the identity broker on, the mecak8s chart requires replicaCount: 1 and renders the Recreate strategy (deploy/helm/mecak8s/templates/_helpers.tpl). Phases 1 and 2 keep this (#2451, #2545). Several pieces of state and coordination assume one process:

Design

Requirements

  • Sessions and opens. The per-host-session open lock holds across replicas. Concurrent opens of one session on two replicas store one refresh token and revoke the other. Two replicas creating the same session converge on one broker session.
  • One live refresh token per session. An exchange that gets revoked rereads the shared record. Any replica retries pending AS-1 revocations.
  • One upstream refresh. Concurrent exchanges for one user across replicas cause one upstream refresh, under a lease.
  • Shared jti stores. The converted access-token set and the jti stores for client assertions and ID-JAGs are shared, so a second use on another replica is refused, including two concurrent ID-JAG redemptions at the embedded AS-2.
  • AS-1 and AS-2 across replicas. Every replica serves the same AS-1 and embedded AS-2: shared users, upstream tokens, refresh tokens, client records, and operator-supplied signing keys (Keys and gateway entries for the identity broker #2538), never a per-replica generated key.
  • Clock. The broker's echo and hard-expiry checks allow the configured clock skew, since the broker and AS-1 no longer share a clock.
  • Revocation and sign-out. Sign-out everywhere and revocation reach sessions and grants served or stored by every replica, and cancel live runs and parked calls there.
  • Run records. Run records and delegation reports created concurrently on two replicas keep one record.
  • mecak8s call state. The send-once record, parked gateway calls, and vMCP session IDs are shared, behind the interfaces MCP broker authorizes gateway calls and sends them to the configured gateway #2536 and MCP client state: one vMCP session per agent, durable send-once and parked calls #2564 introduce.
  • Rate limits. The embedded AS-2's route limits are sized per replica or shared, and the chosen rule is documented.
  • Chart. The chart allows more than one replica with the broker on only when all of the above hold.

How it fits

Removes the "one replica" shortcut in #2451. Slice 3 (the broker as its own service) builds on it, because a separate broker serves several mecak8s replicas.

Done when

The design's replica checks in "Sign-out and revocation checks" and "Run owner checks" pass with two replicas, a concurrent-open and a concurrent-redemption test pass across two replicas, and the chart allows more than one replica with the identity broker on.

Sub-issues

Sub-issues

0 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. rdimitrov commented on Nov 25, 2026

    @rdimitrov
    Member

    Scope addition from #2985: one accepted broker record per registration and per delegation across replicas. Today in-process locks keep an identical repeat from producing a second success record; two replicas could each record it under a different AuditID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions