Skip to content

feat(feishu): support declarative event subscribers - #79311

Closed
Gscienty wants to merge 3 commits into
openclaw:mainfrom
Gscienty:main
Closed

Gscienty wants to merge 3 commits into
openclaw:mainfrom
Gscienty:main

Conversation

@Gscienty

@Gscienty Gscienty commented May 8, 2026

Copy link
Copy Markdown

Add a Feishu event runtime that normalizes publish-path events into a topic bus, loads declarative subscriber specs from skills, and dispatches matching handlers or agent triggers.

Wire the runtime into Feishu monitor startup, register SDK event handlers for active subscriber event types, and cover the event model, hijacker, loader, subscriptions, topic bus, triggers, and monitor startup paths.

Summary

  • Problem: Feishu events did not have a declarative subscriber runtime, so publish-path events could not be consumed by skill-defined handlers or triggers.
  • Why it matters: Adding new Feishu event integrations required hardcoded monitor handlers, making the plugin harder to extend and debug.
  • What changed: Added a Feishu event runtime with normalized event modeling, hijacking, topic-bus publishing, subscriptions, triggers, execution, and skill-side subscriber spec loading/handler dispatch.
  • What did NOT change (scope boundary): This PR does not add hot-reload for newly installed subscriber skills and does not change the core skill installation notification flow.

Change Type (select all)

  • Bug fix
  • [✅] Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • [✅] Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • [✅] This PR fixes a bug or regression

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: Feishu publish-path events can be matched by declarative skill subscribers and dispatched to handlers/triggers.
  • Real environment tested: Local OpenClaw setup with Feishu channel enabled in websocket mode; sensitive account details redacted.
  • Exact steps or command run after this patch: Started gateway, placed a skill with feishu-event.subscribers.json under the configured skills directory, then triggered a matching Feishu event.
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output):
  • [managed-by=feishu.event-skill-loader] loaded subscriber id=... skill=... hasHandler=true
  • [managed-by=feishu.event-runtime] activeSubscriptions=... diagnostics=0
  • [managed-by=feishu.event-hijacker] feishu[main]: route=publish ...
  • Observed result after fix: The event was normalized, published to the topic bus, matched by the subscriber, and dispatched to the handler/trigger path.
  • What was not tested: Long-running soak tests, large multi-account load, and automatic hot-reload for newly installed subscriber skills.
  • Before evidence (optional but encouraged): Before this PR there was no declarative Feishu event runtime, so skill-defined subscribers were not loaded or registered.

Root Cause (if applicable)

  • Root cause: Feishu event handling only had monitor-specific handler paths and no declarative subscription abstraction for skill-owned event consumers.
  • Missing detection / guardrail: No schema, loader, topic bus, subscription matching, or runtime tests existed for skill-defined Feishu subscribers.
  • Contributing context (if known): Existing Feishu event handling grew around hardcoded monitor handlers, which made publish-path event extensibility difficult.

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • [✅] Unit test
    • [✅] Seam / integration test
    • [✅] End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • extensions/feishu/src/event.runtime.test.ts
    • extensions/feishu/src/event.skill-loader.test.ts
    • extensions/feishu/src/event.skill-spec.test.ts
    • extensions/feishu/src/event.subscription.test.ts
    • extensions/feishu/src/event.topic-bus.test.ts
    • extensions/feishu/src/event.hijacker.test.ts
  • Scenario the test should lock in: A skill sidecar subscriber can be parsed, loaded, subscribed, matched against a normalized Feishu event, and dispatched through handler/trigger execution.
  • Why this is the smallest reliable guardrail: These tests cover the full declarative subscriber chain without requiring a live Feishu account.
  • Existing test that already covers this (if any): The new event runtime, loader, spec, subscription, topic bus, hijacker, trigger, and handler tests cover this path.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

Feishu skills can now define event subscribers through feishu-event.subscribers.json.
Feishu monitor startup now loads declarative event subscribers and registers required SDK event types.
Runtime logs now report loaded subscriber specs, active subscriptions, diagnostics, and publish-path event routing.

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.

Before:
[Feishu publish event] -> [legacy monitor handlers only] -> [no skill subscriber dispatch]

After:
[Feishu publish event]
  -> [event hijacker normalizes event]
  -> [topic bus publishes event]
  -> [subscription matcher]
  -> [skill handler OR trigger executor]

Security Impact (required)

  • New permissions/capabilities? ( Yes/No ) Yes
  • Secrets/tokens handling changed? ( Yes/No ) No
  • New/changed network calls? ( Yes/No ) No
  • Command/tool execution surface changed? ( Yes/No ) Yes
  • Data access scope changed? ( Yes/No ) No
  • If any Yes , explain risk + mitigation: This adds a new capability for skill-defined Feishu event handlers/triggers. Mitigations include schema validation, duplicate subscriber diagnostics, handler path containment within the skill directory, handler existence checks, and explicit targetAgentId requirements for trigger-based subscribers.

Repro + Verification

Environment

  • OS: Linux
  • Runtime/container: Local OpenClaw gateway process
  • Model/provider: N/A for the event runtime path
  • Integration/channel (if any): Feishu websocket channel
  • Relevant config (redacted): channels.feishu.enabled=true , connectionMode=websocket , account credentials redacted

Steps

  • Add a skill containing SKILL.md and feishu-event.subscribers.json under a configured skills directory.
  • Start the OpenClaw gateway with the Feishu channel enabled.
  • Trigger a matching Feishu publish-path event.

Expected

  • The skill subscriber spec loads successfully.
  • The runtime registers an active subscription.
  • The matching Feishu event is normalized, published to the topic bus, matched, and dispatched.

Actual

  • The subscriber loader reported the subscriber as loaded.
  • The event runtime reported active subscriptions.
  • The Feishu hijacker logged publish-path routing, and the event reached the subscriber dispatch path.

Evidence

Attach at least one:

  • [✅] Failing test/log before + passing after
  • [✅] Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Subscriber spec loading, runtime subscription activation, publish-path event routing, and handler/trigger dispatch path.
  • Edge cases checked: Duplicate subscriber IDs, invalid sidecar specs, missing handler files, and handler paths escaping the skill directory.
  • What you did not verify: Production-scale multi-account load, long-running soak behavior, and automatic hot-reload for newly installed subscriber skills.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? ( Yes/No ) Yes
  • Config/env changes? ( Yes/No ) No
  • Migration needed? ( Yes/No ) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: Invalid subscriber specs may prevent a skill subscriber from loading.
    • Mitigation: The loader reports structured diagnostics and skips invalid entries without failing the entire runtime.
  • Risk: New event types may not reach the topic bus if the SDK dispatcher has no registered handler.
    • Mitigation: Monitor startup registers SDK handlers for active subscriber event types.
  • Risk: Handler or trigger failures could affect event processing reliability.
    • Mitigation: Subscriber execution errors are caught and logged per subscription path.

Add a Feishu event runtime that normalizes publish-path events into a topic bus, loads declarative subscriber specs from skills, and dispatches matching handlers or agent triggers.

Wire the runtime into Feishu monitor startup, register SDK event handlers for active subscriber event types, and cover the event model, hijacker, loader, subscriptions, topic bus, triggers, and monitor startup paths.
@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XL triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 8, 2026
@clawsweeper

clawsweeper Bot commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open: current main does not implement Feishu declarative subscribers, and the PR still has source-reproducible blockers around skill eligibility, publish-event dedupe, real behavior proof, and maintainer product/security sponsorship.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

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

Yes for the review blockers: source inspection shows raw skill roots are loaded outside the canonical eligibility filter, and publish dedupe uses normalizedEvent.sourceId. I did not run live Feishu E2E in this read-only review.

Is this the best way to solve the issue?

No. A Feishu-owned event runtime is a plausible layer, but this implementation is not the best fix until it preserves canonical skill eligibility, uses event-ID dedupe, resolves current-main conflicts, and receives maintainer approval for the new sidecar contract.

Security review:

Security review needs attention: Event-triggered skill-local handler imports and agent runs currently bypass existing skill eligibility and agent skill filters.

  • [high] Skill sidecar handlers bypass eligibility settings — extensions/feishu/src/event.runtime.ts:145
    The event runtime loads subscriber specs from raw roots before importing or triggering matching handlers, so disabled, ineligible, bundled-allowlist-blocked, or agent-excluded skills can execute when Feishu events arrive.
    Confidence: 0.9

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-05-08T08:29:21Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is insufficient and proof tier is D, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • ZengWen-DT: Authored recent stable Feishu retry-dedupe work in extensions/feishu/src/dedupe-key.ts, directly adjacent to the publish-event dedupe concern. (role: recent Feishu dedupe contributor; confidence: medium; commits: 9ed9d389e05d; files: extensions/feishu/src/dedupe-key.ts)
  • Acache: Co-authored recent Feishu transport health work touching monitor.ts and monitor.account.ts, the startup and monitor surfaces changed by this PR. (role: recent Feishu monitor contributor; confidence: medium; commits: e7d6566b8fd1; files: extensions/feishu/src/monitor.ts, extensions/feishu/src/monitor.account.ts)
  • Vincent Koc: Recently trimmed skills loader exports and co-authored/reviewed adjacent Feishu and plugin-skill boundary work relevant to this PR's new skill execution path. (role: recent skills and Feishu adjacent contributor; confidence: medium; commits: 5b1ba437ba85, 2e27a37791c9, 085d0c5d3006; files: src/skills/loading/config.ts, src/skills/loading/workspace.ts, extensions/feishu/src/dedup.ts)
  • Shakker: Carried the skills subsystem organization and bundled allowlist preparation that underpins the canonical skill eligibility paths the PR needs to reuse. (role: skills subsystem feature-history contributor; confidence: medium; commits: d9278c8efdb5, 112939df6065, 496e1e071f8d; files: src/skills/loading/config.ts, src/skills/loading/workspace.ts)
  • Peter Steinberger: Recently removed Feishu dedupe JSON fallback, documented skill/channel loading files, and refactored Feishu runtime surfaces adjacent to this branch. (role: recent Feishu runtime and skills docs contributor; confidence: medium; commits: 3a335c6df15b, 43cee29f70c9, 3361593442e2; files: extensions/feishu/src/dedup.ts, extensions/feishu/src/monitor.ts, src/skills/loading/config.ts)

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

@barnacle-openclaw

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@barnacle-openclaw barnacle-openclaw Bot added the stale Marked as stale due to inactivity label May 31, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label May 31, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 1, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 14, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 22, 2026
@steipete

Copy link
Copy Markdown
Contributor

Closing per ClawSweeper review verdict duplicate_or_superseded (decision packet 2026-07-07T15:20:51.188Z). This item was part of the audited close backlog (openclaw/clawsweeper#920) stranded by an apply-lane defect, drained manually after re-verification. If this is wrong, reopen and ClawSweeper will re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants