Skip to content

[BUG] openclaw-lark plugin: contracts.tools not propagated through createCapabilityPluginRecord #77982

Description

@pangxianyu-pixel

Bug Description

The openclaw-lark plugin declares tool contracts via contracts: { tools: [...] } in its export, but all 27+ tools fail registration with the error:

plugin must declare contracts.tools before registering agent tools

This error fires 41 times per plugin load (once per tool registration).

Root Cause Analysis

Traced through the OpenClaw source:

  1. createCapabilityPluginRecord in bundled-capability-runtime-CQy4xWvL.js (line ~259) does NOT include contracts in the returned object:
function createCapabilityPluginRecord(params) {
    return {
        id: params.id,
        name: params.name ?? params.id,
        // ... all other fields ...
        // ❌ NO `contracts` field
    };
}


2.Later, at line ~513, the bundled runtime calls:
const declaredToolNames = normalizePluginToolContractNames(record.contracts);
record.contracts is undefined  declaredToolNames is empty  every tool fails findUndeclaredPluginToolNames check.

3.Compare with createPluginRecord in loader-DmHfdX8U.js (line ~392), which correctly passes contracts: params.contracts:

function createPluginRecord(params) {
    return {
        // ...
        contracts: params.contracts  // ✅ present here
    };
}

4.But manifestRecord.contracts is never read from the plugin module export by the bundled runtime. The plugin's contracts field in its export is lost at the loadBundledCapabilityRuntimeRegistry level.
Plugin Code (verified correct)
// D:\AI\Openclaw\.openclaw\extensions\openclaw-lark\index.js

const _TOOL_CONTRACTS = [
    "feishu_bitable_app",
    "feishu_bitable_app_table",
    "feishu_bitable_app_table_field",
    "feishu_bitable_app_table_record",
    "feishu_bitable_app_table_view",
    "feishu_calendar_calendar",
    "feishu_calendar_event",
    "feishu_calendar_event_attendee",
    "feishu_calendar_freebusy",
    "feishu_chat",
    "feishu_chat_members",
    "feishu_doc_comments",
    "feishu_doc_media",
    "feishu_drive_file",
    "feishu_im_user_fetch_resource",
    "feishu_im_user_get_messages",
    "feishu_im_user_get_thread_messages",
    "feishu_im_user_message",
    "feishu_im_user_search_messages",
    "feishu_search_doc_wiki",
    "feishu_get_user",
    "feishu_search_user",
    "feishu_sheet",
    "feishu_task_task",
    "feishu_task_tasklist",
    "feishu_task_attachment",
    "feishu_task_comment",
    "feishu_task_section",
    "feishu_task_subtask",
    "feishu_task_agent",
    "feishu_wiki_space",
    "feishu_wiki_space_node",
    "feishu_create_doc",
    "feishu_fetch_doc",
    "feishu_update_doc",
    "feishu_search_doc",
    "feishu_oauth",
    "feishu_oauth_batch_auth",
    "ask_user_form",
    "feishu_im_bot_image",
];

const plugin = {
    id: 'openclaw-lark',
    contracts: {
        tools: _TOOL_CONTRACTS,
    },
    register(api) { ... }
};




The plugin module correctly exports contracts: { tools: [...] }  the bug is in how OpenClaw's bundled capability runtime reads it.

【Impact】
All 27+ Feishu tools (bitable, calendar, task, chat, im, drive, wiki, doc, OAuth) are completely non-functional
The Feishu channel (IM messaging) still works for basic chat
Error floods logs: 41 diagnostics per plugin load

【Environment】
OpenClaw version: 2026.5.3-1 (2eae30e)
Platform: Windows 10 (x64)
Plugin path: D:\AI\Openclaw\.openclaw\extensions\openclaw-lark\
Bundled runtime: node_modules\openclaw\dist\bundled-capability-runtime-CQy4xWvL.js
Loader: node_modules\openclaw\dist\loader-DmHfdX8U.js

【Suggested Fix】
Pass contracts: manifestRecord.contracts in createCapabilityPluginRecord and propagate it from the manifest through the bundled runtime loading chain, matching what createPluginRecord already does in the loader path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions