Skip to content

fix(hermes/marmot): accept npub welcomer ids and stop wiping the allowlist#840

Open
jooray wants to merge 1 commit into
marmot-protocol:masterfrom
jooray:fix/hermes-welcomer-npub
Open

fix(hermes/marmot): accept npub welcomer ids and stop wiping the allowlist#840
jooray wants to merge 1 commit into
marmot-protocol:masterfrom
jooray:fix/hermes-welcomer-npub

Conversation

@jooray

@jooray jooray commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #837.

install-hermes-marmot.sh documents --allow-welcomer npub1... and hermes_marmot_configure_gateway.py writes the value verbatim into platforms.marmot.extra.welcomer_allowlist. But at runtime normalize_welcomer_id() only did str(entry).strip().lower().removeprefix("0x") — it never decoded bech32 npub → hex. sync_allowlist() then filtered the npub out of its hex-only want set, so want came 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() decodes npub1... → 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-desired sync adds the decoded hex, and the no-wipe-on-parse-failure guard. Full test_adapter.py (85 tests) and test_configure_gateway.py pass.

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.


Open in Stage

…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
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jooray, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4cc78c54-ea3d-43f1-bab0-2db68de2f87a

📥 Commits

Reviewing files that changed from the base of the PR and between e391adc and 697e36d.

📒 Files selected for processing (2)
  • integrations/hermes/marmot/adapter.py
  • integrations/hermes/marmot/tests/test_adapter.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@stage-review

stage-review Bot commented Jul 12, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Implement bech32 decoding for npub identifiers
2 Prevent allowlist wiping on parse failures
3 Verify npub normalization and allowlist persistence
Open in Stage

Chapters generated by Stage for commit 697e36d on Jul 12, 2026 9:43pm UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hermes plugin: npub welcomer allowlist entries never work and silently wipe the allowlist

1 participant