Repository navigation
feat(runner): Windows Job Object process-tree backend (Foundation M004 + Operations M004a) - #1
Merged
Merged
Conversation
added 10 commits
October 5, 2026 17:48
Windows executions previously refused to start: `run` returned `RunnerError::UnsupportedPlatform` before spawn, and the server mapped that to `Failed`/`Internal` with `exit_code: null`. Foundation M004 replaces the refusal with a real tree owner. `process_tree.rs` is the single platform seam behind the one shared lifecycle. Unix keeps `process_group(0)` + `killpg` escalation; Windows wraps the same sanitised `Command` in `process-wrap`'s `JobObject`, which adds `CREATE_SUSPENDED`, assigns the still-suspended process, and only then resumes it, so no descendant can exist before Eggwork owns it. Termination is one `TerminateJobObject` over a job created with `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE`, whose handle closes when the tree owner drops -- before `run` returns and before the caller's execution permit is released. The dependency is pinned to `=10.0.1` because upstream raises its MSRV inside a major version, so `10` is not a stable lower bound. It is on the ownership guard's process-owner denylist, so the guard now applies that denylist to all five crates and permits exactly one recorded exception, `eggwork-runner` -> `process-wrap`, validated by `unexplained_process_dep_exceptions()`. What Windows does not claim: per-descendant exit observation. No safe surface exposes a job-membership query and adding one would mean Eggwork-owned `unsafe` Win32 FFI, which the workspace denies. Convergence rests on job ownership for the whole execution, the kernel marking every member terminating, and the existing reader-EOF barrier. A `windows-latest` CI job runs the new `#![cfg(windows)]` tree-lifecycle suite, because none of this is observable from Linux. The installed production path stays qualified by `operational-qualification.yml` from a staged release's own bytes.
Every test in `landlock_runner.rs` was already `#[cfg(target_os = "linux")]`, but the file's imports and the `request` helper were not, so a Windows `clippy -D warnings` build failed on unused imports and one dead function. The gate belongs on the file: the suite needs the Landlock kernel interface and a cgroup v2 hierarchy, so there is nothing to run on any other host.
Operations M004a. The recorded CI flake was `Spawn("Text file busy (os
error 26)")` from a same-head rerun of
`required_landlock_allows_workspace_and_denies_outside_reads_and_writes`.
Linux returns ETXTBSY when a running executable is opened for writing, so
the class of failure to remove is "a fixture mutates an executable path
another concurrently runnable test may execute".
Measured on this host first, rather than assumed: over a running
executable, `open`/`O_TRUNC`/`shutil.copyfile` all return ETXTBSY,
while `os.replace` succeeds. So staging now writes a staging name and
renames it into place -- never in place -- and every fixture gets its own
`0700` directory and its own copy. Build output is read-only input.
The staging block was duplicated in ten places and drifted; it now lives
once, in `tests/support/helper_fixture.rs`, and both suites use it
(`eggwork-runner`'s capability probe includes it with `#[path]` rather
than adding a workspace member the release contract enumerates). No
retry, no sleep, no fixed path.
New proofs, none of which are timing-dependent: two fixtures stage
distinct executable paths; staging never changes the build output's bytes
or mode; two fixtures execute concurrently and both really report
`SandboxResult::Applied`; mutating one fixture's mode or bytes cannot
disturb a neighbour; dropping a fixture removes only its own directory.
One finding worth recording: `verify_trusted_helper` is a filesystem-trust
check and does not identify the file, so a correctly-permissioned junk
file passes it. That is the intended boundary -- anything able to write in
an owner-only directory owns that installation -- and the new test asserts
the remaining property: such a fixture fails loudly at execution instead of
claiming isolation was applied.
Also fixes the Windows-only clippy failures the new `windows-runner` CI job
surfaced: a Linux-only `deadline` binding and a needless `return` in the
Windows SCM refusal path.
The capability probe's `built_helper` returns an owned `PathBuf` and is Linux-only, so the import has to be gated the same way or the Windows clippy run sees it unused.
`--all-targets` on the workspace cannot compile for Windows: the server's unit tests are Linux-shaped, and `place_trusted_helper` in `crates/eggwork-server/src/lib.rs` plus the `PermissionsExt` uses in artifact/blob/operations/deployment do not even build off Unix. Rather than delete real Linux coverage or silently leave a red job, the job now lints production code on Windows (`--lib --bins`) and test targets for `eggwork-runner`, the crate this milestone owns, and the gap is recorded in architecture/ci-guardrails.md instead of hidden.
Two closure records, plus the status corrections both plans require. Foundation M004 is conditionally closed. The Windows process-tree backend is implemented and its tree lifecycle is qualified on hosted windows-latest; what remains is acceptance criterion 10, the installed-release receipt, which needs a release containing M004. That is a release-lineage action, so it is recorded as outstanding rather than taken unilaterally. Operations M004a is closed. Its closure record is explicit that the recorded flake did not disappear: the fixture-isolation invariant is implemented and proven, and the residual is a host-level kernel window around executing a just-written executable, measured on a path with no writer that closes immediately and reproduces outside Eggwork's spawn path. Both plan-required current-state corrections are in: the roadmaps and registry no longer advertise M004/M004a as ready, Operations M004's outstanding-evidence item 3 and its unresolved-findings row are re-dispositioned against the real cause (there was no Windows process-tree owner at all, not a malformed child environment), and the operational-qualification workflow comments no longer blame the child environment for a refusal that happened before any child existed. No historical release row was rewritten.
…'s handoff The planning process treats status as part of the plan, not just the registry: both implementation plans now carry their closure status and a pointer to the closure record. M007 stays **ready** — Foundation M004 introduced no service-host interface and its closure record says so. What M007 did gain is a hosted Windows verification surface that did not exist before (the `windows-runner` job), plus a warning that matters for its test design: the server's unit tests are Linux-shaped and do not compile for Windows, so a service state-machine test placed there would need either a Linux-compatible design or a new Windows-target test target. That is a decision to make when writing M007 §10 tests, not to discover during CI. Also records that the next release candidate is now blocked on a decision rather than on missing implementation.
The first hosted run of this suite (37411582121) compiled and then failed 11 of 16 tests. The evidence says the fixtures were at fault, not the backend, and the failures show exactly why: every simple `cmd.exe` target passed (direct exit, cwd, refusal cases, bare program name), while every long-running PowerShell fixture failed — 'fixture never beat' where the deadline was 2-2.5s, and timeouts where the fixture nested a second PowerShell. Sixteen concurrent PowerShell startups on a hosted runner take longer than the deadlines under test. `cmd.exe` starts in milliseconds and expresses everything these proofs need. Fixtures are now batch files, which also removes the quoting teeth: `cmd /C "echo a & echo b"` echoes a trailing space before the `&`, so the very first assertion failed on `out-marker ` rather than `out-marker`. Batch files have none of that. Changes of substance, not just speed: - the heartbeat cadence is ~1s, so the freeze window is 2.5s — still wider than two beats, and a live writer still grows within it; - finite fixtures get a 120s ceiling instead of 60s, and only the interruption tests use short deadlines; - `descendant_output_reaches_the_captured_streams` now uses a nested `cmd /C` rather than PowerShell's call operator, because `& powershell` was ambiguous about whether a child process existed at all — a nested `cmd /C` is unambiguously a second process that inherits the pipes, and `call` would not do (a batch file invoked with `call` runs in the same process); - the stdin fixture reads with `set /p` and asserts the exact bytes, so the next run cannot be ambiguous the way `[Console]::In` was; - `concurrent_fixtures_both_execute_concurrently` now asserts both executions timed out cleanly with both heartbeats frozen, which is a stronger statement than the previous version made. Assertions are unchanged in strength. If the backend is wrong, these still say so.
…ckend Run `37412678849` took the Windows suite from 5/16 to 14/16 passing. The three remaining failures were all fixture defects, and one of them showed the runner was behaving correctly: 1. `output_limit_terminates_the_whole_tree` asked for `Truncate` and then expected `OutputLimit`. A truncating overflow is *supposed* to leave the target running, so the runner kept waiting and the test saw `TimedOut` after its full 120s patience. The runner is right; the test was asking for the wrong policy. It now requests `OverflowPolicy::Terminate`, matching the Unix equivalent. 2. `environment_is_the_documented_baseline_and_leaks_nothing` reported `COMSPEC`, `PATHEXT`, and `PROMPT` as leaks. Those are synthesised by `cmd.exe` at startup, not inherited: the runner clears the environment and supplies only the baseline. The assertion is now exact -- the child key set must be the baseline plus what the interpreter synthesises -- which is a stronger claim than 'no leak' and says why. 3. `working_directory_is_honoured_and_no_isolation_is_claimed` compared `fs::canonicalize`'s verbatim `\\?\C:\...` against the plain form `cmd` prints. It failed on spelling, not behaviour; both sides are normalised now. The positive results are worth stating plainly: descendant convergence, timeout, cancellation, leader-exit with a live descendant, pipe inheritance from a real child process, stdin delivery, and the required-control refusals all now pass on hosted Windows.
Run `37413709840`: `rust`, `release-drift`, and `windows-runner` all succeeded, with the Windows tree-lifecycle suite reporting 17 passed, 0 failed in 21.29s. Both records now carry the full run history rather than only the green run, because three of the five failures in it were fixture defects and one of those showed the runner behaving correctly (a `Truncate` overflow must not terminate). A closure record that lists only the green run would imply the first attempt was clean, and that is exactly the kind of claim this repository's planning process asks to avoid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes two plans and records both closures.
Foundation M004 — Windows Job Object finite-process backend
Windows executions previously refused to start:
runreturnedRunnerError::UnsupportedPlatformbefore spawn, which the server mapped toFailed / Internal / exit_code: null. This adds a real tree owner.crates/eggwork-runner/src/process_tree.rsis the single platform seam behindthe one shared lifecycle — one runner, two tree backends. Unix keeps
process_group(0)pluskillpgescalation unchanged; Windows wraps the samesanitised
Commandinprocess-wrap'sJobObject, which addsCREATE_SUSPENDED, assigns the still-suspended process, and only then resumesit, so no descendant can exist before Eggwork owns the tree. Termination is one
TerminateJobObjectover a job created withJOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE,whose handle closes before
runreturns and before the caller's execution permitis released.
The dependency is pinned
=10.0.1because upstream raises its MSRV inside amajor version. It is on the ownership guard's process-owner denylist, so the
guard now applies that denylist to all five crates with exactly one recorded
exception.
Not claimed: per-descendant exit observation. No safe surface exposes a
job-membership query and adding one would mean Eggwork-owned
unsafe. The proofused is job ownership for the whole execution, kernel termination, and the
existing reader-EOF barrier.
Operations M004a — qualification helper fixture isolation
One reusable staging path for both suites that need a trusted helper: private
0700directory, own bytes, atomic publish (write under a staging name,renameinto place), Cargo-built helper read-only. Five new tests prove those properties.
No retry, no sleep, no serialisation, no trust-rule change.
The recorded flake did not fully disappear, and the closure record says so
with the measurements: the failing path is staged once, has no writer at failure
time, and the window closes immediately — a host-level kernel window around
executing a just-written executable, reproducible outside Eggwork's spawn path.
The M004 finding is re-dispositioned rather than closed by assertion.
Evidence
--all-features -D warnings, workspace tests, ownershipguard with
--prove-negative-exit, 52 release-harness tests — all green.37413709840:rust,release-drift, andwindows-runnerallgreen; the Windows tree-lifecycle suite reports 17 passed, 0 failed.
Windows-only drift, and because three of the suite failures were fixture
defects — one of which showed the runner behaving correctly (a
Truncateoverflow must not terminate).
Deliberately not done
release containing it. Cutting a tag is a release-lineage action and a
maintainer decision, so it is recorded as outstanding evidence.
--all-targetsclippy on Windows. The server's and client's unit testsare Linux-shaped and do not compile for Windows. The job lints production code
on the Windows target plus
eggwork-runnertest targets, and the gap isrecorded in
architecture/ci-guardrails.mdrather than hidden.ETXTBSYwindow: they would also let one fixture'schmodchange the modeevery other fixture sees, which is the invariant this milestone exists to hold.