Repository navigation
Conversation
…poll waitForAgentRenderFrame polled every 16ms with chained setTimeouts. In a background tab Chrome throttles chained timers to once per second, and to once per minute after five minutes hidden, so an MCP render snapshot routed to an unfocused editor could stall for minutes. It now re-checks on a MutationObserver over the canvas DOM and readiness markers; observer callbacks are microtasks and are not throttled. A 250ms timer stays as a fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ngocht
marked this pull request as ready for review
October 14, 2026 18:12
This branch has not been deployed
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
waitForAgentRenderFramepolled every 16ms with chainedsetTimeouts. In a background tab Chrome throttles chained timers to once per second, and to once per minute after five minutes hidden. An MCPsite_render_snapshotrouted to an unfocused editor could therefore stall for minutes.It now re-checks on a
MutationObserverover the canvas DOM and the readiness markers (data-instatic-canvas-document-loaded,data-agent-snapshot-ready, the breakpoint and request-id attributes). Observer callbacks are microtasks and are not throttled. A 250ms timer stays as a fallback; the 5s deadline is unchanged.Impact: render snapshots resolve as soon as the frame is ready, whether or not the editor tab is focused.
Verification
bun run build— rantsc -p tsconfig.app.json(clean)bun test— ranbun test src/__tests__/agent/: 269 pass. NewrenderFrameWait.test.tssimulates throttled timers (every timer ≥1s): resolves in <500ms with this change, fails (1035ms) onmain.bun run lint— eslint on the changed files (clean)Checklist
🤖 Generated with Claude Code