Skip to content

Enforce script timeout in Hyperlight runner#351

Merged
huzaifa-d merged 4 commits into
microsoft:mainfrom
danbugs:danbugs/hyperlight-timeout
May 21, 2026
Merged

Enforce script timeout in Hyperlight runner#351
huzaifa-d merged 4 commits into
microsoft:mainfrom
danbugs:danbugs/hyperlight-timeout

Conversation

@danbugs

@danbugs danbugs commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Update hyperlight-unikraft to v0.6.0 which adds run_code_with_timeout() with cancellable host sleep
  • When script_timeout is set in the config, the Hyperlight runner uses the timeout variant to kill long-running or sleeping guest code promptly; otherwise run_code() is used as before
  • Add hyperlight_timeout.json test config and e2e test case (time.sleep(120) killed by 5s timeout)
Microsoft Reviewers: Open in CodeFlow

Use hyperlight-unikraft v0.6.0 which adds run_code_with_timeout()
with cancellable host sleep. When script_timeout is set in the
config, the runner uses the timeout variant; otherwise run_code()
is used as before.

Signed-off-by: danbugs <danilochiarlone@gmail.com>
Copilot AI review requested due to automatic review settings May 19, 2026 23:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds support for enforcing script execution timeouts in the Hyperlight runner and introduces an E2E test case/config to validate timeout behavior, alongside a dependency bump for the Hyperlight Unikraft host.

Changes:

  • Add timeout-aware execution path in HyperlightScriptRunner using run_code_with_timeout.
  • Add a new Hyperlight E2E test case + config that should time out.
  • Bump hyperlight-unikraft-host dependency from v0.5.0 to v0.6.0.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test_configs/hyperlight_timeout.json Adds a config intended to force a timeout scenario for Hyperlight runs.
src/wxc_e2e_tests/tests/e2e_windows.rs Adds a Windows E2E test case asserting the timeout behavior/output.
src/wxc_common/src/hyperlight_runner.rs Implements timeout-aware execution via run_code_with_timeout when configured.
src/wxc_common/Cargo.toml Updates Hyperlight Unikraft host dependency tag to a newer version.

Comment thread src/wxc_common/src/hyperlight_runner.rs Outdated
Comment thread src/wxc_e2e_tests/tests/e2e_windows.rs
Comment thread test_configs/hyperlight_timeout.json Outdated
danbugs added 3 commits May 19, 2026 23:43
Signed-off-by: danbugs <danilochiarlone@gmail.com>
Signed-off-by: danbugs <danilochiarlone@gmail.com>
Signed-off-by: danbugs <danilochiarlone@gmail.com>
{
"process": {
"commandLine": "import time; time.sleep(120); print('should not reach here')",
"timeout": 1000

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this timeout for the first cold launch?

@huzaifa-d
huzaifa-d merged commit c0aee5e into microsoft:main May 21, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants