openclaw - ✅(Solved) Fix Bug: feishu_doc write and append actions return 400 on valid markdown content [2 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#64299Fetched 2026-04-11 06:15:28
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Participants
Timeline (top)
commented ×2cross-referenced ×2

Error Message

  • Actual: 400 error returned, no content written

Fix Action

Workaround

Use update_block to write content block-by-block, but this prevents use of markdown formatting.

PR fix notes

PR #64331: fix: normalize feishu doc descendant children

Description (problem / solution / changelog)

Summary

  • fix feishu_doc descendant payload construction so normalized children arrays are not overwritten by raw converted block data
  • add a regression test covering converted blocks whose children come back as a single string id

Root cause

write and append both serialize converted markdown blocks through toDescendantBlock(). That helper normalized block.children into a string array, but then spread the original block object afterwards, which could overwrite children back to a raw string. Feishu's descendant create endpoint expects children to be an array, so those requests failed with 400 on otherwise valid markdown.

Testing

  • attempted: pnpm vitest run extensions/feishu/src/docx.test.ts extensions/feishu/src/docx-batch-insert.test.ts
  • attempted: pnpm vitest run extensions/feishu/src/docx.test.ts --maxWorkers=1 --no-file-parallelism -t "normalizes descendant children to arrays before sending create requests"
  • note: this workspace repeatedly SIGKILLed vitest during execution, so I could not get a clean local completion despite adding a focused regression test

Closes #64299

Changed files

  • extensions/feishu/src/docx.test.ts (modified, +34/-0)
  • extensions/feishu/src/docx.ts (modified, +1/-1)
  • extensions/ollama/openclaw.plugin.json (modified, +2/-1)
  • src/agents/auth-profiles.ensureauthprofilestore.test.ts (modified, +132/-0)
  • src/agents/auth-profiles/store.ts (modified, +16/-21)
  • src/gateway/server-close.test.ts (modified, +64/-0)
  • src/gateway/server-close.ts (modified, +61/-57)

PR #64336: fix(feishu): add docx:document.block:convert scope to batch import JSON

Description (problem / solution / changelog)

Summary

Adds the missing docx:document.block:convert scope to the Feishu batch import JSON in the documentation. This scope is required for the document.convert API that powers the feishu_doc tool's write and append actions.

Without this scope, the write and append actions return 400 Bad Request even with valid markdown content.

Changes

  • Added docx:document to tenant scopes (for basic docx read/write)
  • Added docx:document.block:convert to tenant scopes (for markdown-to-block conversion)

Context

  • Issue: openclaw/openclaw#64299
  • The docx:document.block:convert API is required for markdown-to-block conversion used by write/append actions

Changed files

  • docs/channels/feishu.md (modified, +2/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

The feishu_doc tool's write (replace all) and append actions consistently return 400 Bad Request for any markdown content, even simple plain text. The update_block action works correctly with the same content, but write and append always fail.

This makes formatted document creation impossible — only raw block-level updates via update_block work, which prevents use of markdown formatting (headings, lists, tables, etc.).

Steps to Reproduce

  1. Create a new document via feishu_doc create
  2. Try to write content via feishu_doc write with any markdown string (even single line of text)
  3. Observe: Request failed with status code 400

Environment

  • OpenClaw version: 2026.3.11
  • Feishu plugin: bundled
  • Feishu API permissions: 20 granted including docx:document

Expected vs Actual

  • Expected: Document content replaced with/written from markdown
  • Actual: 400 error returned, no content written

Workaround

Use update_block to write content block-by-block, but this prevents use of markdown formatting.

Additional Context

The read, list_blocks, get_block, update_block, and create actions all work correctly. Only write and append are broken.

extent analysis

TL;DR

The feishu_doc tool's write and append actions may be failing due to incorrect handling of markdown content, and using the update_block action as a workaround can bypass this issue.

Guidance

  • Verify that the markdown content being passed to the write and append actions is properly formatted and escaped, as malformed input could cause a 400 Bad Request error.
  • Check the Feishu API documentation to ensure that the write and append actions support markdown content, and that the correct content type is being specified in the request.
  • Test the write and append actions with plain text content to determine if the issue is specific to markdown formatting.
  • Consider modifying the feishu_doc tool to handle markdown content correctly, or to use the update_block action as a fallback for writing formatted content.

Example

No code snippet is provided, as the issue does not include specific code examples.

Notes

The root cause of the issue is unclear, but it may be related to the handling of markdown content by the feishu_doc tool or the Feishu API. Further investigation is needed to determine the exact cause and develop a permanent fix.

Recommendation

Apply workaround: Use the update_block action to write content block-by-block, as this is the only action that currently works correctly for writing formatted content. This workaround is necessary until the root cause of the issue can be determined and a permanent fix can be implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING