Skip to content

refactor!: move the Discord integration out of the workspace - #2417

Closed
gold-silver-copper wants to merge 4 commits into
mainfrom
chore/move-discord-bot-out-of-workspace
Closed

refactor!: move the Discord integration out of the workspace#2417
gold-silver-copper wants to merge 4 commits into
mainfrom
chore/move-discord-bot-out-of-workspace

Conversation

@gold-silver-copper

Copy link
Copy Markdown
Contributor

Why

The four open rustls-webpki 0.102.8 advisories — a reachable CRL-parsing panic plus three name-constraint/CRL-authority weaknesses — are reached only through rig-agent's optional discord-bot feature:

rustls-webpki 0.102.8 ← rustls 0.22.4 ← tokio-rustls 0.25 ← tokio-tungstenite 0.21
                                          ← serenity 0.12.5 ← rig-agent (feature "discord-bot")

serenity 0.12.5 is the newest published release and hard-pins tokio-tungstenite = "0.21.0", so no version bump reaches a patched rustls. The alternatives were switching serenity to its native-TLS backend (drops the advisories, but drags openssl into every --all-features build and keeps us married to a stale crate) or deleting the integration outright. This does neither: it keeps the demo and gets the graph out of the published crates.

What changed

  • Removed rig's discord-bot feature, rig-agent's discord-bot feature, and rig_agent::integrations::discord_bot (DiscordExt, DiscordBotError), plus the workspace serenity dependency and the fixture entry in tests/fixtures/tool_facade.
  • Moved the module verbatim into examples/discord_bot/src/discord_bot.rs. That crate now depends on serenity directly, declares its own [workspace], and is in the root exclude list, so its lockfile is separate (and gitignored — no point tracking a lock full of unpatchable pins).
  • Incidental trims that came with the move: the unused DiscordExt::into_discord_bot_from_env default method and the DiscordBotError::MissingToken variant it fed.
  • MIGRATING.md (0.41 → next) documents the break and the copy-this-file path for anyone who was using DiscordExt; examples/README.md notes the different run command.

serenity, tokio-tungstenite 0.21, rustls 0.22 and rustls-webpki 0.102.8 are gone from the workspace Cargo.lock — the only remaining rustls-webpki is the patched 0.103.x on the default reqwest path.

Breaking

Per rig's no-backcompat policy there is no shim. rig = { features = ["discord-bot"] } no longer resolves, and rig::integrations::discord_bot is gone. The integration is ~230 lines over the public Agent API — copy examples/discord_bot/src/discord_bot.rs and depend on serenity directly.

Tradeoff worth flagging

The example leaves CI's workspace build, so it is no longer compile-checked there. Run it with cargo run --manifest-path examples/discord_bot/Cargo.toml.

Verification

  • cargo check --workspace --all-features --all-targets — clean
  • cargo clippy --workspace --all-features --all-targets — no warnings
  • cargo test --features facade-build-tests --test tool_facade_features — passes
  • cargo clippy --manifest-path examples/discord_bot/Cargo.toml --all-targets — clean
  • cargo fmt --all --check — clean

…rkspace

Mechanical ownership fixes: drop the per-hook-iteration RequestPatch clone,
per-row String clones used only to index JSON maps (lancedb), a
loop-invariant table-name clone (surrealdb), a per-tool schema clone
(gemini-grpc), clone-to-format allocations (agent tool), borrowed-Value
deserialization where no serde-policy wall applies (message.rs, candle),
and eager default/error construction (unwrap_or/ok_or -> *_else).
Both public items have zero implementors, constructors, or consumers
anywhere in the workspace, tests, or examples. Documented in the
CHANGELOG Unreleased 'Removed' section with migration recipes.
`serenity` 0.12.5 is the newest published release and pins `rustls` 0.22,
whose `rustls-webpki` 0.102.8 carries four unpatched advisories: a reachable
CRL-parsing panic and three name-constraint/CRL-authority weaknesses. There is
no version to bump to, and the only in-tree reason that graph exists is the
optional `discord-bot` feature — a ~230-line wrapper over the public `Agent`
API behind a demo.

Remove `rig`'s and rig-agent's `discord-bot` features along with
`rig_agent::integrations::discord_bot`, and move the code verbatim into
`examples/discord_bot`, which now depends on `serenity` directly, is excluded
from the workspace, and carries its own (gitignored) lockfile. `serenity`,
`tokio-tungstenite` 0.21, `rustls` 0.22 and `rustls-webpki` 0.102.8 are gone
from the workspace `Cargo.lock`; the remaining `rustls-webpki` is the patched
0.103.x on the default reqwest path.

Two incidental trims came with the move: `into_discord_bot_from_env` and the
`DiscordBotError::MissingToken` variant it fed, both unused by the example.

The example is built on demand
(`cargo run --manifest-path examples/discord_bot/Cargo.toml`) and is no longer
covered by CI's workspace build.
@gold-silver-copper

Copy link
Copy Markdown
Contributor Author

Recreated off latest main as a single commit — the branch was cut before #2416 landed, so this PR carried its already-merged commits.

@gold-silver-copper
gold-silver-copper deleted the chore/move-discord-bot-out-of-workspace branch August 24, 2026 20:20
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.

1 participant