Skip to content

[Bug] doc: successful +update / +media-insert writes reported as read-back verification failure; block list hasMore stays true past the end #1465

Closed

Description

@dzshzx

Summary

On v1.0.63 (commit 4cd5d05), document writes that actually succeed are reported as failed by the built-in read-back verification, and doc block list pagination signals more pages after the last block. Together they make agents treat successful writes as partial_success and tempt them to retry (which the error text itself forbids).

Related: #1103 reports the same "applied remotely, read-back verification fails" pattern for aitable composites.

Environment

  • dingtalk-workspace-cli 1.0.63, Edition open, MCP Static Endpoint Mode, Linux (WSL2)
  • Target: a normal online doc (adoc) of about 117 top-level blocks with tables, callouts (container / colorBlocks), links and one inline image

Observed

  1. dws doc +update --command overwrite --doc-format jsonml --content @doc.json --yes and the block commands block_replace / block_insert_after (also --doc-format jsonml) return:

    • status: partial_success, steps update_document: success, verify: failed
    • message 文档写入已经执行,但回读验证失败;请先检查当前内容,不要直接重试写入, cause 回读结果未包含预期内容

    A manual +fetch / doc block list read-back shows the content was fully written every time (6 of 6 block operations, plus the overwrite).

  2. dws doc +media-insert --file ./image.png --ref-block <table block> --where after --yes uploads and inserts the image, then fails verification with cause 媒体资源在有界回读窗口内仍无法读取: list_document_blocks 声明仍有下一页但当前页为空. The image block is present on read-back.

  3. dws doc block list --content-format jsonml pagination:

    • --end-index is exclusive: --start-index 0 --end-index 49 returns 49 blocks (indices 0–48), so paging with s .. s+49 silently skips every 50th block. The help example (--start-index 0 --end-index 5) does not state which way it works.
    • A page past the end (--start-index 150 on a 117-block document) returns blocks: [] with hasMore: true, matching the media-insert verification cause above.

Expected

  • Write verification reports success when the content is present, or reports unknown with a pointer to read back, rather than verify: failed.
  • hasMore is false once the last block has been returned; an empty page never carries hasMore: true.
  • --end-index semantics (inclusive / exclusive) are documented in the help text.

Reproduce

  1. Create a doc from JSONML containing a few tables and one container callout (dws doc +create --doc-format jsonml).
  2. Run any of the writes above against it, then read back with +fetch.
  3. Call doc block list with --start-index beyond totalCount and inspect hasMore.

Activity

  1. AlwaysLee commented on Oct 13, 2026

    @AlwaysLee
    Collaborator

    Hi @dzshzx 👋

    感谢报告这个问题!你提供的复现步骤和详细环境信息非常有助于定位。三个子问题已全部修复并部署。

    问题原因

    服务端 list_document_blocks 接口的分页计算存在缺陷:

    1. hasMore 在越界时仍返回 true — 分页终止条件计算错误,导致空页也声称"还有下一页"
    2. --end-index 表现为 exclusive — 闭区间计算差一,每页最后 1 个块被静默丢弃
    3. 写入验证误报 — 上述两个问题叠加,使 CLI 的回读验证在分页时无法正常终止

    修复状态

    服务端已修复并上线,hasMore、totalCount、nextStartIndex 在 jsonml 和 element 两种格式下行为一致且正确。写入操作(+update / +media-insert / block_replace)的回读验证现在可以正常分页收敛,不再误报 verify: failed。

    如果问题仍然存在,请提供 dws --version 和 --verbose 日志,我们会继续跟进 🔧

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions