fix(sap): heartbeat script to keep the self-hosted VM session logged in - #453
Open
HappyDevs1 wants to merge 1 commit into
Open
fix(sap): heartbeat script to keep the self-hosted VM session logged in#453HappyDevs1 wants to merge 1 commit into
HappyDevs1 wants to merge 1 commit into
Conversation
connect() already auto-logs in when it finds a session sitting at SAP's login screen (see #226 / 0e32af0), and the nightly sap-e2e workflow already benefits from that on every scheduled run. Nothing, however, touches the session between a human's interactive record/run sessions on the same VM - it idles out ("Maximum idle time exceeded", #438) and the first anyone learns of it is a failed flow. sap-keep-alive.ps1 triggers the existing auto-login path on a timer: it bootstraps the session (reusing sap-session-bootstrap.ps1) and attaches via the existing no-op session-status ping flow, logging one line per run so "when did this last succeed" doesn't require Task Scheduler's own history UI. Meant to be registered as a Windows Scheduled Task. No Rust changes - this only schedules an already-tested recovery path. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a Windows Scheduled Task–friendly heartbeat script to periodically attach to the long-lived SAP GUI session on the self-hosted VM, ensuring the existing connect() auto-login/self-healing path gets exercised before a human-triggered record/run fails due to SAP idle timeout.
Changes:
- Add
scripts/sap-keep-alive.ps1to bootstrap SAP Logon and run the existingexamples/sap/session-status.flow.yaml“ping” flow on a timer. - Append timestamped success/failure lines to
%LOCALAPPDATA%\flowproof\keep-alive.logand exit non-zero on failures for Task Scheduler visibility.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try { | ||
| & (Join-Path $PSScriptRoot 'sap-session-bootstrap.ps1') | ||
|
|
||
| $output = & npx flowproof run $pingFlow 2>&1 |
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
Closes #438. The SAP GUI session kept logged in on our self-hosted VM
periodically hits "Maximum idle time exceeded" between a human's
interactive
record/runsessions, and nobody notices until the nextflow fails.
connect()already auto-logs in whenever it finds a session sitting atSAP's login screen (
SAP_USER/SAP_PASSWORD, see #226 /0e32af0), andthe nightly
sap-e2e.ymlworkflow already benefits from this on everyscheduled run. The actual gap is that nothing triggers an attach on a
timer between runs on the VM outside CI, so that self-healing path
never fires until someone happens to run a flow.
scripts/sap-keep-alive.ps1(new): bootstraps the session (reusingsap-session-bootstrap.ps1) and attaches via the existingexamples/sap/session-status.flow.yamlno-op ping, logging one lineper run to
%LOCALAPPDATA%\flowproof\keep-alive.log. Meant to beregistered as a Windows Scheduled Task, e.g. every 5-10 minutes.
Follow-up outside this repo
Raising the SAP-side idle-timeout profile parameter
(
rdisp/gui_auto_logoutor equivalent) for this technical/service userwould reduce how often this triggers at all. Flagging for whoever owns
SAP Basis; not blocking this PR on it.
Test plan
[System.Management.Automation.Language.Parser]::ParseFile(...)—confirms the script has no syntax errors
keep-alive.logpicks up a success line on schedulescheduled run self-heals it (auto-login + ping passes)
🤖 Generated with Claude Code