Skip to content

fix(feishu): folder listings can continue after first page#101249

Closed
zhangguiping-xydt wants to merge 1 commit into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-feishu-drive-listfolder-pagination
Closed

fix(feishu): folder listings can continue after first page#101249
zhangguiping-xydt wants to merge 1 commit into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-feishu-drive-listfolder-pagination

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users listing a Feishu Drive folder could receive next_page_token in the response but could not request the next page because the feishu_drive list action did not accept pagination inputs.

Why This Change Was Made

The list action now exposes page_token and page_size in its tool schema and forwards those values, along with any folder token, to Feishu Drive's file listing API. This keeps the existing list response shape, remains scoped to manual folder list continuation, and does not change other Drive actions.

User Impact

Users can continue Feishu Drive folder listings by passing the returned next_page_token as page_token, and can optionally set page_size for the folder listing request.

Evidence

  • Reviewer-visible runtime proof through the real OpenClaw gateway HTTP surface:
    daily_fix run-validation --name runtime-proof-feishu-drive-pagination -- runtime-proof-feishu-drive-pagination/run-proof.sh

    Verdict: PASS
    Surface: OpenClaw gateway HTTP /tools/invoke -> bundled feishu_drive tool -> @larksuiteoapi/node-sdk default Feishu HTTPS boundary via local HTTP capture proxy
    Limitation: Uses a local HTTPS Feishu-compatible OAPI capture server because live Feishu credentials are unavailable in this environment; it is not a live tenant proof.
    

    Observed SDK-boundary requests after invoking feishu_drive via /tools/invoke:

    1. GET /open-apis/drive/v1/files query={"folder_token":"folder_proof","page_size":"2"}
    2. GET /open-apis/drive/v1/files query={"folder_token":"folder_proof","page_size":"2","page_token":"proof-page-2-token"}
    3. GET /open-apis/drive/v1/files query={"folder_token":"folder_proof","page_size":"2"}
    

    Key assertions from runtime-proof-summary.json:

    firstPageReturnedContinuationToken: true
    secondToolsInvokeAcceptedPageToken: true
    sdkUsedDefaultFeishuHttpsHost: true
    secondSdkRequestIncludedPageToken: true
    secondSdkRequestIncludedPageSize: true
    secondSdkRequestPreservedFolderToken: true
    emptyTokenProbeDidNotForwardBlankPageToken: true
    
  • Focused regression proof: node scripts/run-vitest.mjs run extensions/feishu/src/drive.test.ts -t "lists a folder continuation page"

    Test Files  1 passed (1)
         Tests  1 passed | 15 skipped (16)
    
  • Full Feishu Drive test file: node scripts/run-vitest.mjs run extensions/feishu/src/drive.test.ts

    Test Files  1 passed (1)
         Tests  16 passed (16)
    
  • Extension test typecheck: pnpm tsgo:test:extensions

    $ pnpm tsgo:extensions:test
    $ node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfo
    

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S labels Jul 7, 2026
@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed July 6, 2026, 11:44 PM ET / 03:44 UTC.

Summary
The branch adds page_size and page_token to the Feishu Drive list action, forwards them to client.drive.file.list, and adds focused regression coverage for continuation-page requests.

PR surface: Source +16, Tests +73. Total +89 across 3 files.

Reproducibility: yes. Current main returns next_page_token from listFolder, but the list action schema and dispatcher cannot accept a continuation token, so the failure is source-reproducible without a live tenant.

Review metrics: 1 noteworthy metric.

  • Feishu drive list inputs: 2 added. The PR expands the model-facing feishu_drive list contract with cursor and page-size inputs, which maintainers should notice before merge.

Root-cause cluster
Relationship: partial_overlap
Canonical: #93928
Summary: This PR overlaps the canonical Feishu Drive pagination bug by fixing manual list continuation, while the canonical issue also covers info pagination and another open PR targets the broader fix.

Members:

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

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • Update the bundled Feishu Drive skill to document page_size and page_token continuation.

Risk before merge

  • [P1] The runtime proof uses a Feishu-compatible local HTTPS capture server rather than a live Feishu tenant, so maintainers may still want live-tenant confirmation before landing.
  • [P1] This branch fixes manual list continuation only; the canonical Feishu Drive pagination issue still needs info pagination resolved or explicitly tracked after this PR.

Maintainer options:

  1. Decide the mitigation before merge
    Update the bundled Feishu Drive skill to document cursor continuation, then land this narrow list fix only while keeping Feishu drive info falsely reports File not found for files past page 1 (list pagination already fixed in #101572) #93928 open for the remaining info pagination work or coordinating with fix(feishu): add pagination support for drive list and info #94000.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • A narrow automated follow-up can update the Feishu Drive skill text to match the new list cursor inputs without changing runtime behavior.

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

Review findings

  • [P3] Document list pagination in the drive skill — extensions/feishu/src/drive-schema.ts:29-30
Review details

Best possible solution:

Update the bundled Feishu Drive skill to document cursor continuation, then land this narrow list fix only while keeping #93928 open for the remaining info pagination work or coordinating with #94000.

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

Yes. Current main returns next_page_token from listFolder, but the list action schema and dispatcher cannot accept a continuation token, so the failure is source-reproducible without a live tenant.

Is this the best way to solve the issue?

Mostly yes for the narrow list claim: forwarding page_token and page_size in the Feishu plugin is the right owner-boundary fix, but the bundled skill should be updated and the broader info pagination issue should remain tracked.

Full review comments:

  • [P3] Document list pagination in the drive skill — extensions/feishu/src/drive-schema.ts:29-30
    The schema now accepts list.page_size and list.page_token, but the bundled Feishu Drive skill still only teaches list with folder_token and does not explain using returned cursors. Agents loaded with the skill may not discover how to continue pages; this is the still-unfixed prior P3 finding and the relevant files are unchanged since the previous reviewed head.
    Confidence: 0.85
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is correct
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 780ca1d25315.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes copied after-fix gateway /tools/invoke runtime output through the bundled Feishu Drive tool and a Feishu-compatible HTTPS capture proxy, showing page_size and page_token forwarded after the fix.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body now includes copied after-fix gateway /tools/invoke runtime output through the bundled Feishu Drive tool and a Feishu-compatible HTTPS capture proxy, showing page_size and page_token forwarded after the fix.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a normal-priority Feishu plugin bugfix with limited blast radius to Drive folder listing.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body now includes copied after-fix gateway /tools/invoke runtime output through the bundled Feishu Drive tool and a Feishu-compatible HTTPS capture proxy, showing page_size and page_token forwarded after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes copied after-fix gateway /tools/invoke runtime output through the bundled Feishu Drive tool and a Feishu-compatible HTTPS capture proxy, showing page_size and page_token forwarded after the fix.
Evidence reviewed

PR surface:

Source +16, Tests +73. Total +89 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 20 4 +16
Tests 1 73 0 +73
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 93 4 +89

Acceptance criteria:

  • [P1] git diff --check.
  • [P1] node scripts/run-vitest.mjs run extensions/feishu/src/drive.test.ts -t "lists a folder continuation page".

What I checked:

  • Repository policy read: Root and scoped extension policy were read fully; plugin-boundary, dependency-contract, whole-path review, real-proof, and related-PR handling rules applied. (AGENTS.md:1, 780ca1d25315)
  • Current main cannot accept list cursors: Current main exposes only folder_token on the list schema and dispatches list with only p.folder_token, so returned next_page_token cannot be supplied on a follow-up call. (extensions/feishu/src/drive-schema.ts:23, 780ca1d25315)
  • PR head wires the requested cursor path: At head, the schema adds page_size and page_token, listFolder forwards them to client.drive.file.list, and the dispatcher passes the parsed fields into listFolder. (extensions/feishu/src/drive.ts:328, 85d20d1c04ab)
  • Regression coverage exists for the narrow path: The added test asserts the new schema fields and verifies folder_token, page_size, and page_token are forwarded to the mocked Lark drive list call. (extensions/feishu/src/drive.test.ts:382, 85d20d1c04ab)
  • Bundled skill still omits cursor guidance: The Feishu Drive skill still documents only root and folder_token list examples and does not mention next_page_token, page_token, or page_size. (extensions/feishu/skills/feishu-drive/SKILL.md:17, 85d20d1c04ab)
  • Lark SDK contract supports the forwarded params: The upstream generated SDK declares drive.file.list params page_size, page_token, and folder_token, and response fields next_page_token and has_more. (larksuite/node-sdk/code-gen/projects/drive.ts:1773)

Likely related people:

  • doodlewind: Commit metadata maps the community Feishu plugin introduction to this handle and the commit added the drive runtime, schema, and bundled drive skill touched by this PR. (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: Path history shows this contributor added and hardened drive comment/reply paths that already expose pagination in the same runtime and schema area. (role: adjacent Feishu drive contributor; confidence: medium; commits: 1b94e8ca14de, ce0ff42ff5ed; files: extensions/feishu/src/drive.ts, extensions/feishu/src/drive-schema.ts)
  • jalehman: Current blame on the affected Feishu drive runtime and schema lines points to a recent refactor that carried the current implementation forward. (role: recent area contributor; confidence: medium; commits: cb0d8a1294ea; files: extensions/feishu/src/drive.ts, extensions/feishu/src/drive-schema.ts)
  • ZengWen-DT: Recent sibling Feishu wiki pagination work fixed the same has_more and cursor class for wiki list surfaces. (role: adjacent pagination fix author; confidence: medium; commits: 5f90f0895750; files: extensions/feishu/src/wiki.ts, extensions/feishu/src/wiki-schema.ts)
  • Sliverp: CONTRIBUTING.md lists this person for Feishu and other Chinese channel areas, making them a likely routing candidate for Feishu-specific behavior decisions. (role: listed Feishu area owner; confidence: medium; files: CONTRIBUTING.md)
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.
Review history (2 earlier review cycles)
  • reviewed 2026-07-07T01:33:20.480Z sha 86e81df :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-07T02:26:29.811Z sha 50793d2 :: needs real behavior proof before merge. :: [P3] Document list pagination in the drive skill

@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 Jul 7, 2026
@zhangguiping-xydt
zhangguiping-xydt force-pushed the fix/problem-feishu-drive-listfolder-pagination branch from 50793d2 to 86e81df Compare July 7, 2026 03:06
@zhangguiping-xydt
zhangguiping-xydt force-pushed the fix/problem-feishu-drive-listfolder-pagination branch from 86e81df to 85d20d1 Compare July 7, 2026 03:26
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. labels Jul 7, 2026
@steipete steipete self-assigned this Jul 7, 2026
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Landed the cleaned, current-main version in #101572 as commit 69b9932fae45423e5ee6b391406a3f09eb466a4c.

Your original folder-pagination implementation and contributor credit are preserved in the co-authored landing commit. The original branch was 159 main commits / 903 files behind, and the repo-native maintainer sync repeatedly timed out while trying to carry that oversized rebase, so the safe path was a clean replacement containing only the intended Feishu files.

Thank you @zhangguiping-xydt for the implementation and Gateway-level proof.

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: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants