Skip to content

chore(deps): bump oapi-sdk-go to v3.12.2 to detect dead websocket connections - #2825

Open
dethan3 wants to merge 2 commits into
larksuite:mainfrom
dethan3:deps/oapi-sdk-go-v3.12.2
Open

dethan3 wants to merge 2 commits into
larksuite:mainfrom
dethan3:deps/oapi-sdk-go-v3.12.2

Conversation

@dethan3

@dethan3 dethan3 commented Oct 16, 2026 •

Copy link
Copy Markdown

Summary

lark-cli event consume can stay "connected" while receiving no events after a half-open websocket. oapi-sdk-go v3.7.2 sends pings but sets no read deadline or pong timeout, so the read loop blocks forever and never reconnects. Observed on 2026-10-16: the bus log showed no disconnect, yet zero events for about 70 minutes. Abnormal 1006 closes behind a local egress proxy looked similar to #2358.

The SDK fix is larksuite/oapi-sdk-go#224, merged in larksuite/oapi-sdk-go#244 (v3.11.0). This takes v3.12.2.

Changes

  • Bump github.com/larksuite/oapi-sdk-go/v3 from v3.7.2 to v3.12.2.
  • v3.12.2 no longer uses http.DefaultClient for websocket endpoint bootstrap. Pass the CLI's pinned client via larkws.WithHttpClient so proxy and platform policy still apply (event consume, event subscribe, mail watch).
  • Record the SDK packages newly linked into the binary.

Test Plan

  • go build ./...
  • go vet ./...
  • gofmt -l . clean
  • go test -count=1 -timeout=8m ./internal/... (80 packages, 0 failed)
  • golangci-lint v2.1.6 --new-from-rev=upstream/main and lintcheck against upstream/main
  • A binary built with the SDK bump has been running in production

Related Issues

Summary by CodeRabbit

  • Bug Fixes
    • Improved Lark WebSocket connections by consistently using the configured HTTP client for their bootstrap requests.
  • Chores
    • Updated the Lark Suite SDK to a newer version.

cursoragent and others added 2 commits October 16, 2026 06:17
v3.7.2 sends websocket pings but sets no read deadline, so a half-open
connection leaves event consume blocked with no reconnect. The pong
timeout landed in v3.11.0 (larksuite/oapi-sdk-go#244); take v3.12.2.

Co-authored-by: dEthan3 <iimsyw@gmail.com>
oapi-sdk-go v3.12.2 builds a private http.Client for endpoint bootstrap,
so the CLI bridge on the init-captured client never saw those requests.
Pass that client via larkws.WithHttpClient from every websocket constructor.
Tests use the same pointer: it is the production path, and it stays pinned
when http.DefaultClient is replaced.

Record the SDK packages newly linked into the binary.

Co-authored-by: dEthan3 <iimsyw@gmail.com>
@dethan3
dethan3 requested a review from liangshuo-1 as a code owner October 16, 2026 06:44
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added domain/mail PR touches the mail domain size/L Large or sensitive change across domains or core paths labels Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3101a96f-8efc-40b2-97fc-ab608ca864d9
📥 Commits

Reviewing files that changed from the base of the PR and between 017b19a and ef7711b.

⛔ Files ignored due to path filters: 1
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing: 9
  • go.mod
  • internal/event/adapter/lark/websocket/feishu.go
  • internal/qualitygate/deptest/testdata/import-surface-darwin.txt
  • internal/qualitygate/deptest/testdata/import-surface-linux.txt
  • internal/qualitygate/deptest/testdata/import-surface-windows.txt
  • internal/transport/default_client.go
  • internal/transport/extension_test.go
  • shortcuts/event/subscribe.go
  • shortcuts/mail/mail_watch.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The Lark SDK dependency is upgraded. The transport package exposes its captured bootstrap HTTP client, and the Feishu, event subscription, and mail watch WebSocket clients pass that client to the SDK.

Changes: Lark WebSocket bootstrap client

Layer / File(s) Summary
SDK version and import surface
go.mod, internal/qualitygate/deptest/testdata/import-surface-*.txt
The Lark SDK dependency changes from v3.7.2 to v3.12.2. The Darwin, Linux, and Windows import-surface lists add SDK package entries.
Expose and test the bootstrap client
internal/transport/default_client.go, internal/transport/extension_test.go
The transport package exposes the HTTP client captured from http.DefaultClient. Documentation and WebSocket bootstrap tests use that client with larkws.WithHttpClient.
Configure WebSocket clients
internal/event/adapter/lark/websocket/feishu.go, shortcuts/event/subscribe.go, shortcuts/mail/mail_watch.go
The Feishu, event subscription, and mail watch WebSocket clients pass transport.SDKBootstrapHTTPClient() to the SDK.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to ef771

The upgrade preserves dead-WebSocket detection and reconnect handling while routing bootstrap requests through the CLI's configured HTTP transport. No concrete behavior regression is evident, so the change appears ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. (4 skipped: 4… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the dependency upgrade and its primary purpose: detecting dead WebSocket connections.
Description check Passed The description includes all required sections. It explains the motivation, lists the dependency and HTTP-client changes, documents test results, and references related issues.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. (4 skipped: 4 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

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

Labels

domain/mail PR touches the mail domain size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants