Repository navigation
fix(worker): avoid repeatedly serializing screenshot history - #146907
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
180886a to
562f80a
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:20 AM ET / 11:20 UTC (Revision 2). ClawSweeper reviewWhat this changesCaches unchanged messages’ encoded sizes while trimming oversized worker inference requests, reducing repeated screenshot serialization and adding regression coverage. Merge readiness✅ Ready for maintainer review This remains a useful, focused optimization absent from current main and v2026.9.4. No actionable correctness or security findings were found; the maintainer-authored PR should remain open for normal merge handling. Priority: P2 Review scores
Verification
How this fits togetherCloud workers send conversation context through the Gateway for model inference. The worker stream adapter trims eligible historical images to fit the transport budget while preserving the original transcript. flowchart TD
A[Worker conversation context] --> B[Clone inference request]
B --> C[Measure full request]
C --> D{Fits transport budget?}
D -->|Yes| F[Gateway inference request]
D -->|No| E[Prune eligible images and reuse message sizes]
E --> D
E --> G[Report error if protected context cannot fit]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +28, Tests +143. Total +171 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep exact sizing within the existing adapter, with request-local caching and unchanged image-retention and final transport checks. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main serializes the entire inference frame after every eligible image removal. The adapter regression targets that repeated work; it was inspected but not executed here. Is this the best way to solve the issue? Yes. The cache follows the fitter’s message-replacement contract and preserves exact frame sizing without changing pruning policy, protocol, or stored data. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 32bf352734f0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
562f80a to
d1e22c6
Compare
|
Merged via squash.
|
* temp/pr-146799: (70 commits) test: reuse explicit fallback config fixtures (openclaw#146948) fix(computer): return fresh window observations after actions (openclaw#146822) refactor(feishu): remove unreachable requester topic selection (openclaw#146904) improve(gateway): reduce CPU spent listing agent-owned sessions (openclaw#137745) fix(ui): avoid recapturing chat drafts during UI updates (openclaw#146884) fix(ui): show system uptime in the debug overlay (openclaw#146960) fix(retry): honor waits beyond the native timer limit (openclaw#145718) fix(ui): keep chat history idle when run status changes (openclaw#146802) fix(ui): reuse persisted text during chat streaming (openclaw#146831) refactor(qa): share harness drift result construction (openclaw#146903) test(agents): coordinate settings lock contention (openclaw#146949) fix(worker): avoid repeatedly serializing screenshot history (openclaw#146907) fix(secrets): stop buffered upload writes after cancellation (openclaw#146840) perf(doctor): avoid unnecessary state runtime imports (openclaw#146926) improve: reduce compaction request estimation work (openclaw#146961) fix(ci): wait for forwarded avatar imports before assertions (openclaw#146729) perf(workers): skip configured Git author lookups (openclaw#146833) fix: admit borrowed memory writes through the agent database owner (openclaw#146760) fix(discord): prevent voice playback gaps and stale turn controls (openclaw#146798) improve: reduce worktree filesystem stalls and archive syncs (openclaw#146906) ...
* commit 'ccfd2377cd07d1ad3a583ba64d08e29a065f7061': (1587 commits) fix(ui): avoid recapturing chat drafts during UI updates (#146884) fix(ui): show system uptime in the debug overlay (#146960) fix(retry): honor waits beyond the native timer limit (#145718) fix(ui): keep chat history idle when run status changes (#146802) fix(ui): reuse persisted text during chat streaming (#146831) refactor(qa): share harness drift result construction (#146903) test(agents): coordinate settings lock contention (#146949) fix(worker): avoid repeatedly serializing screenshot history (#146907) fix(secrets): stop buffered upload writes after cancellation (#146840) perf(doctor): avoid unnecessary state runtime imports (#146926) improve: reduce compaction request estimation work (#146961) fix(ci): wait for forwarded avatar imports before assertions (#146729) perf(workers): skip configured Git author lookups (#146833) fix: admit borrowed memory writes through the agent database owner (#146760) fix(discord): prevent voice playback gaps and stale turn controls (#146798) improve: reduce worktree filesystem stalls and archive syncs (#146906) fix(ui): avoid extra chat rail work while replies stream (#146883) improve(ui): speed up populated Usage timelines (#146947) test(gateway): retain auth recovery failure diagnostics (#146925) fix(tests): create private temporary home directories (#146931) ... # Conflicts: # test/tsconfig/tsconfig.core.test.agents-other.json # test/tsconfig/tsconfig.core.test.agents-root.json
What Problem This Solves
Cloud worker turns repeatedly serialize unchanged screenshot history while pruning an oversized inference request. Each removed image previously triggered another full request encoding before inference could start.
Why This Change Was Made
Keep the existing full-frame measurement for requests that already fit. Once pruning starts, cache each unchanged message's encoded byte length for that synchronous request and combine those lengths with the exact envelope and array separators. The fitter replaces changed message objects, so later measurements only re-encode those replacements.
Pruning rules, original transcript history, protected images and the final transport payload check remain unchanged. Production grows by 28 lines to own exact request-local measurement; regression tests add 143 lines.
User Impact
Screenshot-heavy requests need less serialization work when historical images must be removed to fit the payload budget. Requests that fit retain their single full-frame measurement. No configuration, protocol or storage change is required. No measured Team latency or memory improvement is claimed.
Evidence
d1e22c62be8cf24d89b1e98312a4f05ecb0d6a24preserves tested production from07db30618c230e81332a36cbb625380e69e5ae0e/ treee4f9cba446776482074c87a62cc9444783e02958. Later fixture corrections usesatisfieswhile constructing a mutable request and add braces to two existing statements; runtime behavior and assertions are unchanged.