Skip to content

fix(feishu): wire setup runtime setter#89689

Closed
glenn-agent wants to merge 1 commit into
openclaw:mainfrom
glenn-agent:fix/feishu-p2p-binding-run-crash
Closed

fix(feishu): wire setup runtime setter#89689
glenn-agent wants to merge 1 commit into
openclaw:mainfrom
glenn-agent:fix/feishu-p2p-binding-run-crash

Conversation

@glenn-agent
Copy link
Copy Markdown
Contributor

@glenn-agent glenn-agent commented Jun 3, 2026

Summary

  • expose setFeishuRuntime from the Feishu setup-only entry
  • add a narrow runtime setter barrel so setup/runtime registration does not need the broader runtime API
  • cover setup-only runtime wiring in the Feishu setup-entry test

Real behavior proof

Behavior or issue addressed: Feishu setup-only / setup-runtime registration did not initialize the Feishu runtime store. The monitor path can then reach getFeishuRuntime().channel without an initialized runtime, causing inbound dispatch for Feishu messages to fail before channel.inbound.run(...) can run.

Real environment tested: User-designated remote test machine, fresh shallow openclaw/openclaw checkout at origin/main plus this patch, Node v22.22.2, pnpm v11.2.2 via corepack.

Exact steps or command run after this patch:

  1. corepack pnpm install --frozen-lockfile --ignore-scripts
  2. node --import tsx .tmp-check-feishu-runtime.mjs
  3. corepack pnpm exec vitest run extensions/feishu/setup-entry.test.ts --reporter=dot

The smoke script imported the patched Feishu setup entry, called setupEntry.setChannelRuntime(runtime), then imported getFeishuRuntime() and verified that the stored runtime is the same object and that channel.inbound.run() is reachable.

Evidence after fix: Terminal output from the user-designated remote test machine:

kind=bundled-channel-setup-entry
setter=function
sameRuntime=true
inboundRun=ok

Targeted regression test output from the same remote machine:

Test Files  1 passed (1)
Tests       2 passed (2)

Observed result after fix: The Feishu setup-only entry now exposes and applies the runtime setter. After setup-only registration calls the setter, getFeishuRuntime() returns the active runtime and getFeishuRuntime().channel.inbound.run is available instead of undefined.

What was not tested: A live Feishu/Lark tenant message was not sent; the remote verification exercised the runtime-registration path that caused the reported dispatch crash, plus the targeted regression test.

Supplemental verification

  • Local preflight: git diff --check
  • Local preflight: git verify-commit HEAD

Closes #88024

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 3, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 3, 2026

Codex review: passed. Reviewed June 3, 2026, 7:39 AM ET / 11:39 UTC.

Summary
The branch adds a narrow Feishu runtime-setter entry, wires it into setup-entry metadata, and extends the setup-entry test to assert runtime storage.

PR surface: Source +7, Tests +11. Total +18 across 3 files.

Reproducibility: yes. source inspection gives a high-confidence path: current main has no Feishu setup-entry runtime descriptor while monitorSingleAccount falls back to getFeishuRuntime().channel. I did not run a live Feishu tenant repro.

Review metrics: 1 noteworthy metric.

  • Setup runtime surface: 1 Feishu setup-runtime setter added. This is the exact seam the setup-runtime loader uses to initialize plugin runtime before inbound dispatch.

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.

Next step before merge

  • [P2] No repair lane is needed; the PR already contains the narrow code change, focused test, and sufficient real behavior proof.

Security
Cleared: The diff adds a local Feishu runtime setter re-export, setup metadata, and a test; it does not add dependencies, scripts, workflow permissions, or secret-handling changes.

Review details

Best possible solution:

Land the narrow setup-entry runtime wiring with its targeted regression test; a broader loader-level test would be useful follow-up coverage but is not required for this patch.

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

Yes, source inspection gives a high-confidence path: current main has no Feishu setup-entry runtime descriptor while monitorSingleAccount falls back to getFeishuRuntime().channel. I did not run a live Feishu tenant repro.

Is this the best way to solve the issue?

Yes, this is the best fix shape: it uses the existing bundled setup-entry runtime contract and matches sibling Matrix/Slack patterns without loading the broad Feishu runtime API during setup.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against e5e6cf04a2f4.

Label changes

Label changes:

  • add status: 🚀 automerge armed: This PR is in ClawSweeper's automerge lane. Sufficient (terminal): The PR body includes remote terminal output showing the patched setup entry stores the active runtime and exposes inbound.run, plus a passing targeted regression test.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 🚀 automerge armed.

Label justifications:

  • P1: The linked Feishu regression breaks inbound dispatch for real channel messages by leaving the runtime store uninitialized.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 🚀 automerge armed: This PR is in ClawSweeper's automerge lane. Sufficient (terminal): The PR body includes remote terminal output showing the patched setup entry stores the active runtime and exposes inbound.run, plus a passing targeted regression test.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes remote terminal output showing the patched setup entry stores the active runtime and exposes inbound.run, plus a passing targeted regression test.
Evidence reviewed

PR surface:

Source +7, Tests +11. Total +18 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 7 0 +7
Tests 1 11 0 +11
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 18 0 +18

What I checked:

  • Current main gap: Current main's Feishu setup entry declares setup plugin, legacy migrations, and secrets, but no runtime descriptor, so setup-only registration has no Feishu setChannelRuntime hook. (extensions/feishu/setup-entry.ts:3, e5e6cf04a2f4)
  • Failing runtime-dependent path: The Feishu monitor falls back to getFeishuRuntime().channel before registering event handlers, matching the linked dispatch failure when setup-only registration leaves the runtime store unset. (extensions/feishu/src/monitor.account.ts:482, e5e6cf04a2f4)
  • Existing setup contract: defineBundledChannelSetupEntry already converts a runtime specifier into setChannelRuntime by loading the declared setter and invoking it with the active plugin runtime. (src/plugin-sdk/channel-entry-contract.ts:605, e5e6cf04a2f4)
  • Loader consumption: The setup-runtime loader applies mergedSetupRegistration.setChannelRuntime(api.runtime) when a runtime entry setter was not already applied, so the Feishu setup-entry field is consumed by the intended loader path. (src/plugins/loader.ts:2518, e5e6cf04a2f4)
  • PR implementation: The PR head adds the Feishu runtime descriptor pointing at runtime-setter-api and exports setFeishuRuntime from the new narrow setter file. (extensions/feishu/setup-entry.ts:20, fc3666302a17)
  • Regression coverage: The PR head asserts setupEntry.setChannelRuntime exists and that calling it makes getFeishuRuntime() return the same runtime object. (extensions/feishu/setup-entry.test.ts:20, fc3666302a17)

Likely related people:

  • m1heng: The Feishu plugin manifest describes the Feishu/Lark plugin as community maintained by @m1heng, and the PR timeline mentions that handle on this Feishu fix path. (role: declared Feishu community owner; confidence: medium; files: extensions/feishu/openclaw.plugin.json)
  • Vincent Koc: Current-main blame for the Feishu setup entry, runtime store, and monitor fallback points to commit 2c92973. (role: recent area contributor; confidence: medium; commits: 2c9297339817; files: extensions/feishu/setup-entry.ts, extensions/feishu/src/runtime.ts, extensions/feishu/src/monitor.account.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.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 3, 2026
@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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Jun 3, 2026
@byungskers
Copy link
Copy Markdown

This looks like a good narrow fix. One extra test that could make it even stronger: exercise the actual setup-loader path (the place that consumes setChannelRuntime from setup entries), not just the exported setup entry shape.

The current test proves the entry exposes the setter and that setFeishuRuntime works, but a loader-level regression would pin the exact integration that broke here.

@Takhoffman
Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 3, 2026

🦞🔧
ClawSweeper saw the passing review, but the PR needs another repair pass before merge.

Source: clawsweeper[bot]
Feedback: structured ClawSweeper verdict: pass (sha=fc3666302a1781990b6cd3e732b0df6b5a52fad8); failed required checks before automerge: Real behavior proof:CANCELLED
Action: repair worker queued. Run: https://github.com/openclaw/clawsweeper/actions/runs/26882321966
Model: gpt-5.5

I will update this PR branch, or open a safe credited replacement, if the repair worker finds a narrow CI fix.

Automerge progress:

  • 2026-06-03 11:33:16 UTC review queued fc3666302a17 (queued)
  • 2026-06-03 11:39:34 UTC review passed fc3666302a17 (structured ClawSweeper verdict: pass (sha=fc3666302a1781990b6cd3e732b0df6b5a52f...)

@clawsweeper clawsweeper Bot added clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 3, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 3, 2026

ClawSweeper 🐠 reef update

Thanks for the work on this. ClawSweeper could not push to this branch with the permissions available, so it opened a narrow replacement PR to keep the fix swimming forward without losing the contributor trail. not your fault, just GitHub branch-permission tides.

Why replacement: ClawSweeper could not update the source PR branch directly; GitHub did not grant sufficient push rights to the bot for that branch.
Replacement PR: #89814
Why close: this run explicitly closes the superseded source PR after the credited replacement PR is open, so review continues in one place.
Closing this source PR because this run explicitly enabled source-PR closeout.
Attribution stays attached; the replacement just gives the fix a writable branch.
Co-author credit kept:

fish notes: model gpt-5.5, reasoning high; reviewed against cbad0c6.

@clawsweeper clawsweeper Bot closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu channel broken since 5.27: never called, dispatch fails with 'Cannot read properties of undefined (reading run)'

3 participants