Repository navigation
fix(lark): preserve image replies in adopted and unified sessions - #1703
LeonYuanYao wants to merge 4 commits into
Conversation
Upload bounded workspace images in adopted replies through the existing Lark image API. Preserve code examples and explicit image placeholders, and degrade unresolved images without losing the reply body. Retry only confirmed invalid-image-key rejections with an image-free card while retaining delivery ownership and UUID semantics. Cover final output, local turns, adopt preambles, and existing image flows with regression tests.
Remove rejected images from native Markdown table cells while preserving text columns and code examples. Apply image fallback at the durable reply-card publisher so POST, PATCH, and later terminal updates share the delivered image-free state. Persist downgraded pending content before retrying with the same provider UUID, retain ownership and withdrawal checks, and leave managed VC delivery unchanged. Add regression coverage for table fallback, recovery after unknown send results, and Codex and Claude bridge delivery.
|
Thanks for the thorough PR — the layered design is solid: the shared render boundary, the heavily guarded workspace upload (lexical + realpath containment, There is one blocking issue, test-only, which is also why the
|
#1703 的图片上传回归测试把夹具与工作目录写死为 /tmp/test-sessions; 主干 #1615 将 config.session.dataDir 改为每例独立的 mkdtemp 后, beforeEach 不再创建该共享目录,干净 CI 上 writeFileSync 夹具 ENOENT, test(3/3) 上 12 个图片用例红(本机因目录残留而假绿)。 把这些用例的夹具路径、getSessionWorkingDir、ds.workingDir 统一迁到 config.session.dataDir(beforeEach 已按例创建并清理),恢复隔离、 消除对共享残留目录的依赖。纯测试改动,无生产代码影响。 Co-Authored-By: Claude Code <[email protected]>
An adopted Codex final containing a local Markdown screenshot could be visible in the terminal while Feishu rejected the entire reply card with
230099 / 200570: card contains invalid image keys. This change uploads eligible workspace images before rendering and preserves the answer when an image cannot be displayed.--images/img:Nflow, and image syntax inside code examples.The shared renderer covers ordinary finals, adopted local turns, and adopt preambles. Existing native image uploads remain supported. Remote, sandbox/read-isolated, API-only, and managed VC sessions do not gain host-file uploads; managed VC retains its audited delivery contract. Tests cover Codex and Claude paths. Local validation ran on macOS; Linux was not exercised.
Validation
The new table and unified-card regression tests failed before the fixes and passed afterward. The following suite passed 14 files / 526 tests:
bun run test -- \ test/reply-images.test.ts test/lark-image-buffer-upload.test.ts \ test/md-card-images.test.ts test/md-card.test.ts test/md-card-vega-lite.test.ts \ test/bridge-final-output-retry.test.ts test/cli-send-image-mode.test.ts \ test/turn-reply-card.test.ts test/turn-reply-card-runtime.test.ts \ test/lark-transport-boundary.test.ts test/turn-reply-ask.test.ts \ test/cli-send-reply-card.test.ts test/daemon-turn-reply-sender-wiring.test.ts \ test/vc-meeting-im-reply.test.ts bun run build git diff --checkThe live check did not trigger a new Codex turn. Invalid-image-key rejection, fallback, and crash recovery were verified offline using simulated provider errors; deliberate rejection/fallback has not been exercised against Feishu.
Visual example
This local illustration is rendered from the current card JSON using fixture keys. It is not a Feishu client screenshot.
Review follow-up
The filesystem mock in
test/reply-images.test.tsnow uses a synchronous, typedrequire('memfs')factory. This removes the Bunawait import()mock deadlock that caused the sole native-Bun CI timeout. The file passes 25/25 under Vitest and 25/25 under local Bun 1.3.14; the pinned Bun 1.4.2 also passes 25/25 locally in 429 ms. Production code is unchanged by this follow-up. The optional image-placeholder localization suggestion remains a separate UI follow-up.