Skip to content

Python: stabilize Hyperlight output cleanup test - #8380

Merged
Evan Mattson (moonbox3) merged 1 commit into
microsoft:mainfrom
moonbox3:update-hyperlight-unit-test
Sep 14, 2026
Merged

Evan Mattson (moonbox3) merged 1 commit into
microsoft:mainfrom
moonbox3:update-hyperlight-unit-test

Conversation

@moonbox3

Copy link
Copy Markdown
Contributor

Motivation & Context

test_execute_code_tool_clears_output_after_rejection races background cleanup: rejecting an oversized output retires the sandbox entry and asynchronously deletes its temporary directory. If deletion finishes before the test lists that directory, the test raises FileNotFoundError, as seen in this CI job.

Description & Review Guide

  • What are the major changes? Wait for a queued task on the single cleanup worker, then assert that the retired output directory no longer exists.
  • What is the impact of these changes? Makes the unit test deterministic while preserving its output-rejection assertion. Production behavior is unchanged.
  • What do you want reviewers to focus on? The cleanup barrier runs before registry teardown, so the assertion verifies cleanup triggered by rejection.

Related Issue

None.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

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.

🟢 Approval recommended

The barrier correctly waits behind the queued cleanup task and removes the reported race without changing production behavior.

Pull request overview

Stabilizes the Hyperlight output-cleanup test by synchronizing with asynchronous sandbox cleanup.

Changes:

  • Waits for the single cleanup executor to drain.
  • Verifies the retired output directory no longer exists.
File summaries
File Description
python/packages/hyperlight/tests/hyperlight/test_hyperlight_codeact.py Adds a deterministic cleanup barrier before asserting directory removal.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (1 commit(s)): f46f60353c6c
Model: gpt-5.6-sol-fast

Overview

The PR replaces a racy directory listing with a FIFO barrier on the registry's single cleanup worker, then checks that the retired output directory is absent. The awaited invocation guarantees cleanup is queued before the barrier, and the assertion runs before registry teardown, so the test preserves the intended rejection and cleanup contract without introducing a publishable risk.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

@moonbox3
Evan Mattson (moonbox3) added this pull request to the merge queue Sep 14, 2026

This branch was successfully deployed

1 active deployment
github-app-auth f46f6035 Deployed Sep 14, 2026 by moonbox3 via team_check #4366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants