Repository navigation
feat(computer): let a client skip unchanged screen frames - #1797
Merged
Merged
Conversation
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
edenreich
marked this pull request as ready for review
November 10, 2026 00:46
This was referenced Nov 10, 2026
Contributor
|
🎉 This PR is included in version 0.253.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every
read_frameanswered 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_frametakes an optionalhave, theframe.idthe client shows. When the latest frame is still that one the reply is{"type": "frame", "unchanged": true}with noframe. Withouthavethe 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.goandinternal/presentation/web/screen.go- the web terminal'sGET /screen/passesIf-None-Matchon ashave, serves the frame id as theETagand answers304 Not Modifiedfor 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/browser-extension-protocol.mdanddocs/web-terminal.md.Testing
task precommit:runandtask testpass. 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.read_frame-specific handling, sohaveshould pass through with the rest of the request.Notes
haveyet, so it needs a follow-up there to benefit.Docs follow-up: inference-gateway/docs#1177.