Skip to content

fix(feishu): drive info finds files past the first page#104190

Merged
steipete merged 1 commit into
openclaw:mainfrom
destire-mio:fix/feishu-drive-info-lookup
Jul 12, 2026
Merged

fix(feishu): drive info finds files past the first page#104190
steipete merged 1 commit into
openclaw:mainfrom
destire-mio:fix/feishu-drive-info-lookup

Conversation

@destire-mio

@destire-mio destire-mio commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Closes #93928

What Problem This Solves

Fixes an issue where Feishu users running feishu_drive info received File not found for files that were not present on the first page of the root drive listing.

Why This Change Was Made

Drive info now queries Feishu's metadata API directly by file token and type instead of searching a single root-list response. Shortcut lookups retain the existing root-list behavior because the metadata endpoint does not support the shortcut type, and installations without the metadata scope fall back to the legacy lookup for compatibility.

User Impact

Users can retrieve metadata for supported files regardless of the containing shared folder or root-list page. Existing read-only installations continue to support root-level info lookups, while direct lookups require drive:drive.metadata:readonly or the full drive:drive scope.

Evidence

  • pnpm test extensions/feishu/src/drive.test.ts — 24 tests passed
  • pnpm test:extension feishu — 79 files and 1,123 tests passed
  • Focused oxfmt and oxlint checks passed
  • Documentation formatting and git diff --check passed
  • Final Codex review reported no findings

Redacted live Feishu proof

Validated on July 11, 2026 with an enabled enterprise app using application-identity drive:drive.metadata:readonly. No App Secret, tenant token, file token, title, owner ID, or URL is included below.

For an existing wiki document, Feishu resolved the wiki token to its underlying document metadata:

{"httpStatus":200,"code":0,"metasCount":1,"returnedType":"docx","tokenLength":27,"hasTitle":true,"hasUrl":true,"requestType":"wiki","requestTokenMatches":true}

The PR's exact direct lookup shape was then used with that underlying docx token:

{"httpStatus":200,"code":0,"metasCount":1,"tokenMatched":true,"returnedType":"docx","hasTitle":true,"hasUrl":true,"hasOwner":true,"hasCreateTime":true,"hasModifyTime":true}

The same app does not have the legacy root-list scope, so the old root request returned HTTP 400 / Feishu code 99991672, while the direct metadata request above succeeded. This confirms direct info lookup works independently with the documented metadata-only scope.

An invalid docx token returned HTTP 200 with top-level code: 0, an empty metas array, and this per-document failure:

{"failed_list":[{"code":970005,"token":"<redacted-invalid-token>"}]}

The missing-file regression test now mirrors that observed failed_list shape and confirms the tool reports File not found. Shortcut behavior and the legacy read-only fallback remain covered by focused mocked SDK tests; no existing app with exactly drive:drive:readonly and without metadata scope was available for a live fallback test.

After rebasing onto current main, production/test type checks are blocked by pre-existing errors in extensions/feishu/src/presentation-card.ts (renderMessagePresentationTableFallbackText missing and an unrelated select/table comparison). This PR does not modify that file.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: feishu Channel integration: feishu size: M labels Jul 11, 2026
@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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 12:19 AM ET / 04:19 UTC.

Summary
The PR changes Feishu Drive info to query metadata directly by file token and type, retains root-list fallback for shortcuts and missing metadata permission, and updates focused tests and permission documentation.

PR surface: Source +49, Tests +131, Docs +7. Total +187 across 4 files.

Reproducibility: yes. at source level with high confidence: current main makes one root-list request and searches only that response, matching the canonical issue’s later-page failure path. This read-only review did not run a live failing current-main tenant scenario.

Review metrics: 1 noteworthy metric.

  • Permission contract: 1 scope documented, 1 compatibility fallback retained. Direct lookup broadens file access while preserving root-level info behavior for existing read-only installations.

Stored data model
Persistent data-model change detected: vector/embedding metadata: docs/channels/feishu.md, vector/embedding metadata: extensions/feishu/skills/feishu-drive/SKILL.md, vector/embedding metadata: extensions/feishu/src/drive.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #93928
Summary: This PR is the active fix candidate for the canonical issue’s remaining info lookup behavior; list continuation already landed separately.

Members:

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

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

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

Risk before merge

  • [P1] No live app with exactly drive:drive:readonly and without metadata scope was available, so that upgrade path is supported by exact SDK inspection and focused mocked coverage rather than live tenant proof.

Maintainer options:

  1. Merge with compatibility evidence (recommended)
    Accept the limited upgrade risk because the legacy root lookup remains available and the pinned SDK source plus focused tests validate the missing-scope fallback.

Next step before merge

  • [P2] The PR is already the correct implementation candidate and needs ordinary maintainer merge handling rather than an automated repair.

Security
Cleared: The focused plugin change introduces no concrete security or supply-chain concern.

Review details

Best possible solution:

Merge the direct metadata lookup with its narrow shortcut and missing-scope fallback, then close the linked canonical issue once the PR lands.

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

Yes at source level with high confidence: current main makes one root-list request and searches only that response, matching the canonical issue’s later-page failure path. This read-only review did not run a live failing current-main tenant scenario.

Is this the best way to solve the issue?

Yes. Direct token-and-type metadata lookup is narrower and more capable than paginating directory listings, and the exact pinned SDK contract supports the request, result normalization, shortcut exception, and permission fallback.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This plugin-local bug prevents valid Feishu Drive metadata lookups for files outside the first root listing.
  • merge-risk: 🚨 compatibility: Existing read-only installations make a new metadata request first and depend on the retained missing-scope fallback.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Redacted live Feishu output demonstrates after-fix direct metadata lookup and invalid-token behavior; focused tests supplement shortcut and missing-scope compatibility coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. Redacted live Feishu output demonstrates after-fix direct metadata lookup and invalid-token behavior; focused tests supplement shortcut and missing-scope compatibility coverage.
Evidence reviewed

PR surface:

Source +49, Tests +131, Docs +7. Total +187 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 56 7 +49
Tests 1 131 0 +131
Docs 2 9 2 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 196 9 +187

What I checked:

  • Current-main behavior: Current main performs one root-directory drive.file.list request and searches only that response, so valid nested or later-page files can be reported missing. (extensions/feishu/src/drive.ts:367, ef13c2fe98fc)
  • Direct metadata implementation: The PR uses drive.meta.batchQuery with the supplied token and type, preserves root lookup for shortcuts, and falls back only on Feishu missing-permission code 99991672. (extensions/feishu/src/drive.ts:389, c582bc294715)
  • Regression coverage: Focused tests cover direct lookup normalization, observed invalid-token failure, shortcut behavior, and the legacy missing-metadata-scope fallback. (extensions/feishu/src/drive.test.ts:440, c582bc294715)
  • Pinned dependency contract: The plugin pins @larksuiteoapi/node-sdk 1.68.0; its generated types accept every supported non-shortcut type used by the PR and return the normalized metadata fields plus failed_list. (extensions/feishu/package.json:10, c582bc294715)
  • SDK error behavior: The pinned SDK rethrows Axios request failures unchanged, preserving response.data.code for the existing error extractor, while successful HTTP responses expose top-level Feishu codes directly. (extensions/feishu/src/drive.ts:277, c582bc294715)
  • Live behavior proof: The PR body contains redacted live Feishu output showing metadata-only direct lookup succeeds where the legacy root request is denied, and records the real invalid-token failed_list response. (c582bc294715)

Likely related people:

  • steipete: Authored and merged the recent Feishu Drive list-pagination fix across the same runtime, test, schema, and skill surfaces and previously refactored Feishu tool routing. (role: recent adjacent owner and merger; confidence: high; commits: 4a032a7ecd93, 1aa77e4603fc, 125dc322f5c5; files: extensions/feishu/src/drive.ts, extensions/feishu/src/drive.test.ts, extensions/feishu/src/drive-schema.ts)
  • doodlewind: Authored the commit that imported the community Feishu plugin and its Drive tools into the repository. (role: feature introducer; confidence: high; commits: 2267d58afcc7; files: extensions/feishu/src/drive.ts, extensions/feishu/package.json)
  • m1heng: The Feishu package identifies @m1heng as the community owner of the plugin from which the Drive behavior originated. (role: community plugin owner; confidence: medium; commits: 2267d58afcc7; files: extensions/feishu/package.json, extensions/feishu/src/drive.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.
Review history (5 earlier review cycles)
  • reviewed 2026-07-11T05:44:16.434Z sha 6d73b88 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-11T06:21:03.799Z sha 5373f3a :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T07:15:18.525Z sha 9b1fec0 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T17:50:40.076Z sha 69cb320 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T17:58:10.183Z sha 69cb320 :: needs maintainer review before merge. :: none

@destire-mio
destire-mio force-pushed the fix/feishu-drive-info-lookup branch from 6d73b88 to 5373f3a Compare July 11, 2026 06:07
@destire-mio

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 11, 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.

Re-review progress:

@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 11, 2026
@destire-mio
destire-mio force-pushed the fix/feishu-drive-info-lookup branch from 5373f3a to 9b1fec0 Compare July 11, 2026 06:42
@destire-mio
destire-mio marked this pull request as ready for review July 11, 2026 06:42
@destire-mio
destire-mio force-pushed the fix/feishu-drive-info-lookup branch from 9b1fec0 to 69cb320 Compare July 11, 2026 17:43
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 11, 2026
@destire-mio
destire-mio force-pushed the fix/feishu-drive-info-lookup branch from 69cb320 to c582bc2 Compare July 12, 2026 04:09
@steipete steipete self-assigned this Jul 12, 2026
@steipete
steipete merged commit f547e2b into openclaw:main Jul 12, 2026
95 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

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

Labels

channel: feishu Channel integration: feishu docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M 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.

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

2 participants