Skip to content

fix(monitor): treat UND_ERR_HEADERS_TIMEOUT as soft failure in getUpdates long-poll (#75) - #7

Closed
NewFuture wants to merge 1 commit into
mainfrom
upstream/pr-187-monitor-headers-timeout
Closed

fix(monitor): treat UND_ERR_HEADERS_TIMEOUT as soft failure in getUpdates long-poll (#75)#7
NewFuture wants to merge 1 commit into
mainfrom
upstream/pr-187-monitor-headers-timeout

Conversation

@NewFuture

Copy link
Copy Markdown
Owner

Upstream source

Exact mirror of Tencent/openclaw-weixin#187 by @WilShi.

  • Original branch: WilShi/openclaw-weixin:fix/monitor-und-headers-timeout-soft-failure
  • Original base: 128dc53a000f389e7da68e1080115252e5b263dd
  • Preserved head: 49834388fd8636f5b1b730e042f4668d30742a58
  • Current target base at mirror creation: 4feec89ff2b40c93578a96f6325bdd536ad9d38e
  • Commit history and authorship are unchanged.

Upstream intent

Treat normal long-poll UND_ERR_HEADERS_TIMEOUT boundaries as soft failures instead of monitor failures.

Local review status

This focused mirror merges cleanly into the current target and its focused validation, typecheck, and build pass, but it remains a Draft until these findings are addressed:

  • the broad catch can misclassify timeout-shaped failures from downstream message processing;
  • aborting during the new retry sleep rejects the monitor instead of resolving cleanly;
  • the matcher only recognizes one wrapped Node-fetch error shape and misses direct Undici timeout errors;
  • the lower API layer already logs the timeout at ERROR before this code downgrades it;
  • the exact patch truncates existing changelog details.

Draft #5 (upstream #228) only partially mitigates the catch-scope issue and does not supersede this work. Original discussion remains on the upstream PR.

…ates long-poll (#75)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@NewFuture

Copy link
Copy Markdown
Owner Author

Review verdict: BLOCK

???? main ? head 49834388fd8636f5b1b730e042f4668d30742a58 ????????????????????????????????????? ready?

  1. ??????? getUpdates ?????????????src/monitor/monitor.ts:190-207?

    ?? try/catch ???? getUpdates???? configManager.getForUser ? processOneMessage????????????????????????? TypeError("fetch failed", { cause: { code: "UND_ERR_HEADERS_TIMEOUT" } })??????????????? getUpdates ????? continue?processOneMessage ?????????/dispatch ????????????????????????? await getUpdates(...)??? getUpdates API ???????

  2. ???? 2 ? retry sleep ? abort ?? monitor Promise ?????src/monitor/monitor.ts:206,231-241?

    sleep ? abort ? reject(new Error("aborted"))?? await sleep(...) ?? catch ??? rejection ??????? catch ????? channel stop/hot reload ?????????? rejected Promise ??????????? Error: aborted????timer ????????? abort listener??? 25 ???? sleep ??? 25 ? listener???????????/?? monitor????? settle ???? listener?????? aborted ? signal?

  3. ????????????????src/monitor/monitor.ts:203-207?

    ??????????? consecutiveFailures??? hard ? soft ? hard ? soft ? hard ???? 30 ????????????????????????????? poll ? :156 ????? changelog ????????????????????????? poll ???????

  4. ???? main ?????? debug ?????????? src/api/api.ts:412-418?

    apiPostFetch ????? fetch ???? ERROR?????? monitor????????????wrapped UND_ERR_HEADERS_TIMEOUT ?? monitor ? debug ????????? getUpdates: POST fetch failed ERROR??? getUpdates/API ?????????????? ERROR logger ????????

  5. Changelog ???????????????CHANGELOG.md:7-13?CHANGELOG.zh_CN.md:7-13?

    ????? 2.4.3 ???????????????????? 2026-05-08 ???? 2.4.3??? main/package ?? 2.4.6?????????????????? Unreleased/??????????????

Validation

  • ?? main ??????API tests 43/43 passed?typecheck passed?build passed?
  • ???? monitor ????????3/3 failed?abort rejection???????????????
  • git diff --check passed?

???? monitor ????????wrapped timeout????????retry sleep ?? abort?listener ????? hard/soft ?????

@NewFuture NewFuture closed this Aug 2, 2026
@NewFuture
NewFuture deleted the upstream/pr-187-monitor-headers-timeout branch August 3, 2026 05:12
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.

1 participant