Skip to content

fix(feishu): add WebSocket pingTimeout and lifecycle event logging#40

Open
yyteen-bot wants to merge 1 commit into
0xranx:mainfrom
yyteen-bot:fix/feishu-ws-ping-timeout
Open

fix(feishu): add WebSocket pingTimeout and lifecycle event logging#40
yyteen-bot wants to merge 1 commit into
0xranx:mainfrom
yyteen-bot:fix/feishu-ws-ping-timeout

Conversation

@yyteen-bot

Copy link
Copy Markdown

The Feishu adapter's WSClient was created without a pingTimeout, causing the Lark SDK to never detect half-open WebSocket connections. This led to bots becoming unresponsive after idle periods (several hours) without any error logs.

The Lark SDK's pingTimeout defaults to 0 (disabled), meaning the pong watchdog is never armed. When a WebSocket connection silently drops (e.g., due to NAT timeout, firewall, or WSL network sleep), the SDK never detects it and never triggers reconnection.

Changes:

  • Add pingTimeout config option (default: 30s) to enable dead connection detection
  • Add WSClient lifecycle event callbacks for visibility into connection state
  • Fix stop() to properly close WebSocket before releasing references
  • Expose pingTimeout as configurable via golem.yaml

Fixes #28

What does this PR do?

Fixes Feishu bot becoming unresponsive after idle periods by enabling the Lark SDK's WebSocket pong watchdog (pingTimeout). Without this, half-open WebSocket connections (caused by NAT timeout, firewall, or WSL network sleep) are never detected, and the SDK never triggers reconnection.

Configuration

channels:
  feishu:
    appId: cli_xxx
    appSecret: xxx
    pingTimeout: 30  # optional, default 30s

## Type of change

- Bug fix
- New feature
- Breaking change
- Documentation update
- Refactoring
- Other (describe below)

## Checklist

- pnpm run build passes
- pnpm run test passes
- New code has tests (if applicable)
- Updated documentation (if applicable)

The Feishu adapter's WSClient was created without a pingTimeout, causing
the Lark SDK to never detect half-open WebSocket connections. This led to
bots becoming unresponsive after idle periods (several hours) without any
error logs.

The Lark SDK's pingTimeout defaults to 0 (disabled), meaning the pong
watchdog is never armed. When a WebSocket connection silently drops (e.g.,
due to NAT timeout, firewall, or WSL network sleep), the SDK never detects
it and never triggers reconnection.

Changes:
- Add pingTimeout config option (default: 30s) to enable dead connection detection
- Add WSClient lifecycle event callbacks for visibility into connection state
- Fix stop() to properly close WebSocket before releasing references
- Expose pingTimeout as configurable via golem.yaml

Fixes 0xranx#28
@0xranx

0xranx commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix direction. I landed this in main with a small adjustment: the newer Lark SDK expects pingTimeout under wsConfig, not as a top-level WSClient option.\n\nAlso bumped the SDK peer range, added adapter tests, and documented channels.feishu.pingTimeout. Released in v0.48.1.

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.

[Feature] opencode+飞书,长任务时opencode回复几条消息就不回复了,是飞书的限制还是golembot有设置?

2 participants