Python: Clean Hyperlight output files after execution - #8230
Python: Clean Hyperlight output files after execution#8230Eduard van Valkenburg (eavanvalkenburg) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Cleanup can mask results and bypass bounded traversal safeguards.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Cleans Hyperlight worker output directories after invocation processing and adds rejection-path coverage.
Changes:
- Performs post-processing output cleanup.
- Tests cleanup after rejected output.
- Adjusts bounded-enumeration tracking for cleanup.
File summaries
| File | Description |
|---|---|
_execute_code_tool.py |
Adds final output-directory cleanup. |
test_hyperlight_codeact.py |
Adds cleanup regression coverage and updates enumeration tracking. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): b05e413dbcc7
Model: gpt-5.6-sol-fast
Overview
The PR wraps result processing in a worker-thread finally so accepted and rejected outputs are removed while native-result release remains on the owner thread. Existing bounds protect output materialization, and the added test covers ordinary rejected-output cleanup. However, the new final cleanup recursively traverses sandbox-controlled trees; on supported Python 3.12, sufficiently deep output raises RecursionError and leaves the shared cached entry unusable.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 high) across 1 file. Details are attached to the affected lines below.
Affected areas: python/packages/hyperlight/agent_framework_hyperlight/_execute_code_tool.py
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Motivation & Context
Hyperlight output files should not remain in the cached temporary output directory after an invocation completes, including when output materialization is rejected.
Description & Review Guide
Related Issue
None.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and the title prefix in sync automatically.