#16647: feat(feishu_doc): allow optional initial content on create
channel: feishu
size: S
Cluster:
Memory Management Enhancements
## Summary
- feat(feishu_doc): allow optional initial content on create
- Split from our `v2026.2.13` patch train as a single-purpose change for easier review.
## Why
- Keep the diff focused and low-risk so it can be merged or reverted independently.
## Scope
- Branch: `feat/feishu-create-with-content-en`
- Files changed: 3
- Key files:
- `extensions/feishu/src/doc-schema.ts`
- `extensions/feishu/src/docx.test.ts`
- `extensions/feishu/src/docx.ts`
## Test Plan
- Suggested local command:
- `./node_modules/.bin/vitest run extensions/feishu/src/docx.test.ts`
- Validation status:
- [ ] CI checks pass
- [ ] Maintainer re-ran local tests
## Risk & Rollback
- Risk: low to medium; impact limited to touched module(s).
- Rollback: revert this PR commit(s) cleanly.
## Co-authorship
- Co-authored by @ciberponk and Codex (GPT-5).
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added optional `content` parameter to the `create` action in `feishu_doc` tool, allowing users to create a document and write initial content in a single operation. When `content` is provided, the implementation creates the document via `createDoc`, then immediately calls `writeDoc` to populate it.
- Added `content: Type.Optional(Type.String(...))` to the create action schema
- Modified create case handler to conditionally call `writeDoc` and merge results
- Added test coverage for the happy path scenario
Critical issue: if `writeDoc` throws after `createDoc` succeeds, the error propagates to the outer catch block which returns only `{ error: "..." }`, losing the `document_id` of the already-created document. This makes recovery difficult.
<h3>Confidence Score: 3/5</h3>
- Safe to merge with known limitation in error handling
- The feature implementation is straightforward and the happy path works correctly. However, the error handling issue where `document_id` is lost when `writeDoc` fails after successful `createDoc` is a functional defect that could make debugging and recovery difficult. The PR is low-risk for breaking existing functionality since it only adds an optional parameter, but the error handling gap prevents a higher score.
- extensions/feishu/src/docx.ts requires error handling improvement for the create-with-content flow
<sub>Last reviewed commit: 70aa36a</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16637: feat(feishu_doc): support optional public_access on create
by ciberponk · 2026-02-14
84.1%
#16438: feat(feishu): add create_from_markdown import action
by ciberponk · 2026-02-14
81.2%
#16592: feat(feishu): add write mode import for markdown documents
by ciberponk · 2026-02-14
75.3%
#16607: feat(feishu): add get_public_permission doc action
by ciberponk · 2026-02-14
73.2%
#16594: feat(feishu): add set_public_permission doc action
by ciberponk · 2026-02-14
73.2%
#20304: feat(feishu): support Docx table create/write + image/file upload a...
by xuhao1 · 2026-02-18
72.8%
#14402: fix(feishu): chunk large documents for write/append to avoid API 40...
by lml2468 · 2026-02-12
72.5%
#16409: fix(feishu): preserve docx block order via sequential inserts
by ciberponk · 2026-02-14
70.7%
#16428: fix(feishu): retry docx block insertion on rate limits
by ciberponk · 2026-02-14
70.0%
#10675: feat(feishu): add audio message support and fix file upload
by YumoeZhung · 2026-02-06
65.4%