Skip to content

feat: play Grok local videos in Codex Desktop transcripts - #90

Merged
BytePioneer-AI merged 3 commits into
BytePioneer-AI:mainfrom
a70win-wq:feat/play-grok-local-videos
Sep 1, 2026
Merged

feat: play Grok local videos in Codex Desktop transcripts#90
BytePioneer-AI merged 3 commits into
BytePioneer-AI:mainfrom
a70win-wq:feat/play-grok-local-videos

Conversation

@a70win-wq

Copy link
Copy Markdown
Contributor

问题

在 CodexHost 里用 Grok Build 生成视频后,对话里会出现损坏的图片占位符。本地 mp4 路径以灰色 code 显示,不是链接,点不开,也无法在对话内播放。

视频文件本身是好的,系统播放器可以播。Grok TUI 能预览同一条 ![](videos/....mp4);Codex Desktop 不行。

原因

Grok 的回复类似:

`/Users/chris/Downloads/clip.mp4`

![promo](videos/clip.mp4)

Codex Desktop 已经支持本地音视频:绝对路径的 ![](/abs/file.mp4) 会走 app://fs/@fs/...,并用 <video> 播放。

相对路径 videos/clip.mp4 不会被当成本地文件,Markdown 图片被当成远程 <img>,所以变成坏图。反引号路径也不是可点击链接。

改动

  1. Grok Adapter / history
    把已存在的本地媒体 Markdown 图片改写成绝对路径,解析根包括 workspace cwd 和 Grok Native Session 目录(含 videos/images/)。流式 delta 会暂扣未写完的 ![alt](dest,避免改写破坏前缀。

  2. Renderer
    把对话里仍是绝对路径 / file:// / app://fs/@fs 的视频 <img> 换成 <video controls>,并把绝对视频路径的 <code> 补上可播的 video。媒体仍由 Codex 已有的 app://fs 本地 handler 提供(含 Range)。

验证

  • npx vitest run --config tests/vitest.config.js packages/adapters/grok/test/local-media-markdown.test.ts packages/adapters/grok/test/grok-history.test.ts packages/adapters/grok/test/grok-adapter.test.ts packages/renderer-extension/test/renderer-local-media.test.ts
  • 50 tests passed
  • tsc -b、ESLint、package boundary check 通过

未跑完整仓库测试套件,也未在 Codex Desktop 里做端到端录屏。建议用 Grok 生成一段视频后,确认对话里可以直接播放,而不只是坏图 + 灰色路径。

How to test

  1. Launch with codexhost (not ChatGPT.app directly).
  2. Open a project, select Agent Grok.
  3. Ask it to generate a short video.
  4. The transcript should show an inline player for ![](videos/....mp4) and for backtick absolute .mp4 paths.

Grok replies use session-relative Markdown images such as
`![](videos/1.mp4)`. Codex Desktop treats those as remote images, so
the player becomes a broken thumbnail and the path is not clickable.

Resolve existing local media destinations onto absolute paths before
projection, and upgrade leftover absolute video paths in the Renderer
to `<video controls>` served through Codex's `app://fs/@fs` handler.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Grok replies often cite videos as inline code (`videos/clip.mp4`) rather
than image Markdown. Codex Desktop renders those as
`span[data-markdown-copy=inline-code]`, so a `<code>` upgrade never ran
and no player appeared.

Rewrite existing local media backticks onto `![](absolute)` before
projection, and upgrade those inline-code chips in the Renderer.
@a70win-wq

Copy link
Copy Markdown
Contributor Author

本地验证:问题已修正

已在本机用 codexhost 启动的 Codex Desktop(不是直接开 ChatGPT.app)验证,Agent 选 Grok

复现与修正

  1. 第一版只改写了 ![](videos/....mp4)。坏图消失了,但 Grok 常见的反引号路径仍然只显示灰色 chip,对话里播不了:
    • `videos/aura-10s.mp4`
    • `/Users/chris/Downloads/....mp4`
      Codex 把这些渲染成 span[data-markdown-copy=inline-code],不是 <code>
  2. 后续 commit 把已存在的本地媒体反引号改写成 ![](绝对路径),Renderer 也会升级这类 inline-code chip。

本地再测后,对话里可以内联播放,不再是坏图或不可点击的灰色路径。

请审查并考虑合并。

Codex Desktop already plays `![](/abs/file.mp4)` natively. Keep Grok
Adapter rewriting relative media and backticks onto absolute Markdown
images, and stop injecting a global <video> MutationObserver.
@BytePioneer-AI
BytePioneer-AI merged commit dac9641 into BytePioneer-AI:main Sep 1, 2026
BytePioneer-AI added a commit that referenced this pull request Sep 2, 2026
feat: play Grok local videos in Codex Desktop transcripts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants