From b539233e345183b87cf49cf227f4da37ab4138f4 Mon Sep 17 00:00:00 2001 From: Glenn Gore Date: Tue, 4 Aug 2026 10:38:37 +0200 Subject: [PATCH] feat(inbound): log every message that arrives, and on which inbox Two inboxes run in parallel -- the worker (authenticated as the VTA DID) and the approver (a distinct did:key) -- and the mediator routes inbound by the authenticating DID. Nothing logged an arrival on either, so a message delivered to the wrong inbox and a message never sent at all produced identical console output: none. That ambiguity cost real time. Chasing "the approver is never prompted" came down to proving a negative in the extension while the sender insisted it had pushed correctly; the console could not distinguish "nothing arrived" from "arrived and was mishandled". Log type, id, from and to at the top of the handler, before anything can drop the message, tagged with which inbox received it. `to` is the field that matters: a task-consent/request is addressed to the approver DID, so seeing one land on the worker inbox is a routing bug rather than a missing message -- previously indistinguishable. Logging only; no behaviour change. Signed-off-by: Glenn Gore --- packages/extension/src/offscreen.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/extension/src/offscreen.ts b/packages/extension/src/offscreen.ts index dd7558b..6372359 100644 --- a/packages/extension/src/offscreen.ts +++ b/packages/extension/src/offscreen.ts @@ -1704,6 +1704,24 @@ async function onInboundMessage( isApprover = false, ): Promise { const id = typeof message.id === "string" ? message.id : undefined; + // First thing, before any handling can drop it. Two inboxes run in parallel + // (worker + approver) and the mediator routes by the authenticating DID, so + // "did anything arrive, on which inbox, addressed to whom" was previously + // unanswerable from the console — a request delivered to the worker session + // and a request never sent at all produced identical output: none. + // + // `to` is logged because that is the field that distinguishes them: a + // `task-consent/request` is addressed to the approver DID, and seeing it + // arrive on the worker inbox would be a routing bug rather than a missing + // message. + console.info( + "[pnm inbound] received", + isApprover ? "(approver inbox)" : "(worker inbox)", + "type=", message.type, + "id=", id ?? "(none)", + "from=", message.from, + "to=", message.to, + ); let persistError: unknown; if (id) { try {