v0.3.1: DingTalk gateway still panics on stream SDK reconnect (send on closed channel, client.go:161)
The same panic reported in #973 is still reproducible on picoclaw v0.3.1 (commit 2cf030d2) with the upstream `dingtalk-stream-sdk-go` v0.9.1 pin in go.mod.
Reproduction
- Date: 2026-09-20 10:46:26 CST
- picoclaw: v0.3.1 (commit 2cf030d2)
- Channel: DingTalk (Stream Mode), Feishu unaffected
- Trigger: server-side WebSocket drop on the long-lived stream connection; SDK reconnect path panics
``` ERR dingtalk github.com/open-dingtalk/[email protected]/client/client.go:160
connection process read message error: ... use of closed network connection systemd[1]: Stopping picoclaw-gateway.service → Stopped → Started (Restart=on-failure) ```
Panic stack is identical to #973 — `processLoop.func6` at `client.go:161` panics with `send on closed channel`. After systemd restart the SDK reconnects cleanly (`[client ready]` + `[event-dispatch is ready]`), so the symptom is masked, but the root cause hasn't moved since the original report in March 2026.
Why this still matters
picoclaw already wraps several long-running goroutines with `panic recovered` (PTY read / pipe read / cmd.Wait — visible in binary strings). Adding the same `defer recover()` guard around `streamClient.Start()` in `pkg/channels/dingtalk/dingtalk.go` would convert this SDK-internal panic into a logged reconnect — no upstream SDK change required.
Two low-cost fixes, in order of effort:
- Bump `github.com/open-dingtalk/dingtalk-stream-sdk-go` in go.mod. v0.9.1 is the pin that's been there since #973; newer releases may have fixed the closed-channel send in `processLoop`.
- Wrap SDK goroutines with `defer recover()` in `pkg/channels/dingtalk/dingtalk.go` Start() — same pattern already used elsewhere in picoclaw for other channel SDKs.
Without one of these, every user running picoclaw without `Restart=on-failure` (foreground sessions, supervisors without auto-restart, container init systems that don't restart on non-zero exit) silently loses the DingTalk channel until manual intervention.
Willing to test
Happy to run a patch from a maintainer against v0.3.1 + go1.24 and report back.
cc @nikolasdehor from #973 — root cause analysis there was spot-on.
Source: sipeed/picoclaw