Skip to content

fix(lifecycle): reject failed image loads and drain gateway work - #85

Open
morluto wants to merge 2 commits into
scaleapi:mainfrom
morluto:codex/fix-environment-lifecycle
Open

morluto wants to merge 2 commits into
scaleapi:mainfrom
morluto:codex/fix-environment-lifecycle

Conversation

@morluto

@morluto morluto commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #84

Propagate every VM image-load worker/pipeline failure, verify full image references with docker image inspect, and clean staging files on every exit. Cancel and await gateway trigger tasks before MCP clients close.

Reproduced failure Before After
Failed image load, old tag already present Startup reports success Failure propagates
Archive left by failed load 64 MiB 0 bytes
Trigger actions pending after shutdown 1 0

Measurements use the production loader shell with local command stubs and the real trigger engine. Tests cover successful parallel loads, Docker/gunzip failures, exact tag verification, partial downloads, and repeated shutdown.

Validation: 6,326 unit/protocol tests passed, 13 existing capability skips; plugin API check passed. Independent correctness and maintainability reviews are clean. Docker/cloud integration remains for CI.

RetriggerConfidence Score: 5/5

The PR appears safe to merge based on the changes reviewed.

What we checked:

  • Cleanup does not hide load errors: _remove_vm_temp_file catches ordinary cleanup errors, so the original load or download error still reaches the caller.

Summary

VM image loading now propagates worker failures, checks the exact requested image references, and cleans up transfer files. Gateway shutdown cancels and awaits trigger work before MCP clients close.

  • VM image loads report worker failures and check exact image names.
  • Gateway shutdown waits for trigger work before MCP clients close.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Stage image archives] --> B[Start load workers]
  B --> C[Wait for every worker]
  C --> D[Remove staging files]
  D --> E{Every worker succeeded?}
  E -->|Yes| F[Inspect full image references]
  E -->|No| G[Report load failure]
Loading

Reviews (2) · Last reviewed commit: "fix(sandbox): retry image loads and clea..." · Reviewed by Greptile

@morluto
morluto requested a review from a team as a code owner October 7, 2026 01:31
Comment thread src/agent_env/providers/sandbox_providers/sandbox.py Outdated
Comment thread src/agent_env/providers/sandbox_providers/sandbox.py Outdated

This branch has not been deployed

No deployments
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.

fix(lifecycle): reject failed image loads and drain gateway triggers

1 participant