Skip to content

[bugfix] canvas: show video frames in the reference picker - #611

Merged
wangtiance merged 3 commits into
ThinkFlowLab:mainfrom
wangtiance:codex/video-reference-thumbnails
Dec 4, 2026
Merged

wangtiance merged 3 commits into
ThinkFlowLab:mainfrom
wangtiance:codex/video-reference-thumbnails

Conversation

@wangtiance

@wangtiance wangtiance commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Saved video nodes showed only a video icon in the AI assistant’s project reference picker. Use the existing server-generated first-frame JPEG for visible or nearby rows and reuse the cached frame on reopen. If the preview is unavailable, the icon remains and the reference can still be selected. The picker continues to insert the original asset identity. Updated both user guides.

Linked issue

  • No issue applies. This change follows a user report.

Labels

  • type:bug and area:canvas requested on creation.

Test plan

  • Local: npm run build, npm run check:i18n, npm run check:browser-manifest, npm run check:browser-locale, and 48 tests via node --test tests/referenceMentions.test.ts tests/creationClient.test.ts passed.
  • Local Chrome: tests/browser/assistant_chat_references.mjs passed with an isolated assistant fixture, synthetic H.264 MP4 and PNG, real FFmpeg preview, and a local empty skill-catalog double for native OpenCode discovery. The stock local fixture passed the preview and insertion assertions but timed out waiting for the assistant message on Windows. The test injects a one-shot 422, checks the selectable icon fallback, decodes the JPEG, reopens through a typed mention to check reuse, and verifies the original asset ID and fingerprint in the persisted assistant message.
  • Left to CI: PR-triggered Release checks, CodeQL, and the path-scoped DSH check. The full production browser lane was not run locally. The shared generation reference picker can also display these frames for eligible saved canvas nodes. That entry point was reviewed in code and was outside the local browser run.
  • Independent candidate review: 93/100. Base 68f1d5301d7bf8d9f24631df7ae08a840f2f25a5, head 92bc845481bddb7ba6926525c8dc24d53ed2382b. CI and local production-lane gaps are recorded above.

Evidence that it works

Place a saved 镜头.mp4 video node and 海报.png image node on a canvas. Open the right-hand AI assistant and type @ or click the project reference button. Compare the video row while the image row provides a visual control.

Before After
Video icon on 3ac0ce39be31f799fac3996eec925163a7819792 Decodable first frame on f1f413e4be3ec2185c998b16e024eb64d58bb1eb, which has the same application source as the reviewed head
Video row with a generic icon Video row with a first-frame thumbnail

Provider verification

  • The browser test uses an assistant model double and real local media processing. No external model provider was called.

Bilingual UI

  • The existing UI messages and accessibility labels remain in use. The English and Simplified Chinese user guides were updated together.

中文摘要

修复右侧 AI 助手在引用项目素材时只显示视频图标的问题。已保存的视频在列表中显示首帧,重复打开会复用缓存。预览失败会显示原图标,素材仍可选择。提交的引用保留原视频的 ID 和指纹。

Refresh against main

Updated to main including #648, which isolates the bundled OpenCode test workers. Resolved the media client conflict by retaining main’s cancellable shared read and the reference picker’s video preview rendition. Leaving the picker releases its pending first-frame read when the last viewer leaves. Completed previews remain cached.

Exact-head local validation: 52 focused Node tests, TypeScript, i18n and git diff checks passed. The new test checks the video preview route and cancellation after the last observer leaves. The Windows browser rerun was blocked during fixture startup by a local directory permission error. The existing browser screenshot and original run above predate this update. Fresh Release, CodeQL and DSH checks are pending.

Independent candidate review: 93/100, base d083cbc, head 94b4075.

中文摘要

同步包含 #648 的主分支,并解决媒体读取的冲突。视频引用仍走首帧预览,关闭选择器时会释放最后一个观察者对应的未完成读取。本地 52 个相关测试、TypeScript 和 i18n 通过。Windows 浏览器夹具因本地目录权限未能启动,等待新提交的 GitHub 检查。

## summary

Load saved video previews when their reference rows enter view. Reuse
cached first frames and keep the video option available on failure.
Cover preview loading and reuse in the assistant browser workflow.
## summary

Exercise the toolbar for preview fallback and retry, then verify cache
reuse through the original typed mention and send journey.
@wangtiance wangtiance added type:bug Something is broken area:canvas Canvas, nodes and direct manipulation labels Dec 1, 2026
async (signal) => {
const response = await fetch(
`/api${creationPath(this.id)}/assets/${assetId}/thumbnail`,
`/api${creationPath(this.id)}/assets/${assetId}/${rendition}`,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the flagged call at this revision. It sends a GET with no request body to the app’s relative project asset API. The rendition is selected from the fixed preview and thumbnail routes, the project and asset IDs identify the requested resource, and the JPEG bytes come back in the response. The CodeQL workflow completed, but alert #91 remains open. The reported source-to-sink path still needs to be checked before deciding whether to change the code or dismiss the alert.

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST CHANGES 92bc845 Refs: none (user report)

当前证据暂定 82/100,非批准分:范围 3/3、正确性 2/3、验证 2/3、主张证据 3/3、简洁度 2/3。前后两张图已下载并打开,确实由视频图标变成了首帧;录图版本的三个应用文件与当前提交一致。浏览器用例通过,覆盖了失败回退、重新打开复用缓存和原视频身份,没覆盖生成面板的入口,也没覆盖多个慢预览。没运行 PR 代码。

关闭选择器只阻止更新 UI,不会取消已经无人在等的预览。预览和显式媒体读取共用三个并发位;满载时,显式操作只能等位,详见行内。Release Python 的 OpenCode 集成超时,暂无证据归因给此改动;当前 Release 仍红。CodeQL 工作流完成,但已有行内告警,不能把工作流绿灯视作告警已处置。

English: Cancel unobserved preview reads so they do not hold all shared media slots after the picker closes. The before/after images and successful assistant-browser job support the feature, but Release is red.

Dot,代表 @david6666666。

Comment thread src/canvas/ChatReferenceEditor.tsx Outdated
if (mounted) setSrc(url);
})
.catch(() => {});
return () => { mounted = false; };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里关掉列表只会挡住 setSrc,慢首帧请求还占着项目共用的媒体读取位。如果三个预览都在等,下一次用户主动读素材也得排队。建议沿用现有可取消的媒体读取方式:最后一个观察者离开时取消未完成请求,已完成的首帧仍缓存。可以补一条「打开列表触发慢预览 → 关闭 → 主动读素材不被卡住」的回归。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

谢谢指出。确认目前关闭列表只阻止 setSrc,未完成的首帧读取仍会占用项目共享的媒体并发位。这里应复用 holdMediaRead 的取消语义:最后一个观察者离开时中止排队或进行中的预览,有其他观察者时继续读取,已成功的首帧继续缓存。回归用例应先挂起三个预览占满并发位,关闭列表后确认主动素材读取能在这些预览返回前完成,再验证重开时已完成的首帧仍可复用。生成面板也需要单独验证。

Release Python 重跑仍在 OpenCode 图像输入集成测试超时;本 PR 的基线提交也出现同一超时(基线运行)。预览取消和回归用例目前还未提交,先保留这条讨论。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已落实取消语义:关掉选择器或首帧离开视口时,会释放这个观察者。最后一个观察者离开后才取消未完成读取,已成功的首帧仍缓存。新增测试验证视频走 preview 路由、两个观察者共用请求且只有最后一人离开才取消。52 个聚焦测试、TypeScript 和 i18n 已通过;本地浏览器夹具受目录权限阻塞,本次 GitHub 检查待运行。

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PASS 94b4075 · No linked issue

Dot,代表 @david6666666。93/100,本条非表决 COMMENT。

上轮的并发占位问题已修:首帧离开视口或关闭选择器会撤掉当前订阅;同一个视频被两个地方使用时,只有最后一个观察者离开才会取消底层读取。缓存加载成功的首帧,错误仍回退到可选的通用视频图标。当前截图已下载核对,能看出真实首帧;它是上一版视觉证据,不用它证明这次的取消时序。

同 head Release、CodeQL、DSH 已通过;取消有两个 observer 的测试。assistant_chat_references.mjs 属于 extendedFixture/production,不把常规 Release browser gate 当成本次完整场景重跑。未独立运行浏览器。范围 3/3、正确性 3/3、验证 2/3、主张证据 3/3、简洁度 3/3。没有新的阻塞发现;没有当前投票邀请,未投票或合入。

@wangtiance
wangtiance merged commit e5706eb into ThinkFlowLab:main Dec 4, 2026
12 checks passed
@wangtiance

Copy link
Copy Markdown
Collaborator Author

谢谢复核取消时序。94b40751 的 Release、CodeQL 和 DSH 已通过,PR 已合并。两个观察者共享读取的取消行为由本次聚焦测试覆盖,原截图继续作为首帧显示的证据。

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

Labels

area:canvas Canvas, nodes and direct manipulation type:bug Something is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants