Skip to content

[Bug]: Plugin hooks (before_prompt_build, agent_end) not firing for feishu/main agent in embedded PI runtime (v2026.5.2) #76649

@wwf3045

Description

@wwf3045

Bug Description

Plugin hooks (before_prompt_build, agent_end) registered by a custom plugin are not firing for the Feishu channel's main agent (embedded PI runtime), while the same hooks fire correctly for the heartbeat agent (hermes, harness runtime).

Environment: OpenClaw v2026.5.2 (commit 8b2a6e5), plugin memory-tencentdb v0.2.0
Platform: Feishu channel, main agent (embedded PI runtime selection-D1C7VClx.js)
Working correctly: Heartbeat agent hermes (harness runtime)


Steps to Reproduce

  1. Register a plugin with before_prompt_build and agent_end hooks
  2. Configure the plugin for the Feishu channel and for the main agent in openclaw.json
  3. Set allowPromptInjection: true and allowConversationAccess: true in plugin config
  4. Send a message via Feishu → hooks do NOT fire
  5. Heartbeat cron runs → agent_end hook does fire

Expected Behavior

Hooks should fire for the Feishu main agent, just as they do for the hermes agent.


Root Cause Analysis

  • Plugin registration works: logs show hooks are registered with correct registry
  • Hook runner IS initialized for the hermes (harness) agent → hooks fire correctly
  • For the main agent (embedded PI runtime selection-D1C7VClx.js), the embedded runtime has an isRawModelRun guard (line 7697) and calls resolvePromptBuildHookResult at lines 8198/8224
  • v2026.5.2 commit 8283c5d6 ("perf(plugins): reuse startup runtime registry") changed plugin scoping — likely caused the embedded PI runtime's hook bridging to fail to connect to the plugin registry

Likely related issues:


Plugin Config

{
  "allowConversationAccess": true,
  "allowPromptInjection": true
}

Channel and agent both include plugins: - "memory-tencentdb".


Additional Context

  • Same plugin with same hooks works on hermes agent (harness runtime) → plugin code is correct
  • allowPromptInjection: true does NOT fix the issue
  • Problem appears specific to the embedded PI runtime (selection-D1C7VClx.js) used by the main agent on Feishu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions