fix: use clipboard paste and longer delay for automation bootstrap - #74
Open
mikhailsal wants to merge 1 commit into
Open
fix: use clipboard paste and longer delay for automation bootstrap#74mikhailsal wants to merge 1 commit into
mikhailsal wants to merge 1 commit into
Conversation
The automation agent bootstrap was failing because the 500ms delay between pressing Win+R and typing the PowerShell launch command was insufficient when a foreground application (e.g. Steam, browser) was active. The Run dialog takes 1-2 seconds to appear and steal keyboard focus in such cases, causing the typed command to be partially sent to the foreground app and lost. This fix addresses the issue in two ways: 1. Use clipboard paste (Ctrl+V) instead of character-by-character send_text() to input the launch command into the Run dialog. This is an atomic operation that doesn't suffer from per-character timing issues with long commands containing backslashes and quotes. 2. Increase the delay after Win+R from 500ms to 2000ms, giving the Run dialog time to appear and grab focus even when other apps are in the foreground. The command is pre-loaded into the clipboard before Win+R is pressed, so the clipboard is ready by the time the dialog appears. Tested with Steam maximized in the foreground — automation now bootstraps reliably on first connection attempt.
|
this whole thing feels too fragile. isn't there a way to pre-install an app in the server? and make that app somehow trigger the agent execution when the agent-rdp client connects? or maybe, somehow, register that app to trigger when the agent-rdp dvc is present in the RDP session? or even, can't dvc handlers be pre-registered on the server? PS we could use a scheduled task as-in https://gist.github.com/rgl/19ae3a6b0a5d6f30bd9baa89a2d457c0 |
denisix
pushed a commit
to denisix/agent-rdp
that referenced
this pull request
Aug 9, 2026
Merged from thisnick#74 (mikhailsal). 500ms after Win+R was insufficient when a foreground app had focus, causing typed characters to be lost. Pre-load clipboard and paste via Ctrl+V instead of typing character-by-character, and increase the post-Win+R delay to 2000ms.
denisix
pushed a commit
to denisix/agent-rdp
that referenced
this pull request
Aug 9, 2026
Update the automate run examples and bootstrap-sequence description to match the clipboard-paste bootstrap (thisnick#74) and the new --shell/--stream/run-poll flags, and note that legacy TLS targets are unsupported (thisnick#73).
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
--enable-win-automationconnectionsend_text()with clipboard pre-load + Ctrl+V paste, and increased Win+R delay from 500ms to 2000msProblem
When connecting with
--enable-win-automation, the bootstrap sequence:If another application (Steam, browser, etc.) is maximized and has keyboard focus, the Run dialog takes 1-2+ seconds to appear. Characters typed during this window go to the foreground app and are lost. The result is a truncated or garbled command in the Run dialog, the PowerShell agent never starts, and the DVC handshake times out with:
Fix
Test plan
--enable-win-automationwhile Steam was maximized in foregroundautomate statusreturns agent_running=true on first attemptautomate run "hostname" --waitreturns correct outputautomate snapshot -i -c -d 2returns accessibility treecargo test -p agent-rdp-daemon— 19 tests)