Repository navigation
fix(feishu): preserve text and clean up failed inbound file writes - #13337
Conversation
|
Verification report for
This is an offline test-script fallback, not live Feishu E2E: resource HTTP and the final dispatch boundary are mocked, while inbound preparation and filesystem writes/removal are real and isolated. Stop/finally paths and best-effort cleanup-denial behavior were source-reviewed, not claimed as new live/device executions. No platform credentials or models were used. Fresh upstream CI/review remains necessary. 中文: |
|
Thanks for the commit-pinned review. I will keep the isolated storage-test file: its module-level filesystem mocks should not enter the existing adapter test module, and a shared three-adapter refactor is outside this fix. The before/after report uses the same four-case fixture against main 中文:感谢针对精确提交的审查。保留隔离的存储测试文件,避免模块级 fs mock 进入已有 adapter 测试模块;跨三个适配器的共享重构不在本次范围。前后报告使用同一四例 fixture,分别对 main |
Local maintainer verification — PR #13337Verdict: ✅ merge-ready — 383 scripted assertions executed, 383 passed, 0 unexpected failures. Verified head: 中文摘要结论:可合并。 在 macOS(Darwin arm64, Node 22.23.1)上以 head/base 双工作区完成 A/B 验证:
Central claim and A/B proofClaim: when local storage of a downloaded Feishu document fails, the turn no longer dies — partial storage is best-effort removed, a sanitized diagnostic is logged, and the synthetic file placeholder becomes The A/B drove the built dist of both trees through a mock-free wire harness (real loopback HTTP server standing in for the Feishu Open API, real filesystem faults,
All 13 base-side reds were the expected bug signature (encoded as expected-failure cells); all 15 base-side greens confirm untouched behavior. See New-test vacuity / load-bearing proofThe PR's new
Mutation matrix (each guard reverted alone at head, new suite run per mutant)
Zero survivors; every mutant was killed by the assertions that exist to pin it (verified by failed-test names, not just counts). See Gates
FindingsNone blocking. Observations, for the record:
Not covered
MethodologymacOS arm64, Node v22.23.1. Two git worktrees at the verified head/base OIDs; head installed with Evidence capturesLocal maintainer verification by @wenshao — harness, mutation scripts and raw logs preserved under |
|
Thanks for the thorough verification of The remaining production fix is small: if immediate directory removal fails, I retain ownership for the existing 60-second cleanup attempt; Stop clears ownership only after successful removal. I reproduced the residual leak before changing it. The final 18-case fixture has three cleanup failures against the previous adapter and passes with the fix. Full package results are 311/311 on Linux and 309 passed plus two POSIX skips on Windows; all eight isolated mutations are detected on both platforms. A separate probe against compiled JavaScript goes from five cleanup failures/six passing controls to 11/11, including real channel/session dispatch with an offline bridge stub. Build, bundle, typecheck and targeted lint/format checks pass. I also narrowed the docs, added hostile-filename and bounded-diagnostic regressions, and corrected the plain-text test name. The PR description records the environment and limits: no live Feishu run, controlled timers, and an isolated Linux dependency installation. Your verification applies to the previous SHA; this new commit still needs its own upstream CI and review. I am available for any remaining corrections and follow-up maintenance. |
|
I checked the remaining Ubuntu failure at Three alternating base/head comparisons on local Linux Docker reproduced cold-limit failures on both versions, while warm-cache and all five lane controls passed. This was an isolated benchmark dependency install, not a reproduction of the hosted runner. The upstream baseline job passed on ECS with a 1,250 ms limit, so its green result does not settle the 275 ms hosted limit. I have not changed or relaxed the benchmark. @wenshao Could you triage or rerun the Ubuntu job and review |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
中文说明
— qwen3.8-max via Qwen Code /review (v0.25.0)
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
No blocking issues. LGTM! ✅
Deferred under the convergence posture (round 2, not a blocker) — recorded, not requested in this round:
packages/channels/feishu/src/inbound-file-store.test.ts:139 — [review] No test binds the new store-failure diagnostic to the failure pathpackages/channels/feishu/src/FeishuAdapter.ts:2784 — [review] New diagnostic claims a delivery the Stop check below can still cancel
中文说明
无阻断问题。LGTM!✅
收敛姿态下延后(第 2 轮,非阻断)——已记录,本轮不要求修改:共 2 条(原文未翻译,列表见上方英文部分)。
— qwen3.8-max via Qwen Code /review (v0.25.0)
|
Released in v0.25.1. |


What this PR does
Keeps the Feishu message turn running when a downloaded document cannot be saved locally. A local storage failure skips the attachment, logs a sanitized diagnostic and removes partial storage when possible. If no attachment remains, the synthetic file placeholder becomes
(User sent media but download failed), preserving any quoted context.If immediate removal also fails, the directory remains owned by the existing 60-second cleanup timer. Stopping a message clears that ownership only after successful removal. Successful files retain their bytes, metadata and cleanup period; new files and temporary leaf directories use owner-only POSIX permissions (
0600and0700).This is the separate production fix for #13334, based directly on main. It does not include the coverage-only changes in #13278.
Why it's needed
A local storage error previously stopped message dispatch and could leave partial files behind. The fallback preserves the message and explains the unavailable attachment. The second review also exposed a remaining leak when both storage and immediate cleanup fail; retaining directory ownership gives transient cleanup failures the existing delayed attempt.
Reviewer Test Plan
How to verify
0600files and0700leaf directories under umask022and000.Evidence (Before & After)
Validation for
187a2da5265a:db3a0c82) fails three cleanup regressions. Linux: 15 pass / 3 fail; Windows: 13 pass / 3 fail / 2 POSIX skips. With this fix: Linux 18/18; Windows 16 pass / 2 skips.Tested on
Environment (optional)
Offline tests use controlled HTTP responses and real isolated temporary files. The integration probe uses a stub model bridge and controlled timers. No live Feishu account, daemon, ACP or external model run is claimed. Linux checks used an isolated minimal dependency installation at the relevant runtime/test versions, rather than the full frozen repository dependency tree. Fresh upstream CI is still required on this commit.
Risk & Scope
Cleanup retains the existing one-shot best-effort retry; persistent removal failure is not guaranteed to recover. The fallback marker covers local document-storage errors after download; the existing HTTP/download-null behavior remains outside this fix. No dependency, lockfile or other-adapter changes are included.
Linked Issues
Fixes #13334. Refs #13278 and #13220.
中文说明
下载的文档无法在本地保存时,消息仍继续处理:跳过附件、保留引用内容和合成文本标记,并记录经过清理的原始错误。新文件与临时叶子目录使用 POSIX
0600/0700权限。本轮修复立即清理失败后的目录所有权:保留既有 60 秒清理定时器;Stop 分支仅在删除成功后清除所有权。没有新增清理器或无限重试。HTTP 下载失败路径、文件名长度策略和其他适配器不在范围内。
187a2da5265a的验证:扩展 18 项存储回归在此前发布的db3a0c82适配器上出现 3 项清理失败;修复后 Linux 18/18,Windows 16 通过、2 项 POSIX 测试跳过。完整飞书套件 Linux 311/311,Windows 309 通过、2 项跳过;两平台均检出 8/8 个隔离变异。另一个离线集成探针在原适配器上复现 5 项清理失败、6 项对照通过;最终编译后的适配器 11/11 通过。测试使用真实临时文件、受控故障与时间,其中一项经过真实 ChannelBase/SessionRouter 和 stub bridge。全仓 build、bundle、typecheck,测试文件严格类型检查及针对性 lint/格式检查通过。CLI help 等仅为启动检查。
未运行真实飞书账号、daemon、ACP 或外部模型。Linux 使用相关版本的隔离最小依赖安装,并非完整冻结的仓库依赖树;本地未重新测试本提交的 macOS。仍需此提交的新上游 CI 和审查。