Per-guild puppet allocation & multiplexing #46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Roadmap: Stage 3 of the path to hosted bridging (see #43). The load-bearing refactor for sharing one bot pool across many Discord servers.
A single Discord bot maintains an independent voice gateway connection per guild, so one bot can sit in voice in many guilds at once (this is how public music bots scale). Our code doesn't exploit this:
PuppetSlot.busyis a process-globalAtomicBool(crates/discord/src/puppet.rs:202) with no guild qualifier, andChannelCtxcarries a singleguild_id/channel_id. So if one guild's channel claims all N bots, every other guild starves — an artificial cap imposed by our allocator, not by Discord.The SDK layer is already capable: each bot's songbird manager keys Calls by guild (
manager.get_or_insert(guild_id)), so concurrent per-guild Calls are standard.Scope:
(bot, guild): replace the globalbusyflag with per-guild assignment state. Contained to the allocator + tests — moderate.Spike the per-guild concurrent capture first to de-risk before committing to (b). Precondition for multi-tenant hosting (#43). See the "multi-guild scaling finding" in
docs/nether-voicebridge-public-instance-feasibility.md.Code shipped in v0.3.0-alpha.5 — allocation unit is now
(bot, guild): sessions/health keyed under the alloc lock, a per-guildGuildConncommand loop per bot, same-guild-only steals; 34 tests cover the allocator including the steal paths. The same-guild live regression passed (multi-hour prod call, no allocation misbehavior), and alpha.5→alpha.7 have been running on it in prod since.Leaving open for the one unproven claim — the actual cross-guild multiplexing (one bot holding live voice in two guilds at once). The live spike needs a bot invited to a second guild with humans on both sides; scheduled to run today. Will close on a passing spike.
Cross-guild multiplexing live test — PASSED (2026-07-05)
The last unproven #46 claim — one bot holding live Discord voice in two guilds simultaneously — is now verified live on prod (v0.3.0-alpha.7, no code changes).
Setup: tenant bridge via the #45 SIGHUP path — "Multiguild Test": Discord
Auto Test 01(guild1523348036040790087) ↔!iICkB3Qu8tQemzFqDl:nether.im(unencrypted, auto-detected). Pool bot idx 0 ("Voice Bridge 01") was the ONLY bot invited to guild 2, so allocation had to land on the same bot serving guild 1 (1217620951211049080, Purple Voice).Evidence (journal, UTC):
idx=0, two guilds, concurrent capture anchors for ~12 minutes (both bridges voicetick-healthy through 17:55+).puppet left voice and released/released puppet/dropped unexpectedly/rejoin failed/BecomeAnchor with no engagement/no puppet availablelines across the whole window (17:43 → 17:55), confirmed by a live log watchdog and a full-journal sweep.frames_in=250 frames_out=500 jitter_dropped=0), no puppet release, guild-1 session untouched —release_in_one_guild_preserves_other_guild_sessionsemantics observed live.No steals occurred (single-bot guild 2 by design), so nothing to add to #24.
Closing — #46 is fully proven: same-guild regression (alpha.5) + cross-guild multiplexing (this test).