Skip to content

[feishu plugin] wiki spaceNode.list 分页不生效,只返回前20条记录 #37626

Description

@ritou11

问题描述

飞书插件的 feishu_wiki 工具在调用 nodes action 时,无法获取完整的子节点列表。飞书 API 默认只返回前 20 条记录,即使添加了分页支持代码也无法正确获取所有页面。

环境信息

  • 插件版本: `@openclaw/feishu` (local)
  • 插件路径: `~/.openclaw/extensions/feishu`
  • Node.js: v25.6.0
  • OS: macOS (Darwin 25.3.0 arm64)

复现步骤

  1. 使用 `feishu_wiki` 工具调用 `nodes` action 获取一个有超过 20 个子节点的知识库
  2. 观察返回结果只有 20 条记录

```javascript
feishu_wiki({
action: "nodes",
space_id: "7457428970923032579",
parent_node_token: "DmkjwwgQQi8UlkkES2Oc25EdnZd"
})
// 只返回 20 条,实际有 50+ 条
```

已尝试的修复

我已修改 `wiki.ts` 添加了分页逻辑:

  1. 在 `wiki-schema.ts` 添加了 `page_size`, `page_token`, `fetch_all` 参数
  2. 在 `wiki.ts` 的 `listNodes` 函数中添加了分页循环逻辑,使用 `has_more` 判断是否继续获取

但修改后 Gateway 重启,API 仍然只返回 20 条记录,且返回结果中没有包含分页信息(如 `total`, `pages_fetched`),似乎代码修改没有生效。

期望行为

  • 当 `fetch_all=true`(默认)时,自动获取所有页面
  • 返回结果应包含 `total` 和 `pages_fetched` 字段
  • 应能正确获取所有 50+ 条子节点记录

相关文件

  • `~/.openclaw/extensions/feishu/src/wiki.ts`
  • `~/.openclaw/extensions/feishu/src/wiki-schema.ts`

补充

飞书 API 文档确认 `spaceNode.list` 支持 `page_size` 和 `page_token` 分页参数:
https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/list

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions