Skip to content

[Bug]: Yuanbao adapter adds a fixed ~5 second delay during gateway shutdown #40383

@libo1106

Description

@libo1106

Bug Description

When running Hermes with the Yuanbao platform enabled, stopping the gateway consistently takes approximately 5 seconds even when there are no active sessions.

The shutdown sequence completes immediately for all phases except Yuanbao adapter disconnection.

Relevant logs:

INFO gateway.run: Received SIGINT as a planned gateway stop — exiting cleanly
INFO gateway.run: Stopping gateway...
INFO gateway.run: Shutdown phase: notify_active_sessions done at +0.00s
INFO gateway.run: Shutdown phase: drain done at +0.00s (drain took 0.00s, timed_out=False, active_at_start=0, active_now=0)

INFO gateway.platforms.yuanbao: [Yuanbao] Disconnected
INFO gateway.run: ✓ yuanbao disconnected (5.01s)

INFO gateway.run: Shutdown phase: all adapters disconnected at +5.02s
INFO gateway.run: Gateway stopped (total teardown 5.02s)

The shutdown delay appears to come entirely from the Yuanbao adapter disconnect path.

Steps to Reproduce

  1. Configure and start Hermes with the Yuanbao platform enabled.
  2. Ensure there are no active conversations or running tasks.
  3. Stop the gateway with SIGINT (Ctrl+C).
  4. Observe shutdown timing in logs.

Expected Behavior

Gateway shutdown should complete almost immediately when there are no active sessions or pending Yuanbao operations.

Adapter disconnect should not introduce a fixed multi-second delay.

Actual Behavior

The Yuanbao adapter consistently requires approximately 5 seconds to disconnect:

✓ yuanbao disconnected (5.01s)

As a result, total gateway teardown time is approximately 5 seconds even when the system is otherwise idle.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

Report       https://paste.rs/pNwc6
  agent.log    https://paste.rs/Pct7f
  gateway.log  https://paste.rs/llN7Q

Operating System

Debian GNU/Linux 12 (bookworm)

Python Version

3.11.2

Hermes Version

0.16.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliverytype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions