Skip to content

Scope message bus topics by agent name for multi-instance isolation#272

Merged
rockfordlhotka merged 7 commits intomainfrom
rockfordlhotka/268-scope-topics-by-agent-name
Apr 14, 2026
Merged

Scope message bus topics by agent name for multi-instance isolation#272
rockfordlhotka merged 7 commits intomainfrom
rockfordlhotka/268-scope-topics-by-agent-name

Conversation

@rockfordlhotka
Copy link
Copy Markdown
Member

Summary

  • Append .{agentName} suffix to all user proxy and subagent topics so multiple RockBot instances can share the same RabbitMQ broker without message collisions
  • Agent name configurable via Agent:Name config (defaults to "RockBot")
  • Follows the existing A2A topic scoping pattern (agent.task.{agentName})

Closes #268

Changes

  • 22 source files across Agent, Host, Subagent, A2A, and UserProxy projects — all publish/subscribe calls now use scoped topics
  • 4 test files updated with scoped topic assertions
  • UserProxyOptions.AgentName added so Blazor/CLI proxies target the correct agent
  • Intentionally global topics (discovery.announce, agent.task.status, per-proxy response topics) are unchanged

Migration

  • Breaking wire-protocol change — agent and proxy must be deployed together
  • No config changes needed for single-instance deployments (default name is "RockBot")
  • To run a second instance, set Agent__Name=RockBot-Bob on both agent and proxy pods

Test plan

  • dotnet build RockBot.slnx — 0 errors
  • dotnet test RockBot.slnx — all tests pass (0 failures)
  • Grep confirms no remaining unscoped topic references in source
  • Deploy to staging and verify agent ↔ proxy communication
  • Test two instances with distinct Agent:Name values on same RabbitMQ

🤖 Generated with Claude Code

rockfordlhotka and others added 7 commits April 12, 2026 00:48
…268)

Append .{agentName} suffix to all user proxy and subagent topics so
multiple RockBot instances can share the same RabbitMQ broker without
message collisions. Follows the existing A2A scoping pattern.

Agent name is now configurable via Agent:Name (defaults to "RockBot").
UserProxyOptions gains an AgentName property so the Blazor and CLI
proxies publish/subscribe to the correct scoped topics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Proves two agent instances (AgentAlpha, AgentBeta) sharing a single
message bus receive only their own messages with no cross-contamination.

Tests cover user proxy topics (user.message, user.response) and
subagent topics (subagent.progress, subagent.result). InProcess bus
tests always run; RabbitMQ variants are gated by ROCKBOT_RABBITMQ_HOST.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When topic names change (e.g. after the agent-name scoping upgrade),
existing durable queues have mismatched x-dead-letter-routing-key
arguments. RabbitMQ rejects the re-declaration with 406 PRECONDITION_FAILED.

The subscriber now catches this specific error, deletes the stale queue
on a fresh channel, and re-creates it with the correct arguments. This
makes the upgrade self-healing — no manual queue cleanup needed.

Bump version to 0.8.1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When Telemetry.ServiceName is not explicitly overridden, it now defaults
to the Agent:Name value (e.g. "RockBot", "RockBot-Bob"). This lets
Grafana dashboards differentiate between instances without extra config.

If Telemetry__ServiceName is set explicitly in the ConfigMap it still
takes precedence — the default only applies when it equals "rockbot".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move wisp-first guidance into common-directives.md so both the primary
agent and subagents default to spawn_wisps for any multi-step workflow.
Direct tool calls are reserved for single-call tasks or genuinely
dynamic workflows requiring real-time judgment between steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rockfordlhotka rockfordlhotka merged commit 9eab9d5 into main Apr 14, 2026
2 checks passed
@rockfordlhotka rockfordlhotka deleted the rockfordlhotka/268-scope-topics-by-agent-name branch April 14, 2026 00:35
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.

Multi-instance isolation: scope message bus topics by agent name

1 participant