Skip to content

fix(discord): add timeout to typing indicator HTTP request to prevent stuck loop - #64910

Closed
kyssta-exe wants to merge 2 commits into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-64874-discord-typing-timeout
Closed

kyssta-exe wants to merge 2 commits into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-64874-discord-typing-timeout

Conversation

@kyssta-exe

Copy link
Copy Markdown
Contributor

The _typing_loop in the Discord adapter makes a raw HTTP request to Discord's typing endpoint with no timeout. If the request hangs (network blip, Discord API stall, WS reconnect), the task gets stuck forever — stop_typing blocks awaiting the stuck task and the typing indicator never clears.

Wrap the request with asyncio.wait_for(..., timeout=10) so a hung call raises asyncio.TimeoutError, which the existing except Exception handler catches and logs cleanly.

Fixes #64874

Auto-Fix-Bugs Bot added 2 commits July 15, 2026 10:33
…on_id when session_key is unset

When delegate_task is dispatched from a CLI/Desktop session that lacks
an explicit session_key ContextVar, the completion event arrives with an
empty session_key — causing _session_owns_notification_event() to return
False and the result to be silently dropped as an orphan.

Since parent_session_id (the agent's durable state.db session_id) is
always captured at dispatch time, use it as a routing fallback when
session_key is empty. The TUI session's lookup key resolves to the same
agent.session_id, so the event correctly reaches its originating session.

Fixes NousResearch#64901
… stuck loop

The _typing_loop makes a raw HTTP request to Discord's typing endpoint
with no timeout. If the request hangs (network blip, Discord API stall),
the task gets stuck forever — stop_typing blocks awaiting the stuck task
and the typing indicator never clears.

Wrap the request with asyncio.wait_for(..., timeout=10) so a hung call
raises asyncio.TimeoutError, which the existing except Exception handler
catches and logs cleanly.

Fixes NousResearch#64874
@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) platform/discord Discord bot adapter P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 15, 2026
@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 16, 2026
@kyssta-exe

Copy link
Copy Markdown
Contributor Author

Closing due to merge conflicts — this PR is in CONFLICTING state and cannot be merged cleanly into main (mergeable: CONFLICTING). Per automated stale/duplicate sweep, PRs with merge conflicts are closed. Please rebase against the latest main and reopen if still relevant.

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

Labels

comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists platform/discord Discord bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Discord typing indicator gets stuck permanently when _typing_loop HTTP request hangs

3 participants