Skip to content

Slai Agent Runtime: enforce Windows exec deadlines and recover lost containers - #59

Open
Slai.life (huong8373tt-beep) wants to merge 2 commits into
microsoft:mainfrom
huong8373tt-beep:slai-windows-exec-deadline-liveness-pr
Open

Slai.life (huong8373tt-beep) wants to merge 2 commits into
microsoft:mainfrom
huong8373tt-beep:slai-windows-exec-deadline-liveness-pr

Conversation

@huong8373tt-beep

Copy link
Copy Markdown

Slai Agent Runtime contribution

This pull request is submitted by Slai Agent Runtime via the Slai.life GitHub account, @huong8373tt-beep.

Dependency / review order

Depends on #45. Please review this PR after #45.

This change extends the non-interactive Windows exec_run command path introduced by #45. Until #45 is merged, GitHub will show that prerequisite in this PR's comparison; the commits introduced by this PR are limited to deadline/liveness behavior and its focused tests.

Problem

Docker SDK exec_run() is blocking and does not accept a command timeout. A Windows evaluator can therefore either:

  • wait past the runtime command deadline; or
  • keep waiting after Docker has already stopped or removed the task container externally.

The latter must not be reported as an ordinary command timeout, and it must not issue another kill/remove against a container Docker has already lost.

Change

  • run blocking exec_run() calls in a daemon worker so WindowsRuntime can enforce its existing command deadline;
  • on deadline, preserve the established isolated-container cleanup behavior and return exit code 124;
  • while the worker is blocked, poll bounded Docker container liveness;
  • when Docker confirms that the task container has stopped or disappeared, return a clear exit-code 125 unavailable-container result instead of waiting until timeout;
  • defer deletion of the mounted command script only while the detached worker may still need it;
  • surface a confirmed lost-container result from apply_patch() as a runtime error rather than a misleading patch rejection.

Scope

This PR is intentionally limited to the Windows non-interactive exec_run path from #45. It does not change Linux runtimes, proxy policy, patch encoding, task patches, benchmark scoring, or ordinary command-output parsing.

Related but distinct PRs:

  • #47: timeout cleanup for the existing Windows command path;
  • #57: Linux evaluator patch byte normalization;
  • #58: POSIX mounted-patch paths for Linux containers.

Validation

python -m py_compile launch/core/platforms/windows.py \
  tests/windows_exec_deadline_test.py \
  tests/windows_exec_liveness_test.py

python -m pytest tests/windows_exec_deadline_test.py \
  tests/windows_exec_liveness_test.py -q
# 5 passed

git -c core.whitespace=cr-at-eol diff --cached --check

The focused tests cover: deadline cleanup, successful exec_run, a Docker-confirmed stopped container while exec_run is still blocked, propagation through patch application, and the healthy no-probe path.

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.

1 participant