Skip to content

Attach screen recordings as sampled, labelled video frames - #1629

Merged
currentbits merged 2 commits into
mainfrom
coder/video-input-attach-a-screen-recording-to-a92048
Oct 13, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/video-input-attach-a-screen-recording-to-a92048

Conversation

@currentbits

Copy link
Copy Markdown
Owner

What

You can now attach a screen recording (.mp4, .m4v, .mov, .webm) to a thread, and the agent gets still frames from it (#266). The clip stays an ordinary file chip. The renderer then samples frames with Chromium's own <video> decoder and adds each one as an image attachment, labelled with the clip name and time (repro.mov @ 0:03). The runner already routes image attachments to each provider, so the frames reach the agent without any per-provider changes.

Frame sampling: src/coder/videoFrames.ts (new)

  • Takes about one frame per second, up to 8. Each frame comes from the middle of its time slice, so the first one isn't the black pre-roll.
  • If the duration is unknown (MediaRecorder webm reports Infinity), it takes only the first frame.
  • Frames are scaled down to at most 1280px wide and encoded as JPEG (quality 0.85).
  • Each wait for a decode or seek times out after 10s. A clip that won't decode (unsupported codec or timeout) just produces no frames instead of throwing.

Desktop picks and drops

  • useCoderWorkspace passes picked and dropped attachments through withVideoFrames, which puts each video's frames right after its chip. The folder-only picker (includeImages: false) is unchanged.
  • The <video> loads the file through solenta-media://local/ using a new localVideoResponse:
    • It supports range requests, so the video can seek.
    • It sends Access-Control-Allow-Origin: *, so drawing frames to a canvas doesn't taint it.
    • It only accepts absolute paths with a video extension that point to an existing file. Image URLs still go through the old path, without CORS.
  • attachments.js adds resolveVideoFile, which shares its checks with resolveImageFile through a new resolveLocalFile. Video has no size cap because it is streamed. Extension lookup now uses Object.hasOwn.
  • The CSP in index.html gets media-src 'self' blob: solenta-media:.

Web uploads

  • filesToAttachments samples frames from a blob URL. It does this even when the clip itself was too big to upload, since the frames are what the agent actually looks at.

Prompt labelling

  • Saved frame files have timestamp names, so attachmentPromptSection adds the display name when it differs from the file's basename: - Image: /u/1-ab.jpg (repro.mov @ 0:03). Newlines and ] are removed from the name so it can't break out of the bracketed section.

Tests

  • test/videoFrames.test.ts: video extension matching, frame timing (spacing, the cap of 8, unknown durations), and m:ss formatting. jsdom can't decode video, so actual frame decoding isn't unit-tested.
  • electron/test/media-protocol.test.js: a range request for a video returns 206 with the right content type and the CORS header. Image, artifact and missing-file URLs return null.
  • electron/test/attachments.test.js: frame labels appear in the dispatch prompt section.

🤖 Generated with Claude Code

Solenta-Message-Id: 80ff2bc5-ae7e-4581-a118-33057219090b
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T14:39:06.885280Z ee715c9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee715c9d5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 44 to 45
? await save.image(dataUrl)
: await save.file(file.name, dataUrl);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Sample oversized web videos before uploading them

For web/remote users, the original recording is fully read as base64 and sent through save.file before frame sampling begins. Files over the host's 20 MiB limit are guaranteed to be rejected, and a roughly 75 MiB recording exceeds the WebSocket server's default 100 MiB message limit after base64 expansion; that disconnect rejects this await, so the object-URL sampling below is never reached. Detect videos first and sample them before, or independently from, the capped original-file upload.

Useful? React with 👍 / 👎.

Comment thread electron/runnerHelpers.js
Comment on lines +184 to +186
const note =
a.kind === "image" && a.name && a.name !== path.basename(a.path)
? ` (${a.name.replace(/[\r\n\]]+/g, " ")})`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep frame labels when routing images natively

These labels never reach two native-image paths: electron/runner.js lines 2119–2137 excludes all images from promptAttachments for Codex vision models and excludes all files/images for OpenCode. Codex then receives only the random stored path as a localImage, while OpenCode receives that path through -f, so neither agent can associate a frame with its clip or timestamp. Add the frame-label mapping to the prompt independently of the attachment path filtering, or preserve the metadata through the native route.

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit b0c08a5 into main Oct 13, 2026
6 checks passed
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.

1 participant