The reference-admission discard listener matched on followup()'s returned id, but an agent/inbox/enqueue listener that synchronously cancels emits agent/inbox/discard before followup() returns to assign that id. The match then missed, leaking both the submit and discard listeners plus the attached context per referenced prompt. Match on the content reference instead — the same value send() carries onto the message, known before followup() runs, and symmetric with the submit wrapper's content check. The prior "ordinary allowed path" test passed only because the fake agent returned a fixed 'stub' id that collided with the id the test constructed; it now releases each wrapper through its own allowed admission, and a new regression drives the synchronous-discard timing directly.
158 KiB
158 KiB