Stop addressing subscription events to a request id

A subscribe arrives as a request, so the source address the subscription
controller handles it with carries the request id used to route the
response back to the caller. That address was stored verbatim as the
destination for the subscription, so every event broadcast to it, and the
replay event sent when the subscription is created, went out addressed to
a request that had long since been answered.

A request id identifies one request in flight and has no meaning on an
event. The receiving link keys response routing off it, so events carrying
one are put through paths meant for response traffic.

Strip the request id when taking the subscription's destination from the
request that created it. Add Address.withoutRequestId for that, as the
same address is used in three places here.

The subscription map is keyed on addressIndex, which already excludes the
request id, so subscriptions were never duplicated by this and only the
address events are sent to was wrong.

Fixes #847

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 4.8 committed 2026-07-23 22:49:04 +00:00
1 parent 5e0ab3423f
commit 4a9c241eee
3 files changed
+94 -3

No files matched your search

+18
View File
@@ -114,6 +114,24 @@ export class Address {
return `${this.type}:${this.id}` as const;
}
/**
* Returns this address with any request id removed
*
* A request id identifies one request in flight and is set on the
* source address of a request so that its response can be matched back
* up with it. It is meaningless on anything else, so an address taken
* from a request has to be stripped of it before it is used as the
* destination of an event.
*
* @returns this address without a request id.
*/
withoutRequestId() {
if (this.requestId === undefined) {
return this;
}
return new Address(this.type, this.id);
}
/**
* Returns true if this address targets the given destination
* @param dst - Destination to check