Skip to content

fix(feishu): keep the app registration poll deadline on the monotonic clock - #182180

Merged
steipete merged 2 commits into
openclaw:mainfrom
mikasa0818:fix/problem-feishu-registration-monotonic-deadline
Oct 25, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
mikasa0818:fix/problem-feishu-registration-monotonic-deadline

Conversation

@mikasa0818

@mikasa0818 mikasa0818 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: Feishu/Lark QR registration keeps polling beyond device-code expiry, or stops early, when the system wall clock changes during pairing.

User Impact

The registration poll consumes its existing expiry budget using elapsed time, so a clock correction does not extend or shorten the pairing window.

Why This Change Was Made

The poll owner now uses performance.now() for deadline creation and comparison. Provider interval normalization, cancellation, backoff, and registration outcomes retain their existing behavior. The redundant clock explanation was removed; production changes are two substitutions (+2/-2, net 0), with one 24-line regression. Thanks to @mikasa0818 for the fix and regression.

Evidence

  • On main 8c6ad0edc3c9d87f5a5b5a40fad6f84761066348, the regression remains unsettled after 35 seconds of fake elapsed time when the wall clock rewinds ten minutes. With the fix it returns timeout; the entire file plus the temporary runtime probe passed (9/9).
  • Real timers and a real local HTTP server through the existing guarded registration transport: a one-second expiry and ten-second wall rewind produced 16 polls over 3202 ms on base (stopped by the probe's safety cap), versus 5 polls over 1043 ms with the fix. The temporary probe was removed after comparison.
  • Command: TMPDIR=/private/tmp/oc-ct-monoA pnpm test extensions/feishu/src/app-registration.test.ts --maxWorkers=1. Targeted syntax-only oxlint, oxfmt, and git diff --check passed. Independent diff review found no actionable P0–P2 findings.
  • The isolated leaf-package typecheck could not resolve unbuilt openclaw/plugin-sdk/* declaration artifacts. Type-aware extension lint then reached the wrapper’s 300-second SDK declaration-generation timeout. Exact-head PR CI supplies broad validation; neither setup failure is a product verdict.
  • A real Feishu account/QR round-trip was not live-tested; this proof used synthetic responses from a local HTTP server and required no account credentials.

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes Feishu/Lark registration expiry use elapsed time and adds a wall-clock rewind regression.

Example: A registration has a one-second expiry, responses remain pending, and the wall clock rewinds ten seconds.

  • Before: The supplied real-HTTP comparison records 16 polls over 3202 ms before its safety cap stops the run.
  • After: The same comparison records timeout after five polls over 1043 ms.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair with real-transport fault evidence and a distinct regression; no actionable findings remain.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied macOS runtime comparison exercises pollAppRegistration through its guarded transport with real timers, a real local HTTP server, pending responses, and an injected wall-clock rewind; the fixed owner times out near its one-second budget while the base continues polling. This proves the internal deadline repair without claiming a live Feishu account round-trip.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A system clock correction during Feishu/Lark QR setup can prolong polling beyond its expiry budget or stop it early.
Reason: This restores the existing bounded-wait contract with no new setting, public API, or competing implementation.

Merge readiness

✅ Ready for maintainer review

This PR repairs a current-main polling defect with the smallest complete change; no actionable findings remain, and exact-head CI is still pending.

Priority: P2
Reviewed head: 001dc7a9c998a7a55a73f74785eaaca74cd416a7

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Feishu setup wizard passes a device code, polling interval, and expiry to the plugin registration poller, which calls the accounts endpoint and returns credentials or a terminal status.

flowchart TD
 A[Feishu setup wizard] --> B[Begin device registration]
 B --> C[Registration poller]
 D[Monotonic expiry budget] --> C
 C --> E[Feishu or Lark accounts endpoint]
 E --> C
 C --> F[Credentials or terminal status]
Loading

Technical review

Best possible solution:

Keep the existing registration poller as the sole expiry owner and use performance.now for deadline creation and comparison.

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

Current-main source establishes the clock-sensitive polling path, and the supplied base-versus-fix HTTP comparison corroborates it; no target code was executed during this review.

Is this the best way to solve the issue?

The two substitutions restore the elapsed-time invariant at its existing owner, and the single regression catches the distinct rewind failure without new machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 103129e1ae6e.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b9d7dd4 adds extensions/feishu/src/app-registration.ts:187 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b9d7dd4a84b2; files: extensions/feishu/src/app-registration.ts)

PR surface

Source 0, Tests +24. Total +24 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 1 24 0 +24
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 26 2 +24

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Clock adjustments can extend or shorten optional CLI QR registration; the existing setup wizard retains manual credential fallback.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-24T04:10:55.237Z sha 8c8e9f2ec2d4befdb8659fff775401aaaa1a4388 :: needs real behavior proof before merge. :: [P3] Keep the clock-rewind regression on fake timers
  • reviewed 2026-10-24T08:17:34.909Z sha 8c8e9f2ec2d4befdb8659fff775401aaaa1a4388 :: needs changes before merge. :: [P3] Keep the clock-rewind regression on fake timers
  • reviewed 2026-10-24T09:37:49.484Z sha 1847822 :: needs maintainer review before merge. :: none

Reviewed October 24, 2026, 6:37 PM ET / 22:37 UTC (Revision 4).

@mikasa0818

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 24, 2026
@mikasa0818
mikasa0818 force-pushed the fix/problem-feishu-registration-monotonic-deadline branch from 8c8e9f2 to 1847822 Compare October 24, 2026 08:35
@mikasa0818

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 24, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 24, 2026
Integrate current main while retaining the contributor's bounded polling fix
and wall-clock rewind regression. Remove the redundant clock explanation.

Co-authored-by: mikasa0818 <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@steipete
steipete merged commit e6e0545 into openclaw:main Oct 25, 2026
111 of 114 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 Oct 25, 2026
… clock (openclaw#182180)

Registration polling expiry now uses elapsed time, so a wall-clock correction cannot extend or shorten the authorization window. The existing HTTP transport and registration result contracts are preserved.

The regression reproduces the clock rewind. Focused tests and a real local HTTP probe pass; exact-head PR CI is green.

Co-authored-by: mikasa0818 <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 28, 2026
… clock (#182180)

Registration polling expiry now uses elapsed time, so a wall-clock correction cannot extend or shorten the authorization window. The existing HTTP transport and registration result contracts are preserved.

The regression reproduces the clock rewind. Focused tests and a real local HTTP probe pass; exact-head PR CI is green.

Co-authored-by: mikasa0818 <[email protected]>

(cherry picked from commit e6e0545)

Co-authored-by: RomneyDa <[email protected]>
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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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