From b08daadbdcc6cdd60c2c08561e96e5fb73214244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Sat, 2 May 2026 21:11:55 +0100 Subject: [PATCH] fix(broker): topic_create no longer rejects on creator-seal failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bad ed25519 pubkey on the creator member (legacy data) made sealTopicKeyForMember throw, which propagated up through createTopic and made the WS topic_create handler never send a topic_created frame. CLI saw a 5s timeout and printed 'topic create failed'. Wraps the seal call in try/catch — topic creation succeeds even if no copy gets sealed for the creator. They'll see GET /v1/topics/:name/key return 404 until they re-seal (or a holder does it for them via the phase-3 background loop). Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/broker/src/broker.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/broker/src/broker.ts b/apps/broker/src/broker.ts index c15acd8..a5eefd4 100644 --- a/apps/broker/src/broker.ts +++ b/apps/broker/src/broker.ts @@ -593,13 +593,23 @@ export async function createTopic(args: { if (!row) throw new Error("failed to create topic"); // Seal a copy for the creator immediately. Other members get sealed - // copies as they join via joinTopic(). + // copies as they join (re-seal flow). Wrap in try/catch so a seal + // failure (bad pubkey, transient DB error) doesn't roll back topic + // creation — the user can re-seal later. if (args.createdByMemberId) { - await sealTopicKeyForMember({ - topicId: row.id, - memberId: args.createdByMemberId, - bundle: topicKeyBundle, - }); + try { + await sealTopicKeyForMember({ + topicId: row.id, + memberId: args.createdByMemberId, + bundle: topicKeyBundle, + }); + } catch (err) { + // Topic exists but no key sealed for the creator. They'll get + // 404 on GET /key until another holder re-seals. Phase-3 flow + // handles this for any member, including the creator. + // Silent in-band — the topic create itself succeeded. + void err; + } } return {