Skip to content

fix(discord): widen slash-sync timeout to 600s under rate-limit pressure (#16713) - #17029

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-6706a857
Apr 28, 2026
Merged

teknium1 merged 1 commit into
mainfrom
hermes/hermes-6706a857

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

Bumps the outer asyncio.wait_for around _safe_sync_slash_commands from 30 s to 600 s so mass-prune-plus-upsert reconciles drain under Discord's ~5-writes/20-s command-management bucket. The 600 s cap still guards against a true hang.

Root cause: flat 30 s budget. A 107-write reconcile (77 orphans + 30 desired, from the bug report) needs several minutes of forced rate-limit waits to finish; the old budget cancelled mid-loop, subsequent reconnects inside the cooldown also timed out, and slash commands stayed broken for ~60 min until the bucket fully recovered.

Simpler alternative to #16739's plan/execute split + write-count-derived budget — the 600 s ceiling is the only load-bearing number.

Changes

  • gateway/platforms/discord.py _run_post_connect_initialization: timeout 30 → 600, warning message updated to point at saturated bucket.

Validation

Before After
107-write reconcile under bucket pressure cancelled at 30 s, ~60 min outage drains in ~7 min, no outage
True hang detected at 30 s detected at 600 s (still bounded)
tests/gateway/test_discord_connect.py 11 passed 11 passed

Credit: @Tranquil-Flow (PR #16739) and @davidbordenwi (issue #16713 bucket-math diagnosis).

Closes #16713.

…ure (#16713)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR #16739 and @davidbordenwi for reporting
#16713 with the bucket-math diagnosis.

Closes #16713.
@github-actions

Copy link
Copy Markdown
Contributor

🚨 CRITICAL Supply Chain Risk Detected

This PR contains a pattern that has been used in real supply chain attacks. A maintainer must review the flagged code carefully before merging.

🚨 CRITICAL: Install-hook file added or modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Scanner only fires on high-signal indicators: .pth files, base64+exec/eval combos, subprocess with encoded commands, or install-hook files. Low-signal warnings were removed intentionally — if you're seeing this comment, the finding is worth inspecting.

@teknium1
teknium1 merged commit e0f5d39 into main Apr 28, 2026
10 of 12 checks passed
@teknium1
teknium1 deleted the hermes/hermes-6706a857 branch April 28, 2026 14:02
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/discord Discord bot adapter comp/gateway Gateway runner, session dispatch, delivery labels Apr 28, 2026
cluricaun28 referenced this pull request in cluricaun28/Logos Apr 28, 2026
…ure (#16713) (#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR #16739 and @davidbordenwi for reporting
#16713 with the bucket-math diagnosis.

Closes #16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
donald131 pushed a commit to donald131/hermes-agent that referenced this pull request May 2, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
@bgmbgm94

bgmbgm94 commented May 4, 2026

Copy link
Copy Markdown

Sharing a related data point from a Windows Discord gateway deployment.

We saw intermittent Discord send 429 pressure around long/chunked replies. A local mitigation that helped was pacing outbound Discord channel.send(...) calls with a small await asyncio.sleep(0.5) before chunk sends and before the plain-text fallback resend path.

This did not look related to a separate silent Process exited with code 0 investigation, but it did reduce burst pressure during Discord replies. If this area is revisited, a configurable Discord send throttle / adapter pacing helper might be worth considering, similar in spirit to this slash-sync rate-limit budget work.

02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
Seven74AI pushed a commit to Seven74AI/hermes-agent that referenced this pull request Jun 13, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
prmartinow pushed a commit to prmartinow/hermes-agent that referenced this pull request Aug 26, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
…ure (NousResearch#16713) (NousResearch#17029)

Discord's per-app command-management bucket is ~5 writes / 20 s. A
mass-prune-plus-upsert reconcile (77 orphans + 30 desired = 107 writes
in the reported case) can't finish under the old flat 30 s budget, and
the subsequent reconnect retries inside the rate-limit cooldown also
time out — leaving slash commands broken for ~60 min until the bucket
fully recovers.

Bump the timeout to 600 s so realistic bursts drain, update the warning
message to point at the saturated bucket instead of a hardcoded 30 s.
The 600 s cap still guards against a true hang.

Credit to @Tranquil-Flow for PR NousResearch#16739 and @davidbordenwi for reporting
NousResearch#16713 with the bucket-math diagnosis.

Closes NousResearch#16713.

Co-authored-by: Teknium <teknium@nousresearch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/discord Discord bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_safe_sync_slash_commands times out under post-prune rate-limit pressure (30s budget too tight)

3 participants