Skip to content

Revolt adapter: broken for self-hosted instances + group mentions silently ignored #991

@stoicforgeio

Description

@stoicforgeio

Description

Related: #973 (rustls CryptoProvider panic was fixed in 320d059, but the remaining issues below are still open)

Bugs

1. api_url config field is ignored

channel_bridge.rs line ~1460 calls RevoltAdapter::new(token) which uses the hardcoded default https://api.revolt.chat. The api_url from RevoltConfig is never passed through. Should use RevoltAdapter::with_urls() instead.

2. No ws_url config field

RevoltConfig has api_url but no ws_url. The WebSocket URL is hardcoded to wss://ws.revolt.chat. Self-hosted instances need to configure both.

3. Group chat @mentions are silently dropped

parse_revolt_message() doesn't set metadata["was_mentioned"]. The bridge checks this field when group_policy=mention_only (the default), so all group messages — including direct @mentions — are ignored.

Expected Behavior

Fix: check the mentions array from Revolt's WebSocket payload for the bot's user ID:

let was_mentioned = data
    .get("mentions")
    .and_then(|m| m.as_array())
    .map(|arr| arr.iter().any(|v| v.as_str() == Some(bot_user_id)))
    .unwrap_or(false);
metadata.insert("was_mentioned".to_string(), serde_json::Value::Bool(was_mentioned));

Steps to Reproduce

Bugs 1 + 2 (self-hosted)

  1. Set up a self-hosted Revolt instance (e.g. https://chat.example.com)
  2. Create a bot and copy its token
  3. Configure OpenFang:
[channels.revolt]
api_url = "https://chat.example.com/api"
ws_url = "wss://chat.example.com/ws"
bot_token_env = "REVOLT_BOT_TOKEN"
default_agent = "assistant"
  1. Set the token: export REVOLT_BOT_TOKEN="your-self-hosted-bot-token"
  2. Start OpenFang — the daemon logs Revolt authentication failed 401 Unauthorized because it authenticates against the hardcoded https://api.revolt.chat instead of your configured api_url. The self-hosted bot token is invalid on the public API.
  3. Even if api_url were fixed, the WebSocket would still connect to the hardcoded wss://ws.revolt.chat — self-hosted instances typically serve the Bonfire WebSocket at a different URL (e.g. wss://chat.example.com/ws), and there's no ws_url config field to set it.

Bug 3 (any Revolt instance, including public)

  1. Get a working Revolt bot connected (using the public API, where bugs 1+2 don't apply)
  2. Add the bot to a server/group channel
  3. Send @BotName hello in the group channel
  4. The bot does not respond — logs show: Ignoring group message on revolt (group_policy=mention_only, not mentioned)
  5. The Revolt WebSocket payload includes "mentions":["<bot_user_id>"] but parse_revolt_message() never reads this field or sets metadata["was_mentioned"], so the bridge drops it

OpenFang Version

0.5.5

Operating System

Linux (x86_64)

Logs / Screenshots

Note Cargo.toml reports
0.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions