Skip to content

fix(feishu): pass timeoutMs through app-registration guarded fetch#105549

Merged
steipete merged 4 commits into
openclaw:mainfrom
hugenshen:fix/feishu-app-registration-timeout
Jul 16, 2026
Merged

fix(feishu): pass timeoutMs through app-registration guarded fetch#105549
steipete merged 4 commits into
openclaw:mainfrom
hugenshen:fix/feishu-app-registration-timeout

Conversation

@hugenshen

@hugenshen hugenshen commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Feishu/Lark scan-to-create app registration used the guarded SSRF fetch without its transport-level timeoutMs. A peer that accepted a connection but never returned response headers could therefore outlive the onboarding request budget.

This is the HTTP path behind the documented one-click app creation flow.

Why This Change Was Made

fetchFeishuJson now passes one private 10-second app-registration deadline into fetchWithSsrFGuard. That shared boundary already owns DNS preflight, the pinned Undici dispatcher, redirects, body limits, and cleanup, so a second AbortSignal.timeout path was redundant.

The test-only override stays on the internal registration fetch options. Poll expiry and poll sleep fallbacks now use their own named registration constants instead of borrowing the request timeout.

No new config, environment variable, or public SDK surface.

User Impact

Before: a stalled accounts endpoint could leave app registration or owner lookup waiting beyond the intended onboarding budget.

After: every registration JSON request has the guarded 10-second deadline, including connect and response-header waits. Timeout failures surface as TimeoutError: request timed out.

Evidence

  • Exact head: 50c08330fca02042d52f222b21d224e621c4f328
  • Production path: beginAppRegistrationpostRegistrationfetchFeishuJsonfetchWithSsrFGuard
  • Focused Testbox tbx_01kxm1sm2m7r2s8emr4hww28z4: 10/10 tests passed; a real TCP peer that withheld headers timed out in 83 ms under the shortened test deadline
  • Live network smoke on the same Testbox: real initAppRegistration calls reached Feishu in 743 ms and Lark in 1,209 ms without credentials or app creation
  • Touched-file oxfmt --check, pnpm check:test-types, and git diff --check: passed
  • Fresh autoreview: no actionable findings (0.96 confidence; changelog-only follow-up 0.99)
  • Exact-head real-behavior gate: run 29459537848
  • Maintainer coordinator: accepted the immutable same-PR green CI cohort from the last 24 hours (run 29459203417)

What was not tested: a credentialed QR scan that creates an app. The live smoke deliberately stopped before authentication or app creation.

The final head contains one merge-only sync to resolve the real CHANGELOG.md conflict with current main; the reviewed Feishu code is unchanged.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS labels Jul 12, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 12, 2026
@clawsweeper

clawsweeper Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 14, 2026, 2:42 PM ET / 18:42 UTC.

Summary
The PR passes a 10-second timeout through Feishu app-registration guarded fetches, removes redundant request-init timeout signals, and adds a hung-header regression test.

PR surface: Source +7, Tests +35. Total +42 across 2 files.

Reproducibility: no. full failing current-main runtime reproduction is shown, but the source path is high-confidence reproducible: app registration omits the guarded-fetch timeout while sibling guarded calls use that contract. The supplied live run convincingly proves the corrected production path.

Review metrics: none identified.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] The PR head is behind current main, so maintainer review and required checks should be refreshed on the rebased head before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Keep one canonical 10-second budget at the guarded-fetch boundary, refresh the branch onto current main, rerun the focused registration timeout proof, and merge if the refreshed diff remains behaviorally unchanged.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No automated repair is needed; refresh the behind branch and complete ordinary maintainer review on the exact final head.

Security
Cleared: The diff adds no dependency, permission, secret-handling, package-resolution, or third-party execution change; it only tightens an existing outbound request timeout.

Review details

Best possible solution:

Keep one canonical 10-second budget at the guarded-fetch boundary, refresh the branch onto current main, rerun the focused registration timeout proof, and merge if the refreshed diff remains behaviorally unchanged.

Do we have a high-confidence way to reproduce the issue?

No full failing current-main runtime reproduction is shown, but the source path is high-confidence reproducible: app registration omits the guarded-fetch timeout while sibling guarded calls use that contract. The supplied live run convincingly proves the corrected production path.

Is this the best way to solve the issue?

Yes. Moving the existing 10-second budget to fetchWithSsrFGuard is narrower and more maintainable than retaining parallel RequestInit and dispatcher timeout mechanisms, and it matches the sibling guarded-fetch pattern.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against af3d796e199f.

Label changes

Label justifications:

  • P2: The PR addresses bounded Feishu onboarding reliability with limited scope and no broad compatibility surface.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body contains after-fix standalone live output from the production registration path showing TimeoutError at the 10-second floor against a TCP peer that returns no headers.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains after-fix standalone live output from the production registration path showing TimeoutError at the 10-second floor against a TCP peer that returns no headers.
Evidence reviewed

PR surface:

Source +7, Tests +35. Total +42 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 6 +7
Tests 1 35 0 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 48 6 +42

What I checked:

  • Changed surface: The production path replaces the local 10-second RequestInit signal with FEISHU_APP_REGISTRATION_TIMEOUT_MS and forwards the selected timeout to fetchWithSsrFGuard. (extensions/feishu/src/app-registration.ts:25, 3ec4fce6a90e)
  • Caller and callee: postRegistration forwards the optional timeout into fetchFeishuJson, which applies the 10-second default before calling the shared guarded-fetch helper. (extensions/feishu/src/app-registration.ts:108, 3ec4fce6a90e)
  • Regression coverage: The added test drives beginAppRegistration against a server that accepts a request but never returns headers and verifies a TimeoutError within the bounded test override. (extensions/feishu/src/app-registration.test.ts:258, 3ec4fce6a90e)
  • Real behavior proof: The PR body includes standalone after-fix output from the production caller path showing the full 10-second guarded timeout firing against an accepted TCP connection with no response headers. (extensions/feishu/src/app-registration.ts:127, 3ec4fce6a90e)
  • Supported product path: Current documentation presents QR-based automatic Feishu bot creation as a supported onboarding path, so bounded registration networking belongs in the Feishu plugin. citeturn19search0. Public docs: docs/channels/feishu.md. (docs/channels/feishu.md:14, af3d796e199f)
  • Current branch state: GitHub reports the PR as cleanly mergeable but behind current main; the successful checks and proof apply to head 3ec4fce, so the final merge should refresh against current main without treating base drift as a patch defect. (3ec4fce6a90e)

Likely related people:

  • vincentkoc: Recent merged Feishu runtime refactors split dedup and outbound seams, making this a strong current ownership signal for review routing. (role: recent area contributor; confidence: medium; commits: 027a544d8f, e4cc8cd975; files: extensions/feishu/src)
  • Josh Palmer: The Feishu/Lark channel implementation appears to date to commit 2483f26, providing historical context for the plugin's network and onboarding behavior. (role: introduced behavior; confidence: medium; commits: 2483f26c23; files: extensions/feishu)
  • andrejtr: Recent work on Feishu's setup-only onboarding barrel is directly adjacent to the app-registration caller path. (role: adjacent owner; confidence: medium; files: extensions/feishu/src/setup-surface.ts, extensions/feishu/src/app-registration.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (3 earlier review cycles)
  • reviewed 2026-07-12T17:43:25.606Z sha 4ae9692 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-13T15:33:00.740Z sha 9238e5b :: needs maintainer review before merge. :: none
  • reviewed 2026-07-14T01:09:33.662Z sha 0203a25 :: needs maintainer review before merge. :: none

@hugenshen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Added non-Vitest standalone runtime proof on the production caller beginAppRegistrationfetchWithSsrFGuard:

  1. Short hang (timeoutMs=80): TimeoutError: request timed out (~126ms)
  2. Production floor (default REQUEST_TIMEOUT_MS=10000): timeout at ~10054ms with accepted TCP and no headers

Also re-ran Vitest (10/10 passed). PR body Real behavior proof section updated with verbatim standalone transcripts.

@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@hugenshen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@hugenshen
hugenshen force-pushed the fix/feishu-app-registration-timeout branch from 4ae9692 to 2e52be1 Compare July 13, 2026 15:00
@hugenshen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

New head after rebase + stronger proof:

  • Exported FEISHU_APP_REGISTRATION_TIMEOUT_MS = 10000
  • Vitest hang proof: TimeoutError @ ~84ms (stand-in), asserts production constant = 10000
  • Standalone non-Vitest short: TimeoutError @ ~164ms
  • Standalone non-Vitest production floor: TimeoutError @ ~10074ms with accepted TCP / no headers

PR body Real behavior proof updated with verbatim transcripts.

@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@hugenshen

Copy link
Copy Markdown
Contributor Author

@clawsweeper status

@hugenshen
hugenshen force-pushed the fix/feishu-app-registration-timeout branch from 2e52be1 to 9238e5b Compare July 13, 2026 15:13
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 13, 2026
@hugenshen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Fresh review for current head 9238e5bdff6d5583ffd34149f0bdf14e2d5ab88c (same fix after rebase).

Real behavior proof re-verified on this head:

Vitest (beginAppRegistration hang):

[feishu fetchFeishuJson hang proof] timed_out=true name=TimeoutError elapsed_ms=... production_timeout_ms=10000
Tests 10 passed

Standalone non-Vitest short (timeoutMs=80):

TimeoutError: request timed out
RESULT timed_out=true

Standalone non-Vitest production floor (FEISHU_APP_REGISTRATION_TIMEOUT_MS=10000):

[fetch-timeout] fetch timeout after 10000ms
TimeoutError: request timed out ~10074ms, accepted_connections=1
RESULT timed_out=true

PR body already contains the full verbatim transcripts.

@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 13, 2026
@hugenshen
hugenshen force-pushed the fix/feishu-app-registration-timeout branch 2 times, most recently from 0a849c1 to 0203a25 Compare July 14, 2026 00:52
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 14, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Jul 14, 2026
@hugenshen
hugenshen force-pushed the fix/feishu-app-registration-timeout branch 2 times, most recently from 7639e86 to 50cf7a2 Compare July 14, 2026 14:04
@hugenshen
hugenshen force-pushed the fix/feishu-app-registration-timeout branch from 50cf7a2 to 3ec4fce Compare July 14, 2026 14:49
@steipete steipete self-assigned this Jul 15, 2026
@steipete

steipete commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Land-ready maintainer pass complete on exact head 50c08330fca02042d52f222b21d224e621c4f328.

  • Refactored app-registration HTTP onto the guarded fetch's native timeoutMs, kept the 10-second deadline private, removed redundant request signals, and separated polling fallback math.
  • Testbox tbx_01kxm1sm2m7r2s8emr4hww28z4: 10/10 focused tests passed; the real stalled-header peer rejected with TimeoutError in 83 ms under the shortened test deadline.
  • Same Testbox: live unauthenticated initAppRegistration network smokes reached Feishu in 743 ms and Lark in 1,209 ms; no app was created.
  • Touched formatting, pnpm check:test-types, and git diff --check: passed.
  • Fresh autoreview: no actionable findings (0.96 confidence; changelog-only follow-up 0.99).
  • Exact-head real-behavior gate passed (run).
  • Coordinator accepted the immutable same-PR green CI cohort from the last 24 hours (CI); no rebase was required.

Known gap: no credentialed QR scan/app creation. The live smoke deliberately stopped before authentication or mutation.

The final head contains one merge-only sync to resolve the real CHANGELOG.md conflict with current main; the reviewed Feishu code is unchanged.

@steipete
steipete merged commit ed16970 into openclaw:main Jul 16, 2026
107 of 108 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 16, 2026
…penclaw#105549)

* fix(feishu): pass timeoutMs through app-registration guarded fetch

* refactor(feishu): keep registration timeout internal

* docs(changelog): credit Feishu timeout fix

---------

Co-authored-by: Peter Steinberger <[email protected]>
zw-xysk added a commit to zw-xysk/openclaw that referenced this pull request Jul 17, 2026
Rebuild on current main. Current registration still passes timeoutMs into fetchWithSsrFGuard (openclaw#105549); assert TimeoutError + request timed out with fetchImpl never called.
zw-xysk added a commit to zw-xysk/openclaw that referenced this pull request Jul 17, 2026
Rebuild on current main. Registration still passes timeoutMs into
fetchWithSsrFGuard (openclaw#105549); do not rewrite to AbortSignal.timeout().
Assert TimeoutError + request timed out with fetchImpl never called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants