Skip to content

GH-6117: describe-routing and describe show the local queues of locally handled messages - #6121

Merged
jeremydmiller merged 2 commits into
mainfrom
gh-6117-describe-routing-local
Dec 2, 2026
Merged

jeremydmiller merged 2 commits into
mainfrom
gh-6117-describe-routing-local

Conversation

@jeremydmiller

@jeremydmiller jeremydmiller commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Closes #6117

Root cause

Not the handler graph: HandlerGraph.CanHandle is already true when the diagnostics ask (the host is started and HandlerGraph.Compile() has run).

describe-routing, codegen-preview and describe start the host in metadata-only (lightweight) mode: DynamicCodeBuilder.WithinCodegenCommand, or StartLightweightAsync() for describe. That mode forces DurabilityMode.MediatorOnly, and the MediatorOnly branch of WolverineRuntime.StartAsync never calls startMessagingTransportsAsync(), so discoverListenersFromConventions() and with it LocalTransport.DiscoverListeners() never ran. LocalTransport.Assignments stayed empty, and LocalTransport.DiscoverSenders() -- what LocalRouting.FindRoutes asks once CanHandle is true -- returned nothing. Every locally handled message with a single, unbound handler chain described as "No routes". A message type with several handler types already described correctly, because those chains are bound to their own queues during compile; explicitly routed messages (the sample's ToolFinished) were never affected.

The existing diagnostics test even recorded the gap ("in MediatorOnly (lightweight) mode, local routing assignments are not populated, so runtime.RoutingFor() returns no routes").

Fix

  • The lightweight start remembers the durability mode the application asked for before it replaces it with MediatorOnly.
  • When that mode runs local queues (Balanced or Solo), the lightweight start runs the same listener discovery a real start runs (discoverListenersFromConventions()). External transports are stubbed in lightweight mode, so only the local queues are assigned; no listener or sending agent starts.
  • The lightweight start then compiles the local queues, as a real start does when the transports initialize, so endpoint policies such as UseDurableLocalQueues() show in the Mode and Outbox columns. Without it the sample's durable queues described as BufferedInMemory.
  • describe-routing's Resolution column labelled any local route whose message type had a queue assignment as "Explicit local routing". Now that the convention assigns queues in lightweight mode too, that would have been every route, so LocalTransport records the message types given a queue with LocalQueueFor<T>() or IConfigureLocalQueue, and the rest read "Local handler convention".
  • An IAsyncWolverineExtension may choose the durability mode. In a lightweight start it now sees and changes the application's own mode instead of the forced MediatorOnly; the lightweight start keeps what it chose for the description, then forces MediatorOnly again (review follow-up).
  • With several handler types, LocalQueueFor<T>() configures the message type's queue, which nothing routes to, so "Explicit local routing" now also requires the route's destination to be that queue (review follow-up).
  • An application that is itself MediatorOnly, or that disabled conventional local routing, still describes no local routes, because it gets none at run time.

describe's Message Routing table and describe-routing (including --all, --explain and --json) all go through IWolverineRuntime.RoutingFor / ExplainRoutingFor, so the one fix covers all of them.

Tests

CoreTests.Diagnostics.describe_routing_shows_local_queues_6117, written first and red before the fix:

  • a message with one handler type routes to its local queue
  • a message with several handler types routes to one queue per handler type (already green, kept as a guard)
  • NameQueuesByHandlerType() queues are described
  • the described routes are the routes the running application gets (with UseDurableLocalQueues(), like the issue's sample)
  • ExplainRoutingFor shows LocalRouting producing the local queue
  • describe's StartLightweightAsync() path shows the local queue
  • the described queue has UseDurableLocalQueues() applied
  • Resolution tells the convention from LocalQueueFor<T>()
  • LocalQueueFor<T>() on a message with several handler types leaves their routes "Local handler convention"
  • an async extension that chooses MediatorOnly leaves no local routes; an extension sees the application's mode, and the lightweight start stays MediatorOnly
  • a MediatorOnly application and one with conventional local routing disabled still show no local routes

Also checked by hand against CritterStackSamples SagasVsDurableWorkflows/SagaWorkflows (the issue's repro, at ceea67a) built against this branch: describe-routing BookFlight shows local://sagaworkflows.tripbooking.bookflight/, Durable, outbox, "Local handler convention"; --explain shows LocalRouting producing it and FINAL ROUTES: 1; --all and describe's Message Routing table list the local queues, with "No routes" left only on types nothing handles.

6.x

The 6.0 branch has the same code path (case DurabilityMode.MediatorOnly: break; and the same test note), so 6.x has the same bug. Not backported here.

🤖 Generated with Claude Code

…ly handled messages

The diagnostic commands start the host lightweight (metadata-only), which forces
DurabilityMode.MediatorOnly. That branch of StartAsync never started the messaging
transports, so LocalTransport.DiscoverListeners never assigned the local queues and
LocalRouting found no route for any message type with a single, unbound handler chain.
HandlerGraph.CanHandle was already true; the handler graph was not the problem.

The lightweight start now remembers the durability mode the application asked for and,
when that mode runs local queues (Balanced or Solo), runs the same listener discovery a
real start does and compiles the local queues so endpoint policies such as
UseDurableLocalQueues() are described. External transports stay stubbed and nothing starts.
An application that is MediatorOnly, or has conventional local routing disabled, still
describes no local routes.

describe-routing's Resolution column no longer labels every conventional local route as
"Explicit local routing": LocalTransport records the message types given a queue with
LocalQueueFor<T>() or IConfigureLocalQueue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremydmiller jeremydmiller added this to the 7.0 milestone Dec 2, 2026
Copilot AI balanced review requested due to automatic review settings December 2, 2026 21:29

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

Diagnostics can mislabel convention-generated handler queues as explicitly routed and incorrectly discover local queues using a durability mode captured before async configuration.

2 open issues
What changed in this PR

Addresses #6117 by making Wolverine’s routing diagnostics discover local queues during lightweight startup.

Changes:

  • Discovers and compiles local queues so diagnostics reflect routing and endpoint policies.
  • Tracks explicit queue configuration separately from conventional routing.
  • Adds regression coverage for lightweight diagnostics and routing parity.
File Description
src/​Wolverine/​Transports/​Local/​LocalTransport.cs Tracks explicitly configured message types.
src/​Wolverine/​Runtime/​WolverineRuntime.HostService.cs Discovers and compiles local queues during lightweight startup.
src/​Wolverine/​Diagnostics/​WolverineDiagnosticsCommand.cs Distinguishes explicit routing from conventions.
src/​Testing/​CoreTests/​Diagnostics/​WolverineDiagnosticsCommandTests.cs Updates a comment to reference new coverage.
src/​Testing/​CoreTests/​Diagnostics/​describe_routing_shows_local_queues_6117.cs Adds routing diagnostics regression tests.

Review effort: Balanced

if (options.LocalRouting.Assignments.TryGetValue(messageType, out _))
// Check for explicit local queue assignment. GH-6117: the local routing convention assigns every
// locally handled message type a queue too, so the assignment alone does not make it explicit
if (options.LocalRouting.ExplicitlyConfiguredMessageTypes.Contains(messageType))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 8690dc0: "Explicit local routing" now also requires the route destination to be the explicitly configured queue, so the handler-type queues of a message with several handler types read "Local handler convention". Test: an_explicit_queue_for_a_message_with_several_handler_types_does_not_make_their_routes_explicit.


private void applyLightweightMode()
{
_applicationDurabilityMode ??= Options.Durability.Mode;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 8690dc0: during a lightweight start the async extensions run against the application's own mode, the mode they leave is what the description uses, and the start goes back to MediatorOnly afterwards. Tests: an_async_extension_that_chooses_mediator_only_leaves_no_local_routes, an_async_extension_sees_the_application_mode_and_the_lightweight_start_stays_mediator_only (both red before the change).

…p convention routes off "Explicit"

Review follow-ups on the lightweight-start routing description:

- An IAsyncWolverineExtension may choose the durability mode. In a lightweight start it now sees and
  changes the application's own mode rather than the forced MediatorOnly; the lightweight start keeps
  what it chose for describing the routing, then forces MediatorOnly again. An extension that picks
  MediatorOnly therefore describes no local routes, as a real start of that application gets none.
- With several handler types, LocalQueueFor<T>() configures the message type's queue, which nothing
  routes to. describe-routing's Resolution column only says "Explicit local routing" when the route's
  destination is that explicitly configured queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremydmiller
jeremydmiller merged commit cb39b54 into main Dec 2, 2026
51 checks passed
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.

describe-routing reports no routes for a message with a local handler

2 participants