Repository navigation
fix(feishu): cancel unread streaming-card error bodies before release - #117312
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 6:29 AM ET / 10:29 UTC. ClawSweeper reviewWhat this changesThe branch cancels unread non-success Feishu streaming-card response bodies before releasing the guarded HTTP dispatcher, and adds loopback regression coverage for token, card-create, and close failures. Merge readinessThe PR is still necessary: current Priority: P2 Review scores
Verification
How this fits togetherFeishu streaming cards request tenant tokens and CardKit mutations through OpenClaw’s SSRF-guarded HTTP transport. Each request either reads a successful JSON response or exits through cleanup; that cleanup determines whether its pinned dispatcher can close without waiting for the destroy timeout. flowchart LR
A[Streaming card operation] --> B[Guarded Feishu request]
B --> C[HTTP response]
C --> D{Successful response?}
D -->|Yes| E[Read JSON response]
D -->|No| F[Cancel unread body]
E --> G[Release dispatcher]
F --> G
G --> H[Continue or report failure]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +151. Total +163 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge this narrow Feishu-local repair once the exact-head checks finish, retaining the shared cancellation helper and real guarded-transport regression coverage. Do we have a high-confidence way to reproduce the issue? Yes—current source provides a high-confidence path: a non-2xx token, card-create, or CardKit mutation response throws before the body reader, then the finally block releases the dispatcher. The branch’s loopback test exercises those paths through the real guarded transport. Is this the best way to solve the issue? Yes. Cancelling at the three owner-level throw sites preserves normal response decoding, covers all CardKit callers through the shared helper, and matches the guarded dispatcher lifecycle rather than adding a downstream timeout or fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b6b440d07680. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
dbf68e4 to
e775d58
Compare
e775d58 to
77d9f0c
Compare
|
Maintainer independently ran the identical actual production The existing Google Chat transport uses the same non-awaited body cancellation before guarded dispatcher release; installed Undici explicitly requires consuming or cancelling response bodies. Awaiting cancellation is intentionally avoided because debug-capture teeing can deadlock. Focused real-HTTP and existing owner regressions: |
|
Merged via squash.
|
* origin/main: (22 commits) refactor(ui): consolidate cron form control rendering (#117576) fix(memory): recover restored session freshness (#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (#117579) fix(perf): separate warm and first-device health probes (#117525) fix(ci): repair plugin prerelease validation (#117562) fix(tasks): sanitize every human task and flow detail (#117568) fix(feishu): cancel unread streaming-card error bodies before release (#117312) fix(status): honor explicit local RPC fallback timeouts (#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (#117554) refactor: consolidate full release child workflows (#117385) refactor(policy): centralize doctor health-check descriptors (#117578) perf(gateway): mark recovery before model preparation (#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (#117557) fix(googlechat): drop invalid thread resource names before send (#108324) test(ui): cover bounded realtime Talk entries fix(ui): bound realtime Talk conversation text test(ui): cover reentrant Talk meter cleanup ...
* origin/main: fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578)
* origin/main: (28 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) ...
* origin/main: (53 commits) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) test(ui): cover reentrant Talk meter cleanup fix(plugins): fail blocked enable commands (openclaw#117536) fix(ui): reclaim reentrant Talk audio meters ...
* origin/main: (22 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) test(ui): cover bounded realtime Talk entries fix(ui): bound realtime Talk conversation text test(ui): cover reentrant Talk meter cleanup ...
* origin/main: fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578)
* origin/main: (28 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) ...
* origin/main: (53 commits) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) test(ui): cover reentrant Talk meter cleanup fix(plugins): fail blocked enable commands (openclaw#117536) fix(ui): reclaim reentrant Talk audio meters ...
Summary
Cancel unread Feishu streaming-card error response bodies before releasing the SSRF-guarded dispatcher, so rejected token/create/close requests do not leave connections dangling until the dispatcher-destroy backstop fires.
What Problem This Solves
extensions/feishu/src/streaming-card.tsissues guarded CardKit requests on every streaming message: tenant-token fetch (getToken, :186), card creation (:341), and every update/close viaassertSuccessfulCardKitResponse(:145, reused by update, replace, note, and close paths).On a non-2xx response all three sites throw before reading the body, and the
finallyblock only awaitsrelease().release()closes the dispatcher, which cannot cleanly close while a response body is still unread — the connection dangles until the destroy backstop (100ms) force-kills it. Streaming cards issue these requests per message update, so a Feishu outage or expired app credential turns every streaming reply into a series of dangling connections. This is the same shape as the Google Chat auth transport fix in #115873.Code evidence:
streaming-card.ts:186and:341threw on!response.okwith the body untouched;assertSuccessfulCardKitResponse(:145) did the same for all four CardKit mutation paths.Root Cause
release(); the status guards broke that ordering on exactly the paths where the body is never read.Why This Fix
cancelUnreadResponseBody(response)(if (!response.bodyUsed) { void response.body?.cancel().catch(() => undefined); }) at the three throw sites — byte-for-byte the pattern established by fix(googlechat): cancel unread auth response bodies before release #115873 for the same guard contract.User Impact
Evidence
Real Behavior Proof
Before (on main)
$ node --import tsx proof.mjs caught: Token request failed with HTTP 500 server_chunks_sent=11 socket_alive_ms=-1 FAIL: unread error body left the connection dangling until the dispatcher-destroy backstopAfter (with fix)
Tests and Validation
pnpm checkpassedextensions/feishu/src/streaming-card.error-release.test.ts: drives the real guarded transport against a loopback server and asserts every error path reachesrelease()with the body consumed/cancelled — covers token, create, and close-settings rejections; all 26 pre-existing streaming-card cases still passFeishuStreamingSessioncode path; no external services involved