Skip to content

GH-5098 Event subscription capabilities match tenant-neutrally - #5102

Merged
jeremydmiller merged 1 commit into
mainfrom
gh-5098-tenant-neutral-capabilities
Oct 20, 2026
Merged

jeremydmiller merged 1 commit into
mainfrom
gh-5098-tenant-neutral-capabilities

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Problem

A node captures its agent capabilities once at startup. Under UseTenantPartitionedEvents, a node that started before a tenant was added still advertises the store-global agent or the old tenants. A node that started after advertises the per-tenant agents.

Exact-URI matching made those two nodes look like different releases. AllNodesHaveSameCapabilities went false, and the capability-matching (blue/green) path placed every new tenant's agents only on the newer nodes. CritterWatch #1431's two-node harness showed all four tenant agents on node 2 and nothing on node 1, depending on timing.

Fix

This is option 2 from the issue. Tenants are data, not code, so event subscription capabilities now match tenant-neutrally:

  • EventSubscriptionAgentFamily.CapabilityKeyOf returns the existing TenantNeutralKeyOf for an event-subscriptions:// URI, and null for any other scheme.
  • AssignmentGrid.Node.Declares also matches an event subscription agent by that key. Candidate matching, TryAssign and the undeclared-assignment warning all go through it.
  • AllNodesHaveSameCapabilities compares event subscription capabilities by that key.
  • The stalled-agent release counts a peer that declares the same shard for another tenant, or store-wide.

A new projection, or a new version of one, still changes the key, so blue/green behaviour is unchanged. Other agent schemes compare exactly as before.

Tests

CoreTests tenant_neutral_event_subscription_capabilities_5098 covers:

  • the CritterWatch node table: four tenant agents now split 2/2
  • a store-wide capability declaring a tenant agent
  • different tenant sets counting as the same capabilities
  • a v2 projection still placed blue/green
  • the key helper ignoring other schemes

Results:

  • 4 of the 5 new tests fail without the fix.
  • All 538 tests in CoreTests.Runtime.Agents pass.
  • ./build.sh CIMartenDistribution --framework net9.0: 230 passed, 0 retries.
  • dotnet build wolverine.slnx -c Release -f net9.0 has 0 errors.

Closes #5098

🤖 Generated with Claude Code

https://claude.ai/code/session_01DCggXgxnG3EBXoR9rrq37U

A node captures its capabilities once at startup. Under per-tenant event partitioning, a node that
started before a tenant was added still advertises the store-global agent (or the old tenants), and
a node that started after advertises the per-tenant agents. Exact-URI matching made the two look like
different releases, so AllNodesHaveSameCapabilities went false and the capability-matching
(blue/green) path placed every new tenant's agents only on the newer nodes.

Tenants are data, not code. A node that can run a store's .../{shard} agent can run
.../{shard}/{tenant} for any tenant of that store.

- EventSubscriptionAgentFamily.CapabilityKeyOf: the TenantNeutralKeyOf of an event-subscriptions URI,
  null for any other scheme.
- AssignmentGrid.Node.Declares also matches an event subscription agent by that key, so candidate
  matching, TryAssign and the undeclared-assignment warning agree.
- AllNodesHaveSameCapabilities compares event subscription capabilities by that key.
- The stalled-agent release counts a peer that declares the same shard for another tenant.

A new projection, or a new version of one, still changes the key, so blue/green is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCggXgxnG3EBXoR9rrq37U
@jeremydmiller
jeremydmiller merged commit 60fd70f into main Oct 20, 2026
46 checks passed
This was referenced Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant