f788ea070b4b

diag: log start/end of CREATE_VAULT_FROM_ROOT_KEY handler and the popup-side sendMessage call so we can see whether the SW is replying with undefined (no listener) vs a real error vs a thrown sync exception. (v4.3.17)

time
2026-07-28 18:06 UTC · 3 months ago
machine
koh2
agent
claude-MiniMax-M3
session
sync red indicator port from browser
parent
22bd36b49aa2
2 files src/background/messages.ts+8 −0src/background/relay-adoption-source-bg.ts+2 −0
src/background/messages.ts+8 −0
@@ -322,21 +322,29 @@322322         return { ok: true };323323       }324324       case "CREATE_VAULT_FROM_ROOT_KEY": {325+        console.log("[Peach diag] CREATE_VAULT_FROM_ROOT_KEY handler entered");325326         const { password, rootKeyHex } = (msg.payload ?? {}) as {326327           password?: unknown;327328           rootKeyHex?: unknown;328329         };330+        console.log("[Peach diag] payload types:", typeof password, typeof rootKeyHex, "lengths:", (password as string)?.length, (rootKeyHex as string)?.length);329331         if (typeof password !== "string" || password.length === 0 || typeof rootKeyHex !== "string") {332+          console.log("[Peach diag] payload invalid, returning invalid_payload");330333           return { ok: false, error: "invalid_payload" };331334         }332335 333336         try {337+          console.log("[Peach diag] calling vault.createVaultFromRootKey");334338           const { vaultId } = await vault.createVaultFromRootKey(password, rootKeyHex);339+          console.log("[Peach diag] createVaultFromRootKey returned vaultId", vaultId);335340           await setupAutoLock();341+          console.log("[Peach diag] setupAutoLock done");336342           broadcastToContentScripts({ type: "VAULT_UNLOCKED" });337343           onVaultUnlocked();344+          console.log("[Peach diag] handler completing successfully");338345           return { ok: true, vaultId };339346         } catch (err) {347+          console.error("[Peach diag] handler caught error:", err);340348           return { ok: false, error: err instanceof Error ? err.message : String(err) };341349         }342350       }

view file

src/background/relay-adoption-source-bg.ts+2 −0
@@ -322,10 +322,12 @@322322         return true;323323       },324324       async createVaultFromRootKey(rootKeyHex) {325+        console.log("[Peach diag] sendMessage CREATE_VAULT_FROM_ROOT_KEY starting");325326         const response = (await chrome.runtime.sendMessage({326327           type: "CREATE_VAULT_FROM_ROOT_KEY",327328           payload: { password, rootKeyHex },328329         })) as { ok: boolean; data?: { vaultId?: string }; error?: string } | undefined;330+        console.log("[Peach diag] sendMessage CREATE_VAULT_FROM_ROOT_KEY returned:", response);329331         if (!response) {330332           throw new Error("create_vault_no_response");331333         }

view file