Skip to content

feat(computer): let a client skip unchanged screen frames - #1797

Merged
edenreich merged 1 commit into
mainfrom
feat/skip-unchanged-frames
Nov 10, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/skip-unchanged-frames

Conversation

@edenreich

@edenreich edenreich commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Every read_frame answered with the whole screen as base64, even when nothing had changed since the client's last read. A client that follows a screen polls several times a second, and each poll moved a frame of roughly 100-200 KB through the worker, the daemon relay and the client to redraw the same picture.

A client can now name the frame it already has and get a short "unchanged" answer.

Resolves #1794

Changes

  • internal/presentation/headless - read_frame takes an optional have, the frame.id the client shows. When the latest frame is still that one the reply is {"type": "frame", "unchanged": true} with no frame. Without have the full frame is sent as before.
  • internal/computer/infrastructure/circular_screenshot_buffer.go - a capture that shows what the latest frame shows is not stored again. Until now every capture got a fresh id, so a frame id never stayed current for long. It now changes only when the picture does.
  • cmd/daemon/screen.go and internal/presentation/web/screen.go - the web terminal's GET /screen/ passes If-None-Match on as have, serves the frame id as the ETag and answers 304 Not Modified for the frame the viewer has.
  • internal/presentation/web/static/app.js - the Screen view sends the tag on each poll and keeps its picture on a 304.
  • Docs - docs/browser-extension-protocol.md and docs/web-terminal.md.

Testing

  • task precommit:run and task test pass. New tests cover the unchanged answer in the worker, the 304 on the web route, the daemon's reply decoding and the buffer keeping one frame for a still screen.
  • The page's JavaScript change was not tried in a browser.
  • A teleported session was not tested. The relay has no read_frame-specific handling, so have should pass through with the rest of the request.

Notes

  • The recent-frames buffer now holds distinct pictures, not one entry per capture tick.
  • The Desktop app does not send have yet, so it needs a follow-up there to benefit.

Docs follow-up: inference-gateway/docs#1177.

read_frame takes the id of the frame the client already has and answers unchanged instead of the image when nothing newer exists. A capture that shows what the latest frame shows is not stored again, so a frame id only changes with the picture. The web terminal's screen route serves that id as an ETag and answers 304 to a matching If-None-Match.

Resolves #1794
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 10, 2026
@edenreich
edenreich marked this pull request as ready for review November 10, 2026 00:46
@edenreich
edenreich requested a review from a team as a code owner November 10, 2026 00:46
@edenreich
edenreich merged commit 316e0d5 into main Nov 10, 2026
1 check passed
@edenreich
edenreich deleted the feat/skip-unchanged-frames branch November 10, 2026 01:06
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.253.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 10, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEATURE] Let a client skip unchanged frames in read_frame

1 participant