fix(hermes/marmot): accept npub welcomer ids and stop wiping the allowlist#840
fix(hermes/marmot): accept npub welcomer ids and stop wiping the allowlist#840jooray wants to merge 1 commit into
Conversation
…wlist
The installer documents --allow-welcomer npub1... and configure_gateway
writes it verbatim, but normalize_welcomer_id() only lowercased/stripped
and never decoded bech32 npub -> hex. sync_allowlist() then filtered the
npub out of its desired set, so 'want' came out empty and the reconcile
loop *removed every existing entry* on each connect. Net effect: an
npub-configured welcomer never works and the agent declines all group
welcomes ('leaves immediately').
- normalize_welcomer_id() now decodes npub1... to hex (self-contained
pure-Python bech32 decode, no new deps), matching the installer's
documented interface.
- sync_allowlist() no longer removes existing entries when every desired
entry failed to parse, and logs the dropped entries instead of silently
discarding them.
Adds tests for npub normalization, npub-in-desired sync, and the
no-wipe-on-parse-failure guard.
Fixes marmot-protocol#837
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Ready to review this PR? Stage has broken it down into 3 individual chapters for you:
Chapters generated by Stage for commit 697e36d on Jul 12, 2026 9:43pm UTC. |
Fixes #837.
install-hermes-marmot.shdocuments--allow-welcomer npub1...andhermes_marmot_configure_gateway.pywrites the value verbatim intoplatforms.marmot.extra.welcomer_allowlist. But at runtimenormalize_welcomer_id()only didstr(entry).strip().lower().removeprefix("0x")— it never decoded bech32 npub → hex.sync_allowlist()then filtered the npub out of its hex-onlywantset, sowantcame out empty, and the reconcile loop removed every existing entry from wn-agent's allowlist on each connect.Net effect with an npub configured: the welcomer list is emptied on every connect, so the agent declines all group welcomes and "leaves immediately"; any manually added hex id is also wiped on the next restart.
Changes
normalize_welcomer_id()decodesnpub1...→ hex via a self-contained pure-Python bech32 decoder (no new dependencies), so npub inputs from config/env/installer all work. Non-npub input is returned lowercased for the caller's existing hex check.sync_allowlist()no longer removes existing entries when every desired entry failed to parse (a genuinely empty desired list still clears the allowlist as before), and logs dropped/unparseable entries instead of discarding them silently.Tests — added to
WelcomerAllowlistTests: npub → hex normalization, npub-in-desiredsync adds the decoded hex, and the no-wipe-on-parse-failure guard. Fulltest_adapter.py(85 tests) andtest_configure_gateway.pypass.Verified on a live deployment: switching the configured welcomer to hex (equivalent to decoding the npub) makes the allowlist persist across restarts and the agent accept group invites.