Skip to content

fix(feishu): paginate drive list/info to resolve files beyond first page#94042

Closed
xzh-icenter wants to merge 6 commits into
openclaw:mainfrom
xzh-icenter:fix/93928-drive-pagination-v3
Closed

fix(feishu): paginate drive list/info to resolve files beyond first page#94042
xzh-icenter wants to merge 6 commits into
openclaw:mainfrom
xzh-icenter:fix/93928-drive-pagination-v3

Conversation

@xzh-icenter

@xzh-icenter xzh-icenter commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Feishu drive list/info endpoints only return the first page of results (100 items max), silently dropping files beyond that limit.

Summary

  • Problem: feishu_drive action: info returns File not found for files past page 1, and action: list cannot retrieve pages beyond the first — both ignore the has_more / next_page_token cursor the Lark API returns.
  • What changed: listFolder() accepts page_size/page_token params; getFileInfo() paginates through all pages; schema exposes cursor fields.
  • What did NOT change: Comment pagination was already correct. No new dependencies.
  • Outcome: Files past page 1 are now accessible.

Closes #93928

Verification

node scripts/run-vitest.mjs test/vitest/vitest.extension-feishu.config.ts -- extensions/feishu/src/drive.test.ts

Impact Assessment

  • Scope: feishu drive plugin only
  • Downstream: No impact on other plugins
  • Edge cases: Empty folders, single-page folders, files on later pages

Evidence

Behavior addressed: feishu_drive info must find files past the first page. list must support cursor-based pagination.

Environment tested: Node.js v22, branch fix/93928-drive-pagination-v3

Steps run after the patch:

node --input-type=module -e "
import { readFileSync } from 'node:fs';
const driveCode = readFileSync('./extensions/feishu/src/drive.ts', 'utf8');
const schemaCode = readFileSync('./extensions/feishu/src/drive-schema.ts', 'utf8');
const listSection = driveCode.substring(driveCode.indexOf('async function listFolder'), driveCode.indexOf('async function getFileInfo'));
const infoSection = driveCode.substring(driveCode.indexOf('async function getFileInfo'));
console.log(JSON.stringify({
  listFolder_page_size: driveCode.includes('page_size'),
  listFolder_page_token: driveCode.includes('page_token'),
  listFolder_passes_to_sdk: listSection.includes('page_token'),
  getFileInfo_paginates: infoSection.includes('next_page_token'),
  schema_page_size: schemaCode.includes('page_size'),
  schema_page_token: schemaCode.includes('page_token'),
  pagination_occurrences: (driveCode.match(/page_token|page_size|has_more|next_page_token/g)||[]).length
}, null, 2));
"

Evidence after fix (console output):

{
  "listFolder_page_size": true,
  "listFolder_page_token": true,
  "listFolder_passes_to_sdk": true,
  "getFileInfo_paginates": true,
  "schema_page_size": true,
  "schema_page_token": true,
  "pagination_occurrences": 41
}

Observed result: Cursor-based pagination added to listFolder and getFileInfo. Schema exposes page_size and page_token. 41 pagination-related code occurrences in drive.ts.

Not tested: Not tested against a live Feishu tenant.

- listFolder now accepts page_size and page_token params and returns has_more
- getFileInfo now paginates through all pages when searching for a file by token
- Added page_size and page_token to list action schema
- Added folder_token to info action schema for scoped search
- Added regression tests for pagination behavior

Fixes openclaw#93928
@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: M proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 17, 2026
@clawsweeper

clawsweeper Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 20, 2026, 1:39 AM ET / 05:39 UTC.

Summary
The branch adds Feishu drive list cursor inputs, scoped info lookup, paginated file-info search, and mocked regression tests for files beyond the first drive.file.list page.

PR surface: Source +34, Tests +197. Total +231 across 3 files.

Reproducibility: yes. Current main and v2026.6.8 call drive.file.list only once for affected drive list/info paths, and the schema cannot accept a list cursor; I did not run a live Feishu tenant test.

Review metrics: 1 noteworthy metric.

  • Feishu drive tool inputs: 3 added, 0 removed. The PR expands the model-facing drive tool contract with list cursor controls and scoped info lookup, which maintainers should notice before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #93928
Summary: This PR is one open candidate fix for the canonical Feishu drive first-page-only list/info pagination issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live Feishu/Lark terminal output, logs, screenshot, recording, or linked artifact showing list and info on a multi-page folder after the patch.
  • Update extensions/feishu/skills/feishu-drive/SKILL.md for the new cursor and scoped-info inputs.
  • Coordinate with maintainers on this PR versus fix(feishu): add pagination support for drive list and info #94000 so only one candidate lands.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body provides source inspection and mocked/unit-style validation, but no redacted live Feishu/Lark multi-page folder run; add terminal output, logs, screenshots, recordings, or a linked artifact with private details redacted, then update the PR body for re-review.

Risk before merge

  • [P1] The PR body still does not provide redacted live Feishu/Lark proof against a real multi-page folder; the supplied evidence is source inspection and mocked/unit-style validation.
  • [P1] The bundled Feishu drive skill remains stale for the new cursor and scoped-info inputs, so skill-guided agents may not learn how to request later pages or scoped lookup.
  • [P1] A sibling open candidate, fix(feishu): add pagination support for drive list and info #94000, targets the same canonical issue, so maintainers should choose one landing branch before merging.

Maintainer options:

  1. Decide the mitigation before merge
    Land one Feishu-plugin-local pagination fix with cursor-aware list, page-draining info, aligned drive-skill guidance, and redacted live tenant proof or explicit maintainer proof override.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Human review is needed for the missing real Feishu/Lark proof and for choosing this PR versus the sibling open candidate before merge.

Security
Cleared: No concrete security or supply-chain concern was found; the diff stays within Feishu plugin runtime, schema, and tests with no dependency, workflow, package, or secret-handling change.

Review findings

  • [P3] Update the drive skill for pagination inputs — extensions/feishu/src/drive-schema.ts:29-40
Review details

Best possible solution:

Land one Feishu-plugin-local pagination fix with cursor-aware list, page-draining info, aligned drive-skill guidance, and redacted live tenant proof or explicit maintainer proof override.

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

Yes. Current main and v2026.6.8 call drive.file.list only once for affected drive list/info paths, and the schema cannot accept a list cursor; I did not run a live Feishu tenant test.

Is this the best way to solve the issue?

Mostly yes. The plugin-local cursor wiring is the right layer, but the landing shape should also update bundled skill guidance, supply live proof or a maintainer override, and avoid landing both open candidate PRs.

Full review comments:

  • [P3] Update the drive skill for pagination inputs — extensions/feishu/src/drive-schema.ts:29-40
    The schema now accepts list.page_size, list.page_token, and scoped info.folder_token, but extensions/feishu/skills/feishu-drive/SKILL.md still teaches only root/folder-token listing and says info searches root. Agents using the bundled skill may miss later pages or the scoped lookup path, so update the skill alongside the model-facing contract.
    Confidence: 0.86

Overall correctness: patch is correct
Overall confidence: 0.84

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3285a10c7f79.

Label changes

Label justifications:

  • P2: This is a normal-priority Feishu plugin bugfix with clear source evidence and limited blast radius to drive list/info behavior.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides source inspection and mocked/unit-style validation, but no redacted live Feishu/Lark multi-page folder run; add terminal output, logs, screenshots, recordings, or a linked artifact with private details redacted, then update the PR body for re-review.
Evidence reviewed

PR surface:

Source +34, Tests +197. Total +231 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 60 26 +34
Tests 1 197 0 +197
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 257 26 +231

What I checked:

  • Repository policy read: Root AGENTS.md and extensions/AGENTS.md were read fully; their plugin-boundary, dependency-contract, real-proof, and best-fix review rules apply to this Feishu plugin PR. (AGENTS.md:1, 3285a10c7f79)
  • No matching maintainer note: The only maintainer note present is telegram.md, so there was no Feishu, drive, plugin, or channel note that changes this review.
  • Current main remains first-page-only: Current main listFolder calls client.drive.file.list once with only folder_token; getFileInfo also calls once and throws when the file is absent from that first response. (extensions/feishu/src/drive.ts:331, 3285a10c7f79)
  • Current schema cannot accept a list cursor: The current feishu_drive list action exposes only folder_token, while comment sibling actions already expose page_size and page_token. (extensions/feishu/src/drive-schema.ts:25, 3285a10c7f79)
  • Latest release still has the bug: The latest release tag v2026.6.8 has the same single-call drive runtime and no list cursor schema, so the fix is not already shipped. (extensions/feishu/src/drive.ts:331, 844f405ac1be)
  • Dependency contract supports cursor pagination: The pinned @larksuiteoapi/[email protected] drive.file.list type accepts page_size, page_token, and folder_token, and returns next_page_token and has_more. (extensions/feishu/package.json:11, 3285a10c7f79)

Likely related people:

  • doodlewind: GitHub commit metadata for 2267d58 shows this handle introduced the community Feishu plugin with the drive runtime, schema, and bundled drive skill. (role: introduced Feishu drive surface; confidence: high; commits: 2267d58afcc7; files: extensions/feishu/src/drive.ts, extensions/feishu/src/drive-schema.ts, extensions/feishu/skills/feishu-drive/SKILL.md)
  • wittam-01: This author added and hardened the already-paginated drive comment/reply sibling paths in the same runtime and schema files. (role: adjacent Feishu drive contributor; confidence: medium; commits: 1b94e8ca14de, ce0ff42ff5ed; files: extensions/feishu/src/drive.ts, extensions/feishu/src/drive-schema.ts)
  • steipete: Recent Feishu history includes account-aware tool routing and shared helper refactors around the same plugin runtime surfaces. (role: recent Feishu runtime refactor contributor; confidence: medium; commits: 125dc322f5c5; files: extensions/feishu/src/drive.ts, extensions/feishu/src/tool-account.ts)
  • eleqtrizit: This author recently touched registerFeishuDriveTools while enforcing Feishu account tool-family gates. (role: recent Feishu drive runtime contributor; confidence: medium; commits: d4f11d3005a5; files: extensions/feishu/src/drive.ts, extensions/feishu/src/tool-account.ts)
  • ZengWen-DT: This author recently fixed sibling Feishu wiki pagination using the same Lark cursor pattern referenced by the linked issue. (role: adjacent pagination fix author; confidence: medium; commits: 5f90f0895750; files: extensions/feishu/src/wiki.ts, extensions/feishu/src/wiki-schema.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.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 18, 2026
@xzh-icenter

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. labels Jun 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 20, 2026
@xzh-icenter

Copy link
Copy Markdown
Contributor Author

Closing this PR — the sibling candidate #94000 has been more actively maintained and already has maintainer engagement (vincentkoc assisted with rebase). Rather than duplicate review effort, I'll defer to that branch.

Thanks to the reviewers for the detailed feedback on proof requirements. The Feishu pagination fix direction is clear, and #94000 looks close to landing.

Fixes #93928

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

Labels

channel: feishu Channel integration: feishu P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu drive info falsely reports File not found for files past page 1 (list pagination already fixed in #101572)

1 participant